include/oox/vml/vmlshape.hxx | 8 +++++--- oox/source/vml/vmlshape.cxx | 25 +++++++++++++------------ sc/source/filter/oox/commentsbuffer.cxx | 7 ++++++- 3 files changed, 24 insertions(+), 16 deletions(-)
New commits: commit 6945d031e759823ab52bdf077e43196b67f594a4 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Aug 11 11:37:28 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Aug 11 18:13:13 2023 +0200 move setting properties into note comments from oox to sc no change in behavior intended, the SdrCaption doesn't support the skipped conditions Change-Id: Id909ae4ed115c1ad3398d2a62c6432ff1dfde453 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155585 Tested-by: Jenkins Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index 2aa2163653de..e95e44053330 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -267,9 +267,11 @@ public: const css::uno::Reference< css::drawing::XShapes >& rxShapes, const ShapeParentAnchor* pParentAnchor = nullptr ) const; - /** Converts formatting into the passed existing XShape and returns position. */ - css::awt::Rectangle convertFormatting( - const css::uno::Reference< css::drawing::XShape >& rxShape ) const; + /** Returns bounds of Shape */ + css::awt::Rectangle getShapeRectangle() const; + + /** Collects common shape properties such as formatting attributes. */ + oox::drawingml::ShapePropertyMap makeShapePropertyMap() const; void setContainer(ShapeContainer* pContainer); ShapeContainer* getContainer() const; @@ -295,9 +297,6 @@ protected: css::awt::Rectangle calcShapeRectangle( const ShapeParentAnchor* pParentAnchor ) const; - /** Collects common shape properties such as formatting attributes. */ - oox::drawingml::ShapePropertyMap makeShapePropertyMap() const; - /** Converts common shape properties such as formatting attributes. */ void convertShapeProperties( const css::uno::Reference< css::drawing::XShape >& rxShape ) const; diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index c297fc1563bb..81ba42ba0a48 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -484,20 +484,11 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS return xShape; } -awt::Rectangle ShapeBase::convertFormatting( const Reference< XShape >& rxShape ) const +awt::Rectangle ShapeBase::getShapeRectangle() const { - if( !rxShape.is() ) - return awt::Rectangle(); - /* Calculate shape rectangle. Applications may do something special according to some imported shape client data (e.g. Excel cell anchor). */ - awt::Rectangle aShapeRect = calcShapeRectangle( nullptr ); - - // convert the shape, if the calculated rectangle is not empty - if( (aShapeRect.Width > 0) || (aShapeRect.Height > 0) ) - convertShapeProperties( rxShape ); - - return aShapeRect; + return calcShapeRectangle(nullptr); } void ShapeBase::setContainer(ShapeContainer* pContainer) { mpContainer = pContainer; } diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 555ddad3a924..55bcb7e2cc73 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/text/XText.hpp> #include <osl/diagnose.h> +#include <oox/drawingml/shapepropertymap.hxx> #include <oox/helper/attributelist.hxx> #include <oox/vml/vmlshape.hxx> #include <addressconverter.hxx> @@ -183,11 +184,15 @@ void Comment::finalizeImport() if( const ::oox::vml::ShapeBase* pVmlNoteShape = getVmlDrawing().getNoteShape( maModel.maRange.aStart ) ) { // position and formatting - css::awt::Rectangle aShapeRect = pVmlNoteShape->convertFormatting(xAnnoShape); + css::awt::Rectangle aShapeRect = pVmlNoteShape->getShapeRectangle(); 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)); + + ::oox::drawingml::ShapePropertyMap aPropMap(pVmlNoteShape->makeShapePropertyMap()); + css::uno::Reference<css::drawing::XShape> xShape(xAnnoShape); + PropertySet(xShape).setProperties(aPropMap); } // visibility bVisible = pVmlNoteShape->getTypeModel().mbVisible; commit c88855c45a675cf28e2cfe4fa261c2b0339f5898 Author: Caolán McNamara <[email protected]> AuthorDate: Fri Aug 11 11:15:22 2023 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Aug 11 18:13:04 2023 +0200 split ShapeBase::convertShapeProperties into two parts Change-Id: I62f42e54c776f15ea83c5fc861bb4f4ff899e891 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155584 Tested-by: Caolán McNamara <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> diff --git a/include/oox/vml/vmlshape.hxx b/include/oox/vml/vmlshape.hxx index 8c63d8cbd26c..2aa2163653de 100644 --- a/include/oox/vml/vmlshape.hxx +++ b/include/oox/vml/vmlshape.hxx @@ -295,6 +295,9 @@ protected: css::awt::Rectangle calcShapeRectangle( const ShapeParentAnchor* pParentAnchor ) const; + /** Collects common shape properties such as formatting attributes. */ + oox::drawingml::ShapePropertyMap makeShapePropertyMap() const; + /** Converts common shape properties such as formatting attributes. */ void convertShapeProperties( const css::uno::Reference< css::drawing::XShape >& rxShape ) const; diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 328abeba7875..c297fc1563bb 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -517,16 +517,23 @@ awt::Rectangle ShapeBase::calcShapeRectangle( const ShapeParentAnchor* pParentAn return aShapeRect; } -void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) const +::oox::drawingml::ShapePropertyMap ShapeBase::makeShapePropertyMap() const { ::oox::drawingml::ShapePropertyMap aPropMap( mrDrawing.getFilter().getModelObjectHelper() ); const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); maTypeModel.maStrokeModel.pushToPropMap( aPropMap, rGraphicHelper ); maTypeModel.maFillModel.pushToPropMap( aPropMap, rGraphicHelper ); + return aPropMap; +} + +void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) const +{ + ::oox::drawingml::ShapePropertyMap aPropMap(makeShapePropertyMap()); uno::Reference<lang::XServiceInfo> xSInfo(rxShape, uno::UNO_QUERY_THROW); if (xSInfo->supportsService("com.sun.star.text.TextFrame")) { + const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); // Any other service supporting the ShadowFormat property? maTypeModel.maShadowModel.pushToPropMap(aPropMap, rGraphicHelper); // TextFrames have BackColor, not FillColor @@ -564,7 +571,10 @@ void ShapeBase::convertShapeProperties( const Reference< XShape >& rxShape ) con } } else if (xSInfo->supportsService("com.sun.star.drawing.CustomShape")) + { + const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); maTypeModel.maTextpathModel.pushToPropMap(aPropMap, rxShape, rGraphicHelper); + } PropertySet( rxShape ).setProperties( aPropMap ); }
