summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-03-05 22:09:39 +0100
committerAron Budea <aron.budea@collabora.com>2018-03-23 09:54:00 +0100
commitb862f9f37e38c6e1ce129c7a08b515eb990759ba (patch)
tree590ec678ca7bebf0c423381f83c332c10f1862db /writerfilter
parenteea91d8f4baeb7ce1d22ea695c4f84a9186b6634 (diff)
tdf#115861 DOCX import: avoid last-paragraph removal when discarding footer
Discarding header/footer is necessary when the document or section settings request to ignore first or even headers/footers. In the bugdoc case settings.xml didn't opt-in for different even/odd footers, but there was an even footer to be ignored. Handle this state at two more places, so we don't end up in a situation where we ignore the footer but not its "remove last (empty) paragraph at the end of the footer" action. Also make the debug dumper for text ranges more robust to have a working token dump when we try to get the string for a table. (cherry picked from commit 49cf733effc56c09c5e2eb023120c2d3532b5b3d) Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport11.cxx Change-Id: I6395f37aa40c42304e2c918d87dadecb21e9d378 Reviewed-on: https://gerrit.libreoffice.org/51763 Reviewed-by: Aron Budea <aron.budea@collabora.com> Tested-by: Aron Budea <aron.budea@collabora.com> (cherry picked from commit 01d1fdf8a348013eb6fc4cda61d3225a81681dd5) Reviewed-on: https://gerrit.libreoffice.org/51764
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx6
-rw-r--r--writerfilter/source/dmapper/util.cxx14
2 files changed, 19 insertions, 1 deletions
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3e555e650d7f..858e02069d5a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -392,6 +392,9 @@ void DomainMapper_Impl::AddDummyParaForTableInSection()
void DomainMapper_Impl::RemoveLastParagraph( )
{
+ if (m_bDiscardHeaderFooter)
+ return;
+
if (m_aTextAppendStack.empty())
return;
uno::Reference< text::XTextAppend > xTextAppend = m_aTextAppendStack.top().xTextAppend;
@@ -1039,6 +1042,9 @@ void DomainMapper_Impl::CheckUnregisteredFrameConversion( )
void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
{
+ if (m_bDiscardHeaderFooter)
+ return;
+
#ifdef DEBUG_WRITERFILTER
TagLogger::getInstance().startElement("finishParagraph");
#endif
diff --git a/writerfilter/source/dmapper/util.cxx b/writerfilter/source/dmapper/util.cxx
index 7886bba5c684..f0549fb48d3a 100644
--- a/writerfilter/source/dmapper/util.cxx
+++ b/writerfilter/source/dmapper/util.cxx
@@ -35,7 +35,19 @@ std::string XTextRangeToString(uno::Reference< text::XTextRange > const & textRa
#ifdef DEBUG_WRITERFILTER
if (textRange.get())
{
- OUString aOUStr = textRange->getString();
+ OUString aOUStr;
+
+ try
+ {
+ aOUStr = textRange->getString();
+ }
+ catch (const uno::Exception& rException)
+ {
+ result += "(exception: ";
+ result += rException.Message.toUtf8().getStr();
+ result += ")";
+ }
+
OString aOStr(aOUStr.getStr(), aOUStr.getLength(), RTL_TEXTENCODING_ASCII_US );
result = aOStr.getStr();