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 <gulsah.kose@collabora.com>
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 20965e3..4eb5aca 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -177,6 +177,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>& aVectorOfPropertyValues )
diff --git a/sd/qa/unit/data/pptx/tdf96061.pptx b/sd/qa/unit/data/pptx/tdf96061.pptx
new file mode 100644
index 0000000..c6e6aa5
--- /dev/null
+++ b/sd/qa/unit/data/pptx/tdf96061.pptx
Binary files differ
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 6c12ac0..973503c 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -212,6 +212,7 @@ public:
    void testTdf128213ShapeRot();
    void testTdf125560_textDeflate();
    void testTdf125560_textInflateTop();
    void testTdf96061_textHighlight();

    CPPUNIT_TEST_SUITE(SdOOXMLExportTest2);

@@ -338,6 +339,7 @@ public:
    CPPUNIT_TEST(testTdf128213ShapeRot);
    CPPUNIT_TEST(testTdf125560_textDeflate);
    CPPUNIT_TEST(testTdf125560_textInflateTop);
    CPPUNIT_TEST(testTdf96061_textHighlight);

    CPPUNIT_TEST_SUITE_END();

@@ -3191,6 +3193,40 @@ void SdOOXMLExportTest2::testTdf125560_textInflateTop()
    assertXPath(pXmlDocRels, "/office:document-content/office:body/office:presentation/draw:page/draw:custom-shape/draw:enhanced-geometry", "type", "mso-spt164");
}

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);

CPPUNIT_PLUGIN_IMPLEMENT();