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
00022 #ifndef __gr_AbiGOComponentManager_h__
00023 #define __gr_AbiGOComponentManager_h__
00024 #include "gr_EmbedManager.h"
00025 #include <goffice/component/goffice-component.h>
00026 #include <goffice/component/go-component.h>
00027
00028
00029 class GR_Graphics;
00030 class PD_Document;
00031 class AD_Document;
00032 class GOComponentView;
00033 class GR_AbiGOComponentItems;
00034
00035 class GR_AbiGOComponentItems
00036 {
00037 public:
00038 GR_AbiGOComponentItems();
00039 virtual ~GR_AbiGOComponentItems();
00040 UT_uint32 m_iAPI;
00041 bool m_bHasSnapshot;
00042 };
00043
00044 class GR_GOComponentManager : public GR_EmbedManager
00045 {
00046 public:
00047 GR_GOComponentManager(GR_Graphics * pG);
00048 virtual ~GR_GOComponentManager();
00049 virtual GR_EmbedManager * create(GR_Graphics * pG);
00050 virtual const char * getObjectType(void) const;
00051 virtual void initialize(void);
00052 virtual UT_sint32 makeEmbedView(AD_Document * pDoc, UT_uint32 api, const char * szDataID) ;
00053 virtual void setColor(UT_sint32 uid, UT_RGBColor c);
00054 virtual UT_sint32 getWidth(UT_sint32 uid);
00055 virtual UT_sint32 getAscent(UT_sint32 uid) ;
00056 virtual UT_sint32 getDescent(UT_sint32 uid) ;
00057 virtual void loadEmbedData(UT_sint32 uid);
00058 virtual void setDefaultFontSize(UT_sint32 uid, UT_sint32 iSize);
00059 virtual void render(UT_sint32 uid, UT_Rect & rec);
00060 virtual void releaseEmbedView(UT_sint32 uid);
00061 virtual void initializeEmbedView(UT_sint32 uid);
00062 virtual void makeSnapShot(UT_sint32 uid, UT_Rect & rec);
00063 virtual bool isDefault(void);
00064 virtual bool modify(UT_sint32 uid);
00065 virtual bool convert(UT_uint32 iConv, const UT_ConstByteBufPtr & From,
00066 const UT_ByteBufPtr & To);
00067 virtual bool isEdittable(UT_sint32 uid);
00068 virtual bool isResizeable(UT_sint32 uid);
00069 virtual void setRun (UT_sint32 uid, fp_Run * run);
00070 virtual void updateData(UT_sint32 uid, UT_sint32 api);
00071 virtual bool setFont(UT_sint32 uid, const GR_Font * pFont);
00072
00073 private:
00074 UT_sint32 _makeGOComponentView(void);
00075 UT_sint32 _getNextUID(void);
00076 UT_sint32 m_CurrentUID;
00077 UT_GenericVector<GOComponentView *> m_vecGOComponentView;
00078 UT_GenericVector<GR_AbiGOComponentItems *> m_vecItems;
00079 PD_Document * m_pDoc;
00080 };
00081
00082
00083 class GOComponentView
00084 {
00085 friend class GR_GOComponentManager;
00086 public:
00087 GOComponentView(GR_GOComponentManager * pGOMan);
00088 virtual ~GOComponentView(void);
00089 void render(UT_Rect & rec);
00090 void loadBuffer(const UT_ConstByteBufPtr & sGOComponentData, const char *_mime_type);
00091 void setDefaultFontSize(UT_sint32 iSize);
00092 void modify(void);
00093 void update (void);
00094 GOComponent *getComponent (void) {return component;}
00095 bool IsEdittable () {return go_component_is_editable (component);}
00096 bool IsResizable () {return go_component_is_resizable (component);}
00097 UT_ConstByteBufPtr getSnapShot(std::string &mime_type);
00098 void SetRun (fp_Run *pRun) {m_pRun = pRun;}
00099 bool setFont(const GR_Font * pFont);
00100
00101 private:
00102 GR_GOComponentManager * m_pGOMan;
00103 GOComponent *component;
00104 std::string mime_type;
00105 GR_Image *m_Image;
00106 UT_sint32 width, ascent, descent;
00107 UT_sint32 pix_width, pix_height;
00108 GdkPixbuf *pixbuf;
00109 GdkWindowAttr attributes;
00110 fp_Run *m_pRun;
00111 };
00112
00113 bool AbiGOComponent_FileInsert(AV_View* v, EV_EditMethodCallData *d);
00114 bool AbiGOComponent_Create(AV_View* v, EV_EditMethodCallData *d);
00115
00116 #endif // __gr_AbiGOComponentManager_h__