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

Miklos Vajna vmiklos at suse.cz
Wed Jun 26 00:15:07 PDT 2013


 writerfilter/source/rtftok/rtfdocumentimpl.cxx    |   24 ++++++++++++++++++++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx    |    6 ++++-
 writerfilter/source/rtftok/rtfsdrimport.cxx       |    2 -
 writerfilter/source/rtftok/rtfskipdestination.cxx |    2 -
 writerfilter/source/rtftok/rtftokenizer.cxx       |    8 +++----
 5 files changed, 33 insertions(+), 9 deletions(-)

New commits:
commit 351e8d77f95734f74474e45af060cb1450ea7961
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jun 26 09:10:23 2013 +0200

    Kill RTFDocumentImpl::getState()
    
    RTFParserState is private to RTFDocumentImpl, exposing it is not a good
    idea. One more step towards RTFTokenizer not speaking directly to
    RTFDocumentImpl, but through an interface.
    
    Change-Id: I3f626d4f2c560a20d9e24105459e95a66d0a87ca

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 76ab7ea..c60128e 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4633,9 +4633,29 @@ uno::Reference<lang::XMultiServiceFactory> RTFDocumentImpl::getModelFactory()
     return m_xModelFactory;
 }
 
-RTFParserState& RTFDocumentImpl::getState()
+bool RTFDocumentImpl::isInBackground()
 {
-    return m_aStates.top();
+    return m_aStates.top().bInBackground;
+}
+
+RTFInternalState RTFDocumentImpl::getInternalState()
+{
+    return m_aStates.top().nInternalState;
+}
+
+void RTFDocumentImpl::setInternalState(RTFInternalState nInternalState)
+{
+    m_aStates.top().nInternalState = nInternalState;
+}
+
+RTFDesitnationState RTFDocumentImpl::getDestinationState()
+{
+    return m_aStates.top().nDestinationState;
+}
+
+void RTFDocumentImpl::setDestinationState(RTFDesitnationState nDestinationState)
+{
+    m_aStates.top().nDestinationState = nDestinationState;
 }
 
 void RTFDocumentImpl::setDestinationText(OUString& rString)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index b878309..44c5f92 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -438,7 +438,11 @@ namespace writerfilter {
                 void setIgnoreFirst(OUString& rIgnoreFirst);
                 void seek(sal_uInt32 nPos);
                 uno::Reference<lang::XMultiServiceFactory> getModelFactory();
-                RTFParserState& getState();
+                bool isInBackground();
+                RTFInternalState getInternalState();
+                void setInternalState(RTFInternalState nInternalState);
+                RTFDesitnationState getDestinationState();
+                void setDestinationState(RTFDesitnationState nDestinationState);
                 void setDestinationText(OUString& rString);
                 /// Resolve a picture: If not inline, then anchored.
                 int resolvePict(bool bInline);
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index c47a29b..0e07a45 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -639,7 +639,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose)
         }
     }
 
-    if (m_rImport.getState().bInBackground)
+    if (m_rImport.isInBackground())
     {
         RTFSprms aAttributes;
         aAttributes.set(NS_ooxml::LN_CT_Background_color, RTFValue::Pointer_t(new RTFValue(xPropertySet->getPropertyValue("FillColor").get<sal_Int32>())));
diff --git a/writerfilter/source/rtftok/rtfskipdestination.cxx b/writerfilter/source/rtftok/rtfskipdestination.cxx
index 0bd6a3c..46c7b9e 100644
--- a/writerfilter/source/rtftok/rtfskipdestination.cxx
+++ b/writerfilter/source/rtftok/rtfskipdestination.cxx
@@ -26,7 +26,7 @@ RTFSkipDestination::~RTFSkipDestination()
         if (!m_bParsed)
         {
             SAL_INFO("writerfilter", OSL_THIS_FUNC << ": skipping destination");
-            m_rImport.getState().nDestinationState = DESTINATION_SKIP;
+            m_rImport.setDestinationState(DESTINATION_SKIP);
         }
         m_rImport.setSkipUnknown(false);
     }
diff --git a/writerfilter/source/rtftok/rtftokenizer.cxx b/writerfilter/source/rtftok/rtftokenizer.cxx
index 873c7e9..aa3708f 100644
--- a/writerfilter/source/rtftok/rtftokenizer.cxx
+++ b/writerfilter/source/rtftok/rtftokenizer.cxx
@@ -82,7 +82,7 @@ int RTFTokenizer::resolveParse()
 
         if (m_nGroup < 0)
             return ERROR_GROUP_UNDER;
-        if (m_nGroup > 0 && m_rImport.getState().nInternalState == INTERNAL_BIN)
+        if (m_nGroup > 0 && m_rImport.getInternalState() == INTERNAL_BIN)
         {
             ret = m_rImport.resolveChars(ch);
             if (ret)
@@ -122,7 +122,7 @@ int RTFTokenizer::resolveParse()
                 default:
                     if (m_nGroup == 0)
                         return ERROR_CHAR_OVER;
-                    if (m_rImport.getState().nInternalState == INTERNAL_NORMAL)
+                    if (m_rImport.getInternalState() == INTERNAL_NORMAL)
                     {
                         ret = m_rImport.resolveChars(ch);
                         if (ret)
@@ -144,7 +144,7 @@ int RTFTokenizer::resolveParse()
                                 return ret;
                             count = 2;
                             b = 0;
-                            m_rImport.getState().nInternalState = INTERNAL_NORMAL;
+                            m_rImport.setInternalState(INTERNAL_NORMAL);
                         }
                     }
                     break;
@@ -269,7 +269,7 @@ int RTFTokenizer::resolveKeyword()
 
 int RTFTokenizer::dispatchKeyword(OString& rKeyword, bool bParam, int nParam)
 {
-    if (m_rImport.getState().nDestinationState == DESTINATION_SKIP)
+    if (m_rImport.getDestinationState() == DESTINATION_SKIP)
         return 0;
     /*SAL_INFO("writefilter", OSL_THIS_FUNC << ": keyword '\\" << rKeyword.getStr() <<
                "' with param? " << (bParam ? 1 : 0) <<" param val: '" << (bParam ? nParam : 0) << "'");*/


More information about the Libreoffice-commits mailing list