summaryrefslogtreecommitdiffstats
path: root/sw
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2013-07-11 10:43:07 +0200
committerMiklos Vajna <vmiklos@suse.cz>2013-07-11 11:27:01 +0200
commite5b145a46cd29c9428e6e1894f7b0bb8248a412f (patch)
tree148b5a8083bb4fed73436b30064b79f09064f0b2 /sw
parentRe-do 5dff961ba5fab6d451d9d993e076d190a93be495: Don't look for just GPUs (diff)
downloadcore-e5b145a46cd29c9428e6e1894f7b0bb8248a412f.tar.gz
core-e5b145a46cd29c9428e6e1894f7b0bb8248a412f.zip
fdo#58577 DOCX export: handle multiple textframes anchored to the same para
Also fixes ~SwIndexReg assertion on closing the document. Change-Id: I7c1a9d3d646f2dacdbced2af355c076c1a1063ec
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo58577.odtbin0 -> 9427 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx10
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx15
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.hxx2
4 files changed, 18 insertions, 9 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo58577.odt b/sw/qa/extras/ooxmlexport/data/fdo58577.odt
new file mode 100644
index 000000000000..4c8656d7eb8c
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo58577.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4af6477305bf..9535083d76d7 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -93,6 +93,7 @@ public:
void testN822175();
void testFdo66688();
void testFdo66773();
+ void testFdo58577();
CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT)
@@ -156,6 +157,7 @@ void Test::run()
{"n822175.odt", &Test::testN822175},
{"fdo66688.docx", &Test::testFdo66688},
{"fdo66773.docx", &Test::testFdo66773},
+ {"fdo58577.odt", &Test::testFdo58577},
};
// Don't test the first import of these, for some reason those tests fail
const char* aBlacklist[] = {
@@ -933,6 +935,14 @@ void Test::testFdo66773()
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(100), static_cast<sal_Int32>(alineSpacing.Height));
}
+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 cab5cdf6e454..9957ff4a470d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -293,10 +293,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();
@@ -356,8 +359,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 );
@@ -2772,7 +2773,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:
@@ -5162,7 +5163,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 ),
@@ -5192,7 +5192,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 c4232759216b..06f12fa11c1b 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -642,7 +642,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