summaryrefslogtreecommitdiff
path: root/oox/source/drawingml
diff options
context:
space:
mode:
authorJacobo Aragunde Pérez <jaragunde@igalia.com>2014-05-22 13:54:42 +0200
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2014-05-23 10:04:00 +0200
commit2e68a1468c035fc3bb4d02ad0b3187872fe1e67b (patch)
tree0bd5ccdee8253233ca7f919a70c5bd337b3b5a37 /oox/source/drawingml
parent642a252cf1a2f1d08c4bbfcae15527bb82c7664d (diff)
ooxml: Preserve the original picture in artistic effects
When Word applies an artistic effect, it creates two embedded files; one contains the bitmap with the effect and the other one contains the original bitmap to be able to undo the effect. This patch reads the original bitmap, stores it in the shape grab bag and saves it back to the docx file. Added unit tests too. TODO: right now, if two effects point to the same original bitmap it is stored twice, we should improve this. Change-Id: Ia72034a257739abe4ffafa0f42b2a912e4bf9436
Diffstat (limited to 'oox/source/drawingml')
-rw-r--r--oox/source/drawingml/fillproperties.cxx8
-rw-r--r--oox/source/drawingml/fillpropertiesgroupcontext.cxx13
2 files changed, 18 insertions, 3 deletions
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index a9ca0db37546..7d816758f459 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -608,7 +608,7 @@ css::beans::PropertyValue ArtisticEffectProperties::getEffect()
if( msName.isEmpty() )
return pRet;
- css::uno::Sequence< css::beans::PropertyValue > aSeq( maAttribs.size() );
+ css::uno::Sequence< css::beans::PropertyValue > aSeq( maAttribs.size() + 1 );
sal_uInt32 i = 0;
for( std::map< OUString, css::uno::Any >::iterator it = maAttribs.begin(); it != maAttribs.end(); ++it )
{
@@ -617,6 +617,12 @@ css::beans::PropertyValue ArtisticEffectProperties::getEffect()
i++;
}
+ if( mrOleObjectInfo.maEmbeddedData.hasElements() )
+ {
+ aSeq[i].Name = "OriginalGraphic";
+ aSeq[i].Value = uno::makeAny( mrOleObjectInfo.maEmbeddedData );
+ }
+
pRet.Name = msName;
pRet.Value = css::uno::Any( aSeq );
diff --git a/oox/source/drawingml/fillpropertiesgroupcontext.cxx b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
index e7e414277906..ac8f215a9d03 100644
--- a/oox/source/drawingml/fillpropertiesgroupcontext.cxx
+++ b/oox/source/drawingml/fillpropertiesgroupcontext.cxx
@@ -333,9 +333,18 @@ ContextHandlerRef ArtisticEffectContext::onCreateContext(
sal_Int32 nElement, const AttributeList& rAttribs )
{
// containers
- if( nElement == OOX_TOKEN( a14, imgLayer ) || nElement == OOX_TOKEN( a14, imgEffect ) )
+ if( nElement == OOX_TOKEN( a14, imgLayer ) )
+ {
+ if( rAttribs.hasAttribute( R_TOKEN( embed ) ) )
+ {
+ OUString aFragmentPath = getFragmentPathFromRelId( rAttribs.getString( R_TOKEN( embed ), OUString() ) );
+ if( !aFragmentPath.isEmpty() )
+ getFilter().importBinaryData( maEffect.mrOleObjectInfo.maEmbeddedData, aFragmentPath );
+ }
+ return new ArtisticEffectContext( *this, maEffect );
+ }
+ if( nElement == OOX_TOKEN( a14, imgEffect ) )
return new ArtisticEffectContext( *this, maEffect );
- // TODO: manage r:embed attribute in a14:imgLayer
// effects
maEffect.msName = ArtisticEffectProperties::getEffectString( nElement );