[Libreoffice-commits] core.git: 2 commits - writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon May 20 08:07:06 UTC 2019


 writerfilter/source/rtftok/rtfdispatchdestination.cxx |    2 
 writerfilter/source/rtftok/rtfdispatchflag.cxx        |   12 
 writerfilter/source/rtftok/rtfdispatchvalue.cxx       |   24 -
 writerfilter/source/rtftok/rtfdocumentimpl.cxx        |  220 ++++++++++--------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx        |   63 +++--
 5 files changed, 198 insertions(+), 123 deletions(-)

New commits:
commit 7e24483d12a1ae284b026cd737374b40f2a08aa2
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri May 17 21:40:02 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon May 20 10:06:17 2019 +0200

    writerfilter: make RTFParserState members private, part 3
    
    Change-Id: I823122d89f674539d6aa54ffd48b406d199677d2
    Reviewed-on: https://gerrit.libreoffice.org/72556
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 881096130517..a855f1c99510 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -653,7 +653,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
         }
 
     // new destination => use new destination text
-    m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
+    m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText());
 
     return RTFError::OK;
 }
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 5bc0c75d4171..870ab1e9cd27 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -471,7 +471,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex));
             m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
             m_aStates.top().setCurrentCharacterStyleIndex(-1);
-            m_aStates.top().isRightToLeft = false;
+            m_aStates.top().setIsRightToLeft(false);
             m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
         }
         break;
@@ -579,10 +579,10 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             break;
         case RTF_LTRCH:
             // dmapper does not support this.
-            m_aStates.top().isRightToLeft = false;
+            m_aStates.top().setIsRightToLeft(false);
             break;
         case RTF_RTLCH:
-            m_aStates.top().isRightToLeft = true;
+            m_aStates.top().setIsRightToLeft(true);
             if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255)
                 m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
             break;
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 06097845d5dc..fbf76b468ce0 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -164,7 +164,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     {
         case RTF_FS:
         case RTF_AFS:
-            nSprm = (m_aStates.top().isRightToLeft
+            nSprm = (m_aStates.top().getIsRightToLeft()
                      || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
                         ? NS_ooxml::LN_EG_RPrBase_szCs
                         : NS_ooxml::LN_EG_RPrBase_sz;
@@ -191,7 +191,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     {
         case RTF_LANG:
         case RTF_ALANG:
-            if (m_aStates.top().isRightToLeft
+            if (m_aStates.top().getIsRightToLeft()
                 || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
             {
                 nSprm = NS_ooxml::LN_CT_Language_bidi;
@@ -261,31 +261,31 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     {
         case RTF_YR:
         {
-            m_aStates.top().nYear = nParam;
+            m_aStates.top().setYear(nParam);
             nSprm = 1;
         }
         break;
         case RTF_MO:
         {
-            m_aStates.top().nMonth = nParam;
+            m_aStates.top().setMonth(nParam);
             nSprm = 1;
         }
         break;
         case RTF_DY:
         {
-            m_aStates.top().nDay = nParam;
+            m_aStates.top().setDay(nParam);
             nSprm = 1;
         }
         break;
         case RTF_HR:
         {
-            m_aStates.top().nHour = nParam;
+            m_aStates.top().setHour(nParam);
             nSprm = 1;
         }
         break;
         case RTF_MIN:
         {
-            m_aStates.top().nMinute = nParam;
+            m_aStates.top().setMinute(nParam);
             nSprm = 1;
         }
         break;
@@ -336,7 +336,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     {
         case RTF_F:
         case RTF_AF:
-            if (m_aStates.top().isRightToLeft
+            if (m_aStates.top().getIsRightToLeft()
                 || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
             {
                 nSprm = NS_ooxml::LN_CT_Fonts_cs;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 0d4d4a290041..5ac66cce3abc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -220,8 +220,14 @@ const char* keywordToString(RTFKeyword nKeyword)
 
 static util::DateTime lcl_getDateTime(RTFParserState const& aState)
 {
-    return { 0 /*100sec*/, 0 /*sec*/,     aState.nMinute, aState.nHour,
-             aState.nDay,  aState.nMonth, aState.nYear,   false };
+    return { 0 /*100sec*/,
+             0 /*sec*/,
+             aState.getMinute(),
+             aState.getHour(),
+             aState.getDay(),
+             aState.getMonth(),
+             static_cast<sal_Int16>(aState.getYear()),
+             false };
 }
 
 static void lcl_DestinationToMath(OUStringBuffer* pDestinationText,
@@ -842,7 +848,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
         int b = 0, count = 2;
 
         // Feed the destination text to a stream.
-        OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(),
+        OString aStr = OUStringToOString(m_aStates.top().getDestinationText().makeStringAndClear(),
                                          RTL_TEXTENCODING_ASCII_US);
         for (int i = 0; i < aStr.getLength(); ++i)
         {
@@ -1834,14 +1840,14 @@ RTFError RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int n
     {
         case RTF_B:
         case RTF_AB:
-            nSprm = (m_aStates.top().isRightToLeft
+            nSprm = (m_aStates.top().getIsRightToLeft()
                      || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
                         ? NS_ooxml::LN_EG_RPrBase_bCs
                         : NS_ooxml::LN_EG_RPrBase_b;
             break;
         case RTF_I:
         case RTF_AI:
-            nSprm = (m_aStates.top().isRightToLeft
+            nSprm = (m_aStates.top().getIsRightToLeft()
                      || m_aStates.top().eRunType == RTFParserState::RunType::HICH)
                         ? NS_ooxml::LN_EG_RPrBase_iCs
                         : NS_ooxml::LN_EG_RPrBase_i;
@@ -1940,7 +1946,7 @@ RTFError RTFDocumentImpl::pushState()
                                   m_bMathNor);
         m_aStates.push(m_aStates.top());
     }
-    m_aStates.top().aDestinationText.setLength(0); // was copied: always reset!
+    m_aStates.top().getDestinationText().setLength(0); // was copied: always reset!
 
     m_pTokenizer->pushGroup();
 
@@ -1948,12 +1954,12 @@ RTFError RTFDocumentImpl::pushState()
     {
         case Destination::FONTTABLE:
             // this is a "faked" destination for the font entry
-            m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
+            m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText());
             m_aStates.top().eDestination = Destination::FONTENTRY;
             break;
         case Destination::STYLESHEET:
             // this is a "faked" destination for the style sheet entry
-            m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
+            m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText());
             m_aStates.top().eDestination = Destination::STYLEENTRY;
             {
                 // the *default* is \s0 i.e. paragraph style default
@@ -1983,7 +1989,7 @@ RTFError RTFDocumentImpl::pushState()
             break;
         case Destination::REVISIONTABLE:
             // this is a "faked" destination for the revision table entry
-            m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
+            m_aStates.top().setCurrentDestinationText(&m_aStates.top().getDestinationText());
             m_aStates.top().eDestination = Destination::REVISIONENTRY;
             break;
         default:
@@ -2234,7 +2240,7 @@ RTFError RTFDocumentImpl::popState()
                                 aBuf.append("0");
                             aBuf.append(OUString::number(ch, 16));
                         }
-                        m_aStates.top().aDestinationText = aBuf;
+                        m_aStates.top().getDestinationText() = aBuf;
                     }
                 }
                 popState();
@@ -2244,7 +2250,8 @@ RTFError RTFDocumentImpl::popState()
             break;
         case Destination::LEVELTEXT:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
 
@@ -2301,7 +2308,8 @@ RTFError RTFDocumentImpl::popState()
             break;
         }
         case Destination::SHAPEPROPERTYNAME:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             aState.aShape.getProperties().emplace_back(
                 m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), OUString());
@@ -2375,7 +2383,8 @@ RTFError RTFDocumentImpl::popState()
             break;
         case Destination::BOOKMARKSTART:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             int nPos = m_aBookmarks.size();
@@ -2389,7 +2398,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::BOOKMARKEND:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             if (!m_aStates.top().getCurrentBuffer())
@@ -2404,7 +2414,8 @@ RTFError RTFDocumentImpl::popState()
         case Destination::INDEXENTRY:
         case Destination::TOCENTRY:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString str(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             // dmapper expects this as a field, so let's fake something...
@@ -2421,7 +2432,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::FORMFIELDNAME:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             auto pValue
                 = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
@@ -2430,7 +2442,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::FORMFIELDLIST:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             auto pValue
                 = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
@@ -2441,7 +2454,7 @@ RTFError RTFDocumentImpl::popState()
         {
             if (m_bFormField)
             {
-                if (&m_aStates.top().aDestinationText
+                if (&m_aStates.top().getDestinationText()
                     != m_aStates.top().getCurrentDestinationText())
                     break; // not for nested group
                 OString aStr = OUStringToOString(
@@ -2515,28 +2528,32 @@ RTFError RTFDocumentImpl::popState()
                 m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState));
             break;
         case Destination::AUTHOR:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setAuthor(
                     m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::KEYWORDS:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(
                     m_aStates.top().getCurrentDestinationText()->makeStringAndClear()));
             break;
         case Destination::COMMENT:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setGenerator(
                     m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::SUBJECT:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setSubject(
@@ -2544,7 +2561,8 @@ RTFError RTFDocumentImpl::popState()
             break;
         case Destination::TITLE:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setTitle(
@@ -2553,7 +2571,8 @@ RTFError RTFDocumentImpl::popState()
         break;
 
         case Destination::DOCCOMM:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setDescription(
@@ -2562,7 +2581,8 @@ RTFError RTFDocumentImpl::popState()
         case Destination::OPERATOR:
         case Destination::COMPANY:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aName = aState.eDestination == Destination::OPERATOR ? OUString("Operator")
                                                                           : OUString("Company");
@@ -2586,7 +2606,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::OBJDATA:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
 
             RTFError eError = handleEmbeddedObject();
@@ -2639,7 +2660,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::ANNOTATIONDATE:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr(OStringToOUString(
                 DTTM22OString(
@@ -2654,19 +2676,22 @@ RTFError RTFDocumentImpl::popState()
         }
         break;
         case Destination::ANNOTATIONAUTHOR:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             m_aAuthor = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             break;
         case Destination::ATNID:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             m_aAuthorInitials = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             break;
         case Destination::ANNOTATIONREFERENCESTART:
         case Destination::ANNOTATIONREFERENCEEND:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             auto pValue = new RTFValue(aStr.toInt32());
@@ -2682,7 +2707,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::ANNOTATIONREFERENCE:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             RTFSprms aAnnAttributes;
@@ -2692,7 +2718,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::FALT:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             auto pValue = new RTFValue(aStr);
@@ -3005,12 +3032,14 @@ RTFError RTFDocumentImpl::popState()
                 m_pSdrImport->popParent();
             break;
         case Destination::PROPNAME:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             aState.setPropName(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::STATICVAL:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
+            if (&m_aStates.top().getDestinationText()
+                != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
             {
@@ -3232,7 +3261,7 @@ RTFError RTFDocumentImpl::popState()
             if (!m_aStates.empty())
             {
                 // FIXME: don't use pDestinationText, points to popped state
-                auto pValue = new RTFValue(aState.aDestinationText.makeStringAndClear(), true);
+                auto pValue = new RTFValue(aState.getDestinationText().makeStringAndClear(), true);
                 m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue);
             }
             break;
@@ -3240,7 +3269,7 @@ RTFError RTFDocumentImpl::popState()
             if (!m_aStates.empty())
             {
                 // FIXME: don't use pDestinationText, points to popped state
-                auto pValue = new RTFValue(aState.aDestinationText.makeStringAndClear(), true);
+                auto pValue = new RTFValue(aState.getDestinationText().makeStringAndClear(), true);
                 m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
             }
             break;
@@ -3326,7 +3355,7 @@ RTFError RTFDocumentImpl::popState()
             {
                 m_aStates.top().aPicture = aState.aPicture;
                 // both \sp and \sv are destinations, copy the text up-ward for later
-                m_aStates.top().aDestinationText = aState.aDestinationText;
+                m_aStates.top().getDestinationText() = aState.getDestinationText();
             }
             break;
         case Destination::FALT:
@@ -3477,8 +3506,8 @@ void RTFDocumentImpl::setDestination(Destination eDestination)
 // situation where it looks like the "current" buffer is needed?
 void RTFDocumentImpl::setDestinationText(OUString const& rString)
 {
-    m_aStates.top().aDestinationText.setLength(0);
-    m_aStates.top().aDestinationText.append(rString);
+    m_aStates.top().getDestinationText().setLength(0);
+    m_aStates.top().getDestinationText().append(rString);
 }
 
 bool RTFDocumentImpl::getSkipUnknown() { return m_bSkipUnknown; }
@@ -3517,12 +3546,12 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
     , bLevelNumbersValid(true)
     , aFrame(this)
     , eRunType(RunType::LOCH)
-    , isRightToLeft(false)
-    , nYear(0)
-    , nMonth(0)
-    , nDay(0)
-    , nHour(0)
-    , nMinute(0)
+    , m_bIsRightToLeft(false)
+    , m_nYear(0)
+    , m_nMonth(0)
+    , m_nDay(0)
+    , m_nHour(0)
+    , m_nMinute(0)
     , m_pCurrentDestinationText(nullptr)
     , m_nCurrentStyleIndex(-1)
     , m_nCurrentCharacterStyleIndex(-1)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index a0394ab55414..42249dd5e590 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -456,6 +456,19 @@ public:
         m_pCurrentDestinationText = pDestinationText;
     }
     OUStringBuffer* getCurrentDestinationText() const { return m_pCurrentDestinationText; }
+    OUStringBuffer& getDestinationText() { return m_aDestinationText; }
+    void setMinute(sal_uInt16 nMinute) { m_nMinute = nMinute; }
+    sal_uInt16 getMinute() const { return m_nMinute; }
+    void setHour(sal_uInt16 nHour) { m_nHour = nHour; }
+    sal_uInt16 getHour() const { return m_nHour; }
+    void setDay(sal_uInt16 nDay) { m_nDay = nDay; }
+    sal_uInt16 getDay() const { return m_nDay; }
+    void setMonth(sal_uInt16 nMonth) { m_nMonth = nMonth; }
+    sal_uInt16 getMonth() const { return m_nMonth; }
+    void setYear(sal_uInt16 nYear) { m_nYear = nYear; }
+    sal_uInt16 getYear() const { return m_nYear; }
+    void setIsRightToLeft(bool bIsRightToLeft) { m_bIsRightToLeft = bIsRightToLeft; }
+    bool getIsRightToLeft() const { return m_bIsRightToLeft; }
 
     RTFDocumentImpl* m_pDocumentImpl;
     RTFInternalState nInternalState;
@@ -517,20 +530,20 @@ public:
         DBCH
     };
     RunType eRunType;
+
+private:
     /// ltrch or rtlch
-    bool isRightToLeft;
+    bool m_bIsRightToLeft;
 
     // Info group.
-    sal_Int16 nYear;
-    sal_uInt16 nMonth;
-    sal_uInt16 nDay;
-    sal_uInt16 nHour;
-    sal_uInt16 nMinute;
+    sal_Int16 m_nYear;
+    sal_uInt16 m_nMonth;
+    sal_uInt16 m_nDay;
+    sal_uInt16 m_nHour;
+    sal_uInt16 m_nMinute;
 
     /// Text from special destinations.
-    OUStringBuffer aDestinationText;
-
-private:
+    OUStringBuffer m_aDestinationText;
     /// point to the buffer of the current destination
     OUStringBuffer* m_pCurrentDestinationText;
 
commit aebe2abe77ab748c5325df82e407663141ce2bf8
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Fri May 17 21:39:30 2019 +0200
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon May 20 10:06:06 2019 +0200

    writerfilter: make RTFParserState members private, part 2
    
    Change-Id: I9d712b227ea39bd63c34e77572f7e3d5ff83aa7e
    Reviewed-on: https://gerrit.libreoffice.org/72555
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>

diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 7b1f84fbe6ae..881096130517 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -653,7 +653,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
         }
 
     // new destination => use new destination text
-    m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
+    m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
 
     return RTFError::OK;
 }
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index 34e8401bc368..5bc0c75d4171 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -470,7 +470,7 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
             m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms;
             m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex));
             m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
-            m_aStates.top().nCurrentCharacterStyleIndex = -1;
+            m_aStates.top().setCurrentCharacterStyleIndex(-1);
             m_aStates.top().isRightToLeft = false;
             m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
         }
@@ -514,11 +514,11 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
                 {
                     m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle,
                                                         new RTFValue(aName));
-                    m_aStates.top().nCurrentStyleIndex = 0;
+                    m_aStates.top().setCurrentStyleIndex(0);
                 }
                 else
                 {
-                    m_aStates.top().nCurrentStyleIndex = -1;
+                    m_aStates.top().setCurrentStyleIndex(-1);
                 }
             }
             // Need to send paragraph properties again, if there will be any.
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 7f662812cc43..06097845d5dc 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -431,7 +431,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         break;
         case RTF_S:
         {
-            m_aStates.top().nCurrentStyleIndex = nParam;
+            m_aStates.top().setCurrentStyleIndex(nParam);
 
             if (m_aStates.top().eDestination == Destination::STYLESHEET
                 || m_aStates.top().eDestination == Destination::STYLEENTRY)
@@ -457,7 +457,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         }
         break;
         case RTF_CS:
-            m_aStates.top().nCurrentCharacterStyleIndex = nParam;
+            m_aStates.top().setCurrentCharacterStyleIndex(nParam);
             if (m_aStates.top().eDestination == Destination::STYLESHEET
                 || m_aStates.top().eDestination == Destination::STYLEENTRY)
             {
@@ -667,7 +667,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                                                      pIntValue);
             else if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY)
                 m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue);
-            m_aStates.top().nCurrentListIndex = nParam;
+            m_aStates.top().setCurrentListIndex(nParam);
         }
         break;
         case RTF_LS:
@@ -675,7 +675,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             if (m_aStates.top().eDestination == Destination::LISTOVERRIDEENTRY)
             {
                 m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue);
-                m_aStates.top().nCurrentListOverrideIndex = nParam;
+                m_aStates.top().setCurrentListOverrideIndex(nParam);
             }
             else
             {
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 764bbf28e960..0d4d4a290041 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -489,7 +489,7 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr
 
     int nStyle = 0;
     if (!m_aStates.empty())
-        nStyle = m_aStates.top().nCurrentStyleIndex;
+        nStyle = m_aStates.top().getCurrentStyleIndex();
     auto it = m_aStyleTableEntries.find(nStyle);
     if (it != m_aStyleTableEntries.end())
     {
@@ -498,7 +498,7 @@ RTFDocumentImpl::getProperties(const RTFSprms& rAttributes, RTFSprms const& rSpr
         auto itChar = m_aStyleTableEntries.end();
         if (!m_aStates.empty())
         {
-            int nCharStyle = m_aStates.top().nCurrentCharacterStyleIndex;
+            int nCharStyle = m_aStates.top().getCurrentCharacterStyleIndex();
             itChar = m_aStyleTableEntries.find(nCharStyle);
         }
 
@@ -1334,7 +1334,8 @@ void RTFDocumentImpl::text(OUString& rString)
             if (bEnd)
             {
                 // always clear, necessary in case of group-less fonttable
-                OUString const aName = m_aStates.top().pDestinationText->makeStringAndClear();
+                OUString const aName
+                    = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
                 switch (m_aStates.top().eDestination)
                 {
                     case Destination::FONTTABLE:
@@ -1681,7 +1682,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer, RTFSprms* const pSprms,
         else if (std::get<0>(aTuple) == BUFFER_SETSTYLE)
         {
             if (!m_aStates.empty())
-                m_aStates.top().nCurrentStyleIndex = std::get<1>(aTuple)->getInt();
+                m_aStates.top().setCurrentStyleIndex(std::get<1>(aTuple)->getInt());
         }
         else
             assert(false);
@@ -1935,7 +1936,8 @@ RTFError RTFDocumentImpl::pushState()
         m_aStates.top().eRunType = RTFParserState::RunType::LOCH;
 
         if (m_aStates.top().eDestination == Destination::MR)
-            lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor);
+            lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer,
+                                  m_bMathNor);
         m_aStates.push(m_aStates.top());
     }
     m_aStates.top().aDestinationText.setLength(0); // was copied: always reset!
@@ -1946,12 +1948,12 @@ RTFError RTFDocumentImpl::pushState()
     {
         case Destination::FONTTABLE:
             // this is a "faked" destination for the font entry
-            m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
+            m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
             m_aStates.top().eDestination = Destination::FONTENTRY;
             break;
         case Destination::STYLESHEET:
             // this is a "faked" destination for the style sheet entry
-            m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
+            m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
             m_aStates.top().eDestination = Destination::STYLEENTRY;
             {
                 // the *default* is \s0 i.e. paragraph style default
@@ -1981,7 +1983,7 @@ RTFError RTFDocumentImpl::pushState()
             break;
         case Destination::REVISIONTABLE:
             // this is a "faked" destination for the revision table entry
-            m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
+            m_aStates.top().setCurrentDestinationText(&m_aStates.top().aDestinationText);
             m_aStates.top().eDestination = Destination::REVISIONENTRY;
             break;
         default:
@@ -2242,9 +2244,9 @@ RTFError RTFDocumentImpl::popState()
             break;
         case Destination::LEVELTEXT:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
+            OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
 
             // The first character is the length of the string (the rest should be ignored).
             sal_Int32 nLength(aStr.toChar());
@@ -2299,16 +2301,16 @@ RTFError RTFDocumentImpl::popState()
             break;
         }
         case Destination::SHAPEPROPERTYNAME:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             aState.aShape.getProperties().emplace_back(
-                m_aStates.top().pDestinationText->makeStringAndClear(), OUString());
+                m_aStates.top().getCurrentDestinationText()->makeStringAndClear(), OUString());
             break;
         case Destination::SHAPEPROPERTYVALUE:
             if (!aState.aShape.getProperties().empty())
             {
                 aState.aShape.getProperties().back().second
-                    = m_aStates.top().pDestinationText->makeStringAndClear();
+                    = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
                 if (m_aStates.top().getHadShapeText())
                     m_pSdrImport->append(aState.aShape.getProperties().back().first,
                                          aState.aShape.getProperties().back().second);
@@ -2373,9 +2375,9 @@ RTFError RTFDocumentImpl::popState()
             break;
         case Destination::BOOKMARKSTART:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
+            OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             int nPos = m_aBookmarks.size();
             m_aBookmarks[aStr] = nPos;
             if (!m_aStates.top().getCurrentBuffer())
@@ -2387,9 +2389,9 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::BOOKMARKEND:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
+            OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             if (!m_aStates.top().getCurrentBuffer())
                 Mapper().props(new RTFReferenceProperties(
                     lcl_getBookmarkProperties(m_aBookmarks[aStr], aStr)));
@@ -2402,9 +2404,9 @@ RTFError RTFDocumentImpl::popState()
         case Destination::INDEXENTRY:
         case Destination::TOCENTRY:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString str(m_aStates.top().pDestinationText->makeStringAndClear());
+            OUString str(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             // dmapper expects this as a field, so let's fake something...
             OUString const field((Destination::INDEXENTRY == aState.eDestination)
                                      ? OUStringLiteral("XE")
@@ -2419,17 +2421,19 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::FORMFIELDNAME:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear());
+            auto pValue
+                = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue);
         }
         break;
         case Destination::FORMFIELDLIST:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear());
+            auto pValue
+                = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue);
         }
         break;
@@ -2437,11 +2441,12 @@ RTFError RTFDocumentImpl::popState()
         {
             if (m_bFormField)
             {
-                if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+                if (&m_aStates.top().aDestinationText
+                    != m_aStates.top().getCurrentDestinationText())
                     break; // not for nested group
-                OString aStr
-                    = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(),
-                                        aState.nCurrentEncoding);
+                OString aStr = OUStringToOString(
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear(),
+                    aState.nCurrentEncoding);
                 // decode hex dump
                 OStringBuffer aBuf;
                 int b = 0, count = 2;
@@ -2510,57 +2515,59 @@ RTFError RTFDocumentImpl::popState()
                 m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState));
             break;
         case Destination::AUTHOR:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setAuthor(
-                    m_aStates.top().pDestinationText->makeStringAndClear());
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::KEYWORDS:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(
-                    m_aStates.top().pDestinationText->makeStringAndClear()));
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear()));
             break;
         case Destination::COMMENT:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setGenerator(
-                    m_aStates.top().pDestinationText->makeStringAndClear());
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::SUBJECT:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setSubject(
-                    m_aStates.top().pDestinationText->makeStringAndClear());
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::TITLE:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
-                m_xDocumentProperties->setTitle(aState.pDestinationText->makeStringAndClear());
+                m_xDocumentProperties->setTitle(
+                    aState.getCurrentDestinationText()->makeStringAndClear());
         }
         break;
 
         case Destination::DOCCOMM:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
                 m_xDocumentProperties->setDescription(
-                    m_aStates.top().pDestinationText->makeStringAndClear());
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::OPERATOR:
         case Destination::COMPANY:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aName = aState.eDestination == Destination::OPERATOR ? OUString("Operator")
                                                                           : OUString("Company");
-            uno::Any aValue = uno::makeAny(m_aStates.top().pDestinationText->makeStringAndClear());
+            uno::Any aValue
+                = uno::makeAny(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             if (m_xDocumentProperties.is())
             {
                 uno::Reference<beans::XPropertyContainer> xUserDefinedProperties
@@ -2579,7 +2586,7 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::OBJDATA:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
 
             RTFError eError = handleEmbeddedObject();
@@ -2589,7 +2596,8 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::OBJCLASS:
         {
-            auto pValue = new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear());
+            auto pValue
+                = new RTFValue(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             m_aOLEAttributes.set(NS_ooxml::LN_CT_OLEObject_ProgID, pValue);
             break;
         }
@@ -2631,10 +2639,11 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::ANNOTATIONDATE:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             OUString aStr(OStringToOUString(
-                DTTM22OString(m_aStates.top().pDestinationText->makeStringAndClear().toInt32()),
+                DTTM22OString(
+                    m_aStates.top().getCurrentDestinationText()->makeStringAndClear().toInt32()),
                 aState.nCurrentEncoding));
             auto pValue = new RTFValue(aStr);
             RTFSprms aAnnAttributes;
@@ -2645,21 +2654,21 @@ RTFError RTFDocumentImpl::popState()
         }
         break;
         case Destination::ANNOTATIONAUTHOR:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            m_aAuthor = m_aStates.top().pDestinationText->makeStringAndClear();
+            m_aAuthor = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             break;
         case Destination::ATNID:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            m_aAuthorInitials = m_aStates.top().pDestinationText->makeStringAndClear();
+            m_aAuthorInitials = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             break;
         case Destination::ANNOTATIONREFERENCESTART:
         case Destination::ANNOTATIONREFERENCEEND:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
+            OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             auto pValue = new RTFValue(aStr.toInt32());
             RTFSprms aAttributes;
             if (aState.eDestination == Destination::ANNOTATIONREFERENCESTART)
@@ -2673,9 +2682,9 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::ANNOTATIONREFERENCE:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
+            OUString aStr = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             RTFSprms aAnnAttributes;
             aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, new RTFValue(aStr.toInt32()));
             Mapper().props(new RTFReferenceProperties(aAnnAttributes));
@@ -2683,9 +2692,9 @@ RTFError RTFDocumentImpl::popState()
         break;
         case Destination::FALT:
         {
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            OUString aStr(m_aStates.top().pDestinationText->makeStringAndClear());
+            OUString aStr(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             auto pValue = new RTFValue(aStr);
             aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue);
         }
@@ -2793,7 +2802,8 @@ RTFError RTFDocumentImpl::popState()
         }
         break;
         case Destination::MR:
-            lcl_DestinationToMath(m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor);
+            lcl_DestinationToMath(m_aStates.top().getCurrentDestinationText(), m_aMathBuffer,
+                                  m_bMathNor);
             break;
         case Destination::MF:
             m_aMathBuffer.appendClosingTag(M_TOKEN(f));
@@ -2873,7 +2883,8 @@ RTFError RTFDocumentImpl::popState()
             }
 
             oox::formulaimport::XmlStream::AttributeList aAttribs;
-            aAttribs[M_TOKEN(val)] = m_aStates.top().pDestinationText->makeStringAndClear();
+            aAttribs[M_TOKEN(val)]
+                = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
             m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs);
             m_aMathBuffer.appendClosingTag(nMathToken);
         }
@@ -2994,12 +3005,12 @@ RTFError RTFDocumentImpl::popState()
                 m_pSdrImport->popParent();
             break;
         case Destination::PROPNAME:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
-            aState.setPropName(m_aStates.top().pDestinationText->makeStringAndClear());
+            aState.setPropName(m_aStates.top().getCurrentDestinationText()->makeStringAndClear());
             break;
         case Destination::STATICVAL:
-            if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            if (&m_aStates.top().aDestinationText != m_aStates.top().getCurrentDestinationText())
                 break; // not for nested group
             if (m_xDocumentProperties.is())
             {
@@ -3007,7 +3018,8 @@ RTFError RTFDocumentImpl::popState()
                 uno::Reference<beans::XPropertyContainer> xPropertyContainer
                     = m_xDocumentProperties->getUserDefinedProperties();
                 const OUString& rKey = m_aStates.top().getPropName();
-                OUString aStaticVal = m_aStates.top().pDestinationText->makeStringAndClear();
+                OUString aStaticVal
+                    = m_aStates.top().getCurrentDestinationText()->makeStringAndClear();
                 uno::Any aAny;
                 if (m_aStates.top().getPropType() == cppu::UnoType<OUString>::get())
                     aAny <<= aStaticVal;
@@ -3127,9 +3139,9 @@ RTFError RTFDocumentImpl::popState()
             auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms);
             m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue,
                                   RTFOverwrite::NO_APPEND);
-            m_aListTable[aState.nCurrentListIndex] = pValue;
+            m_aListTable[aState.getCurrentListIndex()] = pValue;
             m_nListLevel = -1;
-            m_aInvalidListTableFirstIndents[aState.nCurrentListIndex]
+            m_aInvalidListTableFirstIndents[aState.getCurrentListIndex()]
                 = m_aInvalidListLevelFirstIndents;
             m_aInvalidListLevelFirstIndents.clear();
         }
@@ -3274,8 +3286,8 @@ RTFError RTFDocumentImpl::popState()
                     auto pValue = new RTFValue(aState.aTableAttributes, aState.aTableSprms);
                     m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue,
                                           RTFOverwrite::NO_APPEND);
-                    m_aListOverrideTable[aState.nCurrentListOverrideIndex]
-                        = aState.nCurrentListIndex;
+                    m_aListOverrideTable[aState.getCurrentListOverrideIndex()]
+                        = aState.getCurrentListIndex();
                 }
             }
             break;
@@ -3430,8 +3442,9 @@ RTFError RTFDocumentImpl::popState()
 
 RTFError RTFDocumentImpl::handleEmbeddedObject()
 {
-    OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(),
-                                     RTL_TEXTENCODING_ASCII_US);
+    OString aStr
+        = OUStringToOString(m_aStates.top().getCurrentDestinationText()->makeStringAndClear(),
+                            RTL_TEXTENCODING_ASCII_US);
     std::unique_ptr<SvStream> pStream(new SvMemoryStream());
     if (!msfilter::rtfutil::ExtractOLE2FromObjdata(aStr, *pStream))
         return RTFError::HEX_INVALID;
@@ -3510,9 +3523,9 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
     , nDay(0)
     , nHour(0)
     , nMinute(0)
-    , pDestinationText(nullptr)
-    , nCurrentStyleIndex(-1)
-    , nCurrentCharacterStyleIndex(-1)
+    , m_pCurrentDestinationText(nullptr)
+    , m_nCurrentStyleIndex(-1)
+    , m_nCurrentCharacterStyleIndex(-1)
     , m_pCurrentBuffer(nullptr)
     , m_bInListpicture(false)
     , m_bInBackground(false)
@@ -3531,7 +3544,7 @@ void RTFDocumentImpl::bufferProperties(RTFBuffer_t& rBuffer, const RTFValue::Poi
                                        const tools::SvRef<TableRowBuffer>& pTableProperties)
 {
     rBuffer.emplace_back(
-        Buf_t(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().nCurrentStyleIndex), nullptr));
+        Buf_t(BUFFER_SETSTYLE, new RTFValue(m_aStates.top().getCurrentStyleIndex()), nullptr));
     rBuffer.emplace_back(Buf_t(BUFFER_PROPS, pValue, pTableProperties));
 }
 
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 2fbf158038c4..a0394ab55414 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -402,8 +402,8 @@ public:
 
     void appendDestinationText(const OUString& rString)
     {
-        if (pDestinationText)
-            pDestinationText->append(rString);
+        if (m_pCurrentDestinationText)
+            m_pCurrentDestinationText->append(rString);
     }
 
     void setPropName(const OUString& rPropName) { m_aPropName = rPropName; }
@@ -437,6 +437,25 @@ public:
     bool getInListpicture() const { return m_bInListpicture; }
     void setCurrentBuffer(RTFBuffer_t* pCurrentBuffer) { m_pCurrentBuffer = pCurrentBuffer; }
     RTFBuffer_t* getCurrentBuffer() const { return m_pCurrentBuffer; }
+    void setCurrentListOverrideIndex(int nCurrentListOverrideIndex)
+    {
+        m_nCurrentListOverrideIndex = nCurrentListOverrideIndex;
+    }
+    int getCurrentListOverrideIndex() const { return m_nCurrentListOverrideIndex; }
+    void setCurrentListIndex(int nCurrentListIndex) { m_nCurrentListIndex = nCurrentListIndex; }
+    int getCurrentListIndex() const { return m_nCurrentListIndex; }
+    void setCurrentCharacterStyleIndex(int nCurrentCharacterStyleIndex)
+    {
+        m_nCurrentCharacterStyleIndex = nCurrentCharacterStyleIndex;
+    }
+    int getCurrentCharacterStyleIndex() const { return m_nCurrentCharacterStyleIndex; }
+    void setCurrentStyleIndex(int nCurrentStyleIndex) { m_nCurrentStyleIndex = nCurrentStyleIndex; }
+    int getCurrentStyleIndex() const { return m_nCurrentStyleIndex; }
+    void setCurrentDestinationText(OUStringBuffer* pDestinationText)
+    {
+        m_pCurrentDestinationText = pDestinationText;
+    }
+    OUStringBuffer* getCurrentDestinationText() const { return m_pCurrentDestinationText; }
 
     RTFDocumentImpl* m_pDocumentImpl;
     RTFInternalState nInternalState;
@@ -510,19 +529,20 @@ public:
 
     /// Text from special destinations.
     OUStringBuffer aDestinationText;
+
+private:
     /// point to the buffer of the current destination
-    OUStringBuffer* pDestinationText;
+    OUStringBuffer* m_pCurrentDestinationText;
 
     /// Index of the current style.
-    int nCurrentStyleIndex;
+    int m_nCurrentStyleIndex;
     /// Index of the current character style.
-    int nCurrentCharacterStyleIndex;
+    int m_nCurrentCharacterStyleIndex;
     /// Current listid, points to a listtable entry.
-    int nCurrentListIndex = -1;
+    int m_nCurrentListIndex = -1;
     /// Current ls, points to a listoverridetable entry.
-    int nCurrentListOverrideIndex = -1;
+    int m_nCurrentListOverrideIndex = -1;
 
-private:
     /// Points to the active buffer, if there is one.
     RTFBuffer_t* m_pCurrentBuffer;
 


More information about the Libreoffice-commits mailing list