sd theme: add PPTX import for shape fill color effects

This is always direct formatting, so FillProperties::pushToPropMap()
always has the needed info at hand.

Change-Id: I3317b618e0e8bb7688d0f0fbfe4546e2e8b4e947
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133525
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
This commit is contained in:
Miklos Vajna
2022-04-28 08:15:54 +02:00
parent bd568b3604
commit 30735bdb5a
5 changed files with 27 additions and 10 deletions
+2 -2
View File
@@ -100,8 +100,8 @@ public:
const OUString& getSchemeColorName() const { return msSchemeName; }
sal_Int16 getSchemeColorIndex() const;
sal_Int16 getTintOrShade();
sal_Int16 getLumMod();
sal_Int16 getLumOff();
sal_Int16 getLumMod() const;
sal_Int16 getLumOff() const;
/** Returns the unaltered list of transformations for interoperability purposes */
const css::uno::Sequence< css::beans::PropertyValue >& getTransformations() const { return maInteropTransformations;}
+2 -2
View File
@@ -496,7 +496,7 @@ sal_Int16 Color::getTintOrShade()
return 0;
}
sal_Int16 Color::getLumMod()
sal_Int16 Color::getLumMod() const
{
for (const auto& rTransform : maTransforms)
{
@@ -512,7 +512,7 @@ sal_Int16 Color::getLumMod()
return 10000;
}
sal_Int16 Color::getLumOff()
sal_Int16 Color::getLumOff() const
{
for (const auto& rTransform : maTransforms)
{
+6
View File
@@ -397,6 +397,12 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
{
rPropMap.setProperty(PROP_FillColorTheme, nPhClrTheme);
}
else
{
rPropMap.setProperty(PROP_FillColorTheme, maFillColor.getSchemeColorIndex());
rPropMap.setProperty(PROP_FillColorLumMod, maFillColor.getLumMod());
rPropMap.setProperty(PROP_FillColorLumOff, maFillColor.getLumOff());
}
eFillStyle = FillStyle_SOLID;
}
+2
View File
@@ -177,6 +177,8 @@ FillBitmapSizeY
FillBitmap
FillColor
FillColorTheme
FillColorLumMod
FillColorLumOff
FillGradient
FillGradientName
FillHatch
+15 -6
View File
@@ -94,17 +94,26 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
// Blue.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x4472c4), GetShapeFillColor(xShape4));
// The theme index of this filled shape is set by the PPTX import:
sal_Int32 nColorTheme = -1;
sal_Int16 nColorTheme = -1;
xShape4->getPropertyValue("FillColorTheme") >>= nColorTheme;
// 4 means accent1, this was -1 without the PPTX import bit in place.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(4), nColorTheme);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nColorTheme);
uno::Reference<beans::XPropertySet> xShape5(xDrawPageShapes->getByIndex(5), uno::UNO_QUERY);
// Blue, lighter.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0xb4c7e7), GetShapeFillColor(xShape5));
// Set theme index to accent 1 & effects till PPTX import is missing.
xShape5->setPropertyValue("FillColorTheme", uno::makeAny(static_cast<sal_Int16>(4)));
xShape5->setPropertyValue("FillColorLumMod", uno::makeAny(static_cast<sal_Int16>(4000)));
xShape5->setPropertyValue("FillColorLumOff", uno::makeAny(static_cast<sal_Int16>(6000)));
// The theme index, and effects (lum mod, lum off) are set by the PPTX import:
nColorTheme = -1;
xShape5->getPropertyValue("FillColorTheme") >>= nColorTheme;
// 4 means accent1, this was -1 without the PPTX import bit in place.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4), nColorTheme);
sal_Int16 nColorLumMod = 10000;
xShape5->getPropertyValue("FillColorLumMod") >>= nColorLumMod;
// This was 10000 without the PPTX import bit in place.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(4000), nColorLumMod);
sal_Int16 nColorLumOff = 0;
xShape5->getPropertyValue("FillColorLumOff") >>= nColorLumOff;
// This was 0 without the PPTX import bit in place.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int16>(6000), nColorLumOff);
// When changing the master slide of slide 1 to use the theme of the second master slide:
uno::Reference<drawing::XMasterPageTarget> xDrawPage2(