[Libreoffice-commits] core.git: Branch 'feature/SOSAW080' - 721 commits - accessibility/inc accessibility/source android/Bootstrap android/source avmedia/source basctl/inc basctl/source basctl/uiconfig basegfx/Library_basegfx.mk basegfx/source basegfx/test basic/inc basic/source bin/gbuild-to-ide bin/gla11y bin/sanitize-blacklist.txt bridges/source canvas/source canvas/workben chart2/source chart2/uiconfig comphelper/source compilerplugins/clang config_host/config_gpgme.h.in config_host.mk.in configmgr/source configure.ac connectivity/source cppcanvas/qa cppcanvas/source cui/inc cui/qa cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/CppunitTest_dbaccess_hsqlbinary_import.mk dbaccess/CppunitTest_dbaccess_hsqlschema_import.mk dbaccess/inc dbaccess/Library_dbahsql.mk dbaccess/Module_dbaccess.mk dbaccess/qa dbaccess/source dbaccess/uiconfig desktop/inc desktop/qa desktop/source dictionaries download.lst drawinglayer/source dtrans/source editeng/inc editeng/qa editeng/source embeddedobj/source em fio/qa emfio/source extensions/inc extensions/qa extensions/source extensions/uiconfig external/firebird external/hunspell external/libepubgen external/libstaroffice external/more_fonts extras/source filter/inc filter/source filter/uiconfig forms/qa forms/source formula/source fpicker/source fpicker/test fpicker/uiconfig framework/inc framework/Library_fwl.mk framework/source framework/util helpcontent2 hwpfilter/source i18npool/inc i18npool/source icon-themes/breeze icon-themes/breeze_dark icon-themes/breeze_svg icon-themes/colibre icon-themes/colibre_svg icon-themes/crystal icon-themes/elementary icon-themes/elementary_svg icon-themes/galaxy icon-themes/sifr icon-themes/sifr_dark icon-themes/sifr_svg idlc/inc idlc/source idl/inc idl/source include/basegfx include/basic include/canvas include/comphelper include/connectivity include/cppuhelper include/editeng include/filter include/LibreOfficeKit include/oox include/sal include/sfx2 include/svl include/svtools include/svx include/te st include/tools include/vcl include/xmloff ios/LibreOfficeLight jvmaccess/source jvmfwk/plugins jvmfwk/source l10ntools/inc l10ntools/source libreofficekit/qa libreofficekit/source lingucomponent/source linguistic/source lotuswordpro/inc lotuswordpro/qa lotuswordpro/source Makefile.in mysqlc/source odk/CustomTarget_html.mk odk/examples odk/README offapi/util officecfg/Configuration_officecfg.mk officecfg/files.mk officecfg/registry onlineupdate/source oox/source package/source postprocess/CustomTarget_images.mk postprocess/CustomTarget_registry.mk postprocess/qa pyuno/qa qadevOOo/Jar_OOoRunner.mk qadevOOo/objdsc qadevOOo/tests readlicense_oo/license README.md reportdesign/inc reportdesign/source sal/osl sax/source scaddins/source sc/CppunitTest_sc_ddelinkobj.mk sc/CppunitTest_sc_spreadsheetsettings.mk sc/inc sc/Library_sc.mk sc/Module_sc.mk sc/qa scripting/examples scripting/java scripting/Package_ScriptsPython.mk scripting/source sc/source sc/uiconfig sc/UITest_autofilter.mk sc/UI Test_calc_tests.mk sdext/source sd/inc sd/qa sd/source sd/uiconfig sfx2/CppunitTest_sfx2_misc.mk sfx2/inc sfx2/qa sfx2/source sfx2/uiconfig sfx2/UIConfig_sfx.mk shell/source slideshow/source solenv/bin solenv/clang-format solenv/CompilerTest_compilerplugins_clang.mk solenv/flatpak-manifest.in solenv/gbuild solenv/gdb solenv/sanitizers sot/CppunitTest_sot_test_sot.mk sot/inc sot/qa sot/source starmath/inc starmath/source starmath/uiconfig svgio/inc svgio/qa svgio/source svl/source svtools/source svtools/uiconfig svx/inc svx/Library_svx.mk svx/qa svx/sdi svx/source svx/uiconfig svx/UIConfig_svx.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_htmlimport.mk sw/CppunitTest_sw_layoutwriter.mk sw/CppunitTest_sw_ooxmlexport12.mk sw/CppunitTest_sw_uiwriter.mk sw/CppunitTest_sw_uwriter.mk swext/mediawiki sw/inc sw/Library_sw.mk sw/Module_sw.mk sw/qa sw/sdi sw/source sw/uiconfig sw/UIConfig_swriter.mk sw/UITest_writer_tests.mk test/inc test/Library_subsequenttest.mk test/Library_test.mk t est/source toolkit/inc toolkit/Library_tk.mk toolkit/source tools/qa tools/source ucb/source uitest/manual_tests uitest/UITest_manual_tests.mk uitest/UITest_writer_demo.mk uitest/writer_tests UnoControls/source unotest/source unotools/source unoxml/qa unoxml/source uui/inc uui/source uui/uiconfig vbahelper/source vcl/headless vcl/inc vcl/Library_vcl.mk vcl/opengl vcl/osx vcl/qa vcl/qt5 vcl/quartz vcl/source vcl/uiconfig vcl/unx vcl/win vcl/workben wizards/source writerfilter/source writerperfect/Library_writerperfect.mk writerperfect/source xmerge/source xmlhelp/source xmloff/Library_xo.mk xmloff/source xmlscript/dtd xmlscript/source xmlscript/test xmlsecurity/CppunitTest_xmlsecurity_signing.mk xmlsecurity/Executable_pdfverify.mk xmlsecurity/inc xmlsecurity/qa xmlsecurity/source xmlsecurity/util xmlsecurity/workben
Armin Le Grand
Armin.Le.Grand at cib.de
Fri Apr 6 16:32:20 UTC 2018
Rebased ref, commits from common ancestor:
commit 7da1d824837c48aa4f53ae0c3fb344616d8b0284
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Thu Apr 5 20:01:28 2018 +0200
SOSAW080: Solve UNO API calls that move SvxShapes to other Model
Due to UNO API tests I got a call to insert an xShape to a
xDrawPage which was constructed in another Model, this has now to
be done by Cloning the SdrObject to the new SdrModel, getting
rid of the old one and getting all the UNO implementation
stuff right (referemces SdrObject <-> xShape).
Change-Id: Ibf097ee7467895823fbd158a2a9543da3b5a5078
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index b5dd038d5622..490af4051362 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -438,6 +438,13 @@ void SdrObject::SetPage(SdrPage* pNewPage)
// If the page is changing to another page with the same model, we
// assume they create compatible UNO shape objects so we shouldn't have
// to invalidate.
+ // TTTT: This causes quite some problems in SvxDrawPage::add when used
+ // e.g. from Writer - the SdrObject may be cloned to target model, and
+ // the xShape was added to it by purpose (see there). Thus it will be
+ // good to think about if this is really needed - it *seems* to be intended
+ // for a xShape being a on-demand-creatable resource - wit hthe argument that
+ // the SdrPage/UnoPage used influences the SvxShape creation. This uses
+ // ressources and would be nice to get rid of anyways.
if (pOldPage != pPage && !(pOldPage && pPage && pOldModel == &getSdrModelFromSdrObject()))
{
SvxShape* const pShape(getSvxShape());
diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx
index f35a104f6da5..3dc69e899965 100644
--- a/svx/source/unodraw/unopage.cxx
+++ b/svx/source/unodraw/unopage.cxx
@@ -191,6 +191,24 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
return;
SdrObject *pObj = pShape->GetSdrObject();
+ bool bNeededToClone(false);
+
+ if(nullptr != pObj && &pObj->getSdrModelFromSdrObject() != &mpPage->getSdrModelFromSdrPage())
+ {
+ // TTTT UNO API tries to add an existing SvxShape to this SvxDrawPage,
+ // but these use different SdrModels. It was possible before to completely
+ // 'change' a SdrObject to another SdrModel (including dangerous MigrateItemPool
+ // stuff), but is no longer. We need to Clone the SdrObject to the target model
+ // and ::Create a new SvxShape (set SdrObject there, take obver values, ...)
+ SdrObject* pClonedSdrShape(pObj->Clone(&mpPage->getSdrModelFromSdrPage()));
+ pObj->setUnoShape(nullptr);
+ pClonedSdrShape->setUnoShape(xShape);
+ // pShape->InvalidateSdrObject();
+ // pShape->Create(pClonedSdrShape, this);
+ SdrObject::Free(pObj);
+ pObj = pClonedSdrShape;
+ bNeededToClone = true;
+ }
if(!pObj)
{
@@ -200,6 +218,19 @@ void SAL_CALL SvxDrawPage::add( const uno::Reference< drawing::XShape >& xShape
else if ( !pObj->IsInserted() )
{
mpPage->InsertObject( pObj );
+
+ if(bNeededToClone)
+ {
+ // TTTT Unfortunately in SdrObject::SetPage (see there) the
+ // xShape/UnoShape at the newly cloned SDrObject is *removed* again,
+ // so re-set it here, the caller *may need it* (e.g. Writer)
+ uno::Reference< uno::XInterface > xShapeCheck(pObj->getWeakUnoShape());
+
+ if( !xShapeCheck.is() )
+ {
+ pObj->setUnoShape(xShape);
+ }
+ }
}
pShape->Create( pObj, this );
commit 365f2c072d00246a158725148942160435d892ed
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Wed Apr 4 13:01:01 2018 +0200
SOSAW080: Free SdrObjects when SdrModel goes down
In an UNO API test problem is that SvxShapes reference
SdrShapes, but these are not added to a SdrPage and not
'owned' by the SvxShape. Thus these do not get deleted
at all (same in master, memory leak). I extended
SvxShape::Notify the case for ModelCleared to also
Free the SdrObject when not owner and it's not added to
a SdrPage (in that case it gets deleted with deleting
the SdrModel)
Change-Id: I7b5c241faec7488924e5935ae8b19f785846b5e4
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index ba0aa389a447..c726444e814d 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -1019,17 +1019,30 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
if( bClearMe )
{
- if( !HasSdrObjectOwnership() ) {
- if( HasSdrObject() )
+ SdrObject* pSdrObject(GetSdrObject());
+
+ if(!HasSdrObjectOwnership())
+ {
+ if(nullptr != pSdrObject)
{
- EndListening(GetSdrObject()->getSdrModelFromSdrObject());
- GetSdrObject()->setUnoShape( nullptr );
+ EndListening(pSdrObject->getSdrModelFromSdrObject());
+ pSdrObject->setUnoShape(nullptr);
}
- mpSdrObjectWeakReference.reset( nullptr );
+ mpSdrObjectWeakReference.reset(nullptr);
+
+ // SdrModel *is* going down, try to Free SdrObject even
+ // when !HasSdrObjectOwnership
+ if(nullptr != pSdrObject && !pSdrObject->IsInserted())
+ {
+ SdrObject::Free(pSdrObject);
+ }
}
- if ( !mpImpl->mbDisposing )
+
+ if(!mpImpl->mbDisposing)
+ {
dispose();
+ }
}
}
commit 0a3454590e124523fb76e94ecc724bf5ae1b075b
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Mon Apr 2 12:04:28 2018 +0200
SOSAW080: Reworked SvxShape to use SdrObject's SdrModel
Change-Id: I17bcb44d2e29920c0c74430c2d9c703b36cfa0ad
diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx
index 181d7db4119d..b5dd038d5622 100644
--- a/svx/source/svdraw/svdobj.cxx
+++ b/svx/source/svdraw/svdobj.cxx
@@ -347,22 +347,7 @@ SdrObject::~SdrObject()
// when they get called from ObjectInDestruction().
mpImpl->maObjectUsers.clear();
- try
- {
- SvxShape* pSvxShape = getSvxShape();
- if ( pSvxShape )
- {
- OSL_ENSURE(!pSvxShape->HasSdrObjectOwnership(),"Please check where this call come from and replace it with SdrObject::Free");
- pSvxShape->InvalidateSdrObject();
- uno::Reference< lang::XComponent > xShapeComp( getWeakUnoShape(), uno::UNO_QUERY_THROW );
- xShapeComp->dispose();
- }
- }
- catch( const uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION("svx");
- }
-
+ // UserCall
SendUserCall(SdrUserCallType::Delete, GetLastBoundRect());
o3tl::reset_preserve_ptr_during(pPlusData);
@@ -374,14 +359,38 @@ SdrObject::~SdrObject()
void SdrObject::Free( SdrObject*& _rpObject )
{
SdrObject* pObject = _rpObject; _rpObject = nullptr;
- if ( pObject == nullptr )
+
+ if(nullptr == pObject)
+ {
// nothing to do
return;
+ }
- SvxShape* pShape = pObject->getSvxShape();
- if ( pShape && pShape->HasSdrObjectOwnership() )
- // only the shape is allowed to delete me, and will reset the ownership before doing so
- return;
+ SvxShape* pShape(pObject->getSvxShape());
+
+ if(pShape)
+ {
+ if(pShape->HasSdrObjectOwnership())
+ {
+ // only the SvxShape is allowed to delete me, and will reset
+ // the ownership before doing so
+ return;
+ }
+ else
+ {
+ // not only delete pObject, but also need to dispose uno shape
+ try
+ {
+ pShape->InvalidateSdrObject();
+ uno::Reference< lang::XComponent > xShapeComp( pObject->getWeakUnoShape(), uno::UNO_QUERY_THROW );
+ xShapeComp->dispose();
+ }
+ catch( const uno::Exception& )
+ {
+ DBG_UNHANDLED_EXCEPTION();
+ }
+ }
+ }
delete pObject;
}
commit ccba0c81c5f560ddb0287c442d5a3b471d66bf0a
Author: Armin Le Grand <Armin.Le.Grand at cib.de>
Date: Mon Apr 2 12:04:28 2018 +0200
SOSAW080: Reworked SvxShape to use SdrObject's SdrModel
Change-Id: I17bcb44d2e29920c0c74430c2d9c703b36cfa0ad
diff --git a/include/svx/unoshape.hxx b/include/svx/unoshape.hxx
index 626031962daf..422f6b13b446 100644
--- a/include/svx/unoshape.hxx
+++ b/include/svx/unoshape.hxx
@@ -137,8 +137,10 @@ protected:
const SvxItemPropertySet* mpPropSet;
const SfxItemPropertyMapEntry* maPropMapEntries;
- ::tools::WeakReference< SdrObject > mpObj;
- SdrModel* mpModel;
+private:
+ ::tools::WeakReference< SdrObject > mpSdrObjectWeakReference;
+
+protected:
// translations for writer, which works in TWIPS
void ForceMetricToItemPoolMetric(Pair& rPoint) const throw();
void ForceMetricToItemPoolMetric(Point& rPoint) const throw() { ForceMetricToItemPoolMetric(rPoint.toPair()); }
@@ -206,8 +208,13 @@ public:
void TakeSdrObjectOwnership();
bool HasSdrObjectOwnership() const;
- void InvalidateSdrObject() { mpObj.reset( nullptr ); };
- SdrObject* GetSdrObject() const {return mpObj.get();}
+ // used exclusively by SdrObject
+ void InvalidateSdrObject();
+
+ // Encapsulated access to SdrObject
+ SdrObject* GetSdrObject() const { return mpSdrObjectWeakReference.get(); }
+ bool HasSdrObject() const { return mpSdrObjectWeakReference.is(); }
+
void SetShapeType( const OUString& ShapeType ) { maShapeType = ShapeType; }
/// @throws css::uno::RuntimeException
css::uno::Any GetBitmap( bool bMetaFile = false ) const;
diff --git a/svx/source/unodraw/tableshape.cxx b/svx/source/unodraw/tableshape.cxx
index a34815611bca..281dfa288ea9 100644
--- a/svx/source/unodraw/tableshape.cxx
+++ b/svx/source/unodraw/tableshape.cxx
@@ -59,8 +59,8 @@ bool SvxTableShape::setPropertyValueImpl(
if( !(rValue >>= xTemplate) )
throw IllegalArgumentException();
- if( mpObj.is() )
- static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->setTableStyle(xTemplate);
+ if( HasSdrObject() )
+ static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->setTableStyle(xTemplate);
return true;
}
@@ -71,9 +71,9 @@ bool SvxTableShape::setPropertyValueImpl(
case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:
case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyleSettings() );
+ TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTableStyleSettings() );
switch( pProperty->nWID )
{
@@ -85,7 +85,7 @@ bool SvxTableShape::setPropertyValueImpl(
case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS: rValue >>= aSettings.mbUseColumnBanding; break;
}
- static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->setTableStyleSettings(aSettings);
+ static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->setTableStyleSettings(aSettings);
}
return true;
@@ -106,25 +106,25 @@ bool SvxTableShape::getPropertyValueImpl(
{
case OWN_ATTR_OLEMODEL:
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- rValue <<= static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTable();
+ rValue <<= static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTable();
}
return true;
}
case OWN_ATTR_TABLETEMPLATE:
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- rValue <<= static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyle();
+ rValue <<= static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTableStyle();
}
return true;
}
case OWN_ATTR_BITMAP:
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- Graphic aGraphic( SvxGetGraphicForShape( *mpObj.get() ) );
+ Graphic aGraphic( SvxGetGraphicForShape( *GetSdrObject() ) );
rValue <<= aGraphic.GetXGraphic();
}
return true;
@@ -136,9 +136,9 @@ bool SvxTableShape::getPropertyValueImpl(
case OWN_ATTR_TABLETEMPLATE_BANDINGROWS:
case OWN_ATTR_TABLETEMPLATE_BANDINGCOULUMNS:
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->getTableStyleSettings() );
+ TableStyleSettings aSettings( static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->getTableStyleSettings() );
switch( pProperty->nWID )
{
@@ -163,14 +163,14 @@ bool SvxTableShape::getPropertyValueImpl(
void SvxTableShape::lock()
{
SvxShape::lock();
- if( mpObj.is() )
- static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->uno_lock();
+ if( HasSdrObject() )
+ static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->uno_lock();
}
void SvxTableShape::unlock()
{
- if( mpObj.is() )
- static_cast< sdr::table::SdrTableObj* >( mpObj.get() )->uno_unlock();
+ if( HasSdrObject() )
+ static_cast< sdr::table::SdrTableObj* >( GetSdrObject() )->uno_unlock();
SvxShape::unlock();
}
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index d3931b6134a4..34106635f1cb 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -181,7 +181,7 @@ void SAL_CALL SvxShapeGroup::leaveGroup( )
void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape, size_t nPos )
{
- if (!mpObj.is() || !mxPage.is())
+ if (!HasSdrObject() || !mxPage.is())
{
OSL_FAIL("could not add XShape to group shape!");
return;
@@ -201,10 +201,10 @@ void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape
if( pSdrShape->IsInserted() )
pSdrShape->GetObjList()->RemoveObject( pSdrShape->GetOrdNum() );
- mpObj->GetSubList()->InsertObject(pSdrShape, nPos);
+ GetSdrObject()->GetSubList()->InsertObject(pSdrShape, nPos);
// TTTT Was created using mpModel in CreateSdrObject_ above
// TTTT may be good to add a assertion here for the future
- // pSdrShape->SetModel(mpObj->GetModel());
+ // pSdrShape->SetModel(GetSdrObject()->GetModel());
// #85922# It makes no sense to set the layer asked
// from the group object since these is an iteration
@@ -219,8 +219,7 @@ void SvxShapeGroup::addUnoShape( const uno::Reference< drawing::XShape >& xShape
// would be created when this connection would not already exist.
pShape->Create( pSdrShape, mxPage.get() );
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
// XShapes
@@ -243,7 +242,7 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS
if( pShape )
pSdrShape = pShape->GetSdrObject();
- if( !mpObj.is() || pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get() )
+ if( !HasSdrObject() || pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != GetSdrObject() )
throw uno::RuntimeException();
SdrObjList& rList = *pSdrShape->GetObjList();
@@ -280,8 +279,7 @@ void SAL_CALL SvxShapeGroup::remove( const uno::Reference< drawing::XShape >& xS
SAL_WARN( "svx", "Fatality! SdrObject is not belonging to its SdrObjList! [CL]" );
}
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
void SAL_CALL SvxShapeGroup::addTop( const uno::Reference< drawing::XShape >& xShape )
@@ -307,10 +305,10 @@ sal_Int32 SAL_CALL SvxShapeGroup::getCount()
{
::SolarMutexGuard aGuard;
- if(!mpObj.is() || !mpObj->GetSubList())
+ if(!HasSdrObject() || !GetSdrObject()->GetSubList())
throw uno::RuntimeException();
- sal_Int32 nRetval = mpObj->GetSubList()->GetObjCount();
+ sal_Int32 nRetval = GetSdrObject()->GetSubList()->GetObjCount();
return nRetval;
}
@@ -319,13 +317,13 @@ uno::Any SAL_CALL SvxShapeGroup::getByIndex( sal_Int32 Index )
{
::SolarMutexGuard aGuard;
- if( !mpObj.is() || mpObj->GetSubList() == nullptr )
+ if( !HasSdrObject() || GetSdrObject()->GetSubList() == nullptr )
throw uno::RuntimeException();
- if( Index<0 || mpObj->GetSubList()->GetObjCount() <= static_cast<size_t>(Index) )
+ if( Index<0 || GetSdrObject()->GetSubList()->GetObjCount() <= static_cast<size_t>(Index) )
throw lang::IndexOutOfBoundsException();
- SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
+ SdrObject* pDestObj = GetSdrObject()->GetSubList()->GetObj( Index );
if(pDestObj == nullptr)
throw lang::IndexOutOfBoundsException();
@@ -347,7 +345,7 @@ sal_Bool SAL_CALL SvxShapeGroup::hasElements()
{
::SolarMutexGuard aGuard;
- return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
+ return HasSdrObject() && GetSdrObject()->GetSubList() && (GetSdrObject()->GetSubList()->GetObjCount() > 0);
}
SvxShapeConnector::SvxShapeConnector(SdrObject* pObj)
@@ -440,10 +438,9 @@ void SAL_CALL SvxShapeConnector::connectStart( const uno::Reference< drawing::XC
SvxShape* pShape = SvxShape::getImplementation( xRef );
if( pShape )
- mpObj->ConnectToNode( true, pShape->mpObj.get() );
+ GetSdrObject()->ConnectToNode( true, pShape->GetSdrObject() );
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
@@ -454,11 +451,10 @@ void SAL_CALL SvxShapeConnector::connectEnd( const uno::Reference< drawing::XCon
Reference< drawing::XShape > xRef( xShape, UNO_QUERY );
SvxShape* pShape = SvxShape::getImplementation( xRef );
- if( mpObj.is() && pShape )
- mpObj->ConnectToNode( false, pShape->mpObj.get() );
+ if( HasSdrObject() && pShape )
+ GetSdrObject()->ConnectToNode( false, pShape->GetSdrObject() );
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
@@ -466,11 +462,10 @@ void SAL_CALL SvxShapeConnector::disconnectBegin( const uno::Reference< drawing:
{
::SolarMutexGuard aGuard;
- if(mpObj.is())
- mpObj->DisconnectFromNode( true );
+ if(HasSdrObject())
+ GetSdrObject()->DisconnectFromNode( true );
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
@@ -478,11 +473,10 @@ void SAL_CALL SvxShapeConnector::disconnectEnd( const uno::Reference< drawing::X
{
::SolarMutexGuard aGuard;
- if(mpObj.is())
- mpObj->DisconnectFromNode( false );
+ if(HasSdrObject())
+ GetSdrObject()->DisconnectFromNode( false );
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
SvxShapeControl::SvxShapeControl(SdrObject* pObj)
@@ -574,7 +568,7 @@ Reference< awt::XControlModel > SAL_CALL SvxShapeControl::getControl()
Reference< awt::XControlModel > xModel;
- SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
+ SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(GetSdrObject());
if( pUnoObj )
xModel = pUnoObj->GetUnoControlModel();
@@ -586,12 +580,11 @@ void SAL_CALL SvxShapeControl::setControl( const Reference< awt::XControlModel >
{
::SolarMutexGuard aGuard;
- SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(mpObj.get());
+ SdrUnoObj* pUnoObj = dynamic_cast< SdrUnoObj * >(GetSdrObject());
if( pUnoObj )
pUnoObj->SetUnoControlModel( xControl );
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
static struct
@@ -985,14 +978,14 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx
{
if( auto s = o3tl::tryAccess<drawing::PointSequenceSequence>(rValue) )
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
basegfx::B2DPolyPolygon aNewPolyPolygon;
basegfx::B2DHomMatrix aNewHomogenMatrix;
- mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
aNewPolyPolygon = ImplSvxPointSequenceSequenceToB2DPolyPolygon(s);
- mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
}
return true;
}
@@ -1095,8 +1088,8 @@ bool SvxShapePolyPolygon::getPropertyValueImpl( const OUString& rName, const Sfx
basegfx::B2DPolyPolygon aNewPolyPolygon;
basegfx::B2DHomMatrix aNewHomogenMatrix;
- if(mpObj.is())
- mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ if(HasSdrObject())
+ GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
drawing::PointSequenceSequence aRetval(aNewPolyPolygon.count());
B2DPolyPolygonToSvxPointSequenceSequence(aNewPolyPolygon, aRetval);
@@ -1149,8 +1142,8 @@ void SvxShapePolyPolygon::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
{
::SolarMutexGuard aGuard;
- if(mpObj.is())
- static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew);
+ if(HasSdrObject())
+ static_cast<SdrPathObj*>(GetSdrObject())->SetPathPoly(rNew);
}
@@ -1158,9 +1151,9 @@ basegfx::B2DPolyPolygon SvxShapePolyPolygon::GetPolygon() const throw()
{
::SolarMutexGuard aGuard;
- if(mpObj.is())
+ if(HasSdrObject())
{
- return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly();
+ return static_cast<SdrPathObj*>(GetSdrObject())->GetPathPoly();
}
else
{
@@ -1197,15 +1190,15 @@ bool SvxShapePolyPolygonBezier::setPropertyValueImpl( const OUString& rName, con
{
if( auto s = o3tl::tryAccess<drawing::PolyPolygonBezierCoords>(rValue) )
{
- if( mpObj.is() )
+ if( HasSdrObject() )
{
basegfx::B2DPolyPolygon aNewPolyPolygon;
basegfx::B2DHomMatrix aNewHomogenMatrix;
- mpObj->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
aNewPolyPolygon = basegfx::unotools::polyPolygonBezierToB2DPolyPolygon(
*s);
- mpObj->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ GetSdrObject()->TRSetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
}
return true;
}
@@ -1238,7 +1231,7 @@ bool SvxShapePolyPolygonBezier::getPropertyValueImpl( const OUString& rName, con
// pack a tools::PolyPolygon in a struct tools::PolyPolygon
basegfx::B2DPolyPolygon aNewPolyPolygon;
basegfx::B2DHomMatrix aNewHomogenMatrix;
- mpObj.get()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
+ GetSdrObject()->TRGetBaseGeometry(aNewHomogenMatrix, aNewPolyPolygon);
drawing::PolyPolygonBezierCoords aRetval;
basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(aNewPolyPolygon, aRetval);
@@ -1261,8 +1254,8 @@ void SvxShapePolyPolygonBezier::SetPolygon(const basegfx::B2DPolyPolygon& rNew)
{
::SolarMutexGuard aGuard;
- if(mpObj.is())
- static_cast<SdrPathObj*>(mpObj.get())->SetPathPoly(rNew);
+ if(HasSdrObject())
+ static_cast<SdrPathObj*>(GetSdrObject())->SetPathPoly(rNew);
}
@@ -1270,9 +1263,9 @@ basegfx::B2DPolyPolygon SvxShapePolyPolygonBezier::GetPolygon() const throw()
{
::SolarMutexGuard aGuard;
- if(mpObj.is())
+ if(HasSdrObject())
{
- return static_cast<SdrPathObj*>(mpObj.get())->GetPathPoly();
+ return static_cast<SdrPathObj*>(GetSdrObject())->GetPathPoly();
}
else
{
@@ -1305,7 +1298,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
if( GraphicConverter::Import( aMemStm, aGraphic ) == ERRCODE_NONE )
{
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
+ static_cast<SdrGrafObj*>(GetSdrObject())->SetGraphic(aGraphic);
bOk = true;
}
}
@@ -1314,7 +1307,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
auto xGraphic = rValue.get<uno::Reference<graphic::XGraphic>>();
if (xGraphic.is())
{
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(Graphic(xGraphic));
+ static_cast<SdrGrafObj*>(GetSdrObject())->SetGraphic(Graphic(xGraphic));
bOk = true;
}
}
@@ -1325,7 +1318,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
{
uno::Reference<graphic::XGraphic> xGraphic(xBitmap, uno::UNO_QUERY);
Graphic aGraphic(xGraphic);
- static_cast<SdrGrafObj*>(mpObj.get())->SetGraphic(aGraphic);
+ static_cast<SdrGrafObj*>(GetSdrObject())->SetGraphic(aGraphic);
bOk = true;
}
}
@@ -1341,9 +1334,9 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
if( !aStreamURL.startsWith( UNO_NAME_GRAPHOBJ_URLPKGPREFIX ) )
aStreamURL.clear();
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- static_cast<SdrGrafObj*>(mpObj.get())->SetGrafStreamURL( aStreamURL );
+ static_cast<SdrGrafObj*>(GetSdrObject())->SetGrafStreamURL( aStreamURL );
}
bOk = true;
}
@@ -1355,7 +1348,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
if( xGraphic.is() )
{
- static_cast< SdrGrafObj*>( mpObj.get() )->SetGraphic( xGraphic );
+ static_cast< SdrGrafObj*>( GetSdrObject() )->SetGraphic( xGraphic );
bOk = true;
}
break;
@@ -1366,7 +1359,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
bool bIsSignatureLine;
if (rValue >>= bIsSignatureLine)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setIsSignatureLine(bIsSignatureLine);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setIsSignatureLine(bIsSignatureLine);
bOk = true;
}
break;
@@ -1377,7 +1370,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
OUString aSignatureLineId;
if (rValue >>= aSignatureLineId)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineId(aSignatureLineId);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineId(aSignatureLineId);
bOk = true;
}
break;
@@ -1388,7 +1381,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
OUString aSuggestedSignerName;
if (rValue >>= aSuggestedSignerName)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSuggestedSignerName(aSuggestedSignerName);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineSuggestedSignerName(aSuggestedSignerName);
bOk = true;
}
break;
@@ -1399,7 +1392,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
OUString aSuggestedSignerTitle;
if (rValue >>= aSuggestedSignerTitle)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSuggestedSignerTitle(aSuggestedSignerTitle);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineSuggestedSignerTitle(aSuggestedSignerTitle);
bOk = true;
}
break;
@@ -1410,7 +1403,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
OUString aSuggestedSignerEmail;
if (rValue >>= aSuggestedSignerEmail)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSuggestedSignerEmail(aSuggestedSignerEmail);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineSuggestedSignerEmail(aSuggestedSignerEmail);
bOk = true;
}
break;
@@ -1421,7 +1414,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
OUString aSigningInstructions;
if (rValue >>= aSigningInstructions)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineSigningInstructions(aSigningInstructions);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineSigningInstructions(aSigningInstructions);
bOk = true;
}
break;
@@ -1432,7 +1425,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
bool bShowSignDate;
if (rValue >>= bShowSignDate)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineShowSignDate(bShowSignDate);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineShowSignDate(bShowSignDate);
bOk = true;
}
break;
@@ -1443,7 +1436,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
bool bCanAddComment;
if (rValue >>= bCanAddComment)
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineCanAddComment(bCanAddComment);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineCanAddComment(bCanAddComment);
bOk = true;
}
break;
@@ -1454,7 +1447,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
Reference<graphic::XGraphic> xGraphic(rValue, uno::UNO_QUERY);
if (xGraphic.is())
{
- static_cast<SdrGrafObj*>(mpObj.get())->setSignatureLineUnsignedGraphic(xGraphic);
+ static_cast<SdrGrafObj*>(GetSdrObject())->setSignatureLineUnsignedGraphic(xGraphic);
bOk = true;
}
break;
@@ -1467,8 +1460,7 @@ bool SvxGraphicObject::setPropertyValueImpl( const OUString& rName, const SfxIte
if( !bOk )
throw lang::IllegalArgumentException();
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
return true;
}
@@ -1479,7 +1471,7 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
{
case OWN_ATTR_VALUE_FILLBITMAP:
{
- const Graphic& rGraphic = static_cast<SdrGrafObj*>(mpObj.get())->GetGraphic();
+ const Graphic& rGraphic = static_cast<SdrGrafObj*>(GetSdrObject())->GetGraphic();
if (rGraphic.GetType() != GraphicType::GdiMetafile)
{
@@ -1501,7 +1493,7 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_REPLACEMENT_GRAPHIC:
{
- const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(mpObj.get())->GetReplacementGraphicObject();
+ const GraphicObject* pGrafObj = static_cast< SdrGrafObj* >(GetSdrObject())->GetReplacementGraphicObject();
if (pGrafObj)
{
@@ -1513,7 +1505,7 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_GRAFSTREAMURL:
{
- const OUString aStreamURL( static_cast<SdrGrafObj*>( mpObj.get() )->GetGrafStreamURL() );
+ const OUString aStreamURL( static_cast<SdrGrafObj*>( GetSdrObject() )->GetGrafStreamURL() );
if( !aStreamURL.isEmpty() )
rValue <<= aStreamURL;
break;
@@ -1522,7 +1514,7 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_VALUE_GRAPHIC:
{
Reference<graphic::XGraphic> xGraphic;
- auto pSdrGraphicObject = static_cast<SdrGrafObj*>(mpObj.get());
+ auto pSdrGraphicObject = static_cast<SdrGrafObj*>(GetSdrObject());
if (pSdrGraphicObject->GetGraphicObject().GetType() != GraphicType::NONE)
xGraphic = pSdrGraphicObject->GetGraphic().GetXGraphic();
rValue <<= xGraphic;
@@ -1531,62 +1523,62 @@ bool SvxGraphicObject::getPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_GRAPHIC_STREAM:
{
- rValue <<= static_cast< SdrGrafObj* >( mpObj.get() )->getInputStream();
+ rValue <<= static_cast< SdrGrafObj* >( GetSdrObject() )->getInputStream();
break;
}
case OWN_ATTR_IS_SIGNATURELINE:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->isSignatureLine();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->isSignatureLine();
break;
}
case OWN_ATTR_SIGNATURELINE_ID:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineId();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->getSignatureLineId();
break;
}
case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_NAME:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSuggestedSignerName();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->getSignatureLineSuggestedSignerName();
break;
}
case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_TITLE:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSuggestedSignerTitle();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->getSignatureLineSuggestedSignerTitle();
break;
}
case OWN_ATTR_SIGNATURELINE_SUGGESTED_SIGNER_EMAIL:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSuggestedSignerEmail();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->getSignatureLineSuggestedSignerEmail();
break;
}
case OWN_ATTR_SIGNATURELINE_SIGNING_INSTRUCTIONS:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineSigningInstructions();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->getSignatureLineSigningInstructions();
break;
}
case OWN_ATTR_SIGNATURELINE_SHOW_SIGN_DATE:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->isSignatureLineShowSignDate();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->isSignatureLineShowSignDate();
break;
}
case OWN_ATTR_SIGNATURELINE_CAN_ADD_COMMENT:
{
- rValue <<= static_cast<SdrGrafObj*>(mpObj.get())->isSignatureLineCanAddComment();
+ rValue <<= static_cast<SdrGrafObj*>(GetSdrObject())->isSignatureLineCanAddComment();
break;
}
case OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE:
{
Reference<graphic::XGraphic> xGraphic(
- static_cast<SdrGrafObj*>(mpObj.get())->getSignatureLineUnsignedGraphic());
+ static_cast<SdrGrafObj*>(GetSdrObject())->getSignatureLineUnsignedGraphic());
rValue <<= xGraphic;
break;
}
@@ -1657,21 +1649,21 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxCustomShape::getImplementationId()
awt::Point SAL_CALL SvxCustomShape::getPosition()
{
::SolarMutexGuard aGuard;
- if ( mpModel && mpObj.is() )
+ if ( HasSdrObject() )
{
SdrAShapeObjGeoData aCustomShapeGeoData;
- static_cast<SdrObjCustomShape*>(mpObj.get())->SaveGeoData( aCustomShapeGeoData );
+ static_cast<SdrObjCustomShape*>(GetSdrObject())->SaveGeoData( aCustomShapeGeoData );
bool bMirroredX = false;
bool bMirroredY = false;
- if ( mpObj.is() )
+ if ( HasSdrObject() )
{
- bMirroredX = static_cast<SdrObjCustomShape*>(mpObj.get())->IsMirroredX();
- bMirroredY = static_cast<SdrObjCustomShape*>(mpObj.get())->IsMirroredY();
+ bMirroredX = static_cast<SdrObjCustomShape*>(GetSdrObject())->IsMirroredX();
+ bMirroredY = static_cast<SdrObjCustomShape*>(GetSdrObject())->IsMirroredY();
}
// get aRect, this is the unrotated snaprect
- tools::Rectangle aRect(static_cast<SdrObjCustomShape*>(mpObj.get())->GetLogicRect());
+ tools::Rectangle aRect(static_cast<SdrObjCustomShape*>(GetSdrObject())->GetLogicRect());
tools::Rectangle aRectangle( aRect );
if ( bMirroredX || bMirroredY )
@@ -1725,8 +1717,8 @@ awt::Point SAL_CALL SvxCustomShape::getPosition()
}
Point aPt( aRectangle.TopLeft() );
- if( mpModel->IsWriter() )
- aPt -= mpObj->GetAnchorPos();
+ if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
+ aPt -= GetSdrObject()->GetAnchorPos();
ForceMetricTo100th_mm(aPt);
return css::awt::Point( aPt.X(), aPt.Y() );
@@ -1740,7 +1732,7 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c
{
::SolarMutexGuard aGuard;
- SdrObject* pObject = mpObj.get();
+ SdrObject* pObject = GetSdrObject();
// tdf#98163 Use a custom slot to have filter code flush the UNO
// API implementations of SdrObjCustomShape. Used e.g. by
@@ -1826,7 +1818,7 @@ bool SvxCustomShape::getPropertyValueImpl( const OUString& rName, const SfxItemP
{
case SDRATTR_ROTATEANGLE:
{
- double fAngle = static_cast<SdrObjCustomShape*>(mpObj.get())->GetObjectRotation();
+ double fAngle = static_cast<SdrObjCustomShape*>(GetSdrObject())->GetObjectRotation();
fAngle *= 100;
rValue <<= static_cast<sal_Int32>(fAngle);
return true;
@@ -1838,13 +1830,13 @@ bool SvxCustomShape::getPropertyValueImpl( const OUString& rName, const SfxItemP
void SvxCustomShape::createCustomShapeDefaults( const OUString& rValueType )
{
- if (!mpObj.is())
+ if (!HasSdrObject())
{
OSL_FAIL("could not create Custom Shape Defaults!");
return;
}
- static_cast<SdrObjCustomShape*>(mpObj.get())->MergeDefaultAttributes( &rValueType );
+ static_cast<SdrObjCustomShape*>(GetSdrObject())->MergeDefaultAttributes( &rValueType );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index c7bbc8bc1c65..663dcc9f6bd9 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -119,13 +119,13 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
SvxShape* pShape = SvxShape::getImplementation( xShape );
- if(!mpObj.is() || !mxPage.is() || pShape == nullptr || nullptr != pShape->GetSdrObject() )
+ if(!HasSdrObject() || !mxPage.is() || pShape == nullptr || nullptr != pShape->GetSdrObject() )
throw uno::RuntimeException();
SdrObject* pSdrShape = mxPage->CreateSdrObject_( xShape );
if( dynamic_cast<const E3dObject* >(pSdrShape) != nullptr )
{
- mpObj->GetSubList()->NbcInsertObject( pSdrShape );
+ GetSdrObject()->GetSubList()->NbcInsertObject( pSdrShape );
if(pShape)
pShape->Create( pSdrShape, mxPage.get() );
@@ -136,8 +136,7 @@ void SAL_CALL Svx3DSceneObject::add( const Reference< drawing::XShape >& xShape
throw uno::RuntimeException();
}
- if( mpModel )
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
@@ -147,11 +146,11 @@ void SAL_CALL Svx3DSceneObject::remove( const Reference< drawing::XShape >& xSha
SvxShape* pShape = SvxShape::getImplementation( xShape );
- if(!mpObj.is() || pShape == nullptr)
+ if(!HasSdrObject() || pShape == nullptr)
throw uno::RuntimeException();
SdrObject* pSdrShape = pShape->GetSdrObject();
- if(pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != mpObj.get())
+ if(pSdrShape == nullptr || pSdrShape->GetObjList()->GetOwnerObj() != GetSdrObject())
{
throw uno::RuntimeException();
}
@@ -185,8 +184,8 @@ sal_Int32 SAL_CALL Svx3DSceneObject::getCount()
sal_Int32 nRetval = 0;
- if(mpObj.is() && dynamic_cast<const E3dScene* >(mpObj.get()) != nullptr && mpObj->GetSubList())
- nRetval = mpObj->GetSubList()->GetObjCount();
+ if(HasSdrObject() && dynamic_cast<const E3dScene* >(GetSdrObject()) != nullptr && GetSdrObject()->GetSubList())
+ nRetval = GetSdrObject()->GetSubList()->GetObjCount();
return nRetval;
}
@@ -195,13 +194,13 @@ uno::Any SAL_CALL Svx3DSceneObject::getByIndex( sal_Int32 Index )
{
SolarMutexGuard aGuard;
- if( !mpObj.is() || mpObj->GetSubList() == nullptr )
+ if( !HasSdrObject() || GetSdrObject()->GetSubList() == nullptr )
throw uno::RuntimeException();
- if( Index<0 || mpObj->GetSubList()->GetObjCount() <= static_cast<size_t>(Index) )
+ if( Index<0 || GetSdrObject()->GetSubList()->GetObjCount() <= static_cast<size_t>(Index) )
throw lang::IndexOutOfBoundsException();
- SdrObject* pDestObj = mpObj->GetSubList()->GetObj( Index );
+ SdrObject* pDestObj = GetSdrObject()->GetSubList()->GetObj( Index );
if(pDestObj == nullptr)
throw lang::IndexOutOfBoundsException();
@@ -222,7 +221,7 @@ sal_Bool SAL_CALL Svx3DSceneObject::hasElements()
{
SolarMutexGuard aGuard;
- return mpObj.is() && mpObj->GetSubList() && (mpObj->GetSubList()->GetObjCount() > 0);
+ return HasSdrObject() && GetSdrObject()->GetSubList() && (GetSdrObject()->GetSubList()->GetObjCount() > 0);
}
@@ -259,14 +258,14 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// patch transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
{
// set CameraGeometry at scene
- E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
+ E3dScene* pScene = static_cast< E3dScene* >( GetSdrObject() );
drawing::CameraGeometry aCamGeo;
if(rValue >>= aCamGeo)
@@ -371,13 +370,13 @@ bool Svx3DSceneObject::getPropertyValueImpl(const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// patch object to a homogeneous 4x4 matrix
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_CAMERA_GEOMETRY:
{
// get CameraGeometry from scene
- E3dScene* pScene = static_cast< E3dScene* >( mpObj.get() );
+ E3dScene* pScene = static_cast< E3dScene* >( GetSdrObject() );
drawing::CameraGeometry aCamGeo;
// fill Vectors from scene camera
@@ -433,7 +432,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformationmatrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -444,7 +443,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
if( rValue >>= aUnoPos )
{
basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
- static_cast< E3dCubeObj* >( mpObj.get() )->SetCubePos(aPos);
+ static_cast< E3dCubeObj* >( GetSdrObject() )->SetCubePos(aPos);
return true;
}
break;
@@ -456,7 +455,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
if( rValue >>= aDirection )
{
basegfx::B3DVector aSize(aDirection.DirectionX, aDirection.DirectionY, aDirection.DirectionZ);
- static_cast< E3dCubeObj* >( mpObj.get() )->SetCubeSize(aSize);
+ static_cast< E3dCubeObj* >( GetSdrObject() )->SetCubeSize(aSize);
return true;
}
break;
@@ -467,7 +466,7 @@ bool Svx3DCubeObject::setPropertyValueImpl( const OUString& rName, const SfxItem
// pack sal_Bool bPosIsCenter to the object
if( rValue >>= bNew )
{
- static_cast< E3dCubeObj* >( mpObj.get() )->SetPosIsCenter(bNew);
+ static_cast< E3dCubeObj* >( GetSdrObject() )->SetPosIsCenter(bNew);
return true;
}
break;
@@ -486,13 +485,13 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation to a homogeneous matrix
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_POSITION:
{
// pack position
- const basegfx::B3DPoint& rPos = static_cast<E3dCubeObj*>(mpObj.get())->GetCubePos();
+ const basegfx::B3DPoint& rPos = static_cast<E3dCubeObj*>(GetSdrObject())->GetCubePos();
drawing::Position3D aPos;
aPos.PositionX = rPos.getX();
@@ -505,7 +504,7 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
case OWN_ATTR_3D_VALUE_SIZE:
{
// pack size
- const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(mpObj.get())->GetCubeSize();
+ const basegfx::B3DVector& rSize = static_cast<E3dCubeObj*>(GetSdrObject())->GetCubeSize();
drawing::Direction3D aDir;
aDir.DirectionX = rSize.getX();
@@ -517,7 +516,7 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
}
case OWN_ATTR_3D_VALUE_POS_IS_CENTER:
{
- rValue <<= static_cast<E3dCubeObj*>(mpObj.get())->GetPosIsCenter();
+ rValue <<= static_cast<E3dCubeObj*>(GetSdrObject())->GetPosIsCenter();
break;
}
default:
@@ -552,7 +551,7 @@ bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxIt
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -564,7 +563,7 @@ bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxIt
if( rValue >>= aUnoPos )
{
basegfx::B3DPoint aPos(aUnoPos.PositionX, aUnoPos.PositionY, aUnoPos.PositionZ);
- static_cast<E3dSphereObj*>(mpObj.get())->SetCenter(aPos);
+ static_cast<E3dSphereObj*>(GetSdrObject())->SetCenter(aPos);
return true;
}
break;
@@ -577,7 +576,7 @@ bool Svx3DSphereObject::setPropertyValueImpl( const OUString& rName, const SfxIt
if( rValue >>= aDir )
{
basegfx::B3DVector aPos(aDir.DirectionX, aDir.DirectionY, aDir.DirectionZ);
- static_cast<E3dSphereObj*>(mpObj.get())->SetSize(aPos);
+ static_cast<E3dSphereObj*>(GetSdrObject())->SetSize(aPos);
return true;
}
break;
@@ -596,13 +595,13 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation to a homogeneous matrix
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_POSITION:
{
// pack position
- const basegfx::B3DPoint& rPos = static_cast<E3dSphereObj*>(mpObj.get())->Center();
+ const basegfx::B3DPoint& rPos = static_cast<E3dSphereObj*>(GetSdrObject())->Center();
drawing::Position3D aPos;
aPos.PositionX = rPos.getX();
@@ -615,7 +614,7 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt
case OWN_ATTR_3D_VALUE_SIZE:
{
// pack size
- const basegfx::B3DVector& rSize = static_cast<E3dSphereObj*>(mpObj.get())->Size();
+ const basegfx::B3DVector& rSize = static_cast<E3dSphereObj*>(GetSdrObject())->Size();
drawing::Direction3D aDir;
aDir.DirectionX = rSize.getX();
@@ -745,7 +744,7 @@ bool Svx3DLatheObject::setPropertyValueImpl( const OUString& rName, const SfxIte
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -760,18 +759,18 @@ bool Svx3DLatheObject::setPropertyValueImpl( const OUString& rName, const SfxIte
// #105127# SetPolyPoly3D sets the Svx3DVerticalSegmentsItem to the number
// of points of the polygon. Thus, value gets lost. To avoid this, rescue
// item here and re-set after setting the polygon.
- const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
+ const sal_uInt32 nPrevVerticalSegs(static_cast<E3dLatheObj*>(GetSdrObject())->GetVerticalSegments());
// set polygon
const basegfx::B3DHomMatrix aIdentity;
const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
- static_cast<E3dLatheObj*>(mpObj.get())->SetPolyPoly2D(aB2DPolyPolygon);
- const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(mpObj.get())->GetVerticalSegments());
+ static_cast<E3dLatheObj*>(GetSdrObject())->SetPolyPoly2D(aB2DPolyPolygon);
+ const sal_uInt32 nPostVerticalSegs(static_cast<E3dLatheObj*>(GetSdrObject())->GetVerticalSegments());
if(nPrevVerticalSegs != nPostVerticalSegs)
{
// restore the vertical segment count
- static_cast<E3dLatheObj*>(mpObj.get())->SetMergedItem(makeSvx3DVerticalSegmentsItem(nPrevVerticalSegs));
+ static_cast<E3dLatheObj*>(GetSdrObject())->SetMergedItem(makeSvx3DVerticalSegmentsItem(nPrevVerticalSegs));
}
return true;
}
@@ -792,14 +791,14 @@ bool Svx3DLatheObject::getPropertyValueImpl( const OUString& rName, const SfxIte
{
// pack transformation to a homogeneous matrix
drawing::HomogenMatrix aHomMat;
- basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
+ basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(GetSdrObject())->GetTransform();
basegfx::utils::B3DHomMatrixToUnoHomogenMatrix(aMat, aHomMat);
rValue <<= aHomMat;
break;
}
case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
{
- const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(mpObj.get())->GetPolyPoly2D();
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dLatheObj*>(GetSdrObject())->GetPolyPoly2D();
const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
@@ -837,7 +836,7 @@ bool Svx3DExtrudeObject::setPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -853,7 +852,7 @@ bool Svx3DExtrudeObject::setPropertyValueImpl( const OUString& rName, const SfxI
// set polygon
const basegfx::B3DHomMatrix aIdentity;
const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
- static_cast<E3dExtrudeObj*>(mpObj.get())->SetExtrudePolygon(aB2DPolyPolygon);
+ static_cast<E3dExtrudeObj*>(GetSdrObject())->SetExtrudePolygon(aB2DPolyPolygon);
return true;
}
break;
@@ -873,7 +872,7 @@ bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxI
{
// pack transformation to a homogeneous matrix
drawing::HomogenMatrix aHomMat;
- basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(mpObj.get())->GetTransform();
+ basegfx::B3DHomMatrix aMat = static_cast<E3dObject*>(GetSdrObject())->GetTransform();
basegfx::utils::B3DHomMatrixToUnoHomogenMatrix(aMat, aHomMat);
rValue <<= aHomMat;
break;
@@ -882,7 +881,7 @@ bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
{
// pack polygon definition
- const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(mpObj.get())->GetExtrudePolygon();
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dExtrudeObj*>(GetSdrObject())->GetExtrudePolygon();
const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon, rValue);
@@ -920,7 +919,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
// pack transformation matrix to the object
- if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( mpObj.get() ), rValue ) )
+ if( ConvertHomogenMatrixToObject( static_cast< E3dObject* >( GetSdrObject() ), rValue ) )
return true;
break;
}
@@ -934,7 +933,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
{
// set polygon
- static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyPolygon3D(aNewB3DPolyPolygon);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetPolyPolygon3D(aNewB3DPolyPolygon);
return true;
}
break;
@@ -948,7 +947,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
if( PolyPolygonShape3D_to_B3dPolyPolygon( rValue, aNewB3DPolyPolygon, false ) )
{
// set polygon
- static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyNormals3D(aNewB3DPolyPolygon);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetPolyNormals3D(aNewB3DPolyPolygon);
return true;
}
break;
@@ -964,7 +963,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
// set polygon
const basegfx::B3DHomMatrix aIdentity;
const basegfx::B2DPolyPolygon aB2DPolyPolygon(basegfx::utils::createB2DPolyPolygonFromB3DPolyPolygon(aNewB3DPolyPolygon, aIdentity));
- static_cast<E3dPolygonObj*>(mpObj.get())->SetPolyTexture2D(aB2DPolyPolygon);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetPolyTexture2D(aB2DPolyPolygon);
return true;
}
break;
@@ -974,7 +973,7 @@ bool Svx3DPolygonObject::setPropertyValueImpl( const OUString& rName, const SfxI
bool bNew = false;
if( rValue >>= bNew )
{
- static_cast<E3dPolygonObj*>(mpObj.get())->SetLineOnly(bNew);
+ static_cast<E3dPolygonObj*>(GetSdrObject())->SetLineOnly(bNew);
return true;
}
break;
@@ -992,26 +991,26 @@ bool Svx3DPolygonObject::getPropertyValueImpl( const OUString& rName, const SfxI
{
case OWN_ATTR_3D_VALUE_TRANSFORM_MATRIX:
{
- ConvertObjectToHomogenMatric( static_cast< E3dObject* >( mpObj.get() ), rValue );
+ ConvertObjectToHomogenMatric( static_cast< E3dObject* >( GetSdrObject() ), rValue );
break;
}
case OWN_ATTR_3D_VALUE_POLYPOLYGON3D:
{
- B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyPolygon3D(),rValue);
+ B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(GetSdrObject())->GetPolyPolygon3D(),rValue);
break;
}
case OWN_ATTR_3D_VALUE_NORMALSPOLYGON3D:
{
- B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyNormals3D(),rValue);
+ B3dPolyPolygon_to_PolyPolygonShape3D(static_cast<E3dPolygonObj*>(GetSdrObject())->GetPolyNormals3D(),rValue);
break;
}
case OWN_ATTR_3D_VALUE_TEXTUREPOLYGON3D:
{
// pack texture definition
- const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(mpObj.get())->GetPolyTexture2D();
+ const basegfx::B2DPolyPolygon& rPolyPoly = static_cast<E3dPolygonObj*>(GetSdrObject())->GetPolyTexture2D();
const basegfx::B3DPolyPolygon aB3DPolyPolygon(basegfx::utils::createB3DPolyPolygonFromB2DPolyPolygon(rPolyPoly));
B3dPolyPolygon_to_PolyPolygonShape3D(aB3DPolyPolygon,rValue);
@@ -1020,7 +1019,7 @@ bool Svx3DPolygonObject::getPropertyValueImpl( const OUString& rName, const SfxI
case OWN_ATTR_3D_VALUE_LINEONLY:
{
- rValue <<= static_cast<E3dPolygonObj*>(mpObj.get())->GetLineOnly();
+ rValue <<= static_cast<E3dPolygonObj*>(GetSdrObject())->GetLineOnly();
break;
}
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 08e33cf04c0f..c9e40652e372 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -90,10 +90,10 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
// TODO/LATER: seems to make no sense for iconified object
awt::Rectangle aVisArea;
- if( (rValue >>= aVisArea) && dynamic_cast<const SdrOle2Obj* >(mpObj.get()) != nullptr)
+ if( (rValue >>= aVisArea) && dynamic_cast<const SdrOle2Obj* >(GetSdrObject()) != nullptr)
{
Size aTmp( aVisArea.X + aVisArea.Width, aVisArea.Y + aVisArea.Height );
- uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef();
+ uno::Reference < embed::XEmbeddedObject > xObj = static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef();
if( xObj.is() )
{
try
@@ -118,7 +118,7 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
sal_Int64 nAspect = 0;
if( rValue >>= nAspect )
{
- static_cast<SdrOle2Obj*>(mpObj.get())->SetAspect( nAspect );
+ static_cast<SdrOle2Obj*>(GetSdrObject())->SetAspect( nAspect );
return true;
}
break;
@@ -144,7 +144,7 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
if( xGraphic.is() )
{
const Graphic aGraphic(xGraphic);
- static_cast<SdrOle2Obj*>(mpObj.get())->SetGraphic(aGraphic);
+ static_cast<SdrOle2Obj*>(GetSdrObject())->SetGraphic(aGraphic);
return true;
}
break;
@@ -154,7 +154,7 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
uno::Reference< graphic::XGraphic > xGraphic( rValue, uno::UNO_QUERY );
if( xGraphic.is() )
{
- SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if( pOle )
{
GraphicObject aGrafObj( xGraphic );
@@ -172,10 +172,10 @@ bool SvxOle2Shape::setPropertyValueImpl( const OUString& rName, const SfxItemPro
{
SdrOle2Obj *pOle;
#if OSL_DEBUG_LEVEL > 0
- pOle = dynamic_cast<SdrOle2Obj*>(mpObj.get());
+ pOle = dynamic_cast<SdrOle2Obj*>(GetSdrObject());
assert(pOle);
#else
- pOle = static_cast<SdrOle2Obj*>(mpObj.get());
+ pOle = static_cast<SdrOle2Obj*>(GetSdrObject());
#endif
pOle->SetPersistName( aPersistName );
return true;
@@ -220,7 +220,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_METAFILE:
{
- SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(mpObj.get());
+ SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>(GetSdrObject());
if( pObj )
{
const Graphic* pGraphic = pObj->GetGraphic();
@@ -260,10 +260,10 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_OLE_VISAREA:
{
awt::Rectangle aVisArea;
- if( dynamic_cast<const SdrOle2Obj* >(mpObj.get()) != nullptr)
+ if( dynamic_cast<const SdrOle2Obj* >(GetSdrObject()) != nullptr)
{
MapMode aMapMode( MapUnit::Map100thMM ); // the API uses this map mode
- Size aTmp = static_cast<SdrOle2Obj*>(mpObj.get())->GetOrigObjSize( &aMapMode ); // get the size in the requested map mode
+ Size aTmp = static_cast<SdrOle2Obj*>(GetSdrObject())->GetOrigObjSize( &aMapMode ); // get the size in the requested map mode
aVisArea = awt::Rectangle( 0, 0, aTmp.Width(), aTmp.Height() );
}
@@ -273,14 +273,14 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_OLESIZE:
{
- Size aTmp( static_cast<SdrOle2Obj*>(mpObj.get())->GetOrigObjSize() );
+ Size aTmp( static_cast<SdrOle2Obj*>(GetSdrObject())->GetOrigObjSize() );
rValue <<= awt::Size( aTmp.Width(), aTmp.Height() );
break;
}
case OWN_ATTR_OLE_ASPECT:
{
- rValue <<= static_cast<SdrOle2Obj*>(mpObj.get())->GetAspect();
+ rValue <<= static_cast<SdrOle2Obj*>(GetSdrObject())->GetAspect();
break;
}
@@ -288,7 +288,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_OLE_EMBEDDED_OBJECT:
case OWN_ATTR_OLE_EMBEDDED_OBJECT_NONEWCLIENT:
{
- SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>( mpObj.get() );
+ SdrOle2Obj* pObj = dynamic_cast<SdrOle2Obj*>( GetSdrObject() );
if( pObj )
{
uno::Reference < embed::XEmbeddedObject > xObj( pObj->GetObjRef() );
@@ -315,7 +315,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_VALUE_GRAPHIC:
{
uno::Reference< graphic::XGraphic > xGraphic;
- const Graphic* pGraphic = static_cast<SdrOle2Obj*>( mpObj.get() )->GetGraphic();
+ const Graphic* pGraphic = static_cast<SdrOle2Obj*>( GetSdrObject() )->GetGraphic();
if( pGraphic )
xGraphic = pGraphic->GetXGraphic();
rValue <<= xGraphic;
@@ -325,7 +325,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_THUMBNAIL:
{
uno::Reference< graphic::XGraphic > xGraphic;
- const Graphic* pGraphic = static_cast<SdrOle2Obj*>( mpObj.get() )->GetGraphic();
+ const Graphic* pGraphic = static_cast<SdrOle2Obj*>( GetSdrObject() )->GetGraphic();
if( pGraphic )
xGraphic = pGraphic->GetXGraphic();
rValue <<= xGraphic;
@@ -334,14 +334,14 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_PERSISTNAME:
{
OUString aPersistName;
- SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if( pOle )
{
aPersistName = pOle->GetPersistName();
if( !aPersistName.isEmpty() )
{
- ::comphelper::IEmbeddedHelper* pPersist(mpObj->getSdrModelFromSdrObject().GetPersist());
+ ::comphelper::IEmbeddedHelper* pPersist(GetSdrObject()->getSdrModelFromSdrObject().GetPersist());
if( (nullptr == pPersist) || !pPersist->getEmbeddedObjectContainer().HasEmbeddedObject( pOle->GetPersistName() ) )
aPersistName.clear();
}
@@ -353,7 +353,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro
case OWN_ATTR_OLE_LINKURL:
{
OUString aLinkURL;
- SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if( pOle )
{
@@ -376,12 +376,12 @@ bool SvxOle2Shape::createObject( const SvGlobalName &aClassName )
{
DBG_TESTSOLARMUTEX();
- SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if ( !pOle2Obj || !pOle2Obj->IsEmpty() )
return false;
// create storage and inplace object
- ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
+ ::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist();
OUString aPersistName;
OUString aTmpStr;
if( SvxShape::getPropertyValue( UNO_NAME_OLE2_PERSISTNAME ) >>= aTmpStr )
@@ -438,13 +438,13 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL )
{
DBG_TESTSOLARMUTEX();
- SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if ( !pOle2Obj || !pOle2Obj->IsEmpty() )
return;
OUString aPersistName;
- ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
+ ::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist();
uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
aMediaDescr[0].Name = "URL";
@@ -497,10 +497,10 @@ void SvxOle2Shape::createLink( const OUString& aLinkURL )
void SvxOle2Shape::resetModifiedState()
{
- ::comphelper::IEmbeddedHelper* pPersist = mpModel ? mpModel->GetPersist() : nullptr;
+ ::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist();
if( pPersist && !pPersist->isEnableSetModified() )
{
- SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if( pOle && !pOle->IsEmpty() )
{
uno::Reference < util::XModifiable > xMod( pOle->GetObjRef(), uno::UNO_QUERY );
@@ -515,7 +515,7 @@ const SvGlobalName SvxOle2Shape::GetClassName_Impl(OUString& rHexCLSID)
{
DBG_TESTSOLARMUTEX();
SvGlobalName aClassName;
- SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( mpObj.get() );
+ SdrOle2Obj* pOle2Obj = dynamic_cast< SdrOle2Obj* >( GetSdrObject() );
if( pOle2Obj )
{
@@ -523,7 +523,7 @@ const SvGlobalName SvxOle2Shape::GetClassName_Impl(OUString& rHexCLSID)
if( pOle2Obj->IsEmpty() )
{
- ::comphelper::IEmbeddedHelper* pPersist = mpModel->GetPersist();
+ ::comphelper::IEmbeddedHelper* pPersist = GetSdrObject()->getSdrModelFromSdrObject().GetPersist();
if( pPersist )
{
uno::Reference < embed::XEmbeddedObject > xObj =
@@ -584,9 +584,9 @@ bool SvxAppletShape::setPropertyValueImpl( const OUString& rName, const SfxItemP
{
if( (pProperty->nWID >= OWN_ATTR_APPLET_DOCBASE) && (pProperty->nWID <= OWN_ATTR_APPLET_ISSCRIPT) )
{
- if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef() ) )
{
- uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
if( xSet.is() )
{
// allow exceptions to pass through
@@ -605,9 +605,9 @@ bool SvxAppletShape::getPropertyValueImpl( const OUString& rName, const SfxItemP
{
if( (pProperty->nWID >= OWN_ATTR_APPLET_DOCBASE) && (pProperty->nWID <= OWN_ATTR_APPLET_ISSCRIPT) )
{
- if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ if ( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef() ) )
{
- uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
if( xSet.is() )
{
rValue = xSet->getPropertyValue( rName );
@@ -655,9 +655,9 @@ bool SvxPluginShape::setPropertyValueImpl( const OUString& rName, const SfxItemP
{
if( (pProperty->nWID >= OWN_ATTR_PLUGIN_MIMETYPE) && (pProperty->nWID <= OWN_ATTR_PLUGIN_COMMANDS) )
{
- if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef() ) )
{
- uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
if( xSet.is() )
{
// allow exceptions to pass through
@@ -676,9 +676,9 @@ bool SvxPluginShape::getPropertyValueImpl( const OUString& rName, const SfxItemP
{
if( (pProperty->nWID >= OWN_ATTR_PLUGIN_MIMETYPE) && (pProperty->nWID <= OWN_ATTR_PLUGIN_COMMANDS) )
{
- if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef() ) )
{
- uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
if( xSet.is() )
{
rValue = xSet->getPropertyValue( rName );
@@ -727,9 +727,9 @@ bool SvxFrameShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr
{
if( (pProperty->nWID >= OWN_ATTR_FRAME_URL) && (pProperty->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT) )
{
- if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef() ) )
{
- uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
if( xSet.is() )
{
// allow exceptions to pass through
@@ -749,9 +749,9 @@ bool SvxFrameShape::getPropertyValueImpl(const OUString& rName, const SfxItemPro
{
if( (pProperty->nWID >= OWN_ATTR_FRAME_URL) && (pProperty->nWID <= OWN_ATTR_FRAME_MARGIN_HEIGHT) )
{
- if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef() ) )
+ if( svt::EmbeddedObjectRef::TryRunningState( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef() ) )
{
- uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(mpObj.get())->GetObjRef()->getComponent(), uno::UNO_QUERY );
+ uno::Reference < beans::XPropertySet > xSet( static_cast<SdrOle2Obj*>(GetSdrObject())->GetObjRef()->getComponent(), uno::UNO_QUERY );
if( xSet.is() )
{
rValue = xSet->getPropertyValue( rName );
@@ -783,7 +783,7 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr
|| (pProperty->nWID == OWN_ATTR_MEDIA_STREAM)
|| (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE) )
{
- SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() );
+ SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() );
::avmedia::MediaItem aItem;
bool bOk = false;
@@ -926,7 +926,7 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr
|| (pProperty->nWID == OWN_ATTR_MEDIA_MIMETYPE)
|| (pProperty->nWID == OWN_ATTR_FALLBACK_GRAPHIC))
{
- SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( mpObj.get() );
+ SdrMediaObj* pMedia = static_cast< SdrMediaObj* >( GetSdrObject() );
const ::avmedia::MediaItem aItem( pMedia->getMediaProperties() );
switch( pProperty->nWID )
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index 18572b659066..ba0aa389a447 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -180,8 +180,7 @@ SvxShape::SvxShape( SdrObject* pObject )
, mbIsMultiPropertyCall(false)
, mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
, maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
-, mpObj(pObject)
-, mpModel(nullptr)
+, mpSdrObjectWeakReference(pObject)
, mnLockCount(0)
{
impl_construct();
@@ -194,8 +193,7 @@ SvxShape::SvxShape( SdrObject* pObject, const SfxItemPropertyMapEntry* pEntries,
, mbIsMultiPropertyCall(false)
, mpPropSet(pPropertySet)
, maPropMapEntries(pEntries)
-, mpObj(pObject)
-, mpModel(nullptr)
+, mpSdrObjectWeakReference(pObject)
, mnLockCount(0)
{
impl_construct();
@@ -208,8 +206,7 @@ SvxShape::SvxShape()
, mbIsMultiPropertyCall(false)
, mpPropSet(getSvxMapProvider().GetPropertySet(SVXMAP_SHAPE, SdrObject::GetGlobalDrawObjectItemPool()))
, maPropMapEntries(getSvxMapProvider().GetMap(SVXMAP_SHAPE))
-, mpObj(nullptr)
-, mpModel(nullptr)
+, mpSdrObjectWeakReference(nullptr)
, mnLockCount(0)
{
impl_construct();
@@ -222,19 +219,19 @@ SvxShape::~SvxShape() throw()
DBG_ASSERT( mnLockCount == 0, "Locked shape was disposed!" );
- if ( mpModel )
- EndListening( *mpModel );
-
if ( mpImpl->mpMaster )
mpImpl->mpMaster->dispose();
- if ( mpObj.is() )
- mpObj->setUnoShape(nullptr);
+ if ( HasSdrObject() )
+ {
+ EndListening(GetSdrObject()->getSdrModelFromSdrObject());
+ GetSdrObject()->setUnoShape(nullptr);
+ }
- if( HasSdrObjectOwnership() && mpObj.is() )
+ if( HasSdrObjectOwnership() && HasSdrObject() )
{
mpImpl->mbHasSdrObjectOwnership = false;
- SdrObject* pObject = mpObj.get();
+ SdrObject* pObject = GetSdrObject();
SdrObject::Free( pObject );
}
@@ -248,13 +245,23 @@ void SvxShape::TakeSdrObjectOwnership()
}
+void SvxShape::InvalidateSdrObject()
+{
+ if(HasSdrObject())
+ {
+ EndListening(GetSdrObject()->getSdrModelFromSdrObject());
+ }
+
+ mpSdrObjectWeakReference.reset( nullptr );
+};
+
bool SvxShape::HasSdrObjectOwnership() const
{
if ( !mpImpl->mbHasSdrObjectOwnership )
return false;
- OSL_ENSURE( mpObj.is(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
- return mpObj.is();
+ OSL_ENSURE( HasSdrObject(), "SvxShape::HasSdrObjectOwnership: have the ownership of an object which I don't know!" );
+ return HasSdrObject();
}
@@ -335,40 +342,31 @@ void SvxShape::impl_construct()
mpImpl->maPropertyNotifier.registerProvider( svx::ShapeProperty::Size,
std::shared_ptr<svx::IPropertyValueProvider>( new ShapeSizeProvider( *mpImpl ) ) );
- if ( mpObj.is() )
+ if ( HasSdrObject() )
+ {
+ StartListening(GetSdrObject()->getSdrModelFromSdrObject());
impl_initFromSdrObject();
+ }
}
void SvxShape::impl_initFromSdrObject()
{
DBG_TESTSOLARMUTEX();
- OSL_PRECOND( mpObj.is(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
- if ( !mpObj.is() )
+ OSL_PRECOND( HasSdrObject(), "SvxShape::impl_initFromSdrObject: not to be called without SdrObject!" );
+ if ( !HasSdrObject() )
return;
osl_atomic_increment( &m_refCount );
{
- mpObj->setUnoShape(*this);
+ GetSdrObject()->setUnoShape(*this);
}
osl_atomic_decrement( &m_refCount );
- auto pNewModel = &mpObj->getSdrModelFromSdrObject();
-
- if (pNewModel != mpModel)
- {
- if (mpModel)
- EndListening( *mpModel );
- if (pNewModel)
- StartListening( *pNewModel );
- mpModel = pNewModel;
- }
-
// #i40944#
// Do not simply return when no model but do the type corrections
// following below.
-
- const SdrInventor nInventor = mpObj->GetObjInventor();
+ const SdrInventor nInventor = GetSdrObject()->GetObjInventor();
// is it one of ours (svx) ?
if( nInventor == SdrInventor::Default || nInventor == SdrInventor::E3d || nInventor == SdrInventor::FmForm )
@@ -379,7 +377,7 @@ void SvxShape::impl_initFromSdrObject()
}
else
{
- mpImpl->mnObjId = mpObj->GetObjIdentifier();
+ mpImpl->mnObjId = GetSdrObject()->GetObjIdentifier();
if( nInventor == SdrInventor::E3d )
mpImpl->mnObjId |= E3D_INVENTOR_FLAG;
}
@@ -415,12 +413,17 @@ void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
// Correct condition (#i52126#)
mpImpl->mpCreatedObj = pNewObj;
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- EndListening( mpObj->getSdrModelFromSdrObject() );
+ EndListening( GetSdrObject()->getSdrModelFromSdrObject() );
}
- mpObj.reset( pNewObj );
+ mpSdrObjectWeakReference.reset( pNewObj );
+
+ if( HasSdrObject() )
+ {
+ StartListening( GetSdrObject()->getSdrModelFromSdrObject() );
+ }
OSL_ENSURE( !mbIsMultiPropertyCall, "SvxShape::Create: hmm?" );
// this was previously set in impl_initFromSdrObject, but I think it was superfluous
@@ -431,19 +434,19 @@ void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
ObtainSettingsFromPropertySet( *mpPropSet );
// save user call
- SdrObjUserCall* pUser = mpObj->GetUserCall();
- mpObj->SetUserCall(nullptr);
+ SdrObjUserCall* pUser = GetSdrObject()->GetUserCall();
+ GetSdrObject()->SetUserCall(nullptr);
setPosition( maPosition );
setSize( maSize );
// restore user call after we set the initial size
- mpObj->SetUserCall( pUser );
+ GetSdrObject()->SetUserCall( pUser );
// if this shape was already named, use this name
if( !maShapeName.isEmpty() )
{
- mpObj->SetName( maShapeName );
+ GetSdrObject()->SetName( maShapeName );
maShapeName.clear();
}
}
@@ -451,9 +454,9 @@ void SvxShape::Create( SdrObject* pNewObj, SvxDrawPage* /*pNewPage*/ )
void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
{
DBG_TESTSOLARMUTEX();
- if(mpModel)
+ if(HasSdrObject())
{
- MapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
if(eMapUnit != MapUnit::Map100thMM)
{
switch(eMapUnit)
@@ -477,9 +480,9 @@ void SvxShape::ForceMetricToItemPoolMetric(Pair& rPoint) const throw()
void SvxShape::ForceMetricToItemPoolMetric(basegfx::B2DPolyPolygon& rPolyPolygon) const throw()
{
DBG_TESTSOLARMUTEX();
- if(mpModel)
+ if(HasSdrObject())
{
- MapUnit eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ MapUnit eMapUnit(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0));
if(eMapUnit != MapUnit::Map100thMM)
{
switch(eMapUnit)
@@ -507,9 +510,9 @@ void SvxShape::ForceMetricTo100th_mm(Pair& rPoint) const throw()
{
DBG_TESTSOLARMUTEX();
MapUnit eMapUnit = MapUnit::Map100thMM;
- if(mpModel)
+ if(HasSdrObject())
{
- eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
if(eMapUnit != MapUnit::Map100thMM)
{
switch(eMapUnit)
@@ -534,9 +537,9 @@ void SvxShape::ForceMetricTo100th_mm(basegfx::B2DPolyPolygon& rPolyPolygon) cons
{
DBG_TESTSOLARMUTEX();
MapUnit eMapUnit = MapUnit::Map100thMM;
- if(mpModel)
+ if(HasSdrObject())
{
- eMapUnit = mpModel->GetItemPool().GetMetric(0);
+ eMapUnit = GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetMetric(0);
if(eMapUnit != MapUnit::Map100thMM)
{
switch(eMapUnit)
@@ -616,15 +619,15 @@ void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemPropertySet&
void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet)
{
DBG_TESTSOLARMUTEX();
- if(mpObj.is() && rPropSet.AreThereOwnUsrAnys() && mpModel)
+ if(HasSdrObject() && rPropSet.AreThereOwnUsrAnys())
{
- SfxItemSet aSet( mpModel->GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{});
+ SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>{});
Reference< beans::XPropertySet > xShape( static_cast<OWeakObject*>(this), UNO_QUERY );
SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, &mpPropSet->getPropertyMap() );
- mpObj->SetMergedItemSetAndBroadcast(aSet);
+ GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
- mpObj->ApplyNotPersistAttr( aSet );
+ GetSdrObject()->ApplyNotPersistAttr( aSet );
}
}
@@ -633,21 +636,21 @@ uno::Any SvxShape::GetBitmap( bool bMetaFile /* = false */ ) const
DBG_TESTSOLARMUTEX();
uno::Any aAny;
- if( !mpObj.is() || mpModel == nullptr || !mpObj->IsInserted() || nullptr == mpObj->GetPage() )
+ if( !HasSdrObject() || !GetSdrObject()->IsInserted() || nullptr == GetSdrObject()->GetPage() )
return aAny;
ScopedVclPtrInstance< VirtualDevice > pVDev;
pVDev->SetMapMode(MapMode(MapUnit::Map100thMM));
- SdrPage* pPage = mpObj->GetPage();
+ SdrPage* pPage = GetSdrObject()->GetPage();
std::unique_ptr<E3dView> pView(
new E3dView(
- mpObj->getSdrModelFromSdrObject(),
+ GetSdrObject()->getSdrModelFromSdrObject(),
pVDev.get()));
pView->hideMarkHandles();
SdrPageView* pPageView = pView->ShowSdrPage(pPage);
- SdrObject *pTempObj = mpObj.get();
+ SdrObject *pTempObj = GetSdrObject();
pView->MarkObj(pTempObj,pPageView);
tools::Rectangle aRect(pTempObj->GetCurrentBoundRect());
@@ -977,7 +980,7 @@ uno::Sequence< sal_Int8 > SAL_CALL SvxShape::getImplementationId()
void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
{
DBG_TESTSOLARMUTEX();
- if( !mpObj.is() )
+ if( !HasSdrObject() )
return;
// #i55919# SdrHintKind::ObjectChange is only interesting if it's for this object
@@ -985,13 +988,14 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
const SdrHint* pSdrHint = dynamic_cast<const SdrHint*>(&rHint);
if (!pSdrHint ||
((pSdrHint->GetKind() != SdrHintKind::ModelCleared) &&
- (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != mpObj.get() )))
+ (pSdrHint->GetKind() != SdrHintKind::ObjectChange || pSdrHint->GetObject() != GetSdrObject() )))
return;
- uno::Reference< uno::XInterface > xSelf( mpObj->getWeakUnoShape() );
+ uno::Reference< uno::XInterface > xSelf( GetSdrObject()->getWeakUnoShape() );
if( !xSelf.is() )
{
- mpObj.reset( nullptr );
+ EndListening(GetSdrObject()->getSdrModelFromSdrObject());
+ mpSdrObjectWeakReference.reset( nullptr );
return;
}
@@ -1007,7 +1011,6 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
case SdrHintKind::ModelCleared:
{
bClearMe = true;
- mpModel = nullptr;
break;
}
default:
@@ -1017,9 +1020,13 @@ void SvxShape::Notify( SfxBroadcaster&, const SfxHint& rHint ) throw()
if( bClearMe )
{
if( !HasSdrObjectOwnership() ) {
- if( mpObj.is() )
- mpObj->setUnoShape( nullptr );
- mpObj.reset( nullptr );
+ if( HasSdrObject() )
+ {
+ EndListening(GetSdrObject()->getSdrModelFromSdrObject());
+ GetSdrObject()->setUnoShape( nullptr );
+ }
+
+ mpSdrObjectWeakReference.reset( nullptr );
}
if ( !mpImpl->mbDisposing )
dispose();
@@ -1091,14 +1098,14 @@ awt::Point SAL_CALL SvxShape::getPosition()
{
::SolarMutexGuard aGuard;
- if( mpObj.is() && mpModel)
+ if(HasSdrObject())
{
- tools::Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
Point aPt( aRect.Left(), aRect.Top() );
// Position is relative to anchor, so recalc to absolute position
- if( mpModel->IsWriter() )
- aPt -= mpObj->GetAnchorPos();
+ if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
+ aPt -= GetSdrObject()->GetAnchorPos();
ForceMetricTo100th_mm(aPt);
return css::awt::Point( aPt.X(), aPt.Y() );
@@ -1114,25 +1121,25 @@ void SAL_CALL SvxShape::setPosition( const awt::Point& Position )
{
::SolarMutexGuard aGuard;
- if( mpObj.is() && mpModel )
+ if(HasSdrObject())
{
// do NOT move 3D objects, this would change the homogen
// transformation matrix
- if(dynamic_cast<const E3dCompoundObject* >(mpObj.get()) == nullptr)
+ if(dynamic_cast<const E3dCompoundObject* >(GetSdrObject()) == nullptr)
{
- tools::Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
Point aLocalPos( Position.X, Position.Y );
ForceMetricToItemPoolMetric(aLocalPos);
// Position is absolute, so recalc to position relative to anchor
- if( mpModel->IsWriter() )
- aLocalPos += mpObj->GetAnchorPos();
+ if( GetSdrObject()->getSdrModelFromSdrObject().IsWriter() )
+ aLocalPos += GetSdrObject()->GetAnchorPos();
long nDX = aLocalPos.X() - aRect.Left();
long nDY = aLocalPos.Y() - aRect.Top();
- mpObj->Move( Size( nDX, nDY ) );
- mpModel->SetChanged();
+ GetSdrObject()->Move( Size( nDX, nDY ) );
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
}
@@ -1144,9 +1151,9 @@ awt::Size SAL_CALL SvxShape::getSize()
{
::SolarMutexGuard aGuard;
- if( mpObj.is() && mpModel)
+ if(HasSdrObject())
{
- tools::Rectangle aRect( svx_getLogicRectHack(mpObj.get()) );
+ tools::Rectangle aRect( svx_getLogicRectHack(GetSdrObject()) );
Size aObjSize( aRect.getWidth(), aRect.getHeight() );
ForceMetricTo100th_mm(aObjSize);
return css::awt::Size( aObjSize.getWidth(), aObjSize.getHeight() );
@@ -1160,26 +1167,26 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
{
::SolarMutexGuard aGuard;
- if( mpObj.is() && mpModel)
+ if(HasSdrObject())
{
// #i123539# optimization for 3D chart object generation: do not use UNO
// API commands to get the range, this is too expensive since for 3D
// scenes it may recalculate the whole scene since in AOO this depends
// on the contained geometry (layouted to show all content)
- const bool b3DConstruction(dynamic_cast< E3dObject* >(mpObj.get()) && mpModel->isLocked());
+ const bool b3DConstruction(dynamic_cast< E3dObject* >(GetSdrObject()) && GetSdrObject()->getSdrModelFromSdrObject().isLocked());
tools::Rectangle aRect(
b3DConstruction ?
tools::Rectangle(maPosition.X, maPosition.Y, maSize.Width, maSize.Height) :
- svx_getLogicRectHack(mpObj.get()) );
+ svx_getLogicRectHack(GetSdrObject()) );
Size aLocalSize( rSize.Width, rSize.Height );
ForceMetricToItemPoolMetric(aLocalSize);
- if(mpObj->GetObjInventor() == SdrInventor::Default && mpObj->GetObjIdentifier() == OBJ_MEASURE )
+ if(GetSdrObject()->GetObjInventor() == SdrInventor::Default && GetSdrObject()->GetObjIdentifier() == OBJ_MEASURE )
{
Fraction aWdt(aLocalSize.Width(),aRect.Right()-aRect.Left());
Fraction aHgt(aLocalSize.Height(),aRect.Bottom()-aRect.Top());
- Point aPt = mpObj->GetSnapRect().TopLeft();
- mpObj->Resize(aPt,aWdt,aHgt);
+ Point aPt = GetSdrObject()->GetSnapRect().TopLeft();
+ GetSdrObject()->Resize(aPt,aWdt,aHgt);
}
else
{
@@ -1197,10 +1204,10 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
else
aRect.setHeight(aLocalSize.Height());
- svx_setLogicRectHack( mpObj.get(), aRect );
+ svx_setLogicRectHack( GetSdrObject(), aRect );
}
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
}
maSize = rSize;
}
@@ -1210,9 +1217,9 @@ void SAL_CALL SvxShape::setSize( const awt::Size& rSize )
OUString SAL_CALL SvxShape::getName( )
{
::SolarMutexGuard aGuard;
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- return mpObj->GetName();
+ return GetSdrObject()->GetName();
}
else
{
@@ -1224,9 +1231,9 @@ OUString SAL_CALL SvxShape::getName( )
void SAL_CALL SvxShape::setName( const OUString& aName )
{
::SolarMutexGuard aGuard;
- if( mpObj.is() )
+ if( HasSdrObject() )
{
- mpObj->SetName( aName );
+ GetSdrObject()->SetName( aName );
}
else
{
@@ -1262,47 +1269,42 @@ void SAL_CALL SvxShape::dispose()
mpImpl->maDisposeListeners.disposeAndClear(aEvt);
mpImpl->maPropertyNotifier.disposing();
- if ( mpObj.is() )
+ if ( HasSdrObject() )
{
+ EndListening( GetSdrObject()->getSdrModelFromSdrObject() );
bool bFreeSdrObject = false;
- if ( mpObj->IsInserted() && mpObj->GetPage() )
+ if ( GetSdrObject()->IsInserted() && GetSdrObject()->GetPage() )
{
OSL_ENSURE( HasSdrObjectOwnership(), "SvxShape::dispose: is the below code correct?" );
// normally, we are allowed to free the SdrObject only if we have its ownership.
// Why isn't this checked here?
- SdrPage* pPage = mpObj->GetPage();
+ SdrPage* pPage = GetSdrObject()->GetPage();
// delete the SdrObject from the page
const size_t nCount = pPage->GetObjCount();
for ( size_t nNum = 0; nNum < nCount; ++nNum )
{
- if ( pPage->GetObj( nNum ) == mpObj.get() )
+ if ( pPage->GetObj( nNum ) == GetSdrObject() )
{
- OSL_VERIFY( pPage->RemoveObject( nNum ) == mpObj.get() );
+ OSL_VERIFY( pPage->RemoveObject( nNum ) == GetSdrObject() );
bFreeSdrObject = true;
break;
}
}
}
- mpObj->setUnoShape(nullptr);
+ GetSdrObject()->setUnoShape(nullptr);
if ( bFreeSdrObject )
{
// in case we have the ownership of the SdrObject, a Free
// would do nothing. So ensure the ownership is reset.
mpImpl->mbHasSdrObjectOwnership = false;
- SdrObject* pObject = mpObj.get();
+ SdrObject* pObject = GetSdrObject();
SdrObject::Free( pObject );
}
}
-
- if( mpModel )
- {
- EndListening( *mpModel );
- mpModel = nullptr;
- }
}
@@ -1368,19 +1370,20 @@ void SAL_CALL SvxShape::removeVetoableChangeListener( const OUString& , const Re
bool SvxShape::SetFillAttribute( sal_uInt16 nWID, const OUString& rName )
{
- SfxItemSet aSet( mpModel->GetItemPool(), {{nWID, nWID}} );
-
- if( SetFillAttribute( nWID, rName, aSet, mpModel ) )
+ if(HasSdrObject())
{
- //mpObj->SetItemSetAndBroadcast(aSet);
- mpObj->SetMergedItemSetAndBroadcast(aSet);
+ SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{nWID, nWID}} );
- return true;
- }
- else
- {
- return false;
+ if( SetFillAttribute( nWID, rName, aSet, &GetSdrObject()->getSdrModelFromSdrObject() ) )
+ {
+ //GetSdrObject()->SetItemSetAndBroadcast(aSet);
+ GetSdrObject()->SetMergedItemSetAndBroadcast(aSet);
+
+ return true;
+ }
}
+
+ return false;
}
@@ -1563,7 +1566,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(rPropertyName);
- if (!mpObj.is() || !mpModel)
+ if (!HasSdrObject())
{
// Since we have no actual sdr object right now, remember all
// properties in a list. These properties will be set when the sdr
@@ -1578,6 +1581,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
// supported after creation.
mpPropSet->setPropertyValue( pMap, rVal );
}
+
return;
}
@@ -1592,7 +1596,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
"Readonly property can't be set: " + rPropertyName,
uno::Reference<drawing::XShape>(this));
- mpModel->SetChanged();
+ GetSdrObject()->getSdrModelFromSdrObject().SetChanged();
if (setPropertyValueImpl(rPropertyName, pMap, rVal))
return;
@@ -1614,7 +1618,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
{
if( mpImpl->mpItemSet == nullptr )
{
- pSet = mpImpl->mpItemSet = mpObj->GetMergedItemSet().Clone();
+ pSet = mpImpl->mpItemSet = GetSdrObject()->GetMergedItemSet().Clone();
}
else
{
@@ -1623,11 +1627,11 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
}
else
{
- pSet = new SfxItemSet( mpModel->GetItemPool(), {{pMap->nWID, pMap->nWID}});
+ pSet = new SfxItemSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
}
if( pSet->GetItemState( pMap->nWID ) != SfxItemState::SET )
- pSet->Put(mpObj->GetMergedItem(pMap->nWID));
+ pSet->Put(GetSdrObject()->GetMergedItem(pMap->nWID));
if( !SvxUnoTextRangeBase::SetPropertyValueHelper( pMap, rVal, *pSet ))
{
@@ -1636,7 +1640,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
if(bIsNotPersist)
{
// not-persistent attribute, get those extra
- mpObj->TakeNotPersistAttr(*pSet);
+ GetSdrObject()->TakeNotPersistAttr(*pSet);
}
}
@@ -1644,7 +1648,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
{
// get default from ItemPool
if(SfxItemPool::IsWhich(pMap->nWID))
- pSet->Put(mpModel->GetItemPool().GetDefaultItem(pMap->nWID));
+ pSet->Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID));
}
if( pSet->GetItemState( pMap->nWID ) == SfxItemState::SET )
@@ -1656,7 +1660,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
if(bIsNotPersist)
{
// set not-persistent attribute extra
- mpObj->ApplyNotPersistAttr( *pSet );
+ GetSdrObject()->ApplyNotPersistAttr( *pSet );
delete pSet;
}
else
@@ -1665,7 +1669,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any&
// will be set in setPropertyValues later
if( !mbIsMultiPropertyCall )
{
- mpObj->SetMergedItemSetAndBroadcast( *pSet );
+ GetSdrObject()->SetMergedItemSetAndBroadcast( *pSet );
delete pSet;
}
@@ -1689,7 +1693,7 @@ uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName);
uno::Any aAny;
- if( mpObj.is() && mpModel )
+ if(HasSdrObject())
{
if(pMap == nullptr )
throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this));
@@ -1699,8 +1703,8 @@ uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName )
DBG_ASSERT( pMap->nWID == SDRATTR_TEXTDIRECTION || (pMap->nWID < SDRATTR_NOTPERSIST_FIRST || pMap->nWID > SDRATTR_NOTPERSIST_LAST), "Not persist item not handled!" );
DBG_ASSERT( pMap->nWID < OWN_ATTR_VALUE_START || pMap->nWID > OWN_ATTR_VALUE_END, "Not item property not handled!" );
- SfxItemSet aSet( mpModel->GetItemPool(), {{pMap->nWID, pMap->nWID}});
- aSet.Put(mpObj->GetMergedItem(pMap->nWID));
+ SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), {{pMap->nWID, pMap->nWID}});
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list