Connect new import / export to starmath

See: https://gerrit.libreoffice.org/c/core/+/120753
Change-Id: I9b02a4a7b4bc6c132220710573b7672b1a5b1c60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134163
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
dante 2022-05-11 12:08:52 +02:00 committed by Noel Grandin
parent 35a7e40d37
commit 9b7600f547
2 changed files with 37 additions and 14 deletions

View file

@ -70,8 +70,8 @@
#include "ooxmlexport.hxx"
#include "ooxmlimport.hxx"
#include "rtfexport.hxx"
#include <mathmlimport.hxx>
#include <mathmlexport.hxx>
#include <import.hxx>
#include <export.hxx>
#include <svx/svxids.hrc>
#include <cursor.hxx>
#include <comphelper/diagnose_ex.hxx>
@ -594,8 +594,7 @@ bool SmDocShell::ConvertFrom(SfxMedium &rMedium)
InvalidateCursor();
}
Reference<css::frame::XModel> xModel(GetModel());
SmXMLImportWrapper aEquation(xModel);
aEquation.useHTMLMLEntities(true);
SmMLImportWrapper aEquation(xModel);
bSuccess = ( ERRCODE_NONE == aEquation.Import(rMedium) );
}
else
@ -655,7 +654,7 @@ bool SmDocShell::Load( SfxMedium& rMedium )
{
// is this a fabulous math package ?
Reference<css::frame::XModel> xModel(GetModel());
SmXMLImportWrapper aEquation(xModel);
SmMLImportWrapper aEquation(xModel);
auto nError = aEquation.Import(rMedium);
bRet = ERRCODE_NONE == nError;
SetError(nError);
@ -686,8 +685,8 @@ bool SmDocShell::Save()
ArrangeFormula();
Reference<css::frame::XModel> xModel(GetModel());
SmXMLExportWrapper aEquation(xModel);
aEquation.SetFlat(false);
SmMLExportWrapper aEquation(xModel);
aEquation.setFlat(false);
return aEquation.Export(*GetMedium());
}
@ -746,8 +745,8 @@ bool SmDocShell::SaveAs( SfxMedium& rMedium )
ArrangeFormula();
Reference<css::frame::XModel> xModel(GetModel());
SmXMLExportWrapper aEquation(xModel);
aEquation.SetFlat(false);
SmMLExportWrapper aEquation(xModel);
aEquation.setFlat(false);
bRet = aEquation.Export(rMedium);
}
return bRet;
@ -768,16 +767,16 @@ bool SmDocShell::ConvertTo( SfxMedium &rMedium )
if(rFltName == STAROFFICE_XML)
{
Reference<css::frame::XModel> xModel(GetModel());
SmXMLExportWrapper aEquation(xModel);
aEquation.SetFlat(false);
SmMLExportWrapper aEquation(xModel);
aEquation.setFlat(false);
bRet = aEquation.Export(rMedium);
}
else if(rFltName == MATHML_XML)
{
Reference<css::frame::XModel> xModel(GetModel());
SmXMLExportWrapper aEquation(xModel);
aEquation.SetFlat(true);
aEquation.SetUseHTMLMLEntities(true);
SmMLExportWrapper aEquation(xModel);
aEquation.setFlat(true);
aEquation.setUseHTMLMLEntities(true);
bRet = aEquation.Export(rMedium);
}
else if (pFlt->GetFilterName() == "MathType 3.x")

View file

@ -67,4 +67,28 @@
constructor="org_libreoffice_comp_Math_sidebar_SmPanelFactory">
<service name="com.sun.star.ui.UIElementFactory"/>
</implementation>
<implementation name="com.sun.star.comp.Math.MLImporter"
constructor="Math_MLImporter_get_implementation">
<service name="com.sun.star.xml.MLImportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.MLOasisMetaImporter"
constructor="Math_MLOasisMetaImporter_get_implementation">
<service name="com.sun.star.xml.MLImportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.MLOasisSettingsImporter"
constructor="Math_MLOasisSettingsImporter_get_implementation">
<service name="com.sun.star.xml.MLImportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.MLContentExporter"
constructor="Math_MLContentExporter_get_implementation">
<service name="com.sun.star.xml.MLExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.MLOasisMetaExporter"
constructor="Math_MLOasisMetaExporter_get_implementation">
<service name="com.sun.star.xml.MLExportFilter"/>
</implementation>
<implementation name="com.sun.star.comp.Math.MLOasisSettingsExporter"
constructor="Math_MLOasisSettingsExporter_get_implementation">
<service name="com.sun.star.xml.MLExportFilter"/>
</implementation>
</component>