diff options
author | Luke Deller <luke@deller.id.au> | 2018-03-05 00:14:28 +1100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-03-05 10:26:47 +0100 |
commit | 18cbb8fe699131a234355e1d00fa917fede6ac46 (patch) | |
tree | 0642ae0059b821ed52228bde8bb526c15e2ec285 /sw | |
parent | 60ac7418747530a006894a7941c67c5006d6158c (diff) |
tdf#107035 Fix field character style DOCX import
Reinstate a call to DontExpandFormat which was removed from
appendTextContent in commit 232ad2f2588beff50cb5c1f3b689c581ba317583
This ensures that direct character formatting which ended immediately
before the insertion point will not be expanded to cover the inserted
content.
Change-Id: Ie5fa6b5c5acee4f885f9e67535e98801af23661a
Reviewed-on: https://gerrit.libreoffice.org/50729
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf107035.docx | bin | 0 -> 4240 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport11.cxx | 24 | ||||
-rw-r--r-- | sw/source/core/unocore/unotext.cxx | 4 |
3 files changed, 28 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf107035.docx b/sw/qa/extras/ooxmlexport/data/tdf107035.docx Binary files differnew file mode 100644 index 000000000000..a8ab045b61c9 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf107035.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx index 4960c87bd9d0..ebc3d81d9f4a 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx @@ -263,6 +263,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258, "tdf113258.docx") getProperty<sal_Int32>(xShape->getStart(), "ParaTopMargin")); } +DECLARE_OOXMLEXPORT_TEST(testTdf107035, "tdf107035.docx") +{ + // Select the second run containing the page number field + auto xPgNumRun = getRun(getParagraph(1), 2, "1"); + + // Check that the page number field colour is set to "automatic". + sal_Int32 nPgNumColour = getProperty<sal_Int32>(xPgNumRun, "CharColor"); +#if 0 + // TODO Enable this once tdf#116179 is fixed + CPPUNIT_ASSERT_EQUAL(sal_Int32(COL_AUTO), nPgNumColour); + +#else + // Meanwhile just check that the page number field colour is different + // from the green text before it: + + // Select the first run containing the green text + auto xTextRun = getRun(getParagraph(1), 1); + + // Check that the page number field colour is different from the green text + CPPUNIT_ASSERT(getProperty<sal_Int32>(xTextRun, "CharColor") != nPgNumColour); +#endif + +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index db3d78c9c382..6d01370e5d19 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -528,6 +528,10 @@ SwXText::insertTextContent( aIllegal.Message = "first parameter invalid"; throw aIllegal; } + // Any direct formatting ending at the insert position (xRange) should not + // be expanded to cover the inserted content (xContent) + GetDoc()->DontExpandFormat( *aPam.Start() ); + // first test if the range is at the right position, then call // xContent->attach const SwStartNode* pOwnStartNode = GetStartNode(); |