[Libreoffice-commits] core.git: Branch 'distro/lhm/libreoffice-6-1+backports' - oox/source sw/qa

Serge Krot (via logerrit) logerrit at kemper.freedesktop.org
Thu May 16 10:59:08 UTC 2019


 oox/source/shape/WpsContext.cxx              |    9 ++++++++-
 sw/qa/extras/ooxmlimport/data/tdf124754.docx |binary
 sw/qa/extras/ooxmlimport/ooxmlimport2.cxx    |   15 +++++++++++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 52042f593fa69dab3a00e780dbbec8c0c6e69e7d
Author:     Serge Krot <Serge.Krot at cib.de>
AuthorDate: Mon May 13 15:43:44 2019 +0200
Commit:     Thorsten Behrens <Thorsten.Behrens at CIB.de>
CommitDate: Thu May 16 12:58:31 2019 +0200

    tdf#124754 sw docx import: do not override text color with -1 (auto) color
    
    Change-Id: Id821b0d8bef69a7124ee41558e822cf8b025df9d
    Reviewed-on: https://gerrit.libreoffice.org/72232
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Reviewed-on: https://gerrit.libreoffice.org/72402
    Reviewed-by: Michael Stahl <Michael.Stahl at cib.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx
index 061b90a7ce8b..9df08c6da819 100644
--- a/oox/source/shape/WpsContext.cxx
+++ b/oox/source/shape/WpsContext.cxx
@@ -152,7 +152,14 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken
             if (ePropertyState == beans::PropertyState_DEFAULT_VALUE)
             {
                 uno::Reference<beans::XPropertySet> xTextBoxPropertySet(xTextCursor, uno::UNO_QUERY);
-                xTextBoxPropertySet->setPropertyValue("CharColor", xPropertySet->getPropertyValue("CharColor"));
+
+                uno::Any xCharColor = xPropertySet->getPropertyValue("CharColor");
+                Color aColor = COL_AUTO;
+                if (xCharColor >>= aColor)
+                {
+                    if (aColor != COL_AUTO)
+                        xTextBoxPropertySet->setPropertyValue("CharColor", xCharColor);
+                }
             }
             return this;
         }
diff --git a/sw/qa/extras/ooxmlimport/data/tdf124754.docx b/sw/qa/extras/ooxmlimport/data/tdf124754.docx
new file mode 100644
index 000000000000..2f7f4e14bda5
Binary files /dev/null and b/sw/qa/extras/ooxmlimport/data/tdf124754.docx differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index a5271cd6332e..70f989af448d 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -180,6 +180,7 @@ DECLARE_OOXMLIMPORT_TEST(testTdf117843, "tdf117843.docx")
         getProperty<sal_Int32>(getParagraphOfText(1, xHeaderText), "ParaTopMargin"));
 }
 
+// related tdf#124754
 DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx")
 {
     uno::Reference<text::XTextRange> xParagraph = getParagraph(1);
@@ -190,6 +191,20 @@ DECLARE_OOXMLIMPORT_TEST(testTdf43017, "tdf43017.docx")
                                  getProperty<sal_Int32>(xText, "CharColor"));
 }
 
+// related tdf#43017
+DECLARE_OOXMLIMPORT_TEST(testTdf124754, "tdf124754.docx")
+{
+    uno::Reference<text::XText> textbox(getShape(1), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(1, getParagraphs(textbox));
+
+    uno::Reference<text::XTextRange> xParagraph = getParagraphOfText(1, textbox);
+    uno::Reference<text::XTextRange> xText = getRun(xParagraph, 2);
+
+    // Ensure that hyperlink text color is not black
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Hyperlink color should be not black!", sal_Int32(353217),
+                                 getProperty<sal_Int32>(xText, "CharColor"));
+}
+
 DECLARE_OOXMLIMPORT_TEST(testTdf112443, "tdf112443.docx")
 {
     // the position of the flying text frame should be off page


More information about the Libreoffice-commits mailing list