summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorGrzegorz Araminowicz <grzegorz.araminowicz@collabora.com>2019-03-08 12:45:24 +0100
committerMiklos Vajna <vmiklos@collabora.com>2019-05-21 09:29:26 +0200
commit3807fb7c541632a4d21afba88c27865957036f0a (patch)
treecc8dc7048124f83ce009f32a4b05b14667cb2d2e /oox
parent5e3a3e7d37aecd353ebab78f24e7b32a66a7df83 (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> Reviewed-on: https://gerrit.libreoffice.org/72471
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx35
-rw-r--r--oox/source/ppt/pptshape.cxx4
2 files changed, 28 insertions, 11 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index d45a88a692cf..3e04f3b7494e 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -284,8 +284,9 @@ void Shape::addShape(
if( meFrameType == FRAMETYPE_DIAGRAM )
{
+ keepDiagramCompatibilityInfo();
if( !SvtFilterOptions::Get().IsSmartArt2Shape() )
- keepDiagramCompatibilityInfo( rFilterBase );
+ convertSmartArtToMetafile( rFilterBase );
}
}
}
@@ -1393,7 +1394,7 @@ Reference< XShape > const & Shape::createAndInsert(
return mxShape;
}
-void Shape::keepDiagramCompatibilityInfo( XmlFilterBase const & rFilterBase )
+void Shape::keepDiagramCompatibilityInfo()
{
try
{
@@ -1424,21 +1425,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 92c573b6f5ea..0121f8905e3d 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&)