diff options
author | Regina Henschel <rb.henschel@t-online.de> | 2022-10-25 17:37:04 +0200 |
---|---|---|
committer | Regina Henschel <rb.henschel@t-online.de> | 2022-10-26 00:40:00 +0200 |
commit | 17dfc9a9da009cc23d2222e3fb4e2cef9c97d581 (patch) | |
tree | f1b8ea03888404fa912bb9d47bf7b654f03d4985 /oox | |
parent | bb07b2e2dba871d8b5c5fb99ea3dbf176c756025 (diff) |
tdf#83671 SmartArt: preserve pos and size for metafile
Import of a SmartArt creates a group with a background shape and then
the SmartArt shapes. The background shape determines the position and
size of the group.
The method Shape::convertSmartArtToMetafile() replaces the existing
SmartArt shapes with a metafile object and thereby throws away the
background shape. Thus the group takes it size from the metafile object,
which has default size 100x100 (Hmm) and position 0|0.
The patch remembers the original size and position from the background
shape and applies it then to the metafile shape.
Change-Id: Id7b1ccd20b2597c5e2adca7294a994fd2e0e066f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141830
Tested-by: Jenkins
Reviewed-by: Regina Henschel <rb.henschel@t-online.de>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/drawingml/shape.cxx | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index e43b6b9ed5b0..7357e36f0481 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -1966,9 +1966,16 @@ void Shape::convertSmartArtToMetafile(XmlFilterBase const & rFilterBase) // from them Reference<XShape> xShape(renderDiagramToGraphic(rFilterBase)); Reference<XShapes> xShapes(mxShape, UNO_QUERY_THROW); + tools::Rectangle aBackgroundRect + = SdrObject::getSdrObjectFromXShape( + Reference<XShape>(xShapes->getByIndex(0), UNO_QUERY_THROW)) + ->GetLogicRect(); while (xShapes->hasElements()) xShapes->remove(Reference<XShape>(xShapes->getByIndex(0), UNO_QUERY_THROW)); xShapes->add(xShape); + SdrObject::getSdrObjectFromXShape( + Reference<XShape>(xShapes->getByIndex(0), UNO_QUERY_THROW)) + ->NbcSetLogicRect(aBackgroundRect); } catch (const Exception&) { |