Kaydet (Commit) b0163130 authored tarafından Caolán McNamara's avatar Caolán McNamara

#82042# Making StarMath XML filter accessable as magical uno components

üst 9e2a874f
......@@ -2,9 +2,9 @@
*
* $RCSfile: document.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:57:24 $
* last change: $Author: cmc $ $Date: 2001-02-02 10:20:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -252,6 +252,7 @@ public:
void Parse();
SmParser & GetParser() { return aInterpreter; }
const SmNode * GetFormulaTree() const { return pTree; }
void SetFormulaTree(SmNode *&rTree) { pTree = rTree; }
void Draw(OutputDevice &rDev, Point &rPosition);
Size GetSize();
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: document.cxx,v $
*
* $Revision: 1.6 $
* $Revision: 1.7 $
*
* last change: $Author: cmc $ $Date: 2001-01-18 14:57:19 $
* last change: $Author: cmc $ $Date: 2001-02-02 10:20:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -629,26 +629,15 @@ void SmDocShell::Convert40To50Txt()
BOOL SmDocShell::ConvertFrom(SfxMedium &rMedium)
{
BOOL bSuccess = FALSE;
if (rMedium.GetFilter()->GetFilterName().EqualsAscii(
"MathML XML (Math)" ))
if (rMedium.GetFilter()->GetFilterName().EqualsAscii("MathML XML (Math)"))
{
SmXMLWrapper aEquation(GetModel());
DBG_ASSERT(!pTree,"pTree not NULL");
if (pTree)
delete pTree;
pTree = aEquation.Import(rMedium);
if (pTree)
{
pTree->CreateTextFromNode(aText);
aText.EraseTrailingChars();
while((aText.GetChar(0) == '{') &&
(aText.GetChar(aText.Len()-1) == '}'))
{
aText.Erase(0,1);
aText.Erase(aText.Len()-1,1);
}
bSuccess = TRUE;
delete pTree;
pTree = 0;
}
SmXMLWrapper aEquation(GetModel());
bSuccess = aEquation.Import(rMedium);
}
else if( rMedium.IsStorage() && rMedium.GetStorage()->IsStream(
C2S( "Equation Native" )))
......@@ -834,7 +823,7 @@ BOOL SmDocShell::ConvertTo( SfxMedium &rMedium )
"MathML XML (Math)" ))
{
SmXMLWrapper aEquation(GetModel());
bRet = aEquation.Export(rMedium,pTree);
bRet = aEquation.Export(rMedium);
}
else if( pFlt->GetFilterName().EqualsAscii("MathType 3.x"))
bRet = WriteAsMathType3( rMedium );
......
This diff is collapsed.
......@@ -2,9 +2,9 @@
*
* $RCSfile: mathml.hxx,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: cmc $ $Date: 2001-01-18 14:57:19 $
* last change: $Author: cmc $ $Date: 2001-02-02 10:20:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -78,8 +78,8 @@ class SmXMLWrapper
{
public:
SmXMLWrapper(com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rRef) : rModel(rRef) {};
SmNode *SmXMLWrapper::Import(SfxMedium &rMedium);
sal_Bool Export(SfxMedium &rMedium,SmNode *pTree);
sal_Bool Import(SfxMedium &rMedium);
sal_Bool Export(SfxMedium &rMedium);
private:
com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel;
......@@ -89,14 +89,27 @@ private:
class SmXMLImport : public SvXMLImport
{
public:
SmXMLImport() :
pMathElemTokenMap(0), pPresLayoutElemTokenMap(0), pPresElemTokenMap(0),
pPresScriptEmptyElemTokenMap(0), pPresTableElemTokenMap(0),
pPresLayoutAttrTokenMap(0),pFencedAttrTokenMap(0),
pOperatorAttrTokenMap(0),pColorTokenMap(0),bSuccess(sal_False)
{}
SmXMLImport(
com::sun::star::uno::Reference<com::sun::star::frame::XModel> &rModel,
const rtl::OUString &rFileName) : SvXMLImport(rModel) ,
pMathElemTokenMap(0), pPresLayoutElemTokenMap(0), pPresElemTokenMap(0),
pPresScriptEmptyElemTokenMap(0), pPresTableElemTokenMap(0),
pPresLayoutAttrTokenMap(0),pFencedAttrTokenMap(0),
pOperatorAttrTokenMap(0),pColorTokenMap(0)
pOperatorAttrTokenMap(0),pColorTokenMap(0),bSuccess(sal_False)
{}
void SAL_CALL endDocument(void)
throw( ::com::sun::star::xml::sax::SAXException,
::com::sun::star::uno::RuntimeException );
sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId()
throw();
SvXMLImportContext *CreateContext(sal_uInt16 nPrefix,
const rtl::OUString &rLocalName,
const com::sun::star::uno::Reference <
......@@ -233,6 +246,7 @@ public:
virtual ~SmXMLImport();
SmNodeStack & GetNodeStack() {return aNodeStack;}
SmNode *GetTree() { return aNodeStack.Pop();}
sal_Bool GetSuccess() { return bSuccess; }
private:
SvXMLTokenMap *pMathElemTokenMap;
SvXMLTokenMap *pPresLayoutElemTokenMap;
......@@ -245,6 +259,7 @@ private:
SvXMLTokenMap *pColorTokenMap;
SmNodeStack aNodeStack;
sal_Bool bSuccess;
};
enum SmXMLMathElemTokenMap
......@@ -322,10 +337,11 @@ enum SmXMLOperatorAttrTokenMap
class SmXMLExport : public SvXMLExport
{
public:
SmXMLExport();
SmXMLExport(const SmNode *pIn,const rtl::OUString &rFileName,
com::sun::star::uno::Reference<
com::sun::star::xml::sax::XDocumentHandler> &rHandler) :
SvXMLExport(rFileName,rHandler), pTree(pIn) {}
SvXMLExport(rFileName,rHandler), pTree(pIn), bSuccess(sal_False) {}
virtual ~SmXMLExport() {};
void _ExportAutoStyles() {}
......@@ -333,6 +349,13 @@ public:
void _ExportContent();
sal_uInt32 exportDoc(const sal_Char *pClass);
sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence<
sal_Int8 >& rId ) throw(::com::sun::star::uno::RuntimeException);
static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId()
throw();
sal_Bool GetSuccess() {return bSuccess;}
protected:
void ExportNodes(const SmNode *pIn,int nLevel);
void ExportTable(const SmNode *pIn,int nLevel);
......@@ -353,5 +376,6 @@ protected:
void ExportMatrix(const SmNode *pNode, int nLevel);
private:
const SmNode *pTree;
sal_Bool bSuccess;
};
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment