diff options
author | Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com> | 2019-03-08 12:45:24 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.com> | 2019-03-11 17:38:07 +0100 |
commit | dba1f992d0757b9c353dd41d55dd89ecafd70603 (patch) | |
tree | e52e80a41f8a56e41782bc78c22b281be6b664a1 /oox | |
parent | 4c4ccdf724dedebce23cc9abd7b74bee43f184d7 (diff) |
PPTX import: save SmartArt markup into InteropGrabBag
it will allow to preserve SmartArt when saving PPTX files
Change-Id: I9bb66c59d202b4ce426864599014d042d4aa04b0
Reviewed-on: https://gerrit.libreoffice.org/68916
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 35 | ||||
-rw-r--r-- | oox/source/ppt/pptshape.cxx | 4 |
2 files changed, 28 insertions, 11 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index e35a9b2e7703..0c522bdfe63e 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -283,8 +283,9 @@ void Shape::addShape( if( meFrameType == FRAMETYPE_DIAGRAM ) { + keepDiagramCompatibilityInfo(); if( !SvtFilterOptions::Get().IsSmartArt2Shape() ) - keepDiagramCompatibilityInfo( rFilterBase ); + convertSmartArtToMetafile( rFilterBase ); } } } @@ -1387,7 +1388,7 @@ Reference< XShape > const & Shape::createAndInsert( return mxShape; } -void Shape::keepDiagramCompatibilityInfo( XmlFilterBase const & rFilterBase ) +void Shape::keepDiagramCompatibilityInfo() { try { @@ -1418,21 +1419,33 @@ void Shape::keepDiagramCompatibilityInfo( XmlFilterBase const & rFilterBase ) xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) ); } else xSet->setPropertyValue( aGrabBagPropName, Any( maDiagramDoms ) ); + } + catch( const Exception& e ) + { + SAL_WARN( "oox.drawingml", "Shape::keepDiagramCompatibilityInfo: " << e ); + } +} - xSet->setPropertyValue( "MoveProtect", Any( true ) ); - xSet->setPropertyValue( "SizeProtect", Any( true ) ); +void Shape::convertSmartArtToMetafile(XmlFilterBase const & rFilterBase) +{ + try + { + Reference<XPropertySet> xSet(mxShape, UNO_QUERY_THROW); + + xSet->setPropertyValue("MoveProtect", Any(true)); + xSet->setPropertyValue("SizeProtect", Any(true)); // Replace existing shapes with a new Graphic Object rendered // from them - Reference < XShape > xShape( renderDiagramToGraphic( rFilterBase ) ); - Reference < XShapes > xShapes( mxShape, UNO_QUERY_THROW ); - while( xShapes->hasElements() ) - xShapes->remove( Reference < XShape > ( xShapes->getByIndex( 0 ), UNO_QUERY_THROW ) ); - xShapes->add( xShape ); + Reference<XShape> xShape(renderDiagramToGraphic(rFilterBase)); + Reference<XShapes> xShapes(mxShape, UNO_QUERY_THROW); + while (xShapes->hasElements()) + xShapes->remove(Reference<XShape>(xShapes->getByIndex(0), UNO_QUERY_THROW)); + xShapes->add(xShape); } - catch( const Exception& e ) + catch (const Exception& e) { - SAL_WARN( "oox.drawingml", "Shape::keepDiagramCompatibilityInfo: " << e ); + SAL_WARN("oox.drawingml", "Shape::convertSmartArtToMetafile: " << e); } } diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx index 362801b8c438..52f9d5236612 100644 --- a/oox/source/ppt/pptshape.cxx +++ b/oox/source/ppt/pptshape.cxx @@ -33,6 +33,7 @@ #include <sal/log.hxx> #include <oox/ppt/slidepersist.hxx> #include <oox/token/tokens.hxx> +#include <unotools/fltrcfg.hxx> using namespace ::oox::core; using namespace ::oox::drawingml; @@ -397,6 +398,9 @@ void PPTShape::addShape( Reference<XShapes> xShapes(xShape, UNO_QUERY); if (xShapes.is()) addChildren( rFilterBase, *this, pTheme, xShapes, pShapeMap, aTransformation ); + + if (meFrameType == FRAMETYPE_DIAGRAM) + keepDiagramCompatibilityInfo(); } } catch (const Exception&) |