From 082d46908533dc254018fa8f5d517b025bb2fca4 Mon Sep 17 00:00:00 2001 From: Xisco Fauli Date: Mon, 6 Jun 2016 01:00:14 +0200 Subject: tdf#89329: use unique_ptr for pImpl in svdoole2 Change-Id: Ie189576336e0670102d7675b59f30e3fc357671d Reviewed-on: https://gerrit.libreoffice.org/25942 Tested-by: Jenkins Reviewed-by: Noel Grandin --- svx/source/svdraw/svdoole2.cxx | 69 ------------------------------------------ 1 file changed, 69 deletions(-) (limited to 'svx') diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 0b8116e212e1..793ecdb29b30 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -167,7 +167,6 @@ private: virtual uno::Reference< awt::XWindow > SAL_CALL getWindow() throw ( uno::RuntimeException, std::exception ) override; }; - SdrLightEmbeddedClient_Impl::SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj ) : mpObj( pObj ) { @@ -185,7 +184,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::changingState( const css::lang::Event { } - void SdrLightEmbeddedClient_Impl::Release() { { @@ -196,7 +194,6 @@ void SdrLightEmbeddedClient_Impl::Release() release(); } - void SAL_CALL SdrLightEmbeddedClient_Impl::stateChanged( const css::lang::EventObject& /*aEvent*/, ::sal_Int32 nOldState, ::sal_Int32 nNewState ) throw (css::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; @@ -212,7 +209,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::stateChanged( const css::lang::EventO } } - void SAL_CALL SdrLightEmbeddedClient_Impl::disposing( const css::lang::EventObject& /*aEvent*/ ) throw (css::uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; @@ -220,7 +216,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::disposing( const css::lang::EventObje GetSdrGlobalData().GetOLEObjCache().RemoveObj(mpObj); } - void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObject& aEvent ) throw( uno::RuntimeException, std::exception ) { // TODO/LATER: when writer uses this implementation the code could be shared with SfxInPlaceClient_Impl @@ -286,7 +281,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::notifyEvent( const document::EventObj } } - void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject() throw ( embed::ObjectSaveVetoException, uno::Exception, @@ -313,7 +307,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::saveObject() xModifiable->setModified( true ); } - void SAL_CALL SdrLightEmbeddedClient_Impl::visibilityChanged( sal_Bool /*bVisible*/ ) throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -334,7 +327,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::visibilityChanged( sal_Bool /*bVisibl } } - uno::Reference< util::XCloseable > SAL_CALL SdrLightEmbeddedClient_Impl::getComponent() throw ( uno::RuntimeException, std::exception ) { @@ -364,14 +356,12 @@ sal_Bool SAL_CALL SdrLightEmbeddedClient_Impl::canInplaceActivate() return bRet; } - void SAL_CALL SdrLightEmbeddedClient_Impl::activatingInplace() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) { } - void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -417,14 +407,12 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::activatingUI() } // for(sal_Int32 i = nCount-1 ; i >= 0;--i) } - void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedInplace() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) { } - void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedUI() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -439,7 +427,6 @@ void SAL_CALL SdrLightEmbeddedClient_Impl::deactivatedUI() } } - uno::Reference< css::frame::XLayoutManager > SAL_CALL SdrLightEmbeddedClient_Impl::getLayoutManager() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -459,7 +446,6 @@ uno::Reference< css::frame::XLayoutManager > SAL_CALL SdrLightEmbeddedClient_Imp return xMan; } - uno::Reference< frame::XDispatchProvider > SAL_CALL SdrLightEmbeddedClient_Impl::getInplaceDispatchProvider() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -468,7 +454,6 @@ uno::Reference< frame::XDispatchProvider > SAL_CALL SdrLightEmbeddedClient_Impl: return uno::Reference < frame::XDispatchProvider >( lcl_getFrame_throw(mpObj), uno::UNO_QUERY_THROW ); } - awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getPlacement() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -487,7 +472,6 @@ awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getPlacement() return AWTRectangle( aLogicRect ); } - awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getClipRectangle() throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) @@ -495,21 +479,18 @@ awt::Rectangle SAL_CALL SdrLightEmbeddedClient_Impl::getClipRectangle() return getPlacement(); } - void SAL_CALL SdrLightEmbeddedClient_Impl::translateAccelerators( const uno::Sequence< awt::KeyEvent >& /*aKeys*/ ) throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) { } - void SAL_CALL SdrLightEmbeddedClient_Impl::scrollObject( const awt::Size& /*aOffset*/ ) throw ( embed::WrongStateException, uno::RuntimeException, std::exception ) { } - void SAL_CALL SdrLightEmbeddedClient_Impl::changedPlacement( const awt::Rectangle& aPosRect ) throw ( embed::WrongStateException, uno::Exception, @@ -588,7 +569,6 @@ void SdrLightEmbeddedClient_Impl::setWindow(const uno::Reference< awt::XWindow > m_xWindow = _xWindow; } - class SdrEmbedObjectLink : public sfx2::SvBaseLink { SdrOle2Obj* pObj; @@ -604,7 +584,6 @@ public: bool Connect() { return GetRealObject() != nullptr; } }; - SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject): ::sfx2::SvBaseLink( ::SfxLinkUpdateMode::ONCALL, SotClipboardFormatId::SVXB ), pObj(pObject) @@ -612,12 +591,10 @@ SdrEmbedObjectLink::SdrEmbedObjectLink(SdrOle2Obj* pObject): SetSynchron( false ); } - SdrEmbedObjectLink::~SdrEmbedObjectLink() { } - ::sfx2::SvBaseLink::UpdateResult SdrEmbedObjectLink::DataChanged( const OUString& /*rMimeType*/, const css::uno::Any & /*rValue*/ ) { @@ -653,14 +630,12 @@ SdrEmbedObjectLink::~SdrEmbedObjectLink() return SUCCESS; } - void SdrEmbedObjectLink::Closed() { pObj->BreakFileLink_Impl(); SvBaseLink::Closed(); } - class SdrOle2ObjImpl { public: @@ -734,7 +709,6 @@ public: } }; - // Predicate determining whether the given OLE is an internal math // object static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObjRef ) @@ -757,7 +731,6 @@ static bool ImplIsMathObj( const uno::Reference < embed::XEmbeddedObject >& rObj } } - // BaseProperties section sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() @@ -765,7 +738,6 @@ sdr::properties::BaseProperties* SdrOle2Obj::CreateObjectSpecificProperties() return new sdr::properties::OleProperties(*this); } - // DrawContact section sdr::contact::ViewContact* SdrOle2Obj::CreateObjectSpecificViewContact() @@ -773,7 +745,6 @@ sdr::contact::ViewContact* SdrOle2Obj::CreateObjectSpecificViewContact() return new sdr::contact::ViewContactOfSdrOle2Obj(*this); } - SdrOle2Obj::SdrOle2Obj( bool bFrame_ ) : mpImpl(new SdrOle2ObjImpl(bFrame_)) { @@ -802,7 +773,6 @@ OUString SdrOle2Obj::GetStyleString() return strStyle; } - SdrOle2Obj::~SdrOle2Obj() { mpImpl->mbInDestruction = true; @@ -817,11 +787,8 @@ SdrOle2Obj::~SdrOle2Obj() mpImpl->pLightClient->Release(); mpImpl->pLightClient = nullptr; } - - delete mpImpl; } - void SdrOle2Obj::SetAspect( sal_Int64 nAspect ) { mpImpl->mxObjRef.SetViewAspect( nAspect ); @@ -888,7 +855,6 @@ bool SdrOle2Obj::IsEmpty() const return !mpImpl->mxObjRef.is(); } - void SdrOle2Obj::Connect() { if( IsEmptyPresObj() ) @@ -906,7 +872,6 @@ void SdrOle2Obj::Connect() AddListeners_Impl(); } - bool SdrOle2Obj::UpdateLinkURL_Impl() { bool bResult = false; @@ -965,7 +930,6 @@ bool SdrOle2Obj::UpdateLinkURL_Impl() return bResult; } - void SdrOle2Obj::BreakFileLink_Impl() { uno::Reference xDoc; @@ -997,7 +961,6 @@ void SdrOle2Obj::BreakFileLink_Impl() } } - void SdrOle2Obj::DisconnectFileLink_Impl() { sfx2::LinkManager* pLinkManager = pModel ? pModel->GetLinkManager() : nullptr; @@ -1008,7 +971,6 @@ void SdrOle2Obj::DisconnectFileLink_Impl() } } - void SdrOle2Obj::CheckFileLink_Impl() { if (pModel && mpImpl->mxObjRef.GetObject().is() && !mpImpl->mpObjectLink) @@ -1045,7 +1007,6 @@ void SdrOle2Obj::CheckFileLink_Impl() } } - void SdrOle2Obj::Reconnect_Impl() { DBG_ASSERT( mpImpl->mbConnected, "Assigned unconnected object?!" ); @@ -1169,7 +1130,6 @@ void SdrOle2Obj::AddListeners_Impl() } } - void SdrOle2Obj::Disconnect() { if( IsEmptyPresObj() ) @@ -1297,7 +1257,6 @@ void SdrOle2Obj::Disconnect_Impl() mpImpl->mbConnected = false; } - SdrObject* SdrOle2Obj::createSdrGrafObjReplacement(bool bAddText, bool /* bUseHCGraphic */) const { const Graphic* pOLEGraphic = GetGraphic(); @@ -1374,7 +1333,6 @@ SdrObject* SdrOle2Obj::DoConvertToPolyObj(bool bBezier, bool bAddText) const return nullptr; } - void SdrOle2Obj::SetModel(SdrModel* pNewModel) { ::comphelper::IEmbeddedHelper* pDestPers = pNewModel ? pNewModel->GetPersist() : nullptr; @@ -1449,7 +1407,6 @@ void SdrOle2Obj::SetModel(SdrModel* pNewModel) AddListeners_Impl(); } - void SdrOle2Obj::SetPage(SdrPage* pNewPage) { bool bRemove=pNewPage==nullptr && pPage!=nullptr; @@ -1484,7 +1441,6 @@ void SdrOle2Obj::SetPage(SdrPage* pNewPage) Connect(); } - void SdrOle2Obj::SetObjRef( const css::uno::Reference < css::embed::XEmbeddedObject >& rNewObjRef ) { DBG_ASSERT( !rNewObjRef.is() || !mpImpl->mxObjRef.GetObject().is(), "SetObjRef called on already initialized object!"); @@ -1523,7 +1479,6 @@ void SdrOle2Obj::SetObjRef( const css::uno::Reference < css::embed::XEmbeddedObj BroadcastObjectChange(); } - void SdrOle2Obj::SetClosedObj( bool bIsClosed ) { // TODO/LATER: do we still need this hack? @@ -1531,14 +1486,12 @@ void SdrOle2Obj::SetClosedObj( bool bIsClosed ) bClosedObj = bIsClosed; } - SdrObject* SdrOle2Obj::getFullDragClone() const { // #i118485# use central replacement generator return createSdrGrafObjReplacement(false, true); } - void SdrOle2Obj::SetPersistName( const OUString& rPersistName ) { DBG_ASSERT( mpImpl->aPersistName.isEmpty(), "Persist name changed!"); @@ -1557,13 +1510,11 @@ void SdrOle2Obj::AbandonObject() SetObjRef(nullptr); } - const OUString& SdrOle2Obj::GetPersistName() const { return mpImpl->aPersistName; } - void SdrOle2Obj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const { // #i118485# Allowing much more attributes for OLEs @@ -1584,13 +1535,11 @@ void SdrOle2Obj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bCanConvToContour = true; } - sal_uInt16 SdrOle2Obj::GetObjIdentifier() const { return mpImpl->mbFrame ? sal_uInt16(OBJ_FRAME) : sal_uInt16(OBJ_OLE2); } - OUString SdrOle2Obj::TakeObjNameSingul() const { OUStringBuffer sName(ImpGetResStr(mpImpl->mbFrame ? STR_ObjNameSingulFrame : STR_ObjNameSingulOLE2)); @@ -1607,7 +1556,6 @@ OUString SdrOle2Obj::TakeObjNameSingul() const return sName.makeStringAndClear(); } - OUString SdrOle2Obj::TakeObjNamePlural() const { return ImpGetResStr(mpImpl->mbFrame ? STR_ObjNamePluralFrame : STR_ObjNamePluralOLE2); @@ -1816,7 +1764,6 @@ void SdrOle2Obj::ImpSetVisAreaSize() } } - void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) { if( pModel && !pModel->isLocked() ) @@ -1836,7 +1783,6 @@ void SdrOle2Obj::NbcResize(const Point& rRef, const Fraction& xFact, const Fract ImpSetVisAreaSize(); } - void SdrOle2Obj::SetGeoData(const SdrObjGeoData& rGeo) { SdrRectObj::SetGeoData(rGeo); @@ -1845,7 +1791,6 @@ void SdrOle2Obj::SetGeoData(const SdrObjGeoData& rGeo) ImpSetVisAreaSize(); } - void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) { SdrRectObj::NbcSetSnapRect(rRect); @@ -1862,7 +1807,6 @@ void SdrOle2Obj::NbcSetSnapRect(const Rectangle& rRect) } } - void SdrOle2Obj::NbcSetLogicRect(const Rectangle& rRect) { SdrRectObj::NbcSetLogicRect(rRect); @@ -1884,7 +1828,6 @@ void SdrOle2Obj::GetNewReplacement() mpImpl->mxObjRef.UpdateReplacement(); } - Size SdrOle2Obj::GetOrigObjSize( MapMode* pTargetMapMode ) const { return mpImpl->mxObjRef.GetSize( pTargetMapMode ); @@ -1903,7 +1846,6 @@ void SdrOle2Obj::NbcMove(const Size& rSize) ImpSetVisAreaSize(); } - bool SdrOle2Obj::CanUnloadRunningObj( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect ) { uno::Reference xPersist(xObj, uno::UNO_QUERY); @@ -1944,7 +1886,6 @@ bool SdrOle2Obj::CanUnloadRunningObj( const uno::Reference< embed::XEmbeddedObje return bResult; } - bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, sal_Int64 nAspect ) { bool bResult = false; @@ -1970,7 +1911,6 @@ bool SdrOle2Obj::Unload( const uno::Reference< embed::XEmbeddedObject >& xObj, s return bResult; } - bool SdrOle2Obj::Unload() { if (!mpImpl->mxObjRef.is()) @@ -1986,7 +1926,6 @@ bool SdrOle2Obj::Unload() return bUnloaded; } - void SdrOle2Obj::GetObjRef_Impl() { if ( !mpImpl->mxObjRef.is() && !mpImpl->aPersistName.isEmpty() && pModel && pModel->GetPersist() ) @@ -2077,7 +2016,6 @@ uno::Reference < embed::XEmbeddedObject > SdrOle2Obj::GetObjRef_NoInit() const return mpImpl->mxObjRef.GetObject(); } - uno::Reference< frame::XModel > SdrOle2Obj::getXModel() const { GetObjRef(); @@ -2087,7 +2025,6 @@ uno::Reference< frame::XModel > SdrOle2Obj::getXModel() const return uno::Reference< frame::XModel >(); } - bool SdrOle2Obj::IsChart() const { if (!mpImpl->mbTypeAsked) @@ -2117,13 +2054,11 @@ void SdrOle2Obj::SetGraphicToObj( const Graphic& aGraphic, const OUString& aMedi mpImpl->mxObjRef.SetGraphic( aGraphic, aMediaType ); } - void SdrOle2Obj::SetGraphicToObj( const uno::Reference< io::XInputStream >& xGrStream, const OUString& aMediaType ) { mpImpl->mxObjRef.SetGraphicStream( xGrStream, aMediaType ); } - bool SdrOle2Obj::IsCalc() const { if ( !mpImpl->mxObjRef.is() ) @@ -2152,7 +2087,6 @@ uno::Reference< frame::XModel > SdrOle2Obj::GetParentXModel() const return xDoc; } - bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHeight, Size& aObjAreaSize ) { // TODO/LEAN: to avoid rounding errors scaling always uses the VisArea. @@ -2174,7 +2108,6 @@ bool SdrOle2Obj::CalculateNewScaling( Fraction& aScaleWidth, Fraction& aScaleHei return true; } - bool SdrOle2Obj::AddOwnLightClient() { // The Own Light Client must be registered in object only using this method! @@ -2206,13 +2139,11 @@ bool SdrOle2Obj::AddOwnLightClient() return true; } - Graphic SdrOle2Obj::GetEmptyOLEReplacementGraphic() { return Graphic(BitmapEx(ResId(BMP_SVXOLEOBJ, *ImpGetResMgr()))); } - void SdrOle2Obj::SetWindow(const css::uno::Reference < css::awt::XWindow >& _xWindow) { if ( mpImpl->mxObjRef.is() && mpImpl->pLightClient ) -- cgit