From 43bdac0ebd65dfc32a0b8cf2c42fde88ad585e3f Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 15 Jun 2020 12:12:43 +0200 Subject: [PATCH] starmath: m_pTree can be private Which shows that subclasses only read it, never write it. Change-Id: I90ea4528d4362c068ba02113b1b038a811ea32b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96321 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- starmath/source/ooxmlexport.cxx | 6 +++--- starmath/source/rtfexport.cxx | 4 ++-- starmath/source/wordexportbase.hxx | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx index fff9cd7c598c..a915596b67a2 100644 --- a/starmath/source/ooxmlexport.cxx +++ b/starmath/source/ooxmlexport.cxx @@ -28,7 +28,7 @@ SmOoxmlExport::SmOoxmlExport(const SmNode *const pIn, OoxmlVersion const v, void SmOoxmlExport::ConvertFromStarMath( const ::sax_fastparser::FSHelperPtr& serializer, const sal_Int8 nAlign ) { - if( m_pTree == nullptr ) + if( GetTree() == nullptr ) return; m_pSerializer = serializer; @@ -66,7 +66,7 @@ void SmOoxmlExport::ConvertFromStarMath( const ::sax_fastparser::FSHelperPtr& se m_pSerializer->singleElementNS(XML_m, XML_jc, FSNS(XML_m, XML_val), "right"); m_pSerializer->endElementNS(XML_m, XML_oMathParaPr); m_pSerializer->startElementNS(XML_m, XML_oMath); - HandleNode(m_pTree, 0); + HandleNode(GetTree(), 0); m_pSerializer->endElementNS(XML_m, XML_oMath); m_pSerializer->endElementNS(XML_m, XML_oMathPara); } @@ -74,7 +74,7 @@ void SmOoxmlExport::ConvertFromStarMath( const ::sax_fastparser::FSHelperPtr& se { m_pSerializer->startElementNS(XML_m, XML_oMath, FSNS(XML_xmlns, XML_m), "http://schemas.openxmlformats.org/officeDocument/2006/math"); - HandleNode( m_pTree, 0 ); + HandleNode( GetTree(), 0 ); m_pSerializer->endElementNS( XML_m, XML_oMath ); } } diff --git a/starmath/source/rtfexport.cxx b/starmath/source/rtfexport.cxx index 87e51a3b9374..90a13f3ce1f4 100644 --- a/starmath/source/rtfexport.cxx +++ b/starmath/source/rtfexport.cxx @@ -24,12 +24,12 @@ SmRtfExport::SmRtfExport(const SmNode* pIn) void SmRtfExport::ConvertFromStarMath(OStringBuffer& rBuffer, rtl_TextEncoding nEncoding) { - if (!m_pTree) + if (!GetTree()) return; m_pBuffer = &rBuffer; m_nEncoding = nEncoding; m_pBuffer->append("{" OOO_STRING_SVTOOLS_RTF_IGNORE LO_STRING_SVTOOLS_RTF_MOMATH " "); - HandleNode(m_pTree, 0); + HandleNode(GetTree(), 0); m_pBuffer->append("}"); // moMath } diff --git a/starmath/source/wordexportbase.hxx b/starmath/source/wordexportbase.hxx index 4f191df2aa4e..af66167a17fb 100644 --- a/starmath/source/wordexportbase.hxx +++ b/starmath/source/wordexportbase.hxx @@ -49,6 +49,9 @@ protected: virtual void HandleBrace(const SmBraceNode* pNode, int nLevel) = 0; virtual void HandleVerticalBrace(const SmVerticalBraceNode* pNode, int nLevel) = 0; virtual void HandleBlank() = 0; + const SmNode* GetTree() const { return m_pTree; } + +private: const SmNode* const m_pTree; };