Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef GR_CONTROL_H
00022 #define GR_CONTROL_H
00023
00024 #include "ut_types.h"
00025 #include "ut_bytebuf.h"
00026
00027 class AV_View;
00028 class XAP_Frame;
00029 class GR_Graphics;
00030
00037 class ABI_EXPORT GR_Control
00038 {
00039
00040 public:
00041
00045 virtual UT_Error isDrawable ( bool & drawable ) = 0;
00046
00050 virtual UT_Error draw ( GR_Graphics * pGr,
00051 UT_uint32 x, UT_uint32 y ) = 0;
00052
00057 virtual UT_Error isPersistable ( bool & persistable ) = 0;
00058
00062 virtual UT_Error persist ( UT_ByteBuf * in ) = 0;
00063
00067 virtual UT_Error _abi_callonce populate ( const UT_Byte * pBytes,
00068 UT_uint32 dataLen ) = 0;
00069
00073 virtual inline UT_Error _abi_callonce populate ( const UT_Bytebuf * pByteBuf )
00074 {
00075 return populate ( pByteBuf->getPointer(0), pByteBuf->getLength () );
00076 }
00077
00081 virtual UT_Error getSize ( UT_uint32 &width, UT_uint32 &height ) = 0;
00082
00086 virtual UT_Error resize ( UT_uint32 width, UT_uint32 height ) = 0;
00087
00088 protected:
00089
00093 GR_Control ( AV_View * pControllingView,
00094 XAP_Frame * pOwningFrame )
00095 : m_pView ( pControllingView ), m_pFrame ( pOwningFrame )
00096 {
00097 }
00098
00102 virtual ~GR_Control ()
00103 {
00104 }
00105
00109 inline AV_View * getControllingView () const
00110 {
00111 return m_pView;
00112 }
00113
00117 inline XAP_Frame * getOwningFrame () const
00118 {
00119 return m_pFrame;
00120 }
00121
00122 private:
00123
00124 GR_Control ( const GR_Control & );
00125 GR_Control & operator=( const GR_Control & );
00126
00127 AV_View * m_pView;
00128 XAP_Frame * m_pFrame;
00129 };
00130
00135 class ABI_EXPORT GR_ControlFactory
00136 {
00137
00138 public:
00139
00143 static GR_ControlFactory * instance ();
00144
00148 virtual ~GR_ControlFactory ()
00149 {
00150 }
00151
00152
00153
00157 virtual UT_Error newControlForMimeType ( AV_View * pControllingView,
00158 XAP_Frame * pOwningFrame,
00159 const char * pszMime,
00160 GR_Control ** pCtlOut ) = 0;
00161
00165 virtual UT_Error newControlForExtension ( AV_View * pControllingView,
00166 XAP_Frame * pOwningFrame,
00167 const char * pszExt,
00168 GR_Control ** pCtlOut ) = 0;
00169
00174 virtual UT_Error newControlForData ( AV_View * pControllingView,
00175 XAP_Frame * pOwningFrame,
00176 const UT_Byte * pData,
00177 UT_uint32 dataLen,
00178 GR_Control ** pCtlOut ) = 0;
00179
00184 inline UT_Error newControlForData ( AV_View * pControllingView,
00185 XAP_Frame * pOwningFrame,
00186 const UT_Bytebuf * pData,
00187 GR_Control ** pCtlOut )
00188 {
00189 return newControlForData ( pControllingView, pOwningFrame,
00190 pData->getPointer(0), pData->getLength(),
00191 pCtlOut );
00192 }
00193
00194 protected:
00195
00199 GR_ControlFactory ()
00200 {
00201 }
00202
00203 private:
00204
00205 void operator delete ( GR_ControlFactory * );
00206 GR_ControlFactory ( const GR_ControlFactory & );
00207 GR_ControlFactory & operator=( const GR_ControlFactory & );
00208 };
00209
00210 #endif // GR_CONTROL_H