summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--oox/inc/drawingml/fillproperties.hxx1
-rw-r--r--oox/source/drawingml/fillproperties.cxx11
-rw-r--r--oox/source/drawingml/shape.cxx4
-rw-r--r--oox/source/token/properties.txt1
-rw-r--r--svx/qa/unit/styles.cxx7
5 files changed, 19 insertions, 5 deletions
diff --git a/oox/inc/drawingml/fillproperties.hxx b/oox/inc/drawingml/fillproperties.hxx
index f308f6aaec0d..532cb0ec3975 100644
--- a/oox/inc/drawingml/fillproperties.hxx
+++ b/oox/inc/drawingml/fillproperties.hxx
@@ -145,6 +145,7 @@ struct FillProperties
const GraphicHelper& rGraphicHelper,
sal_Int32 nShapeRotation = 0,
::Color nPhClr = API_RGB_TRANSPARENT,
+ sal_Int16 nPhClrTheme = -1,
bool bFlipH = false,
bool bFlipV = false,
bool bIsCustomShape = false ) const;
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 49906cc9b10f..9589a7388bd5 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -371,7 +371,7 @@ Color FillProperties::getBestSolidColor() const
}
void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
- const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color nPhClr,
+ const GraphicHelper& rGraphicHelper, sal_Int32 nShapeRotation, ::Color nPhClr, sal_Int16 nPhClrTheme,
bool bFlipH, bool bFlipV, bool bIsCustomShape) const
{
if( !moFillType.has() )
@@ -388,9 +388,16 @@ void FillProperties::pushToPropMap( ShapePropertyMap& rPropMap,
case XML_solidFill:
if( maFillColor.isUsed() )
{
- rPropMap.setProperty( ShapeProperty::FillColor, maFillColor.getColor( rGraphicHelper, nPhClr ) );
+ ::Color aFillColor = maFillColor.getColor(rGraphicHelper, nPhClr);
+ rPropMap.setProperty(ShapeProperty::FillColor, aFillColor);
if( maFillColor.hasTransparency() )
rPropMap.setProperty( ShapeProperty::FillTransparency, maFillColor.getTransparency() );
+
+ if (aFillColor == nPhClr)
+ {
+ rPropMap.setProperty(PROP_FillColorTheme, nPhClrTheme);
+ }
+
eFillStyle = FillStyle_SOLID;
}
break;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 98401179d84d..7a01ebddb09e 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1161,6 +1161,7 @@ Reference< XShape > const & Shape::createAndInsert(
::Color nLinePhClr(ColorTransparency, 0xffffffff);
::Color nFillPhClr(ColorTransparency, 0xffffffff);
+ sal_Int16 nFillPhClrTheme = -1;
// TODO: use ph color when applying effect properties
//sal_Int32 nEffectPhClr = -1;
@@ -1197,6 +1198,7 @@ Reference< XShape > const & Shape::createAndInsert(
if (!mbUseBgFill)
{
nFillPhClr = pFillRef->maPhClr.getColor(rGraphicHelper);
+ nFillPhClrTheme = pFillRef->maPhClr.getSchemeColorIndex();
}
OUString sColorScheme = pFillRef->maPhClr.getSchemeColorName();
@@ -1259,7 +1261,7 @@ Reference< XShape > const & Shape::createAndInsert(
if (getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill)
getFillProperties().assignUsed(aFillProperties);
if(!bIsCroppedGraphic)
- aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV, bIsCustomShape );
+ aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, nFillPhClrTheme, mbFlipH, mbFlipV, bIsCustomShape );
LineProperties aLineProperties = getActualLineProperties(pTheme);
aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr );
EffectProperties aEffectProperties = getActualEffectProperties(pTheme);
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 87a6700bd35a..e318e0038ecb 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -176,6 +176,7 @@ FillBitmapSizeX
FillBitmapSizeY
FillBitmap
FillColor
+FillColorTheme
FillGradient
FillGradientName
FillHatch
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 3881fe1d1006..3bfa6d8cf09b 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -93,8 +93,11 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
uno::Reference<beans::XPropertySet> xShape4(xDrawPageShapes->getByIndex(4), uno::UNO_QUERY);
// Blue.
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0x4472c4), GetShapeFillColor(xShape4));
- // Set theme index to accent 1 till PPTX import is missing.
- xShape4->setPropertyValue("FillColorTheme", uno::makeAny(static_cast<sal_Int16>(4)));
+ // The theme index of this filled shape is set by the PPTX import:
+ sal_Int32 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);
// When changing the master slide of slide 1 to use the theme of the second master slide:
uno::Reference<drawing::XMasterPageTarget> xDrawPage2(