include/svx/svdoashp.hxx | 2 +- include/svx/svdobj.hxx | 11 ++++++----- oox/source/drawingml/diagram/diagram.cxx | 2 +- reportdesign/inc/RptObject.hxx | 14 +++++++------- reportdesign/source/core/sdr/RptObject.cxx | 26 +++++++++++++------------- sc/source/filter/oox/commentsbuffer.cxx | 2 +- sc/source/ui/drawfunc/chartsh.cxx | 2 +- svx/source/dialog/signaturelinehelper.cxx | 1 + svx/source/svdraw/svdoashp.cxx | 2 +- svx/source/svdraw/svdobj.cxx | 12 ++++++------ svx/source/unodraw/unoshape.cxx | 2 +- sw/source/core/doc/textboxhelper.cxx | 4 ++-- sw/source/filter/ww8/docxattributeoutput.cxx | 2 +- sw/source/filter/ww8/docxsdrexport.cxx | 6 ++---- 14 files changed, 44 insertions(+), 44 deletions(-)
New commits: commit 7a61256f9e68201ef7b331ca3e1b4c3302104631 Author: Noel Grandin <n...@peralex.com> AuthorDate: Sat Nov 6 20:58:54 2021 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Nov 7 07:29:38 2021 +0100 return XShape from SdrObject::getUnoShape instead of XInterface, to make it obvious what the reality of the requirement is Change-Id: Icdd4113f2a0ece930305f4d8ba010b81d24f43c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124802 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/include/svx/svdoashp.hxx b/include/svx/svdoashp.hxx index bb0d3446292e..2411931e4a39 100644 --- a/include/svx/svdoashp.hxx +++ b/include/svx/svdoashp.hxx @@ -80,7 +80,7 @@ private: protected: virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override; - virtual void impl_setUnoShape(const css::uno::Reference<css::uno::XInterface>& rxUnoShape) override; + virtual void impl_setUnoShape(const css::uno::Reference<css::drawing::XShape>& rxUnoShape) override; public: virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override; diff --git a/include/svx/svdobj.hxx b/include/svx/svdobj.hxx index a5aa10aa7c66..fe050c0d0157 100644 --- a/include/svx/svdobj.hxx +++ b/include/svx/svdobj.hxx @@ -88,6 +88,7 @@ namespace sdr::properties { class BaseProperties; } namespace sdr::contact { class ViewContact; } namespace svx { class PropertyChangeNotifier; } +namespace com::sun::star::drawing { class XShape; } struct SVXCORE_DLLPUBLIC SdrObjectFreeOp; @@ -768,7 +769,7 @@ public: void DeleteUserData(sal_uInt16 nNum); // access to the UNO representation of the shape - virtual css::uno::Reference< css::uno::XInterface > getUnoShape(); + virtual css::uno::Reference< css::drawing::XShape > getUnoShape(); static SdrObject* getSdrObjectFromXShape( const css::uno::Reference< css::uno::XInterface >& xInt ); @@ -861,9 +862,9 @@ public: // done by impl_setUnoShape(). // Calling this function is only allowed for the UNO representation // itself! - void setUnoShape( const css::uno::Reference<css::uno::XInterface>& _rxUnoShape); + void setUnoShape( const css::uno::Reference<css::drawing::XShape>& _rxUnoShape); - const css::uno::WeakReference< css::uno::XInterface >& getWeakUnoShape() const { return maWeakUnoShape; } + const css::uno::WeakReference< css::drawing::XShape >& getWeakUnoShape() const { return maWeakUnoShape; } void setSuitableOutlinerBg(Outliner& rOutliner) const; // If fillstyle is drawing::FillStyle_BITMAP, returns the graphic. @@ -944,7 +945,7 @@ protected: /// /// The implementation _must_ call the same method of its parent /// class (preferably as the first step)! - virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& _rxUnoShape ); + virtual void impl_setUnoShape( const css::uno::Reference< css::drawing::XShape >& _rxUnoShape ); const SfxItemSet* getBackgroundFillSet() const; @@ -970,7 +971,7 @@ private: // do not use directly, always use getSvxShape() if you have to! SvxShape* mpSvxShape; - css::uno::WeakReference< css::uno::XInterface > + css::uno::WeakReference< css::drawing::XShape > maWeakUnoShape; // HACK: Do not automatically insert newly created object into a page. // The user needs to do it manually later. diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx index 28c79e8cbd60..13fc4aa26b3b 100644 --- a/oox/source/drawingml/diagram/diagram.cxx +++ b/oox/source/drawingml/diagram/diagram.cxx @@ -417,7 +417,7 @@ void reloadDiagram(SdrObject* pObj, core::XmlFilterBase& rFilter) pObj->getChildrenOfSdrObject()->ClearSdrObjList(); - uno::Reference<css::drawing::XShape> xShape(pObj->getUnoShape(), uno::UNO_QUERY_THROW); + uno::Reference<css::drawing::XShape> xShape(pObj->getUnoShape()); uno::Reference<beans::XPropertySet> xPropSet(xShape, uno::UNO_QUERY_THROW); uno::Reference<xml::dom::XDocument> layoutDom; diff --git a/reportdesign/inc/RptObject.hxx b/reportdesign/inc/RptObject.hxx index 732d70947654..db60d2ba9ff8 100644 --- a/reportdesign/inc/RptObject.hxx +++ b/reportdesign/inc/RptObject.hxx @@ -83,7 +83,7 @@ protected: /** called by instances of derived classes to implement their overriding of getUnoShape */ - css::uno::Reference< css::uno::XInterface > + css::uno::Reference< css::drawing::XShape > getUnoShapeOf( SdrObject& _rSdrObject ); private: @@ -138,12 +138,12 @@ public: virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override; - virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override; + virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override; virtual SdrObjKind GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; private: - virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& rxUnoShape ) override; + virtual void impl_setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override; OCustomShape( SdrModel& rSdrModel, @@ -183,7 +183,7 @@ public: virtual css::uno::Reference< css::beans::XPropertySet> getAwtComponent() override; - virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override; + virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override; virtual SdrObjKind GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; // Clone() should make a complete copy of the object. @@ -212,7 +212,7 @@ private: virtual SdrPage* GetImplPage() const override; void impl_createDataProvider_nothrow( const css::uno::Reference< css::frame::XModel>& _xModel); - virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& rxUnoShape ) override; + virtual void impl_setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override; SdrObjKind m_nType; bool m_bOnlyOnce; @@ -266,13 +266,13 @@ public: static OUString GetDefaultName(const OUnoObject* _pObj); - virtual css::uno::Reference< css::uno::XInterface > getUnoShape() override; + virtual css::uno::Reference< css::drawing::XShape > getUnoShape() override; virtual SdrObjKind GetObjIdentifier() const override; virtual SdrInventor GetObjInventor() const override; virtual OUnoObject* CloneSdrObject(SdrModel& rTargetModel) const override; private: - virtual void impl_setUnoShape( const css::uno::Reference< css::uno::XInterface >& rxUnoShape ) override; + virtual void impl_setUnoShape( const css::uno::Reference< css::drawing::XShape >& rxUnoShape ) override; void impl_initializeModel_nothrow(); }; diff --git a/reportdesign/source/core/sdr/RptObject.cxx b/reportdesign/source/core/sdr/RptObject.cxx index 75ba20f61479..284fc4c9c5ae 100644 --- a/reportdesign/source/core/sdr/RptObject.cxx +++ b/reportdesign/source/core/sdr/RptObject.cxx @@ -436,9 +436,9 @@ void OObjectBase::ensureSdrObjectOwnership( const uno::Reference< uno::XInterfac } -uno::Reference< uno::XInterface > OObjectBase::getUnoShapeOf( SdrObject& _rSdrObject ) +uno::Reference< drawing::XShape > OObjectBase::getUnoShapeOf( SdrObject& _rSdrObject ) { - uno::Reference< uno::XInterface > xShape( _rSdrObject.getWeakUnoShape() ); + uno::Reference< drawing::XShape > xShape( _rSdrObject.getWeakUnoShape() ); if ( xShape.is() ) return xShape; @@ -458,7 +458,7 @@ OCustomShape::OCustomShape( : SdrObjCustomShape(rSdrModel) ,OObjectBase(_xComponent) { - impl_setUnoShape( uno::Reference< uno::XInterface >(_xComponent,uno::UNO_QUERY) ); + impl_setUnoShape( uno::Reference< drawing::XShape >(_xComponent,uno::UNO_QUERY_THROW) ); m_bIsListening = true; } @@ -551,9 +551,9 @@ uno::Reference< beans::XPropertySet> OCustomShape::getAwtComponent() } -uno::Reference< uno::XInterface > OCustomShape::getUnoShape() +uno::Reference< drawing::XShape > OCustomShape::getUnoShape() { - uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this ); + uno::Reference<drawing::XShape> xShape = OObjectBase::getUnoShapeOf( *this ); if ( !m_xReportComponent.is() ) { OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); @@ -563,7 +563,7 @@ uno::Reference< uno::XInterface > OCustomShape::getUnoShape() return xShape; } -void OCustomShape::impl_setUnoShape( const uno::Reference< uno::XInterface >& rxUnoShape ) +void OCustomShape::impl_setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShape ) { SdrObjCustomShape::impl_setUnoShape( rxUnoShape ); releaseUnoShape(); @@ -612,7 +612,7 @@ OUnoObject::OUnoObject( // tdf#119067 ,m_bSetDefaultLabel(false) { - impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) ); + impl_setUnoShape( uno::Reference< drawing::XShape >( _xComponent, uno::UNO_QUERY_THROW ) ); if ( !rModelName.isEmpty() ) impl_initializeModel_nothrow(); @@ -889,12 +889,12 @@ uno::Reference< beans::XPropertySet> OUnoObject::getAwtComponent() } -uno::Reference< uno::XInterface > OUnoObject::getUnoShape() +uno::Reference< drawing::XShape > OUnoObject::getUnoShape() { return OObjectBase::getUnoShapeOf( *this ); } -void OUnoObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& rxUnoShape ) +void OUnoObject::impl_setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShape ) { SdrUnoObj::impl_setUnoShape( rxUnoShape ); releaseUnoShape(); @@ -915,7 +915,7 @@ OOle2Obj::OOle2Obj( ,m_nType(_nType) ,m_bOnlyOnce(true) { - impl_setUnoShape( uno::Reference< uno::XInterface >( _xComponent, uno::UNO_QUERY ) ); + impl_setUnoShape( uno::Reference< drawing::XShape >( _xComponent, uno::UNO_QUERY_THROW ) ); m_bIsListening = true; } @@ -1078,9 +1078,9 @@ uno::Reference< beans::XPropertySet> OOle2Obj::getAwtComponent() } -uno::Reference< uno::XInterface > OOle2Obj::getUnoShape() +uno::Reference< drawing::XShape > OOle2Obj::getUnoShape() { - uno::Reference< uno::XInterface> xShape = OObjectBase::getUnoShapeOf( *this ); + uno::Reference< drawing::XShape> xShape = OObjectBase::getUnoShapeOf( *this ); if ( !m_xReportComponent.is() ) { OReportModel& rRptModel(static_cast< OReportModel& >(getSdrModelFromSdrObject())); @@ -1090,7 +1090,7 @@ uno::Reference< uno::XInterface > OOle2Obj::getUnoShape() return xShape; } -void OOle2Obj::impl_setUnoShape( const uno::Reference< uno::XInterface >& rxUnoShape ) +void OOle2Obj::impl_setUnoShape( const uno::Reference< drawing::XShape >& rxUnoShape ) { SdrOle2Obj::impl_setUnoShape( rxUnoShape ); releaseUnoShape(); diff --git a/sc/source/filter/oox/commentsbuffer.cxx b/sc/source/filter/oox/commentsbuffer.cxx index 90c93f8019be..b4e6c7f48cb1 100644 --- a/sc/source/filter/oox/commentsbuffer.cxx +++ b/sc/source/filter/oox/commentsbuffer.cxx @@ -162,7 +162,7 @@ void Comment::finalizeImport() ScPostIt* pPostIt = pDocShell->GetDocFunc().ImportNote( maModel.maRange.aStart, OUString( ' ' ) ); SdrCaptionObj* pCaption = pPostIt->GetOrCreateCaption( maModel.maRange.aStart ); - Reference< XShape > xAnnoShape( pCaption->getUnoShape(), UNO_QUERY_THROW ); // SvxShapeText + Reference< XShape > xAnnoShape( pCaption->getUnoShape() ); // SvxShapeText // setting a property triggers expensive process, so set them all at once Reference< css::beans::XMultiPropertySet > xAnnoShapeMultiPropSet(xAnnoShape, UNO_QUERY_THROW); diff --git a/sc/source/ui/drawfunc/chartsh.cxx b/sc/source/ui/drawfunc/chartsh.cxx index d93b4a4d4249..e1fc24eecf74 100644 --- a/sc/source/ui/drawfunc/chartsh.cxx +++ b/sc/source/ui/drawfunc/chartsh.cxx @@ -137,7 +137,7 @@ void ScChartShell::ExecuteExportAsGraphic( SfxRequest& ) if( dynamic_cast<const SdrOle2Obj*>( pObject) ) { vcl::Window* pWin = GetViewData().GetActiveWin(); - Reference< drawing::XShape > xSourceDoc( pObject->getUnoShape(), UNO_QUERY_THROW ); + Reference< drawing::XShape > xSourceDoc( pObject->getUnoShape() ); GraphicHelper::SaveShapeAsGraphic(pWin ? pWin->GetFrameWeld() : nullptr, xSourceDoc); } } diff --git a/svx/source/dialog/signaturelinehelper.cxx b/svx/source/dialog/signaturelinehelper.cxx index 52bead204d28..560b5effd732 100644 --- a/svx/source/dialog/signaturelinehelper.cxx +++ b/svx/source/dialog/signaturelinehelper.cxx @@ -9,6 +9,7 @@ #include <svx/signaturelinehelper.hxx> +#include <com/sun/star/drawing/XShape.hpp> #include <com/sun/star/graphic/GraphicProvider.hpp> #include <com/sun/star/security/DocumentDigitalSignatures.hpp> diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 15eed6733ab0..ffbfe6456e54 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -3213,7 +3213,7 @@ void SdrObjCustomShape::InvalidateRenderGeometry() mpLastShadowGeometry = nullptr; } -void SdrObjCustomShape::impl_setUnoShape(const uno::Reference<uno::XInterface>& rxUnoShape) +void SdrObjCustomShape::impl_setUnoShape(const uno::Reference<drawing::XShape>& rxUnoShape) { SdrTextObj::impl_setUnoShape(rxUnoShape); diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 1191a8784e08..4c8b9d142197 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -494,7 +494,7 @@ void SdrObject::Free( SdrObject*& _rpObject ) try { pShape->InvalidateSdrObject(); - uno::Reference< lang::XComponent > xShapeComp( pObject->getWeakUnoShape(), uno::UNO_QUERY_THROW ); + uno::Reference< lang::XComponent > xShapeComp( pObject->getWeakUnoShape().get(), uno::UNO_QUERY_THROW ); xShapeComp->dispose(); } catch( const uno::Exception& ) @@ -2797,7 +2797,7 @@ void SdrObject::SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle& } } -void SdrObject::impl_setUnoShape( const uno::Reference< uno::XInterface >& _rxUnoShape ) +void SdrObject::impl_setUnoShape( const uno::Reference< drawing::XShape >& _rxUnoShape ) { const uno::Reference< uno::XInterface>& xOldUnoShape( maWeakUnoShape ); // the UNO shape would be gutted by the following code; return early @@ -2853,10 +2853,10 @@ SvxShape* SdrObject::getSvxShape() return mpSvxShape; } -css::uno::Reference< css::uno::XInterface > SdrObject::getUnoShape() +css::uno::Reference< css::drawing::XShape > SdrObject::getUnoShape() { // try weak reference first - uno::Reference< uno::XInterface > xShape( getWeakUnoShape() ); + uno::Reference< css::drawing::XShape > xShape( getWeakUnoShape() ); if( xShape ) return xShape; @@ -2932,13 +2932,13 @@ css::uno::Reference< css::uno::XInterface > SdrObject::getUnoShape() // using this fallback (!) - what a bad trap rtl::Reference<SvxShape> xNewShape = SvxDrawPage::CreateShapeByTypeAndInventor( GetObjIdentifier(), GetObjInventor(), this ); mpSvxShape = xNewShape.get(); - maWeakUnoShape = xShape = static_cast< ::cppu::OWeakObject* >( mpSvxShape ); + maWeakUnoShape = xShape = mpSvxShape; } return xShape; } -void SdrObject::setUnoShape(const uno::Reference<uno::XInterface >& _rxUnoShape) +void SdrObject::setUnoShape(const uno::Reference<drawing::XShape >& _rxUnoShape) { impl_setUnoShape( _rxUnoShape ); } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index c7fc27260744..5965bb11cd2a 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -344,7 +344,7 @@ void SvxShape::impl_initFromSdrObject() osl_atomic_increment( &m_refCount ); { - GetSdrObject()->setUnoShape(*this); + GetSdrObject()->setUnoShape(this); } osl_atomic_decrement( &m_refCount ); diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx index d6b49f81df75..418c69927228 100644 --- a/sw/source/core/doc/textboxhelper.cxx +++ b/sw/source/core/doc/textboxhelper.cxx @@ -77,7 +77,7 @@ void SwTextBoxHelper::create(SwFrameFormat* pShape, SdrObject* pObject, bool bCo { if (pObject) { - uno::Reference<text::XText> xSrcCnt(pObject->getWeakUnoShape(), uno::UNO_QUERY); + uno::Reference<text::XText> xSrcCnt(pObject->getWeakUnoShape().get(), uno::UNO_QUERY); auto xCur = xSrcCnt->createTextCursor(); xCur->gotoStart(false); xCur->gotoEnd(true); @@ -254,7 +254,7 @@ bool SwTextBoxHelper::hasTextFrame(const SdrObject* pObj) if (!pObj) return false; - uno::Reference<drawing::XShape> xShape(pObj->getWeakUnoShape(), uno::UNO_QUERY); + uno::Reference<drawing::XShape> xShape(pObj->getWeakUnoShape().get(), uno::UNO_QUERY); if (!xShape) return false; return SwTextBoxHelper::getOtherTextBoxFormat(xShape); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index ef525f45e816..035e1e8e4d62 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2804,7 +2804,7 @@ void DocxAttributeOutput::GetSdtEndBefore(const SdrObject* pSdrObj) if (!pSdrObj) return; - uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObj)->getUnoShape(), uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObj)->getUnoShape()); uno::Reference< beans::XPropertySet > xPropSet( xShape, uno::UNO_QUERY ); if( !xPropSet.is() ) return; diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx index 0e07d34ed40e..3b25c0c0c608 100644 --- a/sw/source/filter/ww8/docxsdrexport.cxx +++ b/sw/source/filter/ww8/docxsdrexport.cxx @@ -1398,8 +1398,7 @@ static bool lcl_isLockedCanvas(const uno::Reference<drawing::XShape>& xShape) void DocxSdrExport::writeDMLDrawing(const SdrObject* pSdrObject, const SwFrameFormat* pFrameFormat, int nAnchorId) { - uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape(), - uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pSdrObject)->getUnoShape()); if (!Impl::isSupportedDMLShape(xShape)) return; @@ -1588,8 +1587,7 @@ void DocxSdrExport::writeDMLAndVMLDrawing(const SdrObject* sdrObj, // Depending on the shape type, we actually don't write the shape as DML. OUString sShapeType; ShapeFlag nMirrorFlags = ShapeFlag::NONE; - uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape(), - uno::UNO_QUERY_THROW); + uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(sdrObj)->getUnoShape()); MSO_SPT eShapeType = EscherPropertyContainer::GetCustomShapeType(xShape, nMirrorFlags, sShapeType);