[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - sw/qa sw/source

Miklos Vajna vmiklos at suse.cz
Thu Jul 11 04:24:49 PDT 2013


 sw/qa/extras/ooxmlexport/data/fdo58577.odt   |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   10 ++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   15 +++++++--------
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 +-
 4 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit 6a10a2940a82c7fb376fc1b5a7c940e0a849e15a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Thu Jul 11 10:43:07 2013 +0200

    fdo#58577 DOCX export: handle multiple textframes anchored to the same para
    
    Also fixes ~SwIndexReg assertion on closing the document.
    
    (cherry picked from commit e5b145a46cd29c9428e6e1894f7b0bb8248a412f)
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    
    Change-Id: I7c1a9d3d646f2dacdbced2af355c076c1a1063ec
    Reviewed-on: https://gerrit.libreoffice.org/4826
    Reviewed-by: Michael Meeks <michael.meeks at suse.com>
    Tested-by: Michael Meeks <michael.meeks at suse.com>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo58577.odt b/sw/qa/extras/ooxmlexport/data/fdo58577.odt
new file mode 100644
index 0000000..4c8656d
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo58577.odt differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index dc5b215..4a58bf1 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -71,6 +71,7 @@ public:
     void testFdo48557();
     void testI120928();
     void testN822175();
+    void testFdo58577();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -119,6 +120,7 @@ void Test::run()
         {"fdo48557.odt", &Test::testFdo48557},
         {"i120928.docx", &Test::testI120928},
         {"n822175.odt", &Test::testN822175},
+        {"fdo58577.odt", &Test::testFdo58577},
     };
     // Don't test the first import of these, for some reason those tests fail
     const char* aBlacklist[] = {
@@ -684,6 +686,14 @@ void Test::testN822175()
     CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_PARALLEL, getProperty<text::WrapTextMode>(xFrame, "Surround"));
 }
 
+void Test::testFdo58577()
+{
+    // The second frame was simply missing, so let's check if both frames were imported back.
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xIndexAccess(xTextFramesSupplier->getTextFrames(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(2), xIndexAccess->getCount());
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 803fe03..153580c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -290,10 +290,13 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
     m_pSerializer->mergeTopMarks();
 
     // Write the anchored frame if any
-    if ( m_pParentFrame )
+    // Make a copy and clear the original early, as this method is called
+    // recursively for in-frame paragraphs
+    std::vector<sw::Frame> aParentFrames = m_aParentFrames;
+    m_aParentFrames.clear();
+    for (size_t i = 0; i < aParentFrames.size(); ++i)
     {
-        sw::Frame *pParentFrame = m_pParentFrame;
-        m_pParentFrame = NULL;
+        sw::Frame* pParentFrame = &aParentFrames[i];
 
         const SwFrmFmt& rFrmFmt = pParentFrame->GetFrmFmt( );
         const SwNodeIndex* pNodeIndex = rFrmFmt.GetCntnt().GetCntntIdx();
@@ -353,8 +356,6 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
         m_rExport.RestoreData();
 
         m_rExport.mpParentFrame = NULL;
-
-        delete pParentFrame;
     }
 
     m_pSerializer->endElementNS( XML_w, XML_p );
@@ -2601,7 +2602,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
         case sw::Frame::eTxtBox:
             {
                 // The frame output is postponed to the end of the anchor paragraph
-                m_pParentFrame = new sw::Frame(rFrame);
+                m_aParentFrames.push_back(sw::Frame(rFrame));
             }
             break;
         case sw::Frame::eOle:
@@ -4921,7 +4922,6 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_nTableDepth( 0 ),
       m_bParagraphOpened( false ),
       m_nColBreakStatus( COLBRK_NONE ),
-      m_pParentFrame( NULL ),
       m_bTextFrameSyntax( false ),
       m_closeHyperlinkInThisRun( false ),
       m_closeHyperlinkInPreviousRun( false ),
@@ -4951,7 +4951,6 @@ DocxAttributeOutput::~DocxAttributeOutput()
     delete m_pEndnotesList, m_pEndnotesList = NULL;
 
     delete m_pTableWrt, m_pTableWrt = NULL;
-    delete m_pParentFrame;
 }
 
 DocxExport& DocxAttributeOutput::GetExport()
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index d120f30..0854e46 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -618,7 +618,7 @@ private:
     // beginning of the next paragraph
     DocxColBreakStatus m_nColBreakStatus;
 
-    sw::Frame *m_pParentFrame;
+    std::vector<sw::Frame> m_aParentFrames;
     bool m_bTextFrameSyntax;
     OStringBuffer m_aTextFrameStyle;
     // close of hyperlink needed


More information about the Libreoffice-commits mailing list