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

Miklos Vajna vmiklos at collabora.co.uk
Tue Oct 21 23:52:49 PDT 2014


 sw/source/filter/ww8/docxattributeoutput.cxx |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

New commits:
commit 9212cd18b9f2b32f2c2340701b010b678938b47a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Oct 22 08:50:40 2014 +0200

    sw: port two switchHeaderFooter() calls to DocxTableExportContext
    
    These two APIs do the same, except that the previous doesn't handle
    nested calls, while the later does, as it stores its state on the stack.
    
    The idea is that once all calls to the previous are eliminated, we can
    get rid of it, reducing code duplication.
    
    Change-Id: I0162f3ab475e306734412b39d7166c4f0bc6cd7f

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3ba8512..9b0a164 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -483,14 +483,6 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
                        and VML Drawing in another AlternateContent.
                  **/
                 SetAlternateContentChoiceOpen( true );
-                /** FDO#71834 :
-                       We should probably be renaming the function
-                       switchHeaderFooter to something like SaveRetrieveTableReference.
-                       Save the table reference attributes before calling WriteDMLTextFrame,
-                       otherwise the StartParagraph function will use the previous existing
-                       table reference attributes since the variable is being shared.
-                */
-                switchHeaderFooter(true,1);
                 /** Save the table info's before writing the shape
                         as there might be a new table that might get
                         spawned from within the VML & DML block and alter
@@ -500,7 +492,14 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
                 //Reset the table infos after saving.
                 m_rExport.mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
 
+                /** FDO#71834 :
+                       Save the table reference attributes before calling WriteDMLTextFrame,
+                       otherwise the StartParagraph function will use the previous existing
+                       table reference attributes since the variable is being shared.
+                */
+                DocxTableExportContext aDMLTableExportContext(m_rExport.mpTableInfo, m_tableReference->m_bTableCellOpen, m_tableReference->m_nTableDepth);
                 m_rExport.SdrExporter().writeDMLTextFrame(&aFrame, m_anchorId++);
+                aDMLTableExportContext.restore(m_rExport.mpTableInfo, m_tableReference->m_bTableCellOpen, m_tableReference->m_nTableDepth);
                 m_pSerializer->endElementNS(XML_mc, XML_Choice);
                 SetAlternateContentChoiceOpen( false );
 
@@ -509,14 +508,11 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
                 // same table second time.
                 m_rExport.mpTableInfo = ww8::WW8TableInfo::Pointer_t(new ww8::WW8TableInfo());
                 //reset the tableReference.
-                switchHeaderFooter(false,0);
 
                 m_pSerializer->startElementNS(XML_mc, XML_Fallback, FSEND);
+                DocxTableExportContext aVMLTableExportContext(m_rExport.mpTableInfo, m_tableReference->m_bTableCellOpen, m_tableReference->m_nTableDepth);
                 m_rExport.SdrExporter().writeVMLTextFrame(&aFrame);
-                /* FDO#71834 :Restore the data here after having written the Shape
-                   for further processing.
-                */
-                switchHeaderFooter(false,-1);
+                aVMLTableExportContext.restore(m_rExport.mpTableInfo, m_tableReference->m_bTableCellOpen, m_tableReference->m_nTableDepth);
                 m_rExport.mpTableInfo = pOldTableInfo;
 
                 m_pSerializer->endElementNS(XML_mc, XML_Fallback);


More information about the Libreoffice-commits mailing list