[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - sw/qa sw/source

Luke Deller luke at deller.id.au
Sat Mar 17 07:31:46 UTC 2018


 sw/qa/extras/ooxmlexport/data/tdf107035.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport11.cxx   |   24 ++++++++++++++++++++++++
 sw/source/core/unocore/unotext.cxx           |    4 ++++
 3 files changed, 28 insertions(+)

New commits:
commit afe0aa7fde7e4d4f9a928235e41953bf73e2ea6c
Author: Luke Deller <luke at deller.id.au>
Date:   Mon Mar 5 00:14:28 2018 +1100

    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 at libreoffice.org>
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    (cherry picked from commit 18cbb8fe699131a234355e1d00fa917fede6ac46)
    Reviewed-on: https://gerrit.libreoffice.org/50815
    Reviewed-by: Bartosz Kosiorek <gang65 at poczta.onet.pl>

diff --git a/sw/qa/extras/ooxmlexport/data/tdf107035.docx b/sw/qa/extras/ooxmlexport/data/tdf107035.docx
new file mode 100644
index 000000000000..a8ab045b61c9
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf107035.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
index 35bf52ee25af..52128c0a740d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport11.cxx
@@ -185,6 +185,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();


More information about the Libreoffice-commits mailing list