From 555c988f3b896e16afc7bdd1bd98e48229599637 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 12 Aug 2014 17:47:20 +0200 Subject: fdo#82165: ODF import: clear all shapes when removing header content Shapes anchored to the first or last paragraph survive setString("") so need to be deleted with some ruse. (regression from b8499fc3dcf474050f026b8d5cd1d9037bbe42b7) Change-Id: I00a8132583c45d1953c207932cc7f02f3065ae77 --- xmloff/source/text/XMLTextHeaderFooterContext.cxx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'xmloff') diff --git a/xmloff/source/text/XMLTextHeaderFooterContext.cxx b/xmloff/source/text/XMLTextHeaderFooterContext.cxx index 81c12bceb92a..6ee1e7346ae9 100644 --- a/xmloff/source/text/XMLTextHeaderFooterContext.cxx +++ b/xmloff/source/text/XMLTextHeaderFooterContext.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -158,8 +159,16 @@ SvXMLImportContext *XMLTextHeaderFooterContext::CreateChildContext( if( bRemoveContent ) { - OUString aText; - xText->setString( aText ); + xText->setString(OUString()); + // fdo#82165 shapes anchored at the beginning or end survive + // setString("") - kill them the hard way: SwDoc::DelFullPara() + uno::Reference const xAppend( + xText, uno::UNO_QUERY_THROW); + uno::Reference const xPara( + xAppend->finishParagraph( + uno::Sequence()), + uno::UNO_QUERY_THROW); + xPara->dispose(); } rtl::Reference < XMLTextImportHelper > xTxtImport = -- cgit