DATAKIT SDK  V2026.4
dtk_oleobject.hpp
Go to the documentation of this file.
1 #ifndef __UTIL_DTK_OLE_OBJECT_HPP__
2 #define __UTIL_DTK_OLE_OBJECT_HPP__
3 
4 #include "def/define.h"
8 #include "util/error_dtk.hpp"
9 #include "util/util_ptr_dtk.hpp"
10 #include <memory>
11 
12 class Dtk_Oriented2dBBox;
13 
14 #define DTK_OLE_OBJECT_INFO_KEY_FROM_OLE_OBJECT "Dtk_FromOLEObject"
15 
16 //! \class Dtk_OLEObject
17 //! \brief This is the Dtk_OLEObject Class.\n
18 //! The Dtk_OLEObject object is used to store any informations about Object Linking and Embedding items.
19 //! \SmartPtr{Dtk_OLEObjectPtr}
20 
21 class Dtk_OLEObject : public Dtk_Object
22 {
23 public:
25  {
28  // OLE_ASPECT_DOCPRINT,
30  // OLE_ASPECT_THUMBNAIL
31  };
32 
34  {
35  switch( inEnum )
36  {
37  case OLE_ASPECT_CONTENT: return L"OLE_ASPECT_CONTENT";
38  //case OLE_ASPECT_DOCPRINT: return L"OLE_ASPECT_DOCPRINT";
39  case OLE_ASPECT_ICON: return L"OLE_ASPECT_ICON";
40  //case OLE_ASPECT_THUMBNAIL: return L"OLE_ASPECT_THUMBNAIL";
41  default:
42  case OLE_ASPECT_UNKNOWN: return L"OLE_ASPECT_UNKNOWN";
43  }
44  }
45 
46 protected:
47  struct Dtk_Handle; // Not defined here
48  std::unique_ptr<Dtk_Handle> _Private; // Handle
49  enum
50  {
52  };
53  //! \brief Base Constructor
54  Dtk_OLEObject( const Dtk_Char8 *const binaryContent,
55  const Dtk_Size_t & binaryContentSize,
56  const Dtk_Oriented2dBBox & placement,
57  const Dtk_OLEObjectViewingAspect viewingAspect,
58  const Dtk_Double64 & scale = 1 );
59 
62 
63  //! \BaseDestructor
65 
66  inline virtual Dtk_Object* Clone(){ return new Dtk_OLEObject( *this ); }
67 
68 private:
69  friend class Dtk_SmartPtr<Dtk_OLEObject>;
70 public:
71 
72  //! \DtkDynamicType
74 
77 
78  //! \DtkDynamicCast
80 
81  //! \brief Create a Dtk_OLEObjectPtr.
82  //! \param binaryContent The OLE Object data.
83  //! \param binaryContentSize The OLE Object data size.
84  //! \param positioning Position and orientation of the OLE Object in space.
85  //! \param viewingAspect The way the OLE Object should be displayed at screen.
86  //! \param scale The scale that is applied to the OLE Object.
87  //! \return The constructed Dtk_OLEObjectPtr.
88  static Dtk_OLEObjectPtr Create( const Dtk_Char8 *const binaryContent,
89  const Dtk_Size_t & binaryContentSize,
90  const Dtk_Oriented2dBBox & positioning,
91  const Dtk_OLEObjectViewingAspect viewingAspect,
92  const Dtk_Double64 & scale = 1 );
93 
94  //! \CreateCopy{in}
95  static Dtk_OLEObjectPtr Create( const Dtk_OLEObject &in );
96 
98  {
99  return DTK_TYPE_OLE_OBJECT;
100  }
101 
102  //! \Transform{inTransfo}
103  Dtk_ErrorStatus Transform( const Dtk_transfo &inTransfo );
104 
105  //! \brief Returns the OLE Object data.
107  //! \brief Returns the OLE Object data size.
108  const Dtk_Char8 *const GetBinaryContent() const;
109 
110  //! \brief Returns the way the OLE Object should be displayed at screen.
112 
113  //! \brief Returns the position and orientation of the OLE Object in space.
115  //! \brief Returns the position and orientation of the OLE Object in space.
117 
118  //! \brief Returns the scale that is applied to the OLE Object.
120 
121  //! \brief Set the OLE Object data.
122  //! \param inNewContent The OLE Object data.
123  //! \param inNewContentSize The OLE Object data size.
124  void SetBinaryContent( const Dtk_Char8 *const inNewContent,
125  const Dtk_Size_t inNewContentSize );
126 
127  //! \brief Set the way the OLE Object should be displayed at screen.
128  void SetViewingAspect( const Dtk_OLEObjectViewingAspect & inNewAspect );
129 
130  //! \brief Set the position and orientation of the OLE Object in space.
131  void SetPlacement( const Dtk_Oriented2dBBox & inNewPlacement );
132 
133  //! \brief Set the scale that is applied to the OLE Object.
134  void SetScale( const Dtk_Double64 & inNewScale );
135 
136  //! \brief Extract the currently displayed picture from the OLE Object.
137  //! \return dtkNoError if OK.
139 };
140 
141 #endif
Dtk_OLEObject::info
Dtk_InfoPtr & info()
Dtk_transfo
This is the Transformation dedicated class.
Definition: dtk_transfo.hpp:19
Dtk_OLEObject::_typeID
@ _typeID
Definition: dtk_oleobject.hpp:51
Dtk_OLEObject::SetViewingAspect
void SetViewingAspect(const Dtk_OLEObjectViewingAspect &inNewAspect)
Set the way the OLE Object should be displayed at screen.
Dtk_string
This is a high level string class.
Definition: dtk_string.hpp:53
Dtk_Size_t
size_t Dtk_Size_t
Definition: define.h:711
Dtk_OLEObject::Dtk_OLEObject
Dtk_OLEObject(const Dtk_OLEObject &)
Dtk_OLEObject::Dtk_OLEObject
Dtk_OLEObject(Dtk_OLEObject &&) DTK_NOEXCEPT
Dtk_OLEObject::OLE_ASPECT_CONTENT
@ OLE_ASPECT_CONTENT
Definition: dtk_oleobject.hpp:27
Dtk_Double64
double Dtk_Double64
Definition: define.h:698
Dtk_OLEObject::get_info
Dtk_InfoPtr get_info() const
Dtk_OLEObject::_Private
std::unique_ptr< Dtk_Handle > _Private
Definition: dtk_oleobject.hpp:47
Dtk_OLEObject::GetPlacement
Dtk_Oriented2dBBox & GetPlacement()
Returns the position and orientation of the OLE Object in space.
Dtk_OLEObject::Dtk_OLEObjectViewingAspectToString
static Dtk_string Dtk_OLEObjectViewingAspectToString(const Dtk_OLEObjectViewingAspect &inEnum)
Definition: dtk_oleobject.hpp:33
Dtk_OLEObject::Dtk_OLEObjectViewingAspect
Dtk_OLEObjectViewingAspect
Definition: dtk_oleobject.hpp:25
Dtk_OLEObject
This is the Dtk_OLEObject Class. The Dtk_OLEObject object is used to store any informations about Obj...
Definition: dtk_oleobject.hpp:22
Dtk_OLEObject::Clone
virtual Dtk_Object * Clone()
Definition: dtk_oleobject.hpp:66
Dtk_OLEObject::SetScale
void SetScale(const Dtk_Double64 &inNewScale)
Set the scale that is applied to the OLE Object.
Dtk_Int32
int32_t Dtk_Int32
Definition: define.h:686
Dtk_OLEObject::GetBinaryContent
const Dtk_Char8 *const GetBinaryContent() const
Returns the OLE Object data size.
Dtk_OLEObject::SetPlacement
void SetPlacement(const Dtk_Oriented2dBBox &inNewPlacement)
Set the position and orientation of the OLE Object in space.
Dtk_OLEObject::DtkDynamicType
Dtk_Int32 DtkDynamicType(const Dtk_Int32 &inId)
Retrieves the dynamic entity type.
Dtk_Char8
char Dtk_Char8
Definition: define.h:696
error_dtk.hpp
Dtk_ErrorStatus
Dtk_ErrorStatus
Definition: error_dtk.hpp:6
Dtk_SmartPtr
Definition: util_ptr_dtk.hpp:37
Dtk_OLEObject::ExtractPreviewPicture
Dtk_ErrorStatus ExtractPreviewPicture(Dtk_picturePtr &outPreviewPicture) const
Extract the currently displayed picture from the OLE Object.
Dtk_OLEObject::Create
static Dtk_OLEObjectPtr Create(const Dtk_Char8 *const binaryContent, const Dtk_Size_t &binaryContentSize, const Dtk_Oriented2dBBox &positioning, const Dtk_OLEObjectViewingAspect viewingAspect, const Dtk_Double64 &scale=1)
Create a Dtk_OLEObjectPtr.
Dtk_OLEObject::OLE_ASPECT_ICON
@ OLE_ASPECT_ICON
Definition: dtk_oleobject.hpp:29
dtk_transfo.hpp
type_detk
type_detk
Definition: define.h:21
Dtk_OLEObject::DtkDynamicCast
static Dtk_OLEObject * DtkDynamicCast(Dtk_Object *o)
Performs a dynamic cast - doesn't need RTTI -.
DTK_TYPE_OLE_OBJECT
@ DTK_TYPE_OLE_OBJECT
Definition: define.h:608
util_ptr_dtk.hpp
define.h
Dtk_OLEObject::OLE_ASPECT_UNKNOWN
@ OLE_ASPECT_UNKNOWN
Definition: dtk_oleobject.hpp:26
Dtk_OLEObject::GetScale
Dtk_Double64 GetScale() const
Returns the scale that is applied to the OLE Object.
Dtk_OLEObject::GetBinaryContentSize
const Dtk_Size_t GetBinaryContentSize() const
Returns the OLE Object data.
Dtk_OLEObject::Create
static Dtk_OLEObjectPtr Create(const Dtk_OLEObject &in)
Calls copy constructor to allocate a new object.
Dtk_OLEObject::get_type_detk
type_detk get_type_detk() const
Definition: dtk_oleobject.hpp:97
Dtk_Object
Definition: dtk_object.hpp:8
Dtk_OLEObject::GetViewingAspect
Dtk_OLEObjectViewingAspect GetViewingAspect() const
Returns the way the OLE Object should be displayed at screen.
dtk_string.hpp
Dtk_OLEObject::Dtk_OLEObject
Dtk_OLEObject(const Dtk_Char8 *const binaryContent, const Dtk_Size_t &binaryContentSize, const Dtk_Oriented2dBBox &placement, const Dtk_OLEObjectViewingAspect viewingAspect, const Dtk_Double64 &scale=1)
Base Constructor.
Dtk_OLEObject::SetBinaryContent
void SetBinaryContent(const Dtk_Char8 *const inNewContent, const Dtk_Size_t inNewContentSize)
Set the OLE Object data.
Dtk_Oriented2dBBox
This is the base bounding box class. It's used into a lot of 2D Entities This class represents the ba...
Definition: util_draw_dtk.hpp:450
Dtk_OLEObject::Transform
Dtk_ErrorStatus Transform(const Dtk_transfo &inTransfo)
Applies a transformation matrix to the entity. //!
dtk_object.hpp
Dtk_OLEObject::GetPlacement
const Dtk_Oriented2dBBox & GetPlacement() const
Returns the position and orientation of the OLE Object in space.
DTK_NOEXCEPT
#define DTK_NOEXCEPT
Definition: config.hpp:20