• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

AbiGOChart.h

Go to the documentation of this file.
00001 /* AbiWord
00002  * Copyright (C) 2004 Luca Padovani <lpadovan@cs.unibo.it>
00003  * Copyright (C) 2005 Martin Sevior <msevior@physics.unimelb.edu.au>
00004  * Copyright (C) 2005 Jean Brefort <jean.brefort@normalesup.org>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00019  * USA
00020  */
00021 
00022 #ifndef __gr_AbiGOChartManager_h__
00023 #define __gr_AbiGOChartManager_h__
00024 #include "ut_string_class.h"
00025 #include "gr_EmbedManager.h"
00026 #include "ut_types.h"
00027 #include "ut_vector.h"
00028 #include <goffice/goffice.h>
00029 
00030 
00031 class GR_Graphics;
00032 class PD_Document;
00033 class AD_Document;
00034 class GOChartView;
00035 class GR_AbiGOChartItems;
00036 
00037 class GR_AbiGOChartItems
00038 {
00039  public:
00040   GR_AbiGOChartItems();
00041   virtual ~GR_AbiGOChartItems();
00042   UT_uint32 m_iAPI;
00043   bool m_bHasSnapshot;
00044 };
00045 
00046 class GR_GOChartManager : public GR_EmbedManager
00047 {
00048 public:
00049     GR_GOChartManager(GR_Graphics * pG);
00050     virtual ~GR_GOChartManager();
00051     virtual GR_EmbedManager *  create(GR_Graphics * pG);
00052     virtual const char *   getObjectType(void) const;
00053     virtual void           initialize(void);
00054     virtual UT_sint32      makeEmbedView(AD_Document * pDoc, UT_uint32  api, const char * szDataID) ;
00055     virtual void           setColor(UT_sint32 uid, UT_RGBColor c);
00056     virtual UT_sint32      getWidth(UT_sint32 uid);
00057     virtual UT_sint32      getAscent(UT_sint32 uid) ;
00058     virtual UT_sint32      getDescent(UT_sint32 uid) ;
00059     virtual void           loadEmbedData(UT_sint32 uid);
00060     virtual void           setDefaultFontSize(UT_sint32 uid, UT_sint32 iSize);
00061     virtual void           render(UT_sint32 uid, UT_Rect & rec);
00062     virtual void           releaseEmbedView(UT_sint32 uid);
00063     virtual void           initializeEmbedView(UT_sint32 uid);
00064     virtual void           makeSnapShot(UT_sint32 uid, UT_Rect & rec);
00065     virtual bool           isDefault(void);
00066     virtual bool           modify(UT_sint32 uid);
00067     virtual bool           convert(UT_uint32 iConv, const UT_ConstByteBufPtr & From,
00068                                    const UT_ByteBufPtr & To);
00069     virtual void           updateData(UT_sint32 uid, UT_sint32 api);
00070 
00071     virtual bool           isEdittable(UT_sint32 uid);
00072     virtual void           setRun (UT_sint32 uid, fp_Run * run);
00073     EV_EditMouseContext     getContextualMenu(void) const
00074         { return ChartMenuID; }
00075     static void             buildContextualMenu ();
00076     static void             removeContextualMenu ();
00077 
00078     static GOChartView * last_created_view;
00079 
00080 private:
00081     UT_sint32                              _makeGOChartView(void);
00082     void                                    _loadGOChartXML(UT_sint32 uid, UT_UTF8String & sGOChartBuf);
00083     UT_sint32                              _getNextUID(void);
00084     UT_sint32                              m_CurrentUID;
00085     UT_GenericVector<GOChartView *>        m_vecGOChartView;
00086     UT_GenericVector<GR_AbiGOChartItems *>    m_vecItems;
00087     PD_Document *                          m_pDoc;
00088     static EV_EditMouseContext ChartMenuID;
00089 };
00090 
00091 // FIXME wrapper for libGNOMEOFFICEChart object
00092 class GOChartView
00093 {
00094 public:
00095     GOChartView(GR_GOChartManager  * pGOMan);
00096     virtual ~GOChartView(void);
00097     void render(UT_Rect & rec);
00098     void loadBuffer(UT_UTF8String & sGOChartXM);
00099     void setDefaultFontSize(UT_sint32 iSize);
00100     void modify(void);
00101     void SetRun (fp_Run *pRun) {m_pRun = pRun;}
00102     fp_Run *getRun () {return m_pRun;}
00103     void SetGuru (GtkWidget *guru) {m_Guru = guru;}
00104     UT_ByteBufPtr exportToPNG();
00105     UT_ByteBufPtr exportToSVG();
00106     UT_sint32 getWidth() {return width;}
00107     UT_sint32 getHeight() {return height;}
00108 private:
00109     GR_GOChartManager  * m_pGOMan;
00110     GogGraph *m_Graph;
00111     GogRenderer *m_Renderer;
00112     GR_Image *m_Image;
00113     UT_sint32 width, height;
00114     UT_sint32 pix_width;
00115     UT_sint32 pix_height;
00116     fp_Run *m_pRun;
00117     GtkWidget *m_Guru;
00118 };
00119 
00120 bool AbiGOChart_Create(AV_View* v, EV_EditMethodCallData *d);
00121 
00122 #endif // __gr_AbiGOChartManager_h__

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1