Kaydet (Commit) 18cbb8fe authored tarafından Luke Deller's avatar Luke Deller Kaydeden (comit) Miklos Vajna

tdf#107035 Fix field character style DOCX import

Reinstate a call to DontExpandFormat which was removed from
appendTextContent in commit 232ad2f2

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/50729Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 60ac7418
...@@ -263,6 +263,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258, "tdf113258.docx") ...@@ -263,6 +263,30 @@ DECLARE_OOXMLEXPORT_TEST(testTdf113258, "tdf113258.docx")
getProperty<sal_Int32>(xShape->getStart(), "ParaTopMargin")); 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(); CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -528,6 +528,10 @@ SwXText::insertTextContent( ...@@ -528,6 +528,10 @@ SwXText::insertTextContent(
aIllegal.Message = "first parameter invalid"; aIllegal.Message = "first parameter invalid";
throw aIllegal; 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 // first test if the range is at the right position, then call
// xContent->attach // xContent->attach
const SwStartNode* pOwnStartNode = GetStartNode(); const SwStartNode* pOwnStartNode = GetStartNode();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment