summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorRegina Henschel <rb.henschel@t-online.de>2023-01-05 18:33:46 +0100
committerRegina Henschel <rb.henschel@t-online.de>2023-01-06 01:19:12 +0000
commit585f65738270ba8ab2fdc4c49063c3b5663fe768 (patch)
tree3cbd35fd1cc5b6787af18747191fa724eec64c33 /writerfilter
parent3fd0b4053763aa91b0004c523e96e7d390c7b58e (diff)
tdf#152884 import alpha too for schemeClr
Without fix the alpha child element was only read for w14:srgbClr but no for w14:schemeClr. Thus character colored by theme color had no transparency. Change-Id: I73c01b7142d3eab83400d2e5eb9dce01ff8d4a19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145099 Tested-by: Jenkins Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx18
-rw-r--r--writerfilter/qa/cppunittests/dmapper/data/tdf152884_Char_Transparency.docxbin0 -> 14109 bytes
-rw-r--r--writerfilter/source/dmapper/TextEffectsHandler.cxx4
3 files changed, 21 insertions, 1 deletions
diff --git a/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx b/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx
index 7788abe1a62b..f31d9862a1ac 100644
--- a/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx
+++ b/writerfilter/qa/cppunittests/dmapper/TextEffectsHandler.cxx
@@ -47,6 +47,24 @@ CPPUNIT_TEST_FIXTURE(Test, testSemiTransparentText)
// i.e. text was imported as regular text with solid color only.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(74), nCharTransparence);
}
+
+CPPUNIT_TEST_FIXTURE(Test, testThemeColorTransparency)
+{
+ // Load a document with a single paragraph. It has semi-transparent text and the color is
+ // determined by a w14:schemeClr element.
+ loadFromURL(u"tdf152884_Char_Transparency.docx");
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xTextDocument->getText(),
+ uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration();
+ uno::Reference<container::XEnumerationAccess> xPara(xParaEnum->nextElement(), uno::UNO_QUERY);
+ uno::Reference<container::XEnumeration> xPortionEnum = xPara->createEnumeration();
+ sal_Int16 nCharTransparence = 0;
+ uno::Reference<beans::XPropertySet> xPortion(xPortionEnum->nextElement(), uno::UNO_QUERY);
+ xPortion->getPropertyValue("CharTransparence") >>= nCharTransparence;
+ // Without the fix this test would have failed with: Expected 74, Actual 0
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(74), nCharTransparence);
+}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/qa/cppunittests/dmapper/data/tdf152884_Char_Transparency.docx b/writerfilter/qa/cppunittests/dmapper/data/tdf152884_Char_Transparency.docx
new file mode 100644
index 000000000000..e1603956948f
--- /dev/null
+++ b/writerfilter/qa/cppunittests/dmapper/data/tdf152884_Char_Transparency.docx
Binary files differ
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx
index cce02393cd5a..2a3deb5d0e87 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.cxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx
@@ -771,7 +771,9 @@ sal_uInt8 TextEffectsHandler::GetTextFillSolidFillAlpha(const css::beans::Proper
it = aSolidFillMap.find("srgbClr");
if (it == aSolidFillMap.end())
{
- return 0;
+ it = aSolidFillMap.find("schemeClr");
+ if (it == aSolidFillMap.end())
+ return 0;
}
comphelper::SequenceAsHashMap aSrgbClrMap(it->second);