sc/source/filter/oox/commentsbuffer.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
New commits: commit 2c09c15ffbc203c937594d5ec847d80e13045a96 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Sun Jun 4 18:53:36 2023 +0200 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Wed Jun 28 17:32:28 2023 +0200 avoid some UNO querying Change-Id: I5fa793ab979221252f66bdd38e6950c06a66b00a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152601 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153587 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 7dbd5c942e30..5f24cf4cdde2 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -31,6 +31,7 @@ #include <svx/sdtaitm.hxx> #include <svx/svdocapt.hxx> #include <tools/diagnose_ex.h> +#include <svx/unoshape.hxx> #include <document.hxx> #include <drwlayer.hxx> #include <cellsuno.hxx> @@ -162,12 +163,11 @@ void Comment::finalizeImport() ScPostIt* pPostIt = pDocShell->GetDocFunc().ImportNote( maModel.maRange.aStart, OUString( ' ' ) ); SdrCaptionObj* pCaption = pPostIt->GetOrCreateCaption( maModel.maRange.aStart ); - Reference< XShape > xAnnoShape( pCaption->getUnoShape() ); // SvxShapeText + rtl::Reference< SvxShapeText > xAnnoShape( dynamic_cast<SvxShapeText*>(pCaption->getUnoShape().get() ) ); // SvxShapeText // setting a property triggers expensive process, so set them all at once - Reference< css::beans::XMultiPropertySet > xAnnoShapeMultiPropSet(xAnnoShape, UNO_QUERY_THROW); // Add shape formatting properties (autoFill, colHidden and rowHidden are dropped) - xAnnoShapeMultiPropSet->setPropertyValues( + static_cast<SvxShape*>(xAnnoShape.get())->setPropertyValues( Sequence<OUString> { "TextFitToSize", "MoveProtect", "TextHorizontalAdjust", "TextVerticalAdjust" }, Sequence<Any> { Any(maModel.mbAutoScale), Any(maModel.mbLocked), Any(lcl_ToHorizAlign( maModel.mnTHA )), Any(lcl_ToVertAlign( maModel.mnTVA )) }); @@ -188,7 +188,7 @@ void Comment::finalizeImport() // Setting comment text alignment const ::oox::vml::ClientData* xClientData = pVmlNoteShape->getClientData(); - xAnnoShapeMultiPropSet->setPropertyValues( + static_cast<SvxShape*>(xAnnoShape.get())->setPropertyValues( Sequence<OUString> { "TextVerticalAdjust", "ParaAdjust" }, Sequence<Any> { Any(lcl_ToVertAlign( xClientData->mnTextVAlign )), Any(lcl_ToParaAlign( xClientData->mnTextHAlign )) }); } @@ -197,11 +197,10 @@ void Comment::finalizeImport() // insert text and convert text formatting maModel.mxText->finalizeImport(*this); - Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW ); - Reference< css::document::XActionLockable > xAnnoLock( xAnnoShape, UNO_QUERY_THROW ); - xAnnoLock->addActionLock(); + Reference< XText > xAnnoText( xAnnoShape ); + xAnnoShape->addActionLock(); maModel.mxText->convert( xAnnoText ); - xAnnoLock->removeActionLock(); + xAnnoShape->removeActionLock(); } catch( Exception& ) {