summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-01-28 13:39:11 +0100
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-01-28 17:07:26 +0100
commit0d6cb9c123e04585c6adb92a2891048ca2442bac (patch)
tree0f92e97cd0596b265146ecd9f4cf35d242341cd1
parent0b3c6203f87f72684ad018963674a10e1c6f7c36 (diff)
ooxml: Preserve shape style effect attributes
Preserve <a:effectRef> tag and its contents from inside shape style properties tag <wps:style>. Added some lines to existing unit tests to check for the preservation of these attributes. Change-Id: I6e47b228dcc9788a4a2dfe87bd1186d2f04dbeea
-rw-r--r--oox/source/drawingml/shape.cxx10
-rw-r--r--oox/source/export/drawingml.cxx8
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx6
3 files changed, 20 insertions, 4 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 41fe7fd429d2..b2d03008e442 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -605,6 +605,16 @@ Reference< XShape > Shape::createAndInsert(
aEffectProperties.assignUsed( *pEffectProps );
// TODO: use ph color when applying effect properties
// nEffectPhClr = pEffectRef->maPhClr.getColor( rGraphicHelper );
+
+ // Store style-related properties to InteropGrabBag to be able to export them back
+ Sequence< PropertyValue > aProperties( 3 );
+ 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 );
}
}
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 70f4f3b5d0cf..3b84ea0ff8b9 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1794,20 +1794,20 @@ void DrawingML::WriteShapeStyle( Reference< XPropertySet > xPropSet )
// extract the relevant properties from the grab bag
Sequence< PropertyValue > aGrabBag;
- Sequence< PropertyValue > aFillRefProperties;
- Sequence< PropertyValue > aLnRefProperties;
+ Sequence< PropertyValue > aFillRefProperties, aLnRefProperties, aEffectRefProperties;
mAny >>= aGrabBag;
for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i)
if( aGrabBag[i].Name == "StyleFillRef" )
aGrabBag[i].Value >>= aFillRefProperties;
else if( aGrabBag[i].Name == "StyleLnRef" )
aGrabBag[i].Value >>= aLnRefProperties;
+ else if( aGrabBag[i].Name == "StyleEffectRef" )
+ aGrabBag[i].Value >>= aEffectRefProperties;
WriteStyleProperties( XML_lnRef, aLnRefProperties );
WriteStyleProperties( XML_fillRef, aFillRefProperties );
+ WriteStyleProperties( XML_effectRef, aEffectRefProperties );
- // write mock <a:effectRef>
- mpFS->singleElementNS( XML_a, XML_effectRef, XML_idx, I32S( 0 ), FSEND );
// write mock <a:fontRef>
mpFS->singleElementNS( XML_a, XML_fontRef, XML_idx, "minor", FSEND );
}
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ae3125091761..6aa0ed81f24f 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2547,6 +2547,12 @@ DECLARE_OOXMLEXPORT_TEST(testShapeThemePreservation, "shape-theme-preservation.d
assertXPath(pXmlDocument,
"/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:lnRef/a:schemeClr/a:shade",
"val", "50000");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:effectRef",
+ "idx", "0");
+ assertXPath(pXmlDocument,
+ "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:style/a:effectRef/a:schemeClr",
+ "val", "accent1");
// check shape style hasn't been overwritten
assertXPath(pXmlDocument,