summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-03-09 20:51:34 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-03-10 08:17:20 +0100
commitf5089e745367e111fb02c493c8c90e96a29e199c (patch)
treef516f5c9d672f40ab8c2a7a9e6ba097efb8a7eae /oox
parent51fb84829afbc1c0957fd1a489085613ad199f1a (diff)
sd theme: add PPTX import for shape fill color
The theme index is typically not a direct property, but comes from style -> fillref -> theme index, so support that. Change-Id: I00733db44bb5321019bbc7337d10feb0a34661a2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/131268 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-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
4 files changed, 14 insertions, 3 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