oox/source/drawingml/textcharacterproperties.cxx |    2 +
 sd/qa/unit/data/pptx/tdf96061.pptx               |binary
 sd/qa/unit/export-tests-ooxml2.cxx               |   35 +++++++++++++++++++++++
 3 files changed, 37 insertions(+)

New commits:
commit e61bdbf41cf925147eee7f92142089f8adf0a237
Author:     Gülşah Köse <[email protected]>
AuthorDate: Wed May 19 14:37:36 2021 +0300
Commit:     Andras Timar <[email protected]>
CommitDate: Sat May 29 23:32:40 2021 +0200

    tdf#96061 Unset the highlight property
    
    When we have highlight property on specific part of the text
    the following texts were highligthing. To prevent this we unset the
    highlight property when we have not highlight property anymore.
    
    Change-Id: I802cde1c784afe47201a9ba4f41827dd0c705035
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115800
    Tested-by: Jenkins
    Reviewed-by: Gülşah Köse <[email protected]>
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116176
    Reviewed-by: Andras Timar <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116333
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/oox/source/drawingml/textcharacterproperties.cxx 
b/oox/source/drawingml/textcharacterproperties.cxx
index de47058e60ca..6b55c5326455 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -178,6 +178,8 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& 
rPropMap, const XmlFil
 
     if( maHighlightColor.isUsed() )
         rPropMap.setProperty( PROP_CharBackColor, maHighlightColor.getColor( 
rFilter.getGraphicHelper() ));
+    else
+        rPropMap.setProperty( PROP_CharBackColor, sal_Int32(-1));
 }
 
 static void pushToGrabBag( PropertySet& rPropSet, const 
std::vector<PropertyValue>& aVectorOfProperyValues )
diff --git a/sd/qa/unit/data/pptx/tdf96061.pptx 
b/sd/qa/unit/data/pptx/tdf96061.pptx
new file mode 100644
index 000000000000..c6e6aa5ae16f
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf96061.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 399bd4657861..27d42132557f 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -188,6 +188,7 @@ public:
     void testTdf131554();
     void testTdf132282();
     void testTdf128213ShapeRot();
+    void testTdf96061_textHighlight();
 
     CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);
 
@@ -294,6 +295,7 @@ public:
     CPPUNIT_TEST(testTdf131554);
     CPPUNIT_TEST(testTdf132282);
     CPPUNIT_TEST(testTdf128213ShapeRot);
+    CPPUNIT_TEST(testTdf96061_textHighlight);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -2752,6 +2754,39 @@ void SdOOXMLExportTest2::testTdf128213ShapeRot()
     assertXPath(pXmlDocRels, 
"/p:sld/p:cSld/p:spTree/p:sp/p:txBody/a:bodyPr/a:scene3d/a:camera/a:rot", 
"rev", "5400000");
 }
 
+void SdOOXMLExportTest2::testTdf96061_textHighlight()
+{
+    ::sd::DrawDocShellRef xDocShRef = loadURL( 
m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/tdf96061.pptx"), PPTX);
+
+    uno::Reference<beans::XPropertySet> xShape(getShapeFromPage(0, 0, 
xDocShRef));
+    uno::Reference<text::XTextRange> const 
xParagraph1(getParagraphFromShape(0, xShape));
+    uno::Reference<text::XTextRange> xRun1(getRunFromParagraph(0, 
xParagraph1));
+    uno::Reference< beans::XPropertySet> xPropSet1(xRun1, 
uno::UNO_QUERY_THROW);
+    sal_Int32 aColor;
+    xPropSet1->getPropertyValue("CharBackColor") >>= aColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(16776960), aColor);
+
+    uno::Reference<text::XTextRange> const 
xParagraph2(getParagraphFromShape(1, xShape));
+    uno::Reference<text::XTextRange> xRun2(getRunFromParagraph(0, 
xParagraph2));
+    uno::Reference< beans::XPropertySet> xPropSet2(xRun2, 
uno::UNO_QUERY_THROW);
+    xPropSet2->getPropertyValue("CharBackColor") >>= aColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aColor);
+
+    xDocShRef = saveAndReload( xDocShRef.get(), PPTX );
+
+    uno::Reference<beans::XPropertySet> xShape2(getShapeFromPage(0, 0, 
xDocShRef));
+    uno::Reference<text::XTextRange> const 
xParagraph3(getParagraphFromShape(0, xShape2));
+    uno::Reference<text::XTextRange> xRun3(getRunFromParagraph(0, 
xParagraph3));
+    uno::Reference< beans::XPropertySet> xPropSet3(xRun3, 
uno::UNO_QUERY_THROW);
+    xPropSet3->getPropertyValue("CharBackColor") >>= aColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(16776960), aColor);
+
+    uno::Reference<text::XTextRange> const 
xParagraph4(getParagraphFromShape(1, xShape2));
+    uno::Reference<text::XTextRange> xRun4(getRunFromParagraph(0, 
xParagraph4));
+    uno::Reference< beans::XPropertySet> xPropSet4(xRun4, 
uno::UNO_QUERY_THROW);
+    xPropSet4->getPropertyValue("CharBackColor") >>= aColor;
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(-1), aColor);
+}
 
 CPPUNIT_TEST_SUITE_REGISTRATION(SdOOXMLExportTest2);
 
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to