summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
authorTamás Zolnai <zolnaitamas2000@gmail.com>2016-11-18 22:57:29 +0000
committerTamás Zolnai <tamas.zolnai@collabora.com>2016-11-18 22:42:12 +0000
commit8d613870b2cd2e3e4396b4fa97dbd8080fda8f52 (patch)
tree0e9bb4ce750b48773f2e592bb68fcedf0db5c398 /oox/source
parent9745d29227e471ce40e9992fefd92e10a48696fb (diff)
tdf#104015: PPTX import: Title shape does not inherit fill properties
...from slide master. The problem caused by that PPTX files contains not a one-level master slide set, but has two levels: one called slide master, other called slide layout. Slide layout inherit properties from slide master and normal slide inherit propetries from slide layout. Bug appeared because, slide layout inherited properties were not forwarded to the normal slide. Change-Id: I587582498cf4315087f9a576c1b7fc41ee23e2fd Reviewed-on: https://gerrit.libreoffice.org/30969 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/shape.cxx111
1 files changed, 85 insertions, 26 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f027cd159524..0ee6cef28eef 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -303,11 +303,11 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText )
else
mpTextBody.reset();
maShapeProperties = rReferencedShape.maShapeProperties;
- mpShapeRefLinePropPtr = std::make_shared<LineProperties>( *rReferencedShape.mpLinePropertiesPtr.get() );
- mpShapeRefFillPropPtr = std::make_shared<FillProperties>( *rReferencedShape.mpFillPropertiesPtr.get() );
+ mpShapeRefLinePropPtr = std::make_shared<LineProperties>( rReferencedShape.getActualLineProperties(nullptr) );
+ mpShapeRefFillPropPtr = std::make_shared<FillProperties>( rReferencedShape.getActualFillProperties(nullptr, nullptr) );
mpCustomShapePropertiesPtr = std::make_shared<CustomShapeProperties>( *rReferencedShape.mpCustomShapePropertiesPtr.get() );
mpTablePropertiesPtr = table::TablePropertiesPtr( rReferencedShape.mpTablePropertiesPtr.get() ? new table::TableProperties( *rReferencedShape.mpTablePropertiesPtr.get() ) : nullptr );
- mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( *rReferencedShape.mpEffectPropertiesPtr.get() );
+ mpShapeRefEffectPropPtr = std::make_shared<EffectProperties>( rReferencedShape.getActualEffectProperties(nullptr) );
mpMasterTextListStyle = std::make_shared<TextListStyle>( *rReferencedShape.mpMasterTextListStyle.get() );
maSize = rReferencedShape.maSize;
maPosition = rReferencedShape.maPosition;
@@ -654,25 +654,17 @@ Reference< XShape > const & Shape::createAndInsert(
const GraphicHelper& rGraphicHelper = rFilterBase.getGraphicHelper();
- LineProperties aLineProperties;
- aLineProperties.maLineFill.moFillType = XML_noFill;
sal_Int32 nLinePhClr = -1;
- FillProperties aFillProperties;
- aFillProperties.moFillType = XML_noFill;
sal_Int32 nFillPhClr = -1;
- EffectProperties aEffectProperties;
// TODO: use ph color when applying effect properties
//sal_Int32 nEffectPhClr = -1;
- // First apply reference shape's properties (shape on the master slide)
- aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
- aLineProperties.assignUsed( *mpShapeRefLinePropPtr );
- aEffectProperties.assignUsed( *mpShapeRefEffectPropPtr );
-
if( pTheme )
{
if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
{
+ LineProperties aLineProperties;
+ aLineProperties.maLineFill.moFillType = XML_noFill;
if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
aLineProperties.assignUsed( *pLineProps );
nLinePhClr = pLineRef->maPhClr.getColor( rGraphicHelper );
@@ -690,8 +682,6 @@ Reference< XShape > const & Shape::createAndInsert(
}
if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
{
- if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
- aFillProperties.assignUsed( *pFillProps );
nFillPhClr = pFillRef->maPhClr.getColor( rGraphicHelper );
OUString sColorScheme = pFillRef->maPhClr.getSchemeName();
@@ -708,8 +698,6 @@ Reference< XShape > const & Shape::createAndInsert(
}
if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
{
- if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
- aEffectProperties.assignUsed( *pEffectProps );
// TODO: use ph color when applying effect properties
// nEffectPhClr = pEffectRef->maPhClr.getColor( rGraphicHelper );
@@ -721,15 +709,6 @@ Reference< XShape > const & Shape::createAndInsert(
putPropertyToGrabBag( "StyleEffectRef", Any( aProperties ) );
}
}
-
- aLineProperties.assignUsed( getLineProperties() );
-
- // group fill inherits from parent
- if ( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill )
- getFillProperties().assignUsed( rShapeOrParentShapeFillProps );
- aFillProperties.assignUsed( getFillProperties() );
- aEffectProperties.assignUsed ( getEffectProperties() );
-
ShapePropertyMap aShapeProps( rFilterBase.getModelObjectHelper() );
// add properties from textbody to shape properties
@@ -749,8 +728,12 @@ Reference< XShape > const & Shape::createAndInsert(
mpGraphicPropertiesPtr->pushToPropMap( aShapeProps, rGraphicHelper );
if ( mpTablePropertiesPtr.get() && aServiceName == "com.sun.star.drawing.TableShape" )
mpTablePropertiesPtr->pushToPropSet( rFilterBase, xSet, mpMasterTextListStyle );
+
+ FillProperties aFillProperties = getActualFillProperties(pTheme, &rShapeOrParentShapeFillProps);
aFillProperties.pushToPropMap( aShapeProps, rGraphicHelper, mnRotation, nFillPhClr, mbFlipH, mbFlipV );
+ LineProperties aLineProperties = getActualLineProperties(pTheme);
aLineProperties.pushToPropMap( aShapeProps, rGraphicHelper, nLinePhClr );
+ EffectProperties aEffectProperties = getActualEffectProperties(pTheme);
// TODO: use ph color when applying effect properties
aEffectProperties.pushToPropMap( aShapeProps, rGraphicHelper );
@@ -1461,6 +1444,82 @@ void Shape::putPropertiesToGrabBag( const Sequence< PropertyValue >& aProperties
}
}
+FillProperties Shape::getActualFillProperties(const Theme* pTheme, const FillProperties* pParentShapeFillProps) const
+{
+ FillProperties aFillProperties;
+ aFillProperties.moFillType = XML_noFill;
+
+ // Reference shape properties
+ aFillProperties.assignUsed( *mpShapeRefFillPropPtr );
+
+ // Theme
+ if( pTheme != nullptr )
+ {
+ if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) )
+ {
+ if( const FillProperties* pFillProps = pTheme->getFillStyle( pFillRef->mnThemedIdx ) )
+ aFillProperties.assignUsed( *pFillProps );
+ }
+ }
+
+ // Parent shape's properties
+ if ( pParentShapeFillProps != nullptr)
+ if( getFillProperties().moFillType.has() && getFillProperties().moFillType.get() == XML_grpFill )
+ aFillProperties.assignUsed( *pParentShapeFillProps );
+
+ // Properties specified directly for this shape
+ aFillProperties.assignUsed( getFillProperties() );
+
+ return aFillProperties;
+}
+
+LineProperties Shape::getActualLineProperties(const Theme* pTheme) const
+{
+ LineProperties aLineProperties;
+ aLineProperties.maLineFill.moFillType = XML_noFill;
+
+ // Reference shape properties
+ aLineProperties.assignUsed( *mpShapeRefLinePropPtr );
+
+ // Theme
+ if( pTheme != nullptr )
+ {
+ if( const ShapeStyleRef* pLineRef = getShapeStyleRef( XML_lnRef ) )
+ {
+ if( const LineProperties* pLineProps = pTheme->getLineStyle( pLineRef->mnThemedIdx ) )
+ aLineProperties.assignUsed( *pLineProps );
+ }
+ }
+
+ // Properties specified directly for this shape
+ aLineProperties.assignUsed( getLineProperties() );
+
+ return aLineProperties;
+}
+
+EffectProperties Shape::getActualEffectProperties(const Theme* pTheme) const
+{
+ EffectProperties aEffectProperties;
+
+ // Reference shape properties
+ aEffectProperties.assignUsed( *mpShapeRefEffectPropPtr );
+
+ // Theme
+ if( pTheme != nullptr )
+ {
+ if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) )
+ {
+ if( const EffectProperties* pEffectProps = pTheme->getEffectStyle( pEffectRef->mnThemedIdx ) )
+ aEffectProperties.assignUsed( *pEffectProps );
+ }
+ }
+
+ // Properties specified directly for this shape
+ aEffectProperties.assignUsed ( getEffectProperties() );
+
+ return aEffectProperties;
+}
+
uno::Sequence< uno::Sequence< uno::Any > > Shape::resolveRelationshipsOfTypeFromOfficeDoc(core::XmlFilterBase& rFilter, const OUString& sFragment, const OUString& sType )
{
uno::Sequence< uno::Sequence< uno::Any > > xRelListTemp;