commit: Start of Math support in HEAD + Math Plan for 2.4

From: <msevior_at_physics.unimelb.edu.au>
Date: Wed Jan 05 2005 - 23:52:54 CET

CVS: ----------------------------------------------------------------------
CVS: Enter Log. Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS: src/text/ptbl/xp/pt_PT_InsertObject.cpp
CVS: src/text/ptbl/xp/pt_PT_InsertSpan.cpp
CVS: src/text/ptbl/xp/pt_Types.h src/wp/impexp/xp/GNUmakefile.am
CVS: src/wp/impexp/xp/Makefile
CVS: src/wp/impexp/xp/ie_exp_AbiWord_1.cpp
CVS: src/wp/impexp/xp/ie_imp_AbiWord_1.cpp
CVS: src/wp/impexp/xp/ie_types.h
CVS: ----------------------------------------------------------------------
PT and impexp changes needed for math support.

These are all safe xp changes.

My plan is write an opaque cross platform class that provides all the
hooks we need to implement GtkMathView. The src/text/fmt/xp code will use
this to draw the math runs.

The base class will include a rather useless xp implementation that will
draw ??? or something when it encoutners a MathML element.

I will move all the useful code in src/af/math/xp to a plugin and provide
a new method in the XAP_App class.

GR_Abi_MathManager * XAP_App::getMathManager()

If the plugin is not present this method will return the useless base class
which will be used by fl_DocLayout and fp_MathRun.

If the plugin is present it will register itself with XAP_App. Then the
call to getMathManager will return a pointer to GR_Abi_RealMathManager.

This call will only happen during construction of fl_DocLayout and the
decision is simple "if" statement so it will have a very small performance
impact.

The win from AbiWord's perspective is huge. Luca, me and anyone else who
wants can develop the Math code safely as a plugin. Interested Win and OSX
developers can work on porting GtkMathView to windows and OSX and we can
ship 2.4 with Math supported.

Cheers

Martin

PS.

Here are the API's of the base class and implementation class of the
MathManager. I will make this work in ABI_MATH first then port the code to
CVS HEAD.

class GR_Abi_MathManager
{
public:
    GR_Abi_MathManager(GR_Graphics * pG);
    virtual ~GR_Abi_MathManager();
    virtual void initialize(void);
    GR_Graphics * getGraphics(void);
    virtual UT_uint32 makeMathView(void) ;
    virtual void setColor(UT_uint32 uid, UT_RGBColor c);
    virtual UT_sint32 getWidth(UT_uint32 uid);
    virtual UT_sint32 getAscent(UT_uint32 uid) ;
    virtual UT_sint32 getDescent(UT_uint32 uid) ;
    virtual void loadMathML(UT_uint32 uid, UT_UTFString &
sMathBuf);
    virtual void setDefaultFontSize(UT_uint32 uid, UT_sint32);
    virtual void resetRootElement(UT_uint32 uid, void);
    virtual void render(UT_uint32 uid, UT_sint32 x, UT_sint32 y);
    virtual void releaseMathView(UT_uint32 uid);
 private:
    GR_Graphics * m_pG;
};

class GR_Abi_RealMathManager : pubic GR_Abi_MathManager
{
public:
    GR_AbiRealMathManager(GR_Graphics * pG);
    virtual ~GR_AbiRealMathManager();
    virtual void initialize(void);
    GR_Graphics * getGraphics(void);
    virtual UT_uint32 makeMathView(void) ;
    virtual void setColor(UT_uint32 uid, UT_RGBColor c);
    virtual UT_sint32 getWidth(UT_uint32 uid);
    virtual UT_sint32 getAscent(UT_uint32 uid) ;
    virtual UT_sint32 getDescent(UT_uint32 uid) ;
    virtual void loadMathML(UT_uint32 uid, UT_UTFString &
sMathBuf);
    virtual void setDefaultFontSize(UT_uint32 uid, UT_sint32);
    virtual void resetRootElement(UT_uint32 uid, void);
    virtual void render(UT_uint32 uid, UT_sint32 x, UT_sint32 y);
    virtual void releaseMathView(UT_uint32 uid);
 private:
    UT_uint32 _getNextUID(void);
    UT_uint32 m_CurrentUID;
    SmartPtr<AbstractLogger> m_pLogger;
    SmartPtr<GR_Abi_MathGraphicDevice> m_pMathGraphicDevice;
    GR_Abi_RenderingContext * m_pAbiContext;
    SmartPtr<MathMLOperatorDictionary> m_pOperatorDictionary;
    UT_Vector<GR_AbiMathView *> m_vecMathView;
};
Received on Thu Jan 6 14:10:19 2005

This archive was generated by hypermail 2.1.8 : Thu Jan 06 2005 - 14:10:20 CET