writerfilter/source/ooxml/OOXMLFastContextHandler.cxx |    9 ++++-----
 writerfilter/source/ooxml/OOXMLFastContextHandler.hxx |   13 -------------
 writerfilter/source/ooxml/OOXMLParserState.hxx        |   15 +++++++++++++++
 3 files changed, 19 insertions(+), 18 deletions(-)

New commits:
commit 95e6cc2ecbcb653f76c4a1ee109908a12b84e456
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Tue Jun 24 10:25:47 2014 +0200

    Related: fdo#76260 writerfilter: move SavedAlternateStates to 
OOXMLParserState
    
    Change-Id: Ib9bddeb2d3b5ccdb71295587acbd13c86e5dd28b

diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index b89a5cf..4214380 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -150,8 +150,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
   inPositionV(pContext->inPositionV),
   m_xContext(pContext->m_xContext),
   m_bDiscardChildren(pContext->m_bDiscardChildren),
-  m_bTookChoice(pContext->m_bTookChoice),
-  m_aSavedAlternateStates(pContext->m_aSavedAlternateStates)
+  m_bTookChoice(pContext->m_bTookChoice)
 {
     mpParserState = pContext->mpParserState;
 
@@ -179,7 +178,7 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t 
nElement, const uno::Ref
                 m_bDiscardChildren = false;
                 aState.m_bTookChoice = m_bTookChoice;
                 m_bTookChoice = false;
-                m_aSavedAlternateStates.push_back(aState);
+                mpParserState->getSavedAlternateStates().push_back(aState);
             }
             break;
         case OOXML_Choice:
@@ -241,8 +240,8 @@ throw (uno::RuntimeException, xml::sax::SAXException, 
std::exception)
         m_bDiscardChildren = false;
     else if (Element == (NS_mce | OOXML_AlternateContent))
     {
-        SavedAlternateState aState(m_aSavedAlternateStates.back());
-        m_aSavedAlternateStates.pop_back();
+        SavedAlternateState 
aState(mpParserState->getSavedAlternateStates().back());
+        mpParserState->getSavedAlternateStates().pop_back();
         m_bDiscardChildren = aState.m_bDiscardChildren;
         m_bTookChoice = aState.m_bTookChoice;
     }
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx 
b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 88b1b80..eb315cf 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -43,18 +43,6 @@ namespace ooxml
 
 typedef boost::shared_ptr<Stream> StreamPointer_t;
 
-/**
- * Struct to store our 'alternate state'. If multiple mc:AlternateContent
- * elements arrive, then while the inner ones are active, the original state is
- * saved away, and once they inner goes out of scope, the original state is
- * restored.
- */
-struct SavedAlternateState
-{
-    bool m_bDiscardChildren;
-    bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
-};
-
 class OOXMLFastContextHandler:
     public ::cppu::WeakImplHelper1<
         xml::sax::XFastContextHandler>
@@ -290,7 +278,6 @@ private:
     uno::Reference< uno::XComponentContext > m_xContext;
     bool m_bDiscardChildren;
     bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
-    std::vector<SavedAlternateState> m_aSavedAlternateStates;
 
     static sal_uInt32 mnInstanceCount;
 
diff --git a/writerfilter/source/ooxml/OOXMLParserState.hxx 
b/writerfilter/source/ooxml/OOXMLParserState.hxx
index 0cafc11..935ee52 100644
--- a/writerfilter/source/ooxml/OOXMLParserState.hxx
+++ b/writerfilter/source/ooxml/OOXMLParserState.hxx
@@ -31,6 +31,18 @@ namespace writerfilter {
 namespace ooxml
 {
 
+/**
+ * Struct to store our 'alternate state'. If multiple mc:AlternateContent
+ * elements arrive, then while the inner ones are active, the original state is
+ * saved away, and once they inner goes out of scope, the original state is
+ * restored.
+ */
+struct SavedAlternateState
+{
+    bool m_bDiscardChildren;
+    bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
+};
+
 class OOXMLParserState
 {
     bool mbInSectionGroup;
@@ -51,6 +63,7 @@ class OOXMLParserState
     bool savedInParagraphGroup;
     bool savedInCharacterGroup;
     bool savedLastParagraphInSection;
+    std::vector<SavedAlternateState> maSavedAlternateStates;
 
 public:
     typedef boost::shared_ptr<OOXMLParserState> Pointer_t;
@@ -64,6 +77,8 @@ public:
     void setLastParagraphInSection(bool bLastParagraphInSection);
     bool isLastParagraphInSection() const { return mbLastParagraphInSection;}
 
+    std::vector<SavedAlternateState>& getSavedAlternateStates() { return 
maSavedAlternateStates; }
+
     bool isInParagraphGroup() const { return mbInParagraphGroup;}
     void setInParagraphGroup(bool bInParagraphGroup);
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to