commit: Gnome Office Chart plugin

From: <msevior_at_physics.unimelb.edu.au>
Date: Mon Mar 21 2005 - 13:57:46 CET

CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: abimathview/xp/AbiMathView.cpp abimathview/xp/entitiesMap.inc
CVS: abimathview/xp/gr_Abi_RenderingContext.cpp
CVS: Added Files:
CVS: abigochart/GNUmakefile.am abigochart/plugin.m4
CVS: abigochart/unix/AbiGOChart.cpp abigochart/unix/AbiGOChart.h
CVS: abigochart/unix/GNUmakefile.am
CVS: abigochart/unix/ie_imp_GOChart.cpp
CVS: abigochart/unix/ie_imp_GOChart.h
CVS: ----------------------------------------------------------------------
All the infrastructure needed for a Gnome Office Chart Plugin

CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: src/af/xap/unix/xap_UnixDlg_FileOpenSaveAs.cpp
CVS: src/af/xap/xp/xap_Dialog_Id.h src/af/xap/xp/xap_Menu_Layouts.h
CVS: src/af/xap/xp/xap_String_Id.h src/text/fmt/xp/fv_View.cpp
CVS: src/text/fmt/xp/fv_View.h src/text/fmt/xp/fv_View_cmd.cpp
CVS: src/wp/ap/cocoa/ap_CocoaDialog_All.h
CVS: src/wp/ap/unix/ap_UnixDialog_All.h
CVS: src/wp/ap/win/ap_Win32Dialog_All.h
CVS: src/wp/ap/xp/ap_Menu_Layouts.cpp
CVS: ----------------------------------------------------------------------
Lots more of the infrastructure for Generic Embedable plugins.

OK this basically works.

The plugin creates a new menu subdirectory "Insert Object->" and populates
it with the Entry "Gnome Office Chart"

The name of the plugin is abigochart.

You build it by first running

./nextgen.sh (which is really cool BTW FJF)

then do

./configure --with-abiword=/path/to/abiword/source --prefix=/path/to/prefix
--disable-all --enable-abigochart

(You can add more plugins to be build with the "--enable-***" command.

The AbiGOChart.h header file looks like this:

class ABI_EXPORT GR_AbiGOChartItems
{
 public:
  GR_AbiGOChartItems();
  virtual ~GR_AbiGOChartItems();
  UT_uint32 m_iAPI;
  bool m_bHasSnapshot;
};

class ABI_EXPORT GR_GOChartManager : public GR_EmbedManager
{
public:
    GR_GOChartManager(GR_Graphics * pG);
    virtual ~GR_GOChartManager();
    virtual GR_EmbedManager * create(GR_Graphics * pG);
    virtual const char * getObjectType(void) const;
    virtual void initialize(void);
    virtual UT_sint32 makeEmbedView(AD_Document * pDoc, UT_uint32
api, const char * szDataID) ;
    virtual void setColor(UT_sint32 uid, UT_RGBColor c);
    virtual UT_sint32 getWidth(UT_sint32 uid);
    virtual UT_sint32 getAscent(UT_sint32 uid) ;
    virtual UT_sint32 getDescent(UT_sint32 uid) ;
    virtual void loadEmbedData(UT_sint32 uid);
    virtual void setDefaultFontSize(UT_sint32 uid, UT_sint32
iSize);
    virtual void render(UT_sint32 uid, UT_Rect & rec);
    virtual void releaseEmbedView(UT_sint32 uid);
    virtual void initializeEmbedView(UT_sint32 uid);
    virtual void makeSnapShot(UT_sint32 uid, UT_Rect & rec);
    virtual bool isDefault(void);
    virtual bool modify(UT_sint32 uid);
    virtual bool convert(UT_uint32 iConv, UT_ByteBuf & From,
UT_ByteBuf & To);

    bool createPNGSnapshot(AD_Document * pDoc, UT_Rect & rec,
                                           const char * szDataID);
    bool updatePNGSnapshot(AD_Document * pDoc, UT_Rect & rec,
                                           const char * szDataID);
private:
    UT_sint32 _makeGOChartView(void);
    void _loadGOChartXML(UT_sint32 uid,
UT_UTF8String & sGOChartBuf);
    UT_sint32 _getNextUID(void);
    UT_sint32 m_CurrentUID;
    UT_GenericVector<GOChartView *> m_vecGOChartView;
    UT_GenericVector<GR_AbiGOChartItems *> m_vecItems;
    PD_Document * m_pDoc;

};

// FIXME wrapper for libGNOMEOFFICEChart object
class ABI_EXPORT GOChartView
{
 public:
  GOChartView(GR_GOChartManager * pGOMan);
  virtual ~GOChartView(void);
  void render(UT_Rect & rec);
  void loadBuffer(UT_UTF8String & sGOChartXM);
  void setDefaultFontSize(UT_sint32 iSize);
 private:
  GR_GOChartManager * m_pGOMan;
};

The idea is that GOChartView is a wrapper around a Gnome Office Chart
object. Jean will need to write code to load a chart description into a
view and display it within the specfied rectangle. You can use what-ever
gtk-calls you like and need. This code is placed in a unix sub-directory
so don't feel constrained to use XP methods, although would be nice for us
C++ hackers for you to use our af/until/xp/* convienence classes where
appropriate.

You can detect if you are asked to print a chart by doing a
getGraphics()->queryProperties(GR_Graphics::DGP_PAPER) call. If it's true
you are printing and the graphics class has become wrapper around
gnomeprint context.

To help the debugging process and to verify the XP main code works, I've
coded a little hack to draw a square with a cross in it right now if you
attempt to load anything.

As far as I can tell the XP code works just as I hoped it would. I'm very
pleased.

I'll do a bit more on it to allow generic embedable objects to be
selected, resized and dragged like inline images.

After that I'll look at making them postioned objects.

Anyway, over to you Jean! Make Gnome Office Charts embed in AbiWord :-)

Cheers

Martin
Received on Mon Mar 21 13:58:30 2005

This archive was generated by hypermail 2.1.8 : Mon Mar 21 2005 - 13:58:30 CET