[Libreoffice-commits] core.git: 3 commits - include/sax oox/source sax/source sw/qa sw/source

Michael Stahl mstahl at redhat.com
Sat Jul 18 14:05:17 PDT 2015


 include/sax/fshelper.hxx                         |    8 +
 oox/source/export/vmlexport.cxx                  |   11 +-
 sax/source/tools/fastserializer.cxx              |   32 +++----
 sax/source/tools/fastserializer.hxx              |   26 +++--
 sax/source/tools/fshelper.cxx                    |   10 +-
 sw/qa/extras/ooxmlexport/data/rubyhyperlink.fodt |   45 +++++++++
 sw/qa/extras/ooxmlexport/ooxmlexport7.cxx        |    5 +
 sw/source/filter/ww8/docxattributeoutput.cxx     |  104 +++++++++++++----------
 8 files changed, 162 insertions(+), 79 deletions(-)

New commits:
commit c2c51fa587523edd6e31a17affffc77645b60dea
Author: Michael Stahl <mstahl at redhat.com>
Date:   Sat Jul 18 20:59:00 2015 +0200

    sw: DOCX export: *really* fix non-well-formed XML with hyperlink/ruby
    
    Turns out that 84ea33ef9a86f097a248b526554cdc3581c8d725 did not actually
    fix the problem; it was merely good enough to fool the asserts in
    FastSaxSerializer that were not yet adapted to the funky maMarkStack.
    
    The problem is that the StartRuby()/EndRuby() call StartRun()/EndRun()
    and that really messes up the mark stack.  Prevent that by first ending
    the run before starting new one in StartRuby(), and then starting a new
    run after ending the ruby-base one in EndRuby().
    
    The hints handled in SwWW8AttrIter::OutAttrWithRange() are sorted in the
    right way for this to work (i.e. the EndRuby() will be the last call for
    any given position).
    
    This apparently causes an additional <w:r/> empty element to be written,
    not sure if that causes any issues but at least the output is
    well-formed for fdo82849-1.odt.
    
    Change-Id: I28ffd029246310ff0e405b0674aef8e724700d4d

diff --git a/sw/qa/extras/ooxmlexport/data/rubyhyperlink.fodt b/sw/qa/extras/ooxmlexport/data/rubyhyperlink.fodt
new file mode 100644
index 0000000..a201d7c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/rubyhyperlink.fodt
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oas
 is:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:
 experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+
+ <office:font-face-decls>
+  <style:font-face style:name="Lohit Devanagari1" svg:font-family="'Lohit Devanagari'"/>
+  <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/>
+  <style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/>
+  <style:font-face style:name="Lohit Devanagari" svg:font-family="'Lohit Devanagari'" style:font-family-generic="system" style:font-pitch="variable"/>
+  <style:font-face style:name="Source Han Sans CN Normal" svg:font-family="'Source Han Sans CN Normal'" style:font-family-generic="system" style:font-pitch="variable"/>
+ </office:font-face-decls>
+ <office:styles>
+  <style:default-style style:family="paragraph">
+   <style:paragraph-properties fo:hyphenation-ladder-count="no-limit" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/>
+   <style:text-properties style:use-window-font-color="true" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Source Han Sans CN Normal" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lohit Devanagari" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2"/>
+  </style:default-style>
+
+  <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+  <style:style style:name="Internet_20_link" style:display-name="Internet link" style:family="text">
+   <style:text-properties fo:color="#000080" fo:language="zxx" fo:country="none" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:language-asian="zxx" style:country-asian="none" style:language-complex="zxx" style:country-complex="none"/>
+  </style:style>
+
+ </office:styles>
+ <office:automatic-styles>
+  <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Standard">
+   <style:text-properties officeooo:rsid="001000a5" officeooo:paragraph-rsid="001000a5"/>
+  </style:style>
+  <style:style style:name="Ru1" style:family="ruby">
+   <style:ruby-properties style:ruby-align="left" style:ruby-position="above"/>
+  </style:style>
+ </office:automatic-styles>
+ <office:body>
+  <office:text>
+   <text:p text:style-name="P1"><text:ruby text:style-name="Ru1"><text:ruby-base>bar</text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby></text:p>
+   <text:p text:style-name="P1">foo<text:ruby text:style-name="Ru1"><text:ruby-base>bar</text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby>baz</text:p>
+   <text:p text:style-name="P1"><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">foo</text:a><text:ruby text:style-name="Ru1"><text:ruby-base>bar</text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby>baz</text:p>
+   <text:p text:style-name="P1">foo<text:ruby text:style-name="Ru1"><text:ruby-base><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">bar</text:a></text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby>baz</text:p>
+   <text:p text:style-name="P1">foo<text:ruby text:style-name="Ru1"><text:ruby-base>bar</text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">baz</text:a></text:p>
+   <text:p text:style-name="P1"><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">foo</text:a><text:ruby text:style-name="Ru1"><text:ruby-base><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">bar</text:a></text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby>baz</text:p>
+   <text:p text:style-name="P1"><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">foo</text:a><text:ruby text:style-name="Ru1"><text:ruby-base>bar</text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">baz</text:a></text:p>
+   <text:p text:style-name="P1">foo<text:ruby text:style-name="Ru1"><text:ruby-base><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">bar</text:a></text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">baz</text:a></text:p>
+   <text:p text:style-name="P1"><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">foo</text:a><text:ruby text:style-name="Ru1"><text:ruby-base><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">bar</text:a></text:ruby-base><text:ruby-text>quux</text:ruby-text></text:ruby><text:a xlink:type="simple" xlink:href="http://example.com/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">baz</text:a></text:p>
+  </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
index 727d448..a9858f4 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx
@@ -707,6 +707,11 @@ DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx")
     }
 }
 
+DECLARE_OOXMLEXPORT_TEST(testRubyHyperlink, "rubyhyperlink.fodt")
+{
+    // test that export doesn't assert with overlapping ruby / hyperlink attr
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo78300,"fdo78300.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index e185158..4236043 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2158,12 +2158,9 @@ void DocxAttributeOutput::RawText(const OUString& /*rText*/, rtl_TextEncoding /*
 void DocxAttributeOutput::StartRuby( const SwTextNode& rNode, sal_Int32 nPos, const SwFormatRuby& rRuby )
 {
     OSL_TRACE("TODO DocxAttributeOutput::StartRuby( const SwTextNode& rNode, const SwFormatRuby& rRuby )" );
-    if (m_closeHyperlinkInThisRun)
-    {
-        EndRun(); // end hyperlink before starting ruby to avoid overlap
-        assert(!m_closeHyperlinkInThisRun);
-        assert(!m_closeHyperlinkInPreviousRun);
-    }
+    EndRun(); // end run before starting ruby to avoid nested runs, and overlap
+    assert(!m_closeHyperlinkInThisRun); // check that no hyperlink overlaps ruby
+    assert(!m_closeHyperlinkInPreviousRun);
     m_pSerializer->startElementNS( XML_w, XML_ruby, FSEND );
     m_pSerializer->startElementNS( XML_w, XML_rubyPr, FSEND );
     // hps
@@ -2228,6 +2225,7 @@ void DocxAttributeOutput::EndRuby()
     EndRun( );
     m_pSerializer->endElementNS( XML_w, XML_rubyBase );
     m_pSerializer->endElementNS( XML_w, XML_ruby );
+    StartRun(nullptr); // open Run again so OutputTextNode loop can close it
 }
 
 bool DocxAttributeOutput::AnalyzeURL( const OUString& rUrl, const OUString& rTarget, OUString* pLinkURL, OUString* pMark )
commit 0a0f9d71af5247d70012b7d13504bad28a26bde2
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 17 23:49:54 2015 +0200

    sax: convert MergeMarksEnum to enum class
    
    This should detect if a MergeMarks value is erroneously passed as tag.
    
    Change-Id: I7b855a661f182136824cf25f2174a9bcce8ff3d1

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index 52d5399..501dbcb 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -60,7 +60,7 @@ const sal_Int32 FSEND_internal = -1; // same as XML_TOKEN_INVALID
 
 namespace sax_fastparser {
 
-enum MergeMarksEnum { MERGE_MARKS_APPEND = 0, MERGE_MARKS_PREPEND = 1, MERGE_MARKS_POSTPONE = 2, MERGE_MARKS_IGNORE = 3 };
+enum class MergeMarks { APPEND = 0, PREPEND = 1, POSTPONE = 2, IGNORE = 3 };
 
 typedef ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList > XFastAttributeListRef;
 
@@ -141,7 +141,7 @@ public:
             const ::com::sun::star::uno::Sequence< sal_Int32 >& rOrder =
             ::com::sun::star::uno::Sequence< sal_Int32 >() );
     void mergeTopMarks(sal_Int32 nTag,
-            MergeMarksEnum eMergeType = MERGE_MARKS_APPEND );
+            MergeMarks eMergeType = MergeMarks::APPEND );
 
     /*
       Now create all the overloads in a typesafe way (i.e. without varargs) by creating a number of overloads
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 84b3737..5568f56 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -863,7 +863,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
         }
     }
 
-    m_pSerializer->mergeTopMarks(Tag_Commit, sax_fastparser::MERGE_MARKS_POSTPONE );
+    m_pSerializer->mergeTopMarks(Tag_Commit, sax_fastparser::MergeMarks::POSTPONE );
 }
 
 OString VMLExport::ShapeIdString( sal_uInt32 nId )
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 66466e9..32c0358 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -402,7 +402,7 @@ namespace sax_fastparser {
 #endif
 
     void FastSaxSerializer::mergeTopMarks(
-        sal_Int32 const nTag, sax_fastparser::MergeMarksEnum const eMergeType)
+        sal_Int32 const nTag, sax_fastparser::MergeMarks const eMergeType)
     {
         SAL_WARN_IF(mbMarkStackEmpty, "sax", "Empty mark stack - nothing to merge");
         assert(!mbMarkStackEmpty); // should never happen
@@ -428,7 +428,7 @@ namespace sax_fastparser {
         // flush, so that we get everything in getData()
         maCachedOutputStream.flush();
 
-        if ( maMarkStack.size() == 1  && eMergeType != MERGE_MARKS_IGNORE)
+        if (maMarkStack.size() == 1 && eMergeType != MergeMarks::IGNORE)
         {
 #ifdef DBG_UTIL
             while (!maMarkStack.top()->m_DebugEndedElements.empty())
@@ -460,14 +460,14 @@ namespace sax_fastparser {
 #ifdef DBG_UTIL
         switch (eMergeType)
         {
-            case MERGE_MARKS_APPEND:
+            case MergeMarks::APPEND:
                 lcl_DebugMergeAppend(
                     maMarkStack.top()->m_DebugEndedElements,
                     maMarkStack.top()->m_DebugStartedElements,
                     topDebugEndedElements,
                     topDebugStartedElements);
                 break;
-            case MERGE_MARKS_PREPEND:
+            case MergeMarks::PREPEND:
                 if (dynamic_cast<ForSort*>(maMarkStack.top().get())) // argh...
                 {
                     lcl_DebugMergeAppend(
@@ -485,14 +485,14 @@ namespace sax_fastparser {
                         maMarkStack.top()->m_DebugStartedElements);
                 }
                 break;
-            case MERGE_MARKS_POSTPONE:
+            case MergeMarks::POSTPONE:
                 lcl_DebugMergeAppend(
                     maMarkStack.top()->m_DebugPostponedEndedElements,
                     maMarkStack.top()->m_DebugPostponedStartedElements,
                     topDebugEndedElements,
                     topDebugStartedElements);
                 break;
-            case MERGE_MARKS_IGNORE:
+            case MergeMarks::IGNORE:
                 break;
         }
 #endif
@@ -508,10 +508,10 @@ namespace sax_fastparser {
 
         switch ( eMergeType )
         {
-            case MERGE_MARKS_APPEND:   maMarkStack.top()->append( aMerge );   break;
-            case MERGE_MARKS_PREPEND:  maMarkStack.top()->prepend( aMerge );  break;
-            case MERGE_MARKS_POSTPONE: maMarkStack.top()->postpone( aMerge ); break;
-            case MERGE_MARKS_IGNORE  :  break;
+            case MergeMarks::APPEND:   maMarkStack.top()->append( aMerge );   break;
+            case MergeMarks::PREPEND:  maMarkStack.top()->prepend( aMerge );  break;
+            case MergeMarks::POSTPONE: maMarkStack.top()->postpone( aMerge ); break;
+            case MergeMarks::IGNORE:   break;
 
         }
     }
diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx
index 5fcbef5..1f30313 100644
--- a/sax/source/tools/fastserializer.hxx
+++ b/sax/source/tools/fastserializer.hxx
@@ -125,7 +125,7 @@ public:
           p, r, t, [text], /t, rPr, [something], /rPr, /r, /p,
         simply do
           p, r, mark(), t, [text], /t, mark(), rPr, [something], /rPr,
-          mergeTopMarks( MERGE_MARKS_PREPEND ), mergeTopMarks( MERGE_MARKS_APPEND ), /r, /p
+          mergeTopMarks( MergeMarks::PREPEND ), mergeTopMarks( MergeMarks::APPEND ), /r, /p
         and you are done.
 
         @param nTag debugging aid to ensure mark and merge match in LIFO order
@@ -142,7 +142,7 @@ public:
         Writes the result to the output stream if the mark stack becomes empty
         by the operation.
 
-        When the MERGE_MARKS_POSTPONE is specified, the merge happens just
+        When the MergeMarks::POSTPONE is specified, the merge happens just
         before the next merge.
 
         @param nTag debugging aid to ensure mark and merge match in LIFO order
@@ -150,7 +150,7 @@ public:
         @see mark()
      */
     void mergeTopMarks(sal_Int32 nTag,
-        sax_fastparser::MergeMarksEnum eMergeType = sax_fastparser::MERGE_MARKS_APPEND);
+        sax_fastparser::MergeMarks eMergeType = sax_fastparser::MergeMarks::APPEND);
 
 private:
     /** Helper class to cache data and write in chunks to XOutputStream or ForMerge::append.
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 46d8764..75a6fa0 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -160,7 +160,7 @@ void FastSerializerHelper::mark(
 }
 
 void FastSerializerHelper::mergeTopMarks(
-        sal_Int32 const nTag, MergeMarksEnum const eMergeType)
+        sal_Int32 const nTag, MergeMarks const eMergeType)
 {
     mpSerializer->mergeTopMarks(nTag, eMergeType);
 }
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0771d02..e185158 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -580,7 +580,7 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
     if(aFramePrTextbox.empty())
         m_pSerializer->mergeTopMarks(Tag_StartParagraph_1);
     else
-        m_pSerializer->mergeTopMarks(Tag_StartParagraph_1, sax_fastparser::MERGE_MARKS_IGNORE);
+        m_pSerializer->mergeTopMarks(Tag_StartParagraph_1, sax_fastparser::MergeMarks::IGNORE);
 
     // Write framePr
     if(!aFramePrTextbox.empty())
@@ -676,7 +676,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
         m_pSerializer->startElementNS( XML_w, XML_sdtContent, FSEND );
 
         // prepend the tags since the sdt start mark before the paragraph
-        m_pSerializer->mergeTopMarks(Tag_WriteSdtBlock, sax_fastparser::MERGE_MARKS_PREPEND);
+        m_pSerializer->mergeTopMarks(Tag_WriteSdtBlock, sax_fastparser::MergeMarks::PREPEND);
 
         // write the ending tags after the paragraph
         if (bPara)
@@ -1023,7 +1023,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
 
     // merge the properties _before_ the run (strictly speaking, just
     // after the start of the paragraph)
-    m_pSerializer->mergeTopMarks(Tag_StartParagraphProperties, sax_fastparser::MERGE_MARKS_PREPEND);
+    m_pSerializer->mergeTopMarks(Tag_StartParagraphProperties, sax_fastparser::MergeMarks::PREPEND);
 }
 
 void DocxAttributeOutput::SetStateOfFlyFrame( FlyProcessingState nStateOfFlyFrame )
@@ -1218,7 +1218,7 @@ void DocxAttributeOutput::EndRun()
     {
         RunText(OUString("\t")) ;
     }
-    m_pSerializer->mergeTopMarks(Tag_EndRun_1, sax_fastparser::MERGE_MARKS_PREPEND); // merges with "postponed run start", see above
+    m_pSerializer->mergeTopMarks(Tag_EndRun_1, sax_fastparser::MergeMarks::PREPEND); // merges with "postponed run start", see above
 
     // write the run start + the run content
     m_pSerializer->mergeTopMarks(Tag_StartRun_2); // merges the "actual run start"
@@ -1247,7 +1247,7 @@ void DocxAttributeOutput::EndRun()
     {
         m_pSerializer->mark(Tag_EndRun_2);
         EndSdtBlock();
-        m_pSerializer->mergeTopMarks(Tag_EndRun_2, sax_fastparser::MERGE_MARKS_PREPEND);
+        m_pSerializer->mergeTopMarks(Tag_EndRun_2, sax_fastparser::MergeMarks::PREPEND);
     }
 
     m_pSerializer->mergeTopMarks(Tag_StartRun_1);
@@ -1993,7 +1993,7 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
 
     // merge the properties _before_ the run text (strictly speaking, just
     // after the start of the run)
-    m_pSerializer->mergeTopMarks(Tag_StartRunProperties, sax_fastparser::MERGE_MARKS_PREPEND);
+    m_pSerializer->mergeTopMarks(Tag_StartRunProperties, sax_fastparser::MergeMarks::PREPEND);
 }
 
 void DocxAttributeOutput::GetSdtEndBefore(const SdrObject* pSdrObj)
@@ -2401,7 +2401,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
 
                     m_pSerializer->endElementNS( XML_w, XML_rPr );
 
-                    m_pSerializer->mergeTopMarks(Tag_Redline_1, sax_fastparser::MERGE_MARKS_PREPEND);
+                    m_pSerializer->mergeTopMarks(Tag_Redline_1, sax_fastparser::MergeMarks::PREPEND);
                 }
             }
         }
@@ -2452,7 +2452,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
 
                     m_pSerializer->endElementNS( XML_w, XML_pPr );
 
-                    m_pSerializer->mergeTopMarks(Tag_Redline_2, sax_fastparser::MERGE_MARKS_PREPEND);
+                    m_pSerializer->mergeTopMarks(Tag_Redline_2, sax_fastparser::MergeMarks::PREPEND);
                 }
             }
         }
@@ -5024,7 +5024,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
             break;
     }
 
-    m_pSerializer->mergeTopMarks(Tag_OutputFlyFrame, sax_fastparser::MERGE_MARKS_POSTPONE);
+    m_pSerializer->mergeTopMarks(Tag_OutputFlyFrame, sax_fastparser::MergeMarks::POSTPONE);
 }
 
 bool DocxAttributeOutput::IsDiagram( const SdrObject* sdrObject )
commit 2842c5cfb99d41b36dba52db01ca6cd37d2ef4b0
Author: Michael Stahl <mstahl at redhat.com>
Date:   Fri Jul 17 23:27:20 2015 +0200

    sax, sw: try to make that maMarkStack easier to understand
    
    In DocxAttributeOutput it's not at all obvious which mark() is supposed
    to be ended by which mergeTopMarks(), so add an extra parameter to the
    FastSaxSerializer functions and verify with an assertion that a LIFO
    order is maintained.
    
    Change-Id: I5a421e2fb11f15343147417fe0b9b23642c70721

diff --git a/include/sax/fshelper.hxx b/include/sax/fshelper.hxx
index b86e9de..52d5399 100644
--- a/include/sax/fshelper.hxx
+++ b/include/sax/fshelper.hxx
@@ -137,9 +137,11 @@ public:
 
     static FastAttributeList *createAttrList();
 
-    void mark( const ::com::sun::star::uno::Sequence< sal_Int32 >& aOrder =
+    void mark(sal_Int32 nTag,
+            const ::com::sun::star::uno::Sequence< sal_Int32 >& rOrder =
             ::com::sun::star::uno::Sequence< sal_Int32 >() );
-    void mergeTopMarks( MergeMarksEnum eMergeType = MERGE_MARKS_APPEND );
+    void mergeTopMarks(sal_Int32 nTag,
+            MergeMarksEnum eMergeType = MERGE_MARKS_APPEND );
 
     /*
       Now create all the overloads in a typesafe way (i.e. without varargs) by creating a number of overloads
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index 9b42d2c..84b3737 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -45,6 +45,9 @@ using namespace sax_fastparser;
 using namespace oox::vml;
 using namespace com::sun::star;
 
+static const sal_Int32 Tag_Container = 44444;
+static const sal_Int32 Tag_Commit = 44445;
+
 VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport )
     : EscherEx( EscherExGlobalRef(new EscherExGlobal(0)), 0, /*bOOXML=*/true )
     , m_pSerializer( pSerializer )
@@ -98,7 +101,7 @@ void VMLExport::OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance )
 
         // postpone the output so that we are able to write even the elements
         // that we learn inside Commit()
-        m_pSerializer->mark();
+        m_pSerializer->mark(Tag_Container);
     }
 }
 
@@ -109,7 +112,7 @@ void VMLExport::CloseContainer()
         // write the shape now when we have all the info
         sal_Int32 nShapeElement = StartShape();
 
-        m_pSerializer->mergeTopMarks();
+        m_pSerializer->mergeTopMarks(Tag_Container);
 
         EndShape( nShapeElement );
 
@@ -357,7 +360,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
 
     // postpone the output of the embedded elements so that they are written
     // inside the shapes
-    m_pSerializer->mark();
+    m_pSerializer->mark(Tag_Commit);
 
     // dimensions
     if ( m_nShapeType == ESCHER_ShpInst_Line )
@@ -860,7 +863,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const Rectangle& rRect
         }
     }
 
-    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_POSTPONE );
+    m_pSerializer->mergeTopMarks(Tag_Commit, sax_fastparser::MERGE_MARKS_POSTPONE );
 }
 
 OString VMLExport::ShapeIdString( sal_uInt32 nId )
diff --git a/sax/source/tools/fastserializer.cxx b/sax/source/tools/fastserializer.cxx
index 2d4a2e1..66466e9 100644
--- a/sax/source/tools/fastserializer.cxx
+++ b/sax/source/tools/fastserializer.cxx
@@ -330,17 +330,17 @@ namespace sax_fastparser {
         }
     }
 
-    void FastSaxSerializer::mark( const Int32Sequence& aOrder )
+    void FastSaxSerializer::mark(sal_Int32 const nTag, const Int32Sequence& rOrder)
     {
-        if ( aOrder.hasElements() )
+        if (rOrder.hasElements())
         {
-            boost::shared_ptr< ForMerge > pSort( new ForSort( aOrder ) );
+            boost::shared_ptr< ForMerge > pSort( new ForSort(nTag, rOrder) );
             maMarkStack.push( pSort );
             maCachedOutputStream.setOutput( pSort );
         }
         else
         {
-            boost::shared_ptr< ForMerge > pMerge( new ForMerge( ) );
+            boost::shared_ptr< ForMerge > pMerge( new ForMerge(nTag) );
             maMarkStack.push( pMerge );
             maCachedOutputStream.setOutput( pMerge );
         }
@@ -401,12 +401,16 @@ namespace sax_fastparser {
     }
 #endif
 
-    void FastSaxSerializer::mergeTopMarks( sax_fastparser::MergeMarksEnum eMergeType )
+    void FastSaxSerializer::mergeTopMarks(
+        sal_Int32 const nTag, sax_fastparser::MergeMarksEnum const eMergeType)
     {
         SAL_WARN_IF(mbMarkStackEmpty, "sax", "Empty mark stack - nothing to merge");
+        assert(!mbMarkStackEmpty); // should never happen
         if ( mbMarkStackEmpty )
             return;
 
+        assert(maMarkStack.top()->m_Tag == nTag && "mark/merge tag mismatch!");
+        (void) nTag;
 #ifdef DBG_UTIL
         if (dynamic_cast<ForSort*>(maMarkStack.top().get()))
         {
diff --git a/sax/source/tools/fastserializer.hxx b/sax/source/tools/fastserializer.hxx
index 4dc786b..5fcbef5 100644
--- a/sax/source/tools/fastserializer.hxx
+++ b/sax/source/tools/fastserializer.hxx
@@ -127,8 +127,10 @@ public:
           p, r, mark(), t, [text], /t, mark(), rPr, [something], /rPr,
           mergeTopMarks( MERGE_MARKS_PREPEND ), mergeTopMarks( MERGE_MARKS_APPEND ), /r, /p
         and you are done.
+
+        @param nTag debugging aid to ensure mark and merge match in LIFO order
      */
-    void mark( const Int32Sequence& aOrder = Int32Sequence() );
+    void mark(sal_Int32 nTag, const Int32Sequence& rOrder = Int32Sequence());
 
     /** Merge 2 topmost marks.
 
@@ -143,9 +145,12 @@ public:
         When the MERGE_MARKS_POSTPONE is specified, the merge happens just
         before the next merge.
 
+        @param nTag debugging aid to ensure mark and merge match in LIFO order
+
         @see mark()
      */
-    void mergeTopMarks( sax_fastparser::MergeMarksEnum eMergeType = sax_fastparser::MERGE_MARKS_APPEND );
+    void mergeTopMarks(sal_Int32 nTag,
+        sax_fastparser::MergeMarksEnum eMergeType = sax_fastparser::MERGE_MARKS_APPEND);
 
 private:
     /** Helper class to cache data and write in chunks to XOutputStream or ForMerge::append.
@@ -161,6 +166,7 @@ private:
         Int8Sequence maPostponed;
 
     public:
+        sal_Int32 const m_Tag;
 #ifdef DBG_UTIL
         // pending close tags, followed by pending open tags
         ::std::deque<sal_Int32> m_DebugEndedElements;
@@ -170,7 +176,7 @@ private:
         ::std::deque<sal_Int32> m_DebugPostponedStartedElements;
 #endif
 
-        ForMerge() : maData(), maPostponed() {}
+        ForMerge(sal_Int32 const nTag) : m_Tag(nTag) {}
         virtual ~ForMerge() {}
 
         virtual void setCurrentElement( ::sal_Int32 /*nToken*/ ) {}
@@ -196,11 +202,11 @@ private:
         Int32Sequence maOrder;
 
     public:
-        ForSort( const Int32Sequence& aOrder ) :
-            ForMerge(),
-            maData(),
-            mnCurrentElement( 0 ),
-            maOrder( aOrder ) {}
+        ForSort(sal_Int32 const nTag, const Int32Sequence& rOrder)
+            : ForMerge(nTag)
+            , mnCurrentElement( 0 )
+            , maOrder( rOrder )
+        {}
 
         void setCurrentElement( ::sal_Int32 nToken ) SAL_OVERRIDE;
 
diff --git a/sax/source/tools/fshelper.cxx b/sax/source/tools/fshelper.cxx
index 438aef7..46d8764 100644
--- a/sax/source/tools/fshelper.cxx
+++ b/sax/source/tools/fshelper.cxx
@@ -153,14 +153,16 @@ FastSerializerHelper* FastSerializerHelper::writeId(sal_Int32 tokenId)
     return mpSerializer->getOutputStream();
 }
 
-void FastSerializerHelper::mark( const Sequence< sal_Int32 >& aOrder )
+void FastSerializerHelper::mark(
+        sal_Int32 const nTag, const Sequence<sal_Int32>& rOrder)
 {
-    mpSerializer->mark( aOrder );
+    mpSerializer->mark(nTag, rOrder);
 }
 
-void FastSerializerHelper::mergeTopMarks( MergeMarksEnum eMergeType )
+void FastSerializerHelper::mergeTopMarks(
+        sal_Int32 const nTag, MergeMarksEnum const eMergeType)
 {
-    mpSerializer->mergeTopMarks( eMergeType );
+    mpSerializer->mergeTopMarks(nTag, eMergeType);
 }
 
 FastAttributeList * FastSerializerHelper::createAttrList()
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 710c862..0771d02 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -140,6 +140,24 @@ using namespace sw::util;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::drawing;
 
+static const sal_Int32 Tag_StartParagraph_1 = 1;
+static const sal_Int32 Tag_StartParagraph_2 = 2;
+static const sal_Int32 Tag_WriteSdtBlock = 3;
+static const sal_Int32 Tag_StartParagraphProperties = 4;
+static const sal_Int32 Tag_InitCollectedParagraphProperties = 5;
+static const sal_Int32 Tag_StartRun_1 = 6;
+static const sal_Int32 Tag_StartRun_2 = 7;
+static const sal_Int32 Tag_StartRun_3 = 8;
+static const sal_Int32 Tag_EndRun_1 = 9;
+static const sal_Int32 Tag_EndRun_2 = 10;
+static const sal_Int32 Tag_StartRunProperties = 11;
+static const sal_Int32 Tag_InitCollectedRunProperties = 12;
+static const sal_Int32 Tag_Redline_1 = 13;
+static const sal_Int32 Tag_Redline_2 = 14;
+static const sal_Int32 Tag_TableDefinition = 15;
+static const sal_Int32 Tag_OutputFlyFrame = 16;
+static const sal_Int32 Tag_StartSection = 17;
+
 class FFDataWriterHelper
 {
     ::sax_fastparser::FSHelperPtr m_pSerializer;
@@ -303,13 +321,13 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
 
     // this mark is used to be able to enclose the paragraph inside a sdr tag.
     // We will only know if we have to do that later.
-    m_pSerializer->mark();
+    m_pSerializer->mark(Tag_StartParagraph_1);
 
     m_pSerializer->startElementNS( XML_w, XML_p, FSEND );
 
     // postpone the output of the run (we get it before the paragraph
     // properties, but must write it after them)
-    m_pSerializer->mark();
+    m_pSerializer->mark(Tag_StartParagraph_2);
 
     // no section break in this paragraph yet; can be set in SectionBreak()
     m_pSectionInfo.reset();
@@ -431,7 +449,7 @@ bool DocxAttributeOutput::TextBoxIsFramePr(const SwFrameFormat& rFrameFormat)
 void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner )
 {
     // write the paragraph properties + the run, already in the correct order
-    m_pSerializer->mergeTopMarks();
+    m_pSerializer->mergeTopMarks(Tag_StartParagraph_2);
     std::vector<  boost::shared_ptr <sw::Frame> > aFramePrTextbox;
     // Write the anchored frame if any
     // Word can't handle nested text boxes, so write them on the same level.
@@ -560,9 +578,9 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
     m_rExport.SdrExporter().setParagraphHasDrawing( false );
     m_bRunTextIsOn = false;
     if(aFramePrTextbox.empty())
-        m_pSerializer->mergeTopMarks();
+        m_pSerializer->mergeTopMarks(Tag_StartParagraph_1);
     else
-        m_pSerializer->mergeTopMarks(sax_fastparser::MERGE_MARKS_IGNORE );
+        m_pSerializer->mergeTopMarks(Tag_StartParagraph_1, sax_fastparser::MERGE_MARKS_IGNORE);
 
     // Write framePr
     if(!aFramePrTextbox.empty())
@@ -596,7 +614,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
     if( nSdtPrToken > 0 || pSdtPrDataBindingAttrs )
     {
         // sdt start mark
-        m_pSerializer->mark();
+        m_pSerializer->mark(Tag_WriteSdtBlock);
 
         m_pSerializer->startElementNS( XML_w, XML_sdt, FSEND );
 
@@ -658,7 +676,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
         m_pSerializer->startElementNS( XML_w, XML_sdtContent, FSEND );
 
         // prepend the tags since the sdt start mark before the paragraph
-        m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+        m_pSerializer->mergeTopMarks(Tag_WriteSdtBlock, sax_fastparser::MERGE_MARKS_PREPEND);
 
         // write the ending tags after the paragraph
         if (bPara)
@@ -797,7 +815,7 @@ void DocxAttributeOutput::SectionBreaks(const SwTextNode& rNode)
 
 void DocxAttributeOutput::StartParagraphProperties()
 {
-    m_pSerializer->mark( );
+    m_pSerializer->mark(Tag_StartParagraphProperties);
 
     m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
 
@@ -863,7 +881,7 @@ void DocxAttributeOutput::InitCollectedParagraphProperties()
     for ( sal_Int32 i = 0; i < len; i++ )
         aSeqOrder[i] = aOrder[i];
 
-    m_pSerializer->mark( aSeqOrder );
+    m_pSerializer->mark(Tag_InitCollectedParagraphProperties, aSeqOrder);
 }
 
 void DocxAttributeOutput::WriteCollectedParagraphProperties()
@@ -940,7 +958,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
     WriteCollectedParagraphProperties();
 
     // Merge the marks for the ordered elements
-    m_pSerializer->mergeTopMarks( );
+    m_pSerializer->mergeTopMarks(Tag_InitCollectedParagraphProperties);
 
     // Write 'Paragraph Mark' properties
     m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
@@ -978,7 +996,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
     }
 
     // mergeTopMarks() after paragraph mark properties child elements.
-    m_pSerializer->mergeTopMarks();
+    m_pSerializer->mergeTopMarks(Tag_InitCollectedRunProperties);
     m_pSerializer->endElementNS( XML_w, XML_rPr );
 
     if (!m_bWritingHeaderFooter && m_pCurrentFrame)
@@ -1005,7 +1023,7 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
 
     // merge the properties _before_ the run (strictly speaking, just
     // after the start of the paragraph)
-    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+    m_pSerializer->mergeTopMarks(Tag_StartParagraphProperties, sax_fastparser::MERGE_MARKS_PREPEND);
 }
 
 void DocxAttributeOutput::SetStateOfFlyFrame( FlyProcessingState nStateOfFlyFrame )
@@ -1035,16 +1053,16 @@ void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData, bool /*bS
     m_pRedlineData = pRedlineData;
 
     // this mark is used to be able to enclose the run inside a sdr tag.
-    m_pSerializer->mark();
+    m_pSerializer->mark(Tag_StartRun_1);
 
     // postpone the output of the start of a run (there are elements that need
     // to be written before the start of the run, but we learn which they are
     // _inside_ of the run)
-    m_pSerializer->mark(); // let's call it "postponed run start"
+    m_pSerializer->mark(Tag_StartRun_2); // let's call it "postponed run start"
 
     // postpone the output of the text (we get it before the run properties,
     // but must write it after them)
-    m_pSerializer->mark(); // let's call it "postponed text"
+    m_pSerializer->mark(Tag_StartRun_3); // let's call it "postponed text"
 }
 
 void DocxAttributeOutput::EndRun()
@@ -1084,11 +1102,11 @@ void DocxAttributeOutput::EndRun()
     }
 
     // write the run properties + the text, already in the correct order
-    m_pSerializer->mergeTopMarks(); // merges with "postponed text", see above
+    m_pSerializer->mergeTopMarks(Tag_StartRun_3); // merges with "postponed text", see above
 
     // level down, to be able to prepend the actual run start attribute (just
     // before "postponed run start")
-    m_pSerializer->mark(); // let's call it "actual run start"
+    m_pSerializer->mark(Tag_EndRun_1); // let's call it "actual run start"
     bool bCloseEarlierSDT = false;
 
     if (m_bEndCharSdt)
@@ -1200,10 +1218,10 @@ void DocxAttributeOutput::EndRun()
     {
         RunText(OUString("\t")) ;
     }
-    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND ); // merges with "postponed run start", see above
+    m_pSerializer->mergeTopMarks(Tag_EndRun_1, sax_fastparser::MERGE_MARKS_PREPEND); // merges with "postponed run start", see above
 
     // write the run start + the run content
-    m_pSerializer->mergeTopMarks(); // merges the "actual run start"
+    m_pSerializer->mergeTopMarks(Tag_StartRun_2); // merges the "actual run start"
     // append the actual run end
     m_pSerializer->endElementNS( XML_w, XML_r );
 
@@ -1227,12 +1245,12 @@ void DocxAttributeOutput::EndRun()
 
     if (bCloseEarlierSDT)
     {
-        m_pSerializer->mark();
+        m_pSerializer->mark(Tag_EndRun_2);
         EndSdtBlock();
-        m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+        m_pSerializer->mergeTopMarks(Tag_EndRun_2, sax_fastparser::MERGE_MARKS_PREPEND);
     }
 
-    m_pSerializer->mergeTopMarks();
+    m_pSerializer->mergeTopMarks(Tag_StartRun_1);
 
     for (std::vector<const SwOLENode*>::iterator it = m_aPostponedMaths.begin(); it != m_aPostponedMaths.end(); ++it)
         WritePostponedMath(*it);
@@ -1639,7 +1657,7 @@ void DocxAttributeOutput::StartRunProperties()
 {
     // postpone the output so that we can later [in EndRunProperties()]
     // prepend the properties before the text
-    m_pSerializer->mark();
+    m_pSerializer->mark(Tag_StartRunProperties);
 
     m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
 
@@ -1735,7 +1753,7 @@ void DocxAttributeOutput::InitCollectedRunProperties()
     for ( sal_Int32 i = 0; i < len; i++ )
         aSeqOrder[i] = aOrder[i];
 
-    m_pSerializer->mark( aSeqOrder );
+    m_pSerializer->mark(Tag_InitCollectedRunProperties, aSeqOrder);
 }
 
 namespace
@@ -1954,7 +1972,7 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
     WriteCollectedRunProperties();
 
     // Merge the marks for the ordered elements
-    m_pSerializer->mergeTopMarks();
+    m_pSerializer->mergeTopMarks(Tag_InitCollectedRunProperties);
 
     m_pSerializer->endElementNS( XML_w, XML_rPr );
 
@@ -1975,7 +1993,7 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData )
 
     // merge the properties _before_ the run text (strictly speaking, just
     // after the start of the run)
-    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+    m_pSerializer->mergeTopMarks(Tag_StartRunProperties, sax_fastparser::MERGE_MARKS_PREPEND);
 }
 
 void DocxAttributeOutput::GetSdtEndBefore(const SdrObject* pSdrObj)
@@ -2357,7 +2375,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
                 const SfxItemSet *pChangesSet = pFormattingChanges->GetItemSet();
                 if (pChangesSet)
                 {
-                    m_pSerializer->mark();
+                    m_pSerializer->mark(Tag_Redline_1);
 
                     m_pSerializer->startElementNS( XML_w, XML_rPr, FSEND );
 
@@ -2383,7 +2401,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
 
                     m_pSerializer->endElementNS( XML_w, XML_rPr );
 
-                    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+                    m_pSerializer->mergeTopMarks(Tag_Redline_1, sax_fastparser::MERGE_MARKS_PREPEND);
                 }
             }
         }
@@ -2410,7 +2428,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
                 const SfxItemSet *pChangesSet = pFormattingChanges->GetItemSet();
                 if (pChangesSet)
                 {
-                    m_pSerializer->mark();
+                    m_pSerializer->mark(Tag_Redline_2);
 
                     m_pSerializer->startElementNS( XML_w, XML_pPr, FSEND );
 
@@ -2434,7 +2452,7 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
 
                     m_pSerializer->endElementNS( XML_w, XML_pPr );
 
-                    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_PREPEND );
+                    m_pSerializer->mergeTopMarks(Tag_Redline_2, sax_fastparser::MERGE_MARKS_PREPEND);
                 }
             }
         }
@@ -3145,7 +3163,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
     for ( sal_Int32 i = 0; i < len; i++ )
         aSeqOrder[i] = aOrder[i];
 
-    m_pSerializer->mark( aSeqOrder );
+    m_pSerializer->mark(Tag_TableDefinition, aSeqOrder);
 
     long nPageSize = 0;
     const char* widthType = "dxa";
@@ -3364,7 +3382,7 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
             FSEND );
 
     // Merge the marks for the ordered elements
-    m_pSerializer->mergeTopMarks( );
+    m_pSerializer->mergeTopMarks(Tag_TableDefinition);
 
     m_pSerializer->endElementNS( XML_w, XML_tblPr );
 
@@ -4876,7 +4894,7 @@ void DocxAttributeOutput::WritePostponedDMLDrawing()
 
 void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Point& rNdTopLeft )
 {
-    m_pSerializer->mark();
+    m_pSerializer->mark(Tag_OutputFlyFrame);
 
     switch ( rFrame.GetWriterType() )
     {
@@ -5006,7 +5024,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
             break;
     }
 
-    m_pSerializer->mergeTopMarks( sax_fastparser::MERGE_MARKS_POSTPONE );
+    m_pSerializer->mergeTopMarks(Tag_OutputFlyFrame, sax_fastparser::MERGE_MARKS_POSTPONE);
 }
 
 bool DocxAttributeOutput::IsDiagram( const SdrObject* sdrObject )
@@ -5324,7 +5342,7 @@ void DocxAttributeOutput::EndStyleProperties( bool bParProp )
         WriteCollectedParagraphProperties();
 
         // Merge the marks for the ordered elements
-        m_pSerializer->mergeTopMarks( );
+        m_pSerializer->mergeTopMarks(Tag_InitCollectedParagraphProperties);
 
         m_pSerializer->endElementNS( XML_w, XML_pPr );
     }
@@ -5333,7 +5351,7 @@ void DocxAttributeOutput::EndStyleProperties( bool bParProp )
         WriteCollectedRunProperties();
 
         // Merge the marks for the ordered elements
-        m_pSerializer->mergeTopMarks();
+        m_pSerializer->mergeTopMarks(Tag_InitCollectedRunProperties);
 
         m_pSerializer->endElementNS( XML_w, XML_rPr );
     }
@@ -5469,7 +5487,7 @@ void DocxAttributeOutput::StartSection()
     for ( sal_Int32 i = 0; i < len; i++ )
         aSeqOrder[i] = aOrder[i];
 
-    m_pSerializer->mark( aSeqOrder );
+    m_pSerializer->mark(Tag_StartSection, aSeqOrder);
     m_bHadSectPr = true;
 }
 
@@ -5484,7 +5502,7 @@ void DocxAttributeOutput::EndSection()
     }
 
     // Order the elements
-    m_pSerializer->mergeTopMarks( );
+    m_pSerializer->mergeTopMarks(Tag_StartSection);
 
     m_pSerializer->endElementNS( XML_w, XML_sectPr );
     m_bOpenedSectPr = false;


More information about the Libreoffice-commits mailing list