diff options
author | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-01-28 13:51:16 +0100 |
---|---|---|
committer | Jacobo Aragunde Pérez <jaragunde@igalia.com> | 2014-01-28 17:07:26 +0100 |
commit | 2c9c3d3ef52db1571064036800feaa9a9ebd4bb4 (patch) | |
tree | 962cac3cd744335d3a10f5f5bd62ab2c8f423fbb /oox | |
parent | 0d6cb9c123e04585c6adb92a2891048ca2442bac (diff) |
ooxml: Small code refactor
* Use PUT_PROPS macro in all cases.
* Added putPropertyToGrabBag( OUString, Any ) to avoid the explicit
creation of a PropertyValue object every time.
Change-Id: If098dd3a94d1843c4c5dbc3a507b05754d9d59c7
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index b2d03008e442..3259f72b8a06 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -569,10 +569,7 @@ Reference< XShape > Shape::createAndInsert( PUT_PROP( aProperties, 4, "LineJoint", aLineProperties.getLineJoint() ); PUT_PROP( aProperties, 5, "LineWidth", aLineProperties.getLineWidth() ); PUT_PROP( aProperties, 6, "Transformations", pLineRef->maPhClr.getTransformations() ); - PropertyValue pStyleFillRef; - pStyleFillRef.Name = "StyleLnRef"; - pStyleFillRef.Value = Any( aProperties ); - putPropertyToGrabBag( pStyleFillRef ); + putPropertyToGrabBag( "StyleLnRef", Any( aProperties ) ); } if( const ShapeStyleRef* pFillRef = getShapeStyleRef( XML_fillRef ) ) { @@ -584,19 +581,12 @@ Reference< XShape > Shape::createAndInsert( if( !sColorScheme.isEmpty() ) { Sequence< PropertyValue > aProperties(4); - aProperties[0].Name = "SchemeClr"; - aProperties[0].Value = Any( sColorScheme ); - aProperties[1].Name = "Idx"; - aProperties[1].Value = Any( pFillRef->mnThemedIdx ); - aProperties[2].Name = "Color"; - aProperties[2].Value = Any( nFillPhClr ); - aProperties[3].Name = "Transformations"; - aProperties[3].Value = Any( pFillRef->maPhClr.getTransformations() ); - - PropertyValue pStyleFillRef; - pStyleFillRef.Name = "StyleFillRef"; - pStyleFillRef.Value = Any( aProperties ); - putPropertyToGrabBag( pStyleFillRef ); + PUT_PROP( aProperties, 0, "SchemeClr", sColorScheme ); + PUT_PROP( aProperties, 1, "Idx", pFillRef->mnThemedIdx ); + PUT_PROP( aProperties, 2, "Color", nFillPhClr ); + PUT_PROP( aProperties, 3, "Transformations", pFillRef->maPhClr.getTransformations() ); + + putPropertyToGrabBag( "StyleFillRef", Any( aProperties ) ); } } if( const ShapeStyleRef* pEffectRef = getShapeStyleRef( XML_effectRef ) ) @@ -611,10 +601,7 @@ Reference< XShape > Shape::createAndInsert( PUT_PROP( aProperties, 0, "SchemeClr", pEffectRef->maPhClr.getSchemeName() ); PUT_PROP( aProperties, 1, "Idx", pEffectRef->mnThemedIdx ); PUT_PROP( aProperties, 2, "Transformations", pEffectRef->maPhClr.getTransformations() ); - PropertyValue pStyleFillRef; - pStyleFillRef.Name = "StyleEffectRef"; - pStyleFillRef.Value = Any( aProperties ); - putPropertyToGrabBag( pStyleFillRef ); + putPropertyToGrabBag( "StyleEffectRef", Any( aProperties ) ); } } @@ -1100,6 +1087,14 @@ void Shape::finalizeXShape( XmlFilterBase& rFilter, const Reference< XShapes >& } } +void Shape::putPropertyToGrabBag( const OUString& sPropertyName, const Any& aPropertyValue ) +{ + PropertyValue pNewProperty; + pNewProperty.Name = sPropertyName; + pNewProperty.Value = aPropertyValue; + putPropertyToGrabBag( pNewProperty ); +} + void Shape::putPropertyToGrabBag( const PropertyValue& pProperty ) { Reference< XPropertySet > xSet( mxShape, UNO_QUERY ); |