[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - sw/qa writerfilter/source
Miklos Vajna
vmiklos at collabora.co.uk
Wed Oct 18 20:10:29 UTC 2017
sw/qa/extras/rtfexport/data/tdf104079.rtf | 48 ++++++++++++++++++++++
sw/qa/extras/rtfexport/rtfexport.cxx | 16 +++++++
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 -
3 files changed, 66 insertions(+), 1 deletion(-)
New commits:
commit 366beabc786c004fc7ff1b2bb2f606b0ee257a95
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Oct 17 09:04:33 2017 +0200
tdf#104079 RTF import: fix handling fields inside TOC fields
The marker trick is not needed for these, but the paragraph margins are
lost when using it, so avoid it.
(cherry picked from commit 6ee33d0772f991f04e97b5b61d7b11810a1b8ac0)
Conflicts:
writerfilter/source/dmapper/DomainMapper_Impl.cxx
Change-Id: I3fc9644cb85138b5473cb1478196ae8538041fb1
Reviewed-on: https://gerrit.libreoffice.org/43501
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/qa/extras/rtfexport/data/tdf104079.rtf b/sw/qa/extras/rtfexport/data/tdf104079.rtf
new file mode 100644
index 000000000000..f173ce2ddf91
--- /dev/null
+++ b/sw/qa/extras/rtfexport/data/tdf104079.rtf
@@ -0,0 +1,48 @@
+{\rtf1\mac\ansicpg10000\uc1 \deff0\deflang1033\deflangfe1033
+{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;
+\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}
+{\stylesheet
+{\sa120\nowidctlpar\adjustright \cgrid \snext0 Normal;}
+{\s24\sa120\nowidctlpar\tqr\tx9360\adjustright \b\caps\cgrid \sbasedon0 \snext0 \sautoupd toc 1;}
+}
+\margl1440\margr1440\margt1296\margb1296 \widowctrl\ftnbj\aenddoc\hyphcaps0\viewkind1\viewscale100 \fet0\sectd \linex0\sectdefaultcl
+\pard\plain \s24\sa120\nowidctlpar\tqr\tx9360\adjustright \b\caps\cgrid
+{\field\fldedit
+{\*\fldinst TOC \\o "1-3" }
+{\fldrslt
+{\lang1024 toc1\tab }
+{\field\flddirty
+{\*\fldinst GOTOBUTTON _Toc434317063
+{\field
+{\*\fldinst PAGEREF _Toc434317063 }
+{\fldrslt 3 }
+}
+}
+}
+{\lang1024
+\par }
+\pard\plain \s24\sa120\nowidctlpar\tqr\tx9360\adjustright \b\caps\cgrid
+{\lang1024 toc2\tab }
+{\field\flddirty
+{\*\fldinst GOTOBUTTON _Toc434317068
+{\field
+{\*\fldinst PAGEREF _Toc434317068 }
+{\fldrslt 8 }
+}
+}
+}
+{\lang1024
+\par toc3\tab }
+{\field\flddirty
+{\*\fldinst GOTOBUTTON _Toc434317069
+{\field
+{\*\fldinst PAGEREF _Toc434317069 }
+{\fldrslt 8 }
+}
+}
+}
+\par
+\pard\plain \s24\sa120\nowidctlpar\tqr\tx9360\adjustright \b\caps\cgrid }
+}
+\prad\par
+}
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index edb17196f352..151d6b0f4d61 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -1003,6 +1003,22 @@ DECLARE_RTFEXPORT_TEST(testTdf94377, "tdf94377.rtf")
CPPUNIT_ASSERT_EQUAL(12.f, getProperty<float>(getRun(getParagraphOfText(2, xText, "asdf12"), 1), "CharHeight"));
}
+DECLARE_RTFEXPORT_TEST(testTdf104079, "tdf104079.rtf")
+{
+ bool bFound = false;
+ int nIndex = 0;
+ while (!bFound)
+ {
+ uno::Reference<text::XTextRange> xParagraph = getParagraph(++nIndex);
+ if (!xParagraph->getString().startsWith("toc3"))
+ continue;
+
+ bFound = true;
+ // This was 0, 3rd paragraph of ToC lost its bottom paragraph margin.
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212), getProperty<sal_Int32>(xParagraph, "ParaBottomMargin"));
+ }
+}
+
DECLARE_RTFEXPORT_TEST(testPageBackground, "page-background.rtf")
{
// The problem was that \background was ignored.
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 525576fe9a77..2e32b7eb7f4b 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1191,10 +1191,11 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap )
else
{
uno::Reference<text::XTextCursor> xCursor;
- if (m_bParaHadField && !m_bIsInComments)
+ if (m_bParaHadField && !m_bIsInComments && !xTOCMarkerCursor.is())
{
// Workaround to make sure char props of the field are not lost.
// Not relevant for editeng-based comments.
+ // Nor revelent for fields inside a TOC field.
OUString sMarker("X");
xCursor = xTextAppend->getText()->createTextCursor();
if (xCursor.is())
More information about the Libreoffice-commits
mailing list