diff options
Diffstat (limited to 'svx')
24 files changed, 54 insertions, 58 deletions
diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index e3116a9762b7..ba8b7fd7f6f8 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -345,7 +345,7 @@ uno::Reference<XAccessible> SAL_CALL else throw lang::IndexOutOfBoundsException ( "shape has no child with index " + OUString::number(nIndex), - static_cast<uno::XWeak*>(this)); + getXWeak()); return xChild; } @@ -534,7 +534,7 @@ awt::Rectangle SAL_CALL AccessibleShape::getBounds() if (maShapeTreeInfo.GetViewForwarder() == nullptr) throw uno::RuntimeException ( "AccessibleShape has no valid view forwarder", - static_cast<uno::XWeak*>(this)); + getXWeak()); ::Size aPixelSize = maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( ::Size (aBoundingBox.Width, aBoundingBox.Height)); ::Point aPixelPosition = maShapeTreeInfo.GetViewForwarder()->LogicToPixel ( diff --git a/svx/source/accessibility/GraphCtlAccessibleContext.cxx b/svx/source/accessibility/GraphCtlAccessibleContext.cxx index 989d5b4650cd..c30756804b49 100644 --- a/svx/source/accessibility/GraphCtlAccessibleContext.cxx +++ b/svx/source/accessibility/GraphCtlAccessibleContext.cxx @@ -302,7 +302,7 @@ void SvxGraphCtrlAccessibleContext::CommitChange ( const uno::Any& rOldValue) { AccessibleEventObject aEvent ( - static_cast<uno::XWeak*>(this), + getXWeak(), nEventId, rNewValue, rOldValue, -1); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index 5fe9c608bbbd..d7fe7c9c23dd 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -391,7 +391,7 @@ void SAL_CALL FmXGridControl::dispose() SolarMutexGuard aGuard; EventObject aEvt; - aEvt.Source = static_cast< ::cppu::OWeakObject* >(this); + aEvt.Source = getXWeak(); m_aModifyListeners.disposeAndClear(aEvt); m_aUpdateListeners.disposeAndClear(aEvt); m_aContainerListeners.disposeAndClear(aEvt); @@ -1022,7 +1022,7 @@ void FmXGridPeer::selectionChanged() { std::unique_lock g(m_aMutex); EventObject aSource; - aSource.Source = static_cast< ::cppu::OWeakObject* >(this); + aSource.Source = getXWeak(); m_aSelectionListeners.notifyEach( g, &XSelectionChangeListener::selectionChanged, aSource); } @@ -1313,7 +1313,7 @@ void FmXGridPeer::CellModified() { std::unique_lock g(m_aMutex); EventObject aEvt; - aEvt.Source = static_cast< ::cppu::OWeakObject* >(this); + aEvt.Source = getXWeak(); m_aModifyListeners.notifyEach( g, &XModifyListener::modified, aEvt ); } @@ -1452,7 +1452,7 @@ sal_Bool FmXGridPeer::commit() return true; std::unique_lock g(m_aMutex); - EventObject aEvt(static_cast< ::cppu::OWeakObject* >(this)); + EventObject aEvt(getXWeak()); ::comphelper::OInterfaceIteratorHelper4 aIter(g, m_aUpdateListeners); bool bCancel = false; while (aIter.hasMoreElements() && !bCancel) @@ -2042,7 +2042,7 @@ void FmXGridPeer::dispose() { std::unique_lock g(m_aMutex); EventObject aEvt; - aEvt.Source = static_cast< ::cppu::OWeakObject* >(this); + aEvt.Source = getXWeak(); m_aModifyListeners.disposeAndClear(g, aEvt); m_aUpdateListeners.disposeAndClear(g, aEvt); m_aContainerListeners.disposeAndClear(g, aEvt); diff --git a/svx/source/form/fmdmod.cxx b/svx/source/form/fmdmod.cxx index 415e016eeedf..56aa46447a20 100644 --- a/svx/source/form/fmdmod.cxx +++ b/svx/source/form/fmdmod.cxx @@ -44,7 +44,7 @@ using namespace ::svxform; { SdrModel& rTargetModel(getSdrModelFromUnoModel()); rtl::Reference<SdrObject> pObj = new FmFormObj(rTargetModel); - xRet = static_cast<cppu::OWeakObject*>(static_cast<SvxShape_UnoImplHelper*>(new SvxShapeControl(pObj.get()))); + xRet = getXWeak(new SvxShapeControl(pObj.get())); } if (!xRet.is()) diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index bf5306bc71c5..3a241c4d315c 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -1524,7 +1524,7 @@ void FormController::impl_onModify() m_bModified = true; } - EventObject aEvt(static_cast<cppu::OWeakObject*>(this)); + EventObject aEvt(getXWeak()); m_aModifyListeners.notifyEach( &XModifyListener::modified, aEvt ); } diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 4e1ea3c78ac5..de4f85f7c10f 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -239,7 +239,7 @@ SdrModel::~SdrModel() // the DrawingEngine may need it in its destructor if( mxStyleSheetPool.is() ) { - uno::Reference<lang::XComponent> xComponent( static_cast< cppu::OWeakObject* >( mxStyleSheetPool.get() ), uno::UNO_QUERY ); + uno::Reference<lang::XComponent> xComponent( getXWeak( mxStyleSheetPool.get() ), uno::UNO_QUERY ); if( xComponent.is() ) try { xComponent->dispose(); diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 2a316a25080f..a0adb39cb5cd 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1779,9 +1779,7 @@ uno::Reference< uno::XInterface > const & SdrPage::getUnoPage() uno::Reference< uno::XInterface > SdrPage::createUnoPage() { - css::uno::Reference< css::uno::XInterface > xInt = - static_cast<cppu::OWeakObject*>( new SvxFmDrawPage( this ) ); - return xInt; + return cppu::getXWeak(new SvxFmDrawPage(this)); } SfxStyleSheet* SdrPage::GetTextStyleSheetForObject( SdrObject* pObj ) const diff --git a/svx/source/table/accessiblecell.cxx b/svx/source/table/accessiblecell.cxx index 1bb1ca78482a..7ac5e1f414d3 100644 --- a/svx/source/table/accessiblecell.cxx +++ b/svx/source/table/accessiblecell.cxx @@ -288,7 +288,7 @@ css::awt::Rectangle SAL_CALL AccessibleCell::getBounds() // Transform coordinates from internal to pixel. if (maShapeTreeInfo.GetViewForwarder() == nullptr) - throw uno::RuntimeException ("AccessibleCell has no valid view forwarder",static_cast<uno::XWeak*>(this)); + throw uno::RuntimeException ("AccessibleCell has no valid view forwarder", getXWeak()); ::Size aPixelSize( maShapeTreeInfo.GetViewForwarder()->LogicToPixel(::Size(aCellRect.GetWidth(), aCellRect.GetHeight())) ); ::Point aPixelPosition( maShapeTreeInfo.GetViewForwarder()->LogicToPixel( aCellRect.TopLeft() )); diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index bbef530c3dd1..d18cff4ca77a 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -1119,7 +1119,7 @@ void SAL_CALL Cell::setPropertyValue( const OUString& rPropertyName, const Any& } } } - throw UnknownPropertyException( rPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( rPropertyName, getXWeak()); } @@ -1218,7 +1218,7 @@ Any SAL_CALL Cell::getPropertyValue( const OUString& PropertyName ) } } } - throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( PropertyName, getXWeak()); } @@ -1255,7 +1255,7 @@ void SAL_CALL Cell::setPropertyValues( const Sequence< OUString >& aPropertyName const sal_Int32 nCount = aPropertyNames.getLength(); if (nCount != aValues.getLength()) throw css::lang::IllegalArgumentException("lengths do not match", - static_cast<cppu::OWeakObject*>(this), -1); + getXWeak(), -1); const OUString* pNames = aPropertyNames.getConstArray(); const Any* pValues = aValues.getConstArray(); @@ -1550,7 +1550,7 @@ void SAL_CALL Cell::setPropertyToDefault( const OUString& PropertyName ) GetObject().getSdrModelFromSdrObject().SetChanged(); return; } - throw UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( PropertyName, getXWeak()); } @@ -1592,7 +1592,7 @@ Any SAL_CALL Cell::getPropertyDefault( const OUString& aPropertyName ) } } } - throw UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( aPropertyName, getXWeak()); } diff --git a/svx/source/table/propertyset.cxx b/svx/source/table/propertyset.cxx index 536a8170dac0..07360b83b69f 100644 --- a/svx/source/table/propertyset.cxx +++ b/svx/source/table/propertyset.cxx @@ -56,7 +56,7 @@ const Property& FastPropertySetInfo::getProperty( const OUString& aName ) { PropertyMap::iterator aIter( maMap.find( aName ) ); if( aIter == maMap.end() ) - throw UnknownPropertyException( aName, static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( aName, getXWeak()); return maProperties[(*aIter).second]; } diff --git a/svx/source/table/tablecolumn.cxx b/svx/source/table/tablecolumn.cxx index a13b3073be25..efa5f41375fd 100644 --- a/svx/source/table/tablecolumn.cxx +++ b/svx/source/table/tablecolumn.cxx @@ -204,7 +204,7 @@ void SAL_CALL TableColumn::setFastPropertyValue( sal_Int32 nHandle, const Any& a break; } default: - throw UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( OUString::number(nHandle), getXWeak()); } if( !bOk ) { @@ -230,7 +230,7 @@ Any SAL_CALL TableColumn::getFastPropertyValue( sal_Int32 nHandle ) case Property_OptimalWidth: return Any( mbOptimalWidth ); case Property_IsVisible: return Any( mbIsVisible ); case Property_IsStartOfNewPage: return Any( mbIsStartOfNewPage ); - default: throw UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this)); + default: throw UnknownPropertyException( OUString::number(nHandle), getXWeak()); } } diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index 531b646431ea..2491ab94f30f 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -451,7 +451,7 @@ void TableDesignStyle::setPropertyValue( const OUString&, const Any& ) Any TableDesignStyle::getPropertyValue( const OUString& PropertyName ) { if (PropertyName != "IsPhysical") - throw UnknownPropertyException("unknown property: " + PropertyName, static_cast<OWeakObject *>(this)); + throw UnknownPropertyException("unknown property: " + PropertyName, getXWeak()); return Any(mbModified || mbUserDefined); } @@ -495,7 +495,7 @@ void SAL_CALL TableDesignStyle::addModifyListener( const Reference< XModifyListe if (m_bDisposed) { aGuard.unlock(); - EventObject aEvt( static_cast< OWeakObject * >( this ) ); + EventObject aEvt( getXWeak() ); xListener->disposing( aEvt ); } else @@ -518,7 +518,7 @@ void TableDesignStyle::notifyModifyListener() if( maModifyListeners.getLength(aGuard) ) { - EventObject aEvt( static_cast< OWeakObject * >( this ) ); + EventObject aEvt( getXWeak() ); maModifyListeners.forEach(aGuard, [&] (Reference<XModifyListener> const& xListener) { return xListener->modified(aEvt); }); @@ -777,7 +777,7 @@ Any TableDesignFamily::getPropertyValue( const OUString& PropertyName ) { if ( PropertyName != "DisplayName" ) { - throw UnknownPropertyException( "unknown property: " + PropertyName, static_cast<OWeakObject *>(this) ); + throw UnknownPropertyException( "unknown property: " + PropertyName, getXWeak() ); } OUString sDisplayName( SvxResId( RID_SVXSTR_STYLEFAMILY_TABLEDESIGN ) ); diff --git a/svx/source/table/tablemodel.cxx b/svx/source/table/tablemodel.cxx index 64918a39b4de..6ea3aa22fb67 100644 --- a/svx/source/table/tablemodel.cxx +++ b/svx/source/table/tablemodel.cxx @@ -553,7 +553,7 @@ void TableModel::notifyModification() if( pModifyListeners ) { lang::EventObject aSource; - aSource.Source = static_cast< ::cppu::OWeakObject* >(this); + aSource.Source = getXWeak(); pModifyListeners->notifyEach(&util::XModifyListener::modified, aSource); } } diff --git a/svx/source/table/tablerow.cxx b/svx/source/table/tablerow.cxx index 90fa84acb9c9..4545642e3b25 100644 --- a/svx/source/table/tablerow.cxx +++ b/svx/source/table/tablerow.cxx @@ -274,7 +274,7 @@ void SAL_CALL TableRow::setFastPropertyValue( sal_Int32 nHandle, const Any& aVal break; } default: - throw UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this)); + throw UnknownPropertyException( OUString::number(nHandle), getXWeak()); } if( !bOk ) @@ -301,7 +301,7 @@ Any SAL_CALL TableRow::getFastPropertyValue( sal_Int32 nHandle ) case Property_OptimalHeight: return Any( mbOptimalHeight ); case Property_IsVisible: return Any( mbIsVisible ); case Property_IsStartOfNewPage: return Any( mbIsStartOfNewPage ); - default: throw UnknownPropertyException( OUString::number(nHandle), static_cast<cppu::OWeakObject*>(this)); + default: throw UnknownPropertyException( OUString::number(nHandle), getXWeak()); } } diff --git a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx index 466a4efca29e..aedf268e2de7 100644 --- a/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx +++ b/svx/source/unodialogs/textconversiondlgs/chinese_translation_unodialog.cxx @@ -188,7 +188,7 @@ uno::Any SAL_CALL ChineseTranslation_UnoDialog::getPropertyValue( const OUString } else { - throw beans::UnknownPropertyException( rPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( rPropertyName, getXWeak()); } return aRet; diff --git a/svx/source/unodraw/SvxXTextColumns.cxx b/svx/source/unodraw/SvxXTextColumns.cxx index 95d289632241..3103019adacc 100644 --- a/svx/source/unodraw/SvxXTextColumns.cxx +++ b/svx/source/unodraw/SvxXTextColumns.cxx @@ -197,10 +197,10 @@ void SvxXTextColumns::setPropertyValue(const OUString& rPropertyName, const css: const SfxItemPropertyMapEntry* pEntry = m_aPropSet.getPropertyMap().getByName(rPropertyName); if (!pEntry) throw css::beans::UnknownPropertyException("Unknown property: " + rPropertyName, - static_cast<cppu::OWeakObject*>(this)); + getXWeak()); if (pEntry->nFlags & css::beans::PropertyAttribute::READONLY) throw css::beans::PropertyVetoException("Property is read-only: " + rPropertyName, - static_cast<cppu::OWeakObject*>(this)); + getXWeak()); switch (pEntry->nWID) { @@ -264,7 +264,7 @@ css::uno::Any SvxXTextColumns::getPropertyValue(const OUString& rPropertyName) const SfxItemPropertyMapEntry* pEntry = m_aPropSet.getPropertyMap().getByName(rPropertyName); if (!pEntry) throw css::beans::UnknownPropertyException("Unknown property: " + rPropertyName, - static_cast<cppu::OWeakObject*>(this)); + getXWeak()); css::uno::Any aRet; switch (pEntry->nWID) @@ -324,7 +324,7 @@ void SvxXTextColumns::removeVetoableChangeListener( css::uno::Reference<css::uno::XInterface> SvxXTextColumns_createInstance() noexcept { - return static_cast<cppu::OWeakObject*>(new SvxXTextColumns); + return getXWeak(new SvxXTextColumns); } extern "C" SVXCORE_DLLPUBLIC css::uno::XInterface* diff --git a/svx/source/unodraw/UnoNamespaceMap.cxx b/svx/source/unodraw/UnoNamespaceMap.cxx index cd49cc0a6134..0eced8574da5 100644 --- a/svx/source/unodraw/UnoNamespaceMap.cxx +++ b/svx/source/unodraw/UnoNamespaceMap.cxx @@ -72,7 +72,7 @@ namespace svx Reference< XInterface > NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool ) { - return static_cast<XWeak*>(new NamespaceMap( pWhichIds, pPool )); + return getXWeak(new NamespaceMap( pWhichIds, pPool )); } static Sequence< OUString > NamespaceMap_getSupportedServiceNames() diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index c6d3ee635cf7..6464edfb7e36 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -173,14 +173,12 @@ css::uno::Reference<css::uno::XInterface> create( { SdrInventor nI = IsInventorE3D(*nType) ? SdrInventor::E3d : SdrInventor::Default; - return uno::Reference< uno::XInterface >( static_cast<drawing::XShape*>(SvxDrawPage::CreateShapeByTypeAndInventor( *nType, nI, nullptr, nullptr, referer ).get()) ); + return cppu::getXWeak(SvxDrawPage::CreateShapeByTypeAndInventor( *nType, nI, nullptr, nullptr, referer ).get()); } } else if (rServiceSpecifier == "com.sun.star.document.ImportGraphicStorageHandler") { - rtl::Reference<SvXMLGraphicHelper> pGraphicHelper = SvXMLGraphicHelper::Create( SvXMLGraphicHelperMode::Read ); - uno::Reference< uno::XInterface> xRet( static_cast< ::cppu::OWeakObject* >( pGraphicHelper.get() ) ); - return xRet; + return cppu::getXWeak( SvXMLGraphicHelper::Create( SvXMLGraphicHelperMode::Read ).get() ); } else if (rServiceSpecifier == "com.sun.star.text.TextColumns") { @@ -368,7 +366,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c if( aServiceSpecifier == "com.sun.star.text.TextField.DateTime" ) { - return static_cast<cppu::OWeakObject *>(new SvxUnoTextField(text::textfield::Type::DATE)); + return cppu::getXWeak(new SvxUnoTextField(text::textfield::Type::DATE)); } uno::Reference< uno::XInterface > xRet; @@ -454,7 +452,7 @@ uno::Reference< uno::XInterface > SAL_CALL SvxUnoDrawingModel::createInstance( c if( pShape ) pShape->SetShapeType(aServiceSpecifier); - xRet = static_cast<uno::XWeak*>(pShape); + xRet = cppu::getXWeak(pShape); } else { diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index b6172876152a..e94ccb2d7450 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -200,7 +200,7 @@ void SvxUnoDrawPool::_setPropertyValues( const comphelper::PropertyMapEntry** pp DBG_ASSERT( pPool, "I need a SfxItemPool!" ); if( nullptr == pPool ) - throw beans::UnknownPropertyException( "no pool, no properties..", static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( "no pool, no properties..", getXWeak()); while( *ppEntries ) putAny( pPool, *ppEntries++, *pValues++ ); @@ -214,7 +214,7 @@ void SvxUnoDrawPool::_getPropertyValues( const comphelper::PropertyMapEntry** pp DBG_ASSERT( pPool, "I need a SfxItemPool!" ); if( nullptr == pPool ) - throw beans::UnknownPropertyException( "no pool, no properties..", static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( "no pool, no properties..", getXWeak()); while( *ppEntries ) getAny( pPool, *ppEntries++, *pValue++ ); diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 8ae6879ef337..c1f715bd2ad5 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -866,7 +866,7 @@ uno::Any SAL_CALL SvxShapeControl::getPropertyDefault( const OUString& aProperty return aDefault; } - throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( aPropertyName, getXWeak()); } else { diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 02790b767084..27ae6d2899b4 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -935,7 +935,7 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr css::uno::Any exc = cppu::getCaughtException(); throw css::lang::WrappedTargetException( "ContentCreationException Setting InputStream!", - static_cast<OWeakObject *>(this), + getXWeak(), exc); } catch (const css::ucb::CommandFailedException&) @@ -943,7 +943,7 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr css::uno::Any anyEx = cppu::getCaughtException(); throw css::lang::WrappedTargetException( "CommandFailedException Setting InputStream!", - static_cast<OWeakObject *>(this), + getXWeak(), anyEx); } #endif @@ -1028,14 +1028,14 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr css::uno::Any anyEx = cppu::getCaughtException(); throw css::lang::WrappedTargetException( "ContentCreationException Getting InputStream!", - static_cast < OWeakObject * > ( this ), anyEx ); + getXWeak(), anyEx ); } catch (const css::ucb::CommandFailedException&) { css::uno::Any anyEx = cppu::getCaughtException(); throw css::lang::WrappedTargetException( "CommandFailedException Getting InputStream!", - static_cast < OWeakObject * > ( this ), anyEx ); + getXWeak(), anyEx ); } break; diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 32695605dfb0..95adad4150a0 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1531,7 +1531,7 @@ void SvxShape::_setPropertyValue( const OUString& rPropertyName, const uno::Any& // reduce log noise by ignoring two properties that higher level code queries for on all objects SAL_WARN_IF(rPropertyName != "FromWordArt" && rPropertyName != "GraphicColorMode", "svx.uno", "Unknown Property: " << rPropertyName); - throw beans::UnknownPropertyException( rPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( rPropertyName, getXWeak()); } if ((pMap->nFlags & beans::PropertyAttribute::READONLY) != 0) @@ -1633,7 +1633,7 @@ uno::Any SvxShape::_getPropertyValue( const OUString& PropertyName ) if(HasSdrObject()) { if(pMap == nullptr ) - throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( PropertyName, getXWeak()); if( !getPropertyValueImpl( PropertyName, pMap, aAny ) ) { @@ -1688,7 +1688,7 @@ void SAL_CALL SvxShape::setPropertyValues( const css::uno::Sequence< OUString >& const sal_Int32 nCount = aPropertyNames.getLength(); if (nCount != aValues.getLength()) throw css::lang::IllegalArgumentException("lengths do not match", - static_cast<cppu::OWeakObject*>(this), -1); + getXWeak(), -1); const OUString* pNames = aPropertyNames.getConstArray(); const uno::Any* pValues = aValues.getConstArray(); @@ -1907,7 +1907,7 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName ) const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName); if( !HasSdrObject() || pMap == nullptr ) - throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( PropertyName, getXWeak()); beans::PropertyState eState; if( !getPropertyStateImpl( pMap, eState ) ) @@ -3034,7 +3034,7 @@ void SvxShape::_setPropertyToDefault( const OUString& PropertyName ) const SfxItemPropertyMapEntry* pProperty = mpPropSet->getPropertyMapEntry(PropertyName); if( !HasSdrObject() || pProperty == nullptr ) - throw beans::UnknownPropertyException( PropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( PropertyName, getXWeak()); if( !setPropertyToDefaultImpl( pProperty ) ) { @@ -3064,7 +3064,7 @@ uno::Any SvxShape::_getPropertyDefault( const OUString& aPropertyName ) const SfxItemPropertyMapEntry* pMap = mpPropSet->getPropertyMapEntry(aPropertyName); if( !HasSdrObject() || pMap == nullptr ) - throw beans::UnknownPropertyException( aPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( aPropertyName, getXWeak()); if(( pMap->nWID >= OWN_ATTR_VALUE_START && pMap->nWID <= OWN_ATTR_VALUE_END ) || ( pMap->nWID >= SDRATTR_NOTPERSIST_FIRST && pMap->nWID <= SDRATTR_NOTPERSIST_LAST )) @@ -3074,7 +3074,7 @@ uno::Any SvxShape::_getPropertyDefault( const OUString& aPropertyName ) // get default from ItemPool if(!SfxItemPool::IsWhich(pMap->nWID)) - throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, static_cast<cppu::OWeakObject*>(this)); + throw beans::UnknownPropertyException( "No WhichID " + OUString::number(pMap->nWID) + " for " + aPropertyName, getXWeak()); SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), pMap->nWID, pMap->nWID ); aSet.Put(GetSdrObject()->getSdrModelFromSdrObject().GetItemPool().GetDefaultItem(pMap->nWID)); diff --git a/svx/source/unodraw/unoshcol.cxx b/svx/source/unodraw/unoshcol.cxx index c7fadc620147..2cc6d39c88d7 100644 --- a/svx/source/unodraw/unoshcol.cxx +++ b/svx/source/unodraw/unoshcol.cxx @@ -42,7 +42,7 @@ void SvxShapeCollection::release() noexcept { if (! bDisposed) { - uno::Reference< uno::XInterface > xHoldAlive( static_cast<uno::XWeak*>(this) ); + uno::Reference< uno::XInterface > xHoldAlive( getXWeak() ); // First dispose try { diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx index a7392cdeefe0..67a789022d1e 100644 --- a/svx/source/xml/xmleohlp.cxx +++ b/svx/source/xml/xmleohlp.cxx @@ -560,7 +560,7 @@ OUString SAL_CALL SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL(const OUSt css::uno::Any anyEx = cppu::getCaughtException(); throw WrappedTargetRuntimeException( "SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL non-RuntimeException", - static_cast<uno::XWeak*>(this), anyEx); + getXWeak(), anyEx); } return sRet; } |