diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-11 10:46:53 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-08-11 18:12:47 +0200 |
commit | 5aeb15e95d26ce6de28eb5f5933324828d553f41 (patch) | |
tree | 02ec28c990d4c0caf2fbb8e89f192d94082be412 | |
parent | de20853e5243843ac9f4c5927ce0b4cf0e407c15 (diff) |
refactor to return the position to be set by the caller instead
no change in behavior intended
Change-Id: I32043bdf1d29521d8503df315fa786236e272f7d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155580
Tested-by: Caolán McNamara <caolan.mcnamara@collabora.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | include/oox/vml/vmlshape.hxx | 4 | ||||
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 10 | ||||
-rw-r--r-- | sc/source/filter/oox/commentsbuffer.cxx | 7 |
3 files changed, 12 insertions, 9 deletions
diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index d46c23282324..8c63d8cbd26c 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -267,8 +267,8 @@ public: const css::uno::Reference< css::drawing::XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor = nullptr ) const; - /** Converts position and formatting into the passed existing XShape. */ - void convertFormatting( + /** Converts formatting into the passed existing XShape and returns position. */ + css::awt::Rectangle convertFormatting( const css::uno::Reference< css::drawing::XShape >& rxShape ) const; void setContainer(ShapeContainer* pContainer); diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 607ddf5354b4..328abeba7875 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -484,10 +484,10 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS return xShape; } -void ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const +awt::Rectangle ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const { if( !rxShape.is() ) - return; + return awt::Rectangle(); /* Calculate shape rectangle. Applications may do something special according to some imported shape client data (e.g. Excel cell anchor). */ @@ -495,11 +495,9 @@ void ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const // convert the shape, if the calculated rectangle is not empty if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) ) - { - rxShape->setPosition( awt::Point( aShapeRect.X, aShapeRect.Y ) ); - rxShape->setSize( awt::Size( aShapeRect.Width, aShapeRect.Height ) ); convertShapeProperties( rxShape ); - } + + return aShapeRect; } void ShapeBase::setContainer(ShapeContainer* pContainer) { mpContainer = pContainer; } diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 05deae3ee876..555ddad3a924 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -183,7 +183,12 @@ void Comment::finalizeImport() if( const ::oox::vml::ShapeBase* pVmlNoteShape = getVmlDrawing().getNoteShape( maModel.maRange.aStart ) ) { // position and formatting - pVmlNoteShape->convertFormatting( xAnnoShape ); + css::awt::Rectangle aShapeRect = pVmlNoteShape->convertFormatting(xAnnoShape); + if (aShapeRect.Width > 0 || aShapeRect.Height > 0) + { + xAnnoShape->setPosition(css::awt::Point(aShapeRect.X, aShapeRect.Y)); + xAnnoShape->setSize(css::awt::Size(aShapeRect.Width, aShapeRect.Height)); + } // visibility bVisible = pVmlNoteShape->getTypeModel().mbVisible; |