starmath/inc/mathml/mathmlexport.hxx | 35 +++++++++++++++++--------------- starmath/source/document.cxx | 2 - starmath/source/mathml/mathmlexport.cxx | 20 +++++++----------- 3 files changed, 28 insertions(+), 29 deletions(-)
New commits: commit 4e57d6a51c5d619ff41e1a2990267fdc67b0e53a Author: dante <dante19031...@gmail.com> AuthorDate: Sun Mar 7 12:30:57 2021 +0100 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Mar 7 15:50:19 2021 +0100 Simplify the use of custom hmtl/mathml entities on matmlexport This patch also serves as a base for further improvements. Change-Id: I72967e3c9739576fb74d16e656f41c440af3a4ee Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112127 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/starmath/inc/mathml/mathmlexport.hxx b/starmath/inc/mathml/mathmlexport.hxx index 3a32a6e164f5..eae2dd4d7423 100644 --- a/starmath/inc/mathml/mathmlexport.hxx +++ b/starmath/inc/mathml/mathmlexport.hxx @@ -57,22 +57,25 @@ public: bool Export(SfxMedium& rMedium); void SetFlat(bool bIn) { bFlat = bIn; } - void useHTMLMLEntities(bool bUseHTMLMLEntities) { m_bUseHTMLMLEntities = bUseHTMLMLEntities; } - - static bool - WriteThroughComponent(const css::uno::Reference<css::io::XOutputStream>& xOutputStream, - const css::uno::Reference<css::lang::XComponent>& xComponent, - css::uno::Reference<css::uno::XComponentContext> const& rxContext, - css::uno::Reference<css::beans::XPropertySet> const& rPropSet, - const char* pComponentName, bool bUseHTMLMLEntities); - - static bool - WriteThroughComponent(const css::uno::Reference<css::embed::XStorage>& xStor, - const css::uno::Reference<css::lang::XComponent>& xComponent, - const char* pStreamName, - css::uno::Reference<css::uno::XComponentContext> const& rxContext, - css::uno::Reference<css::beans::XPropertySet> const& rPropSet, - const char* pComponentName, bool bUseHTMLMLEntities); + + bool IsUseHTMLMLEntities() const { return m_bUseHTMLMLEntities; } + void SetUseHTMLMLEntities(bool bUseHTMLMLEntities) + { + m_bUseHTMLMLEntities = bUseHTMLMLEntities; + } + + bool WriteThroughComponent(const css::uno::Reference<css::io::XOutputStream>& xOutputStream, + const css::uno::Reference<css::lang::XComponent>& xComponent, + css::uno::Reference<css::uno::XComponentContext> const& rxContext, + css::uno::Reference<css::beans::XPropertySet> const& rPropSet, + const char* pComponentName); + + bool WriteThroughComponent(const css::uno::Reference<css::embed::XStorage>& xStor, + const css::uno::Reference<css::lang::XComponent>& xComponent, + const char* pStreamName, + css::uno::Reference<css::uno::XComponentContext> const& rxContext, + css::uno::Reference<css::beans::XPropertySet> const& rPropSet, + const char* pComponentName); }; class SmXMLExport final : public SvXMLExport diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index 67e216611e57..0b908d00fc76 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -862,7 +862,7 @@ bool SmDocShell::ConvertTo( SfxMedium &rMedium ) Reference<css::frame::XModel> xModel(GetModel()); SmXMLExportWrapper aEquation(xModel); aEquation.SetFlat(true); - aEquation.useHTMLMLEntities(true); + aEquation.SetUseHTMLMLEntities(true); bRet = aEquation.Export(rMedium); } else if (pFlt->GetFilterName() == "MathType 3.x") diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index f1952b5057cc..d125e49be6a2 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -185,8 +185,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) bRet = WriteThroughComponent(xStg, xModelComp, "meta.xml", xContext, xInfoSet, (bOASIS ? "com.sun.star.comp.Math.XMLOasisMetaExporter" - : "com.sun.star.comp.Math.XMLMetaExporter"), - m_bUseHTMLMLEntities); + : "com.sun.star.comp.Math.XMLMetaExporter")); } if (bRet) { @@ -194,8 +193,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) xStatusIndicator->setValue(nSteps++); bRet = WriteThroughComponent(xStg, xModelComp, "content.xml", xContext, xInfoSet, - "com.sun.star.comp.Math.XMLContentExporter", - m_bUseHTMLMLEntities); + "com.sun.star.comp.Math.XMLContentExporter"); } if (bRet) @@ -205,8 +203,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) bRet = WriteThroughComponent(xStg, xModelComp, "settings.xml", xContext, xInfoSet, (bOASIS ? "com.sun.star.comp.Math.XMLOasisSettingsExporter" - : "com.sun.star.comp.Math.XMLSettingsExporter"), - m_bUseHTMLMLEntities); + : "com.sun.star.comp.Math.XMLSettingsExporter")); } } else @@ -218,8 +215,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) xStatusIndicator->setValue(nSteps++); bRet = WriteThroughComponent(xOut, xModelComp, xContext, xInfoSet, - "com.sun.star.comp.Math.XMLContentExporter", - m_bUseHTMLMLEntities); + "com.sun.star.comp.Math.XMLContentExporter"); } if (xStatusIndicator.is()) @@ -233,7 +229,7 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference<io::XOutputStream const Reference<XComponent>& xComponent, Reference<uno::XComponentContext> const& rxContext, Reference<beans::XPropertySet> const& rPropSet, - const char* pComponentName, bool bUseHTMLMLEntities) + const char* pComponentName) { OSL_ENSURE(xOutputStream.is(), "I really need an output stream!"); OSL_ENSURE(xComponent.is(), "Need component!"); @@ -244,7 +240,7 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference<io::XOutputStream // connect XML writer to output stream xSaxWriter->setOutputStream(xOutputStream); - if (bUseHTMLMLEntities) + if (m_bUseHTMLMLEntities) xSaxWriter->setCustomEntityNames(starmathdatabase::icustomMathmlHtmlEntitiesExport); // prepare arguments (prepend doc handler to given arguments) @@ -279,7 +275,7 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference<embed::XStorage>& const char* pStreamName, Reference<uno::XComponentContext> const& rxContext, Reference<beans::XPropertySet> const& rPropSet, - const char* pComponentName, bool bUseHTMLMLEntities) + const char* pComponentName) { OSL_ENSURE(xStorage.is(), "Need storage!"); OSL_ENSURE(nullptr != pStreamName, "Need stream name!"); @@ -312,7 +308,7 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference<embed::XStorage>& // write the stuff bool bRet = WriteThroughComponent(xStream->getOutputStream(), xComponent, rxContext, rPropSet, - pComponentName, bUseHTMLMLEntities); + pComponentName); return bRet; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits