diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2023-06-04 18:53:36 +0200 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2023-06-28 17:32:28 +0200 |
commit | 2c09c15ffbc203c937594d5ec847d80e13045a96 (patch) | |
tree | 18d9fc369abc79b2fe9ed79e0da8814a91b57549 | |
parent | 4728edd282cdbe756ff39c06310f2937a9beb45c (diff) |
avoid some UNO querying
Change-Id: I5fa793ab979221252f66bdd38e6950c06a66b00a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152601
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/153587
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r-- | sc/source/filter/oox/commentsbuffer.cxx | 15 |
1 files changed, 7 insertions, 8 deletions
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& ) { |