summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-01-14 18:43:06 +0100
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-01-18 14:51:42 +0100
commit15e01d90b92a84cba538940614ea30df401a9976 (patch)
tree978b6d6802af74a558d17264596d54cc78e46a01 /include
parent2e34ceeb92b6d61a2bd7a1ac1e2828fbf7c9f176 (diff)
ooxml: Preserve shape style attribute fillRef
Shape style attributes contain the default format for the shape in case that no direct format is specified for it. This is an example of the attribute we want to preserve with this patch: <wps:style> ... <a:fillRef idx="1"> <a:schemeClr val="accent1"/> </a:fillRef> ... </wps:style> The relevant values in these tags are stored at the maShapeStyleRefs member in the Shape object. The storage happens at ShapeStyleContext::onCreateContext which is run when the <a:fillRef> tag is opened. The ShapeStyleRef object contains the idx value and a Color object which will contain the inner tag <a:schemeClr>. The Color object has been modified to store the string value of schemeClr. The storage happens at ColorValueContext::onStartElement which is run when the tag <a:schemeClr> is opened. Later, Shape::createAndInsert is called by the ShapeContextHandler to create the actual XShape, this happens when the tag <wps:wsp> is closed. createAndInsert puts idx and schemeClr values into the InteropGrabBag property of the XShape with the name StyleFillRef. On export time, when the shape data is written at ShapeExport::WriteCustomShape, we added a call to DrawingML::WriteShapeStyle. This method will check the existence of the InteropGrabBag property in the shape, read the StyleFillRef prop inside it and output the proper XML to the style definition. DrawingML::WriteShapeStyle also writes some mock tags into the <wps:style> because we found that they are compulsory. We will replace them with the proper data in further patches. The method putPropertyToGrabBag was added to the Shape object for convenience. The data files for some /sd/qa/ unit tests were updated to reflect the new property StyleFillRef inside the InteropGrabBag. Change-Id: I5ffa5242852461a1a709a8f169d40f0d7a2c9aa3
Diffstat (limited to 'include')
-rw-r--r--include/oox/drawingml/color.hxx7
-rw-r--r--include/oox/drawingml/shape.hxx3
-rw-r--r--include/oox/export/drawingml.hxx1
3 files changed, 11 insertions, 0 deletions
diff --git a/include/oox/drawingml/color.hxx b/include/oox/drawingml/color.hxx
index 2b01e643c91c..481113b364d5 100644
--- a/include/oox/drawingml/color.hxx
+++ b/include/oox/drawingml/color.hxx
@@ -58,6 +58,8 @@ public:
void setPrstClr( sal_Int32 nToken );
/** Sets a scheme color from the a:schemeClr element. */
void setSchemeClr( sal_Int32 nToken );
+ /** Sets the scheme name from the a:schemeClr element for interoperability purposes */
+ void setSchemeName( OUString sSchemeName ) { msSchemeName = sSchemeName; }
/** Sets a system color from the a:sysClr element. */
void setSysClr( sal_Int32 nToken, sal_Int32 nLastRgb );
/** Sets a palette color index. */
@@ -90,6 +92,9 @@ public:
/** Returns the transparency of the color (0 = opaque, 100 = full transparent). */
sal_Int16 getTransparency() const;
+ /** Returns the scheme name from the a:schemeClr element for interoperability purposes */
+ OUString getSchemeName() const { return msSchemeName; }
+
private:
/** Internal helper for getColor(). */
void setResolvedRgb( sal_Int32 nRgb ) const;
@@ -130,6 +135,8 @@ private:
mutable sal_Int32 mnC2; /// Green, green%, saturation, or system default RGB.
mutable sal_Int32 mnC3; /// Blue, blue%, or luminance.
sal_Int32 mnAlpha; /// Alpha value (color opacity).
+
+ OUString msSchemeName; /// Scheme name from the a:schemeClr element for interoperability purposes
};
typedef boost::shared_ptr< Color > ColorPtr;
diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index f39f75d03c82..01cc1e97710b 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -217,6 +217,9 @@ protected:
::oox::core::XmlFilterBase& rFilter,
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes );
+ void putPropertyToGrabBag(
+ const ::com::sun::star::beans::PropertyValue& pProperty );
+
std::vector< ShapePtr > maChildren; // only used for group shapes
com::sun::star::awt::Size maChSize; // only used for group shapes
com::sun::star::awt::Point maChPosition; // only used for group shapes
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 00ec32ed7028..2de1ba0187ee 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -147,6 +147,7 @@ public:
void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
void WritePolyPolygon( const PolyPolygon& rPolyPolygon );
void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
+ void WriteShapeStyle( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
static void ResetCounters();