summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2023-04-23 20:15:07 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2023-10-22 13:43:03 +0200
commit69c7722b6c70db7a39657026689103f541543d4a (patch)
tree35890f9a7b29592fcb17799e410cce3f2515cc2c /sw
parent1eda97c39237f0244faccb220b3bdd692340e013 (diff)
Use getXWeak in sw
Change-Id: I49d2d1a00928c4cea68164e8c91fd9a6bb4b3b94 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150875 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/access/acccontext.cxx10
-rw-r--r--sw/source/core/access/accdoc.cxx12
-rw-r--r--sw/source/core/access/accpara.cxx12
-rw-r--r--sw/source/core/doc/textboxhelper.cxx3
-rw-r--r--sw/source/core/docnode/finalthreadmanager.cxx2
-rw-r--r--sw/source/core/unocore/SwXTextDefaults.cxx14
-rw-r--r--sw/source/core/unocore/unobkm.cxx4
-rw-r--r--sw/source/core/unocore/unochart.cxx2
-rw-r--r--sw/source/core/unocore/unocoll.cxx54
-rw-r--r--sw/source/core/unocore/unocontentcontrol.cxx24
-rw-r--r--sw/source/core/unocore/unodraw.cxx20
-rw-r--r--sw/source/core/unocore/unofield.cxx20
-rw-r--r--sw/source/core/unocore/unoflatpara.cxx2
-rw-r--r--sw/source/core/unocore/unoframe.cxx16
-rw-r--r--sw/source/core/unocore/unoidx.cxx27
-rw-r--r--sw/source/core/unocore/unoobj.cxx23
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx24
-rw-r--r--sw/source/core/unocore/unoport.cxx14
-rw-r--r--sw/source/core/unocore/unorefmk.cxx18
-rw-r--r--sw/source/core/unocore/unosect.cxx22
-rw-r--r--sw/source/core/unocore/unosett.cxx18
-rw-r--r--sw/source/core/unocore/unosrch.cxx6
-rw-r--r--sw/source/core/unocore/unostyle.cxx46
-rw-r--r--sw/source/core/unocore/unotbl.cxx183
-rw-r--r--sw/source/uibase/config/StoredChapterNumbering.cxx2
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx2
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx2
-rw-r--r--sw/source/uibase/uno/unodispatch.cxx8
-rw-r--r--sw/source/uibase/uno/unomailmerge.cxx36
-rw-r--r--sw/source/uibase/uno/unotxdoc.cxx9
-rw-r--r--sw/source/uibase/uno/unotxvw.cxx49
31 files changed, 333 insertions, 351 deletions
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 781533207793..46c4f4a825c7 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -529,7 +529,7 @@ void SwAccessibleContext::ThrowIfDisposed()
if (IsDisposed())
{
throw lang::DisposedException("object is nonfunctional",
- static_cast<cppu::OWeakObject*>(this));
+ getXWeak());
}
}
@@ -828,7 +828,7 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleContext::getAccessibleAtPoint
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
Point aPixPoint( aPoint.X, aPoint.Y ); // px rel to parent
@@ -887,11 +887,11 @@ awt::Rectangle SwAccessibleContext::getBoundsImpl(bool bRelative)
if (!pParent)
{
- throw uno::RuntimeException("no Parent", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Parent", getXWeak());
}
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip relative to document root
@@ -947,7 +947,7 @@ awt::Point SAL_CALL SwAccessibleContext::getLocationOnScreen()
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
AbsoluteScreenPixelPoint aPixPosAbs = pWin->OutputToAbsoluteScreenPixel(aPixPos);
diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx
index 5c8cfde0faa5..d1bb9d84b150 100644
--- a/sw/source/core/access/accdoc.cxx
+++ b/sw/source/core/access/accdoc.cxx
@@ -228,7 +228,7 @@ awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
tools::Rectangle aPixBounds( pWin->GetWindowExtentsRelative( *pWin->GetAccessibleParentWindow() ) );
@@ -250,7 +250,7 @@ awt::Point SAL_CALL SwAccessibleDocumentBase::getLocation()
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
Point aPixPos( pWin->GetWindowExtentsRelative( *pWin->GetAccessibleParentWindow() ).TopLeft() );
@@ -266,7 +266,7 @@ css::awt::Point SAL_CALL SwAccessibleDocumentBase::getLocationOnScreen()
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
Point aPixPos( pWin->GetWindowExtentsAbsolute().TopLeft() );
@@ -282,7 +282,7 @@ css::awt::Size SAL_CALL SwAccessibleDocumentBase::getSize()
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
Size aPixSize( pWin->GetWindowExtentsAbsolute().GetSize() );
@@ -299,7 +299,7 @@ sal_Bool SAL_CALL SwAccessibleDocumentBase::containsPoint(
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
tools::Rectangle aPixBounds( pWin->GetWindowExtentsAbsolute() );
@@ -321,7 +321,7 @@ uno::Reference< XAccessible > SAL_CALL SwAccessibleDocumentBase::getAccessibleAt
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
if (pWin->isDisposed()) // tdf#147967
return nullptr;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index ebd00faab9a3..7226ea72d35d 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -720,7 +720,7 @@ lang::Locale SAL_CALL SwAccessibleParagraph::getLocale()
const SwTextFrame *pTextFrame = GetFrame()->DynCastTextFrame();
if( !pTextFrame )
{
- throw uno::RuntimeException("no SwTextFrame", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no SwTextFrame", getXWeak());
}
lang::Locale aLoc(g_pBreakIt->GetLocale(pTextFrame->GetLangOfChar(TextFrameIndex(0), 0, true)));
@@ -1128,7 +1128,7 @@ css::uno::Sequence< css::style::TabStop > SwAccessibleParagraph::GetCurrentTabSt
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
SwRect aTmpRect(0, 0, tabs[0].Position, 0);
@@ -2075,7 +2075,7 @@ awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aCoreRect ));
@@ -2109,7 +2109,7 @@ sal_Int32 SwAccessibleParagraph::getIndexAtPoint( const awt::Point& rPoint )
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
Point aPoint( rPoint.X, rPoint.Y );
SwRect aLogBounds( GetBounds( *(GetMap()), GetFrame() ) ); // twip rel to doc root
@@ -2501,7 +2501,7 @@ sal_Bool SwAccessibleParagraph::scrollSubstringTo( sal_Int32 nStartIndex,
vcl::Window *pWin = GetWindow();
if ( ! pWin )
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
/* Start and end character bounds, in pixels, relative to the paragraph */
awt::Rectangle startR, endR;
@@ -3305,7 +3305,7 @@ sal_Int32 SAL_CALL SwAccessibleParagraph::getNumberOfLineWithCaret()
vcl::Window *pWin = GetWindow();
if (!pWin)
{
- throw uno::RuntimeException("no Window", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("no Window", getXWeak());
}
tools::Rectangle aScreenRect( GetMap()->CoreToPixel( aCursorCoreRect ));
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 98c77db26d4e..253e39a29383 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -465,8 +465,7 @@ static void lcl_queryInterface(const SwFrameFormat* pShape, uno::Any& rAny, SdrO
= SwTextBoxHelper::getOtherTextBoxFormat(pShape, RES_DRAWFRMFMT, pObj))
{
uno::Reference<T> const xInterface(
- static_cast<cppu::OWeakObject*>(
- SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat).get()),
+ getXWeak(SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat).get()),
uno::UNO_QUERY);
rAny <<= xInterface;
}
diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx
index 73a0feccfaff..460d9ab13d92 100644
--- a/sw/source/core/docnode/finalthreadmanager.cxx
+++ b/sw/source/core/docnode/finalthreadmanager.cxx
@@ -405,7 +405,7 @@ void SAL_CALL FinalThreadManager::notifyTermination( const css::lang::EventObjec
}
// get reference of this
- css::uno::Reference< css::uno::XInterface > aOwnRef( static_cast< cppu::OWeakObject* >( this ));
+ css::uno::Reference< css::uno::XInterface > aOwnRef( getXWeak());
// notify <SwThreadJoiner> to release its reference
SwThreadJoiner::ReleaseThreadJoiner();
}
diff --git a/sw/source/core/unocore/SwXTextDefaults.cxx b/sw/source/core/unocore/SwXTextDefaults.cxx
index b4107f5f15a6..a74808141dc3 100644
--- a/sw/source/core/unocore/SwXTextDefaults.cxx
+++ b/sw/source/core/unocore/SwXTextDefaults.cxx
@@ -66,9 +66,9 @@ void SAL_CALL SwXTextDefaults::setPropertyValue( const OUString& rPropertyName,
throw RuntimeException();
const SfxItemPropertyMapEntry *pMap = m_pPropSet->getPropertyMap().getByName( rPropertyName );
if (!pMap)
- throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
if ( pMap->nFlags & PropertyAttribute::READONLY)
- throw PropertyVetoException ( "Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw PropertyVetoException ( "Property is read-only: " + rPropertyName, getXWeak() );
const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID);
if (RES_PAGEDESC == pMap->nWID && MID_PAGEDESC_PAGEDESCNAME == pMap->nMemberId)
@@ -126,7 +126,7 @@ Any SAL_CALL SwXTextDefaults::getPropertyValue( const OUString& rPropertyName )
throw RuntimeException();
const SfxItemPropertyMapEntry *pMap = m_pPropSet->getPropertyMap().getByName( rPropertyName );
if (!pMap)
- throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
Any aRet;
const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID);
rItem.QueryValue( aRet, pMap->nMemberId );
@@ -162,7 +162,7 @@ PropertyState SAL_CALL SwXTextDefaults::getPropertyState( const OUString& rPrope
throw RuntimeException();
const SfxItemPropertyMapEntry *pMap = m_pPropSet->getPropertyMap().getByName( rPropertyName );
if (!pMap)
- throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
const SfxPoolItem& rItem = m_pDoc->GetDefault(pMap->nWID);
if (IsStaticDefaultItem ( &rItem ) )
@@ -187,9 +187,9 @@ void SAL_CALL SwXTextDefaults::setPropertyToDefault( const OUString& rPropertyNa
throw RuntimeException();
const SfxItemPropertyMapEntry *pMap = m_pPropSet->getPropertyMap().getByName( rPropertyName );
if (!pMap)
- throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
if ( pMap->nFlags & PropertyAttribute::READONLY)
- throw RuntimeException( "setPropertyToDefault: property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException( "setPropertyToDefault: property is read-only: " + rPropertyName, getXWeak() );
SfxItemPool& rSet (m_pDoc->GetAttrPool());
rSet.ResetPoolDefaultItem ( pMap->nWID );
}
@@ -200,7 +200,7 @@ Any SAL_CALL SwXTextDefaults::getPropertyDefault( const OUString& rPropertyName
throw RuntimeException();
const SfxItemPropertyMapEntry *pMap = m_pPropSet->getPropertyMap().getByName( rPropertyName );
if (!pMap)
- throw UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
Any aRet;
SfxItemPool& rSet (m_pDoc->GetAttrPool());
SfxPoolItem const*const pItem = rSet.GetPoolDefaultItem(pMap->nWID);
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index ed99a076244a..81818a13d03a 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -326,7 +326,7 @@ void SAL_CALL SwXBookmark::setName(const OUString& rName)
if(pMarkAccess->findMark(rName) != pMarkAccess->getAllMarksEnd())
{
throw uno::RuntimeException("setName(): name already in use",
- static_cast<::cppu::OWeakObject*>(this));
+ getXWeak());
}
SwPaM aPam(m_pImpl->m_pRegisteredBookmark->GetMarkPos());
@@ -430,7 +430,7 @@ SwXBookmark::setPropertyValue(const OUString& PropertyName,
// nothing to set here
throw lang::IllegalArgumentException("Property is read-only: "
- + PropertyName, static_cast< cppu::OWeakObject * >(this), 0 );
+ + PropertyName, getXWeak(), 0 );
}
uno::Any SAL_CALL SwXBookmark::getPropertyValue(const OUString& rPropertyName)
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index e5265acc4fec..a98f16595643 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2200,7 +2200,7 @@ void SAL_CALL SwChartDataSequence::disposing( const lang::EventObject& rSource )
{
if (m_bDisposed)
throw lang::DisposedException();
- if (rSource.Source == static_cast<cppu::OWeakObject*>(m_xDataProvider.get()))
+ if (rSource.Source == cppu::getXWeak(m_xDataProvider.get()))
{
m_xDataProvider.clear();
}
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index 5b78e31e5582..1b2c4f3c07d0 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -522,45 +522,45 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
{
case SwServiceType::TypeTextTable:
{
- xRet = static_cast<cppu::OWeakObject*>(SwXTextTable::CreateXTextTable(nullptr).get());
+ xRet = getXWeak(SwXTextTable::CreateXTextTable(nullptr).get());
}
break;
case SwServiceType::TypeTextFrame:
{
- xRet = static_cast<cppu::OWeakObject*>(SwXTextFrame::CreateXTextFrame(rDoc, nullptr).get());
+ xRet = getXWeak(SwXTextFrame::CreateXTextFrame(rDoc, nullptr).get());
}
break;
case SwServiceType::TypeGraphic :
case SwServiceType::TypeTextGraphic /* #i47503# */ :
{
- xRet = static_cast<cppu::OWeakObject*>(SwXTextGraphicObject::CreateXTextGraphicObject(rDoc, nullptr).get());
+ xRet = getXWeak(SwXTextGraphicObject::CreateXTextGraphicObject(rDoc, nullptr).get());
}
break;
case SwServiceType::TypeOLE :
{
- xRet = static_cast<cppu::OWeakObject*>(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(rDoc, nullptr).get());
+ xRet = getXWeak(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(rDoc, nullptr).get());
}
break;
case SwServiceType::TypeBookmark :
{
- xRet = static_cast<cppu::OWeakObject*>(SwXBookmark::CreateXBookmark(rDoc, nullptr).get());
+ xRet = getXWeak(SwXBookmark::CreateXBookmark(rDoc, nullptr).get());
}
break;
case SwServiceType::TypeFieldMark :
{
- xRet = static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, nullptr).get());
+ xRet = getXWeak(SwXFieldmark::CreateXFieldmark(rDoc, nullptr).get());
}
break;
case SwServiceType::TypeFormFieldMark :
{
- xRet = static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, nullptr, true).get());
+ xRet = getXWeak(SwXFieldmark::CreateXFieldmark(rDoc, nullptr, true).get());
}
break;
case SwServiceType::VbaObjectProvider :
#if HAVE_FEATURE_SCRIPTING
{
- xRet = static_cast<cppu::OWeakObject*>(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
+ xRet = getXWeak(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
}
#endif
break;
@@ -569,7 +569,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
{
if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell()))
{
- xRet = static_cast<cppu::OWeakObject*>(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
+ xRet = getXWeak(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
}
}
#endif
@@ -605,10 +605,10 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
break;
case SwServiceType::TypeFootnote :
- xRet = static_cast<cppu::OWeakObject*>(SwXFootnote::CreateXFootnote(rDoc, nullptr).get());
+ xRet = getXWeak(SwXFootnote::CreateXFootnote(rDoc, nullptr).get());
break;
case SwServiceType::TypeEndnote :
- xRet = static_cast<cppu::OWeakObject*>(SwXFootnote::CreateXFootnote(rDoc, nullptr, true).get());
+ xRet = getXWeak(SwXFootnote::CreateXFootnote(rDoc, nullptr, true).get());
break;
case SwServiceType::ContentIndexMark :
case SwServiceType::UserIndexMark :
@@ -619,7 +619,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
eType = TOX_CONTENT;
else if(SwServiceType::UserIndexMark == nObjectType)
eType = TOX_USER;
- xRet = static_cast<cppu::OWeakObject*>(SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, nullptr, eType).get());
+ xRet = getXWeak(SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, nullptr, eType).get());
}
break;
case SwServiceType::ContentIndex :
@@ -651,17 +651,17 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
{
eType = TOX_TABLES;
}
- xRet = static_cast<cppu::OWeakObject*>(SwXDocumentIndex::CreateXDocumentIndex(rDoc, nullptr, eType).get());
+ xRet = getXWeak(SwXDocumentIndex::CreateXDocumentIndex(rDoc, nullptr, eType).get());
}
break;
case SwServiceType::IndexHeaderSection :
case SwServiceType::TextSection :
- xRet = static_cast<cppu::OWeakObject*>(SwXTextSection::CreateXTextSection(nullptr,
+ xRet = getXWeak(SwXTextSection::CreateXTextSection(nullptr,
(SwServiceType::IndexHeaderSection == nObjectType)).get());
break;
case SwServiceType::ReferenceMark :
- xRet = static_cast<cppu::OWeakObject*>(SwXReferenceMark::CreateXReferenceMark(rDoc, nullptr).get());
+ xRet = getXWeak(SwXReferenceMark::CreateXReferenceMark(rDoc, nullptr).get());
break;
case SwServiceType::StyleCharacter:
case SwServiceType::StyleParagraph:
@@ -756,10 +756,10 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
case SwServiceType::FieldTypeDropdown:
case SwServiceType::FieldTypeTableFormula:
// NOTE: the sw.SwXAutoTextEntry unoapi test depends on pDoc = 0
- xRet = static_cast<cppu::OWeakObject*>(SwXTextField::CreateXTextField(nullptr, nullptr, nObjectType).get());
+ xRet = getXWeak(SwXTextField::CreateXTextField(nullptr, nullptr, nObjectType).get());
break;
case SwServiceType::FieldTypeAnnotation:
- xRet = static_cast<cppu::OWeakObject*>(SwXTextField::CreateXTextField(&rDoc, nullptr, nObjectType).get());
+ xRet = getXWeak(SwXTextField::CreateXTextField(&rDoc, nullptr, nObjectType).get());
break;
case SwServiceType::FieldMasterUser:
case SwServiceType::FieldMasterDDE:
@@ -775,7 +775,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
case SwServiceType::FieldMasterDatabase: nResId = SwFieldIds::Database; break;
default: break;
}
- xRet = static_cast<cppu::OWeakObject*>(SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId).get());
+ xRet = getXWeak(SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId).get());
}
break;
case SwServiceType::FieldMasterBibliography:
@@ -786,20 +786,20 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
SwAuthorityFieldType aType(&rDoc);
pType = rDoc.getIDocumentFieldsAccess().InsertFieldType(aType);
}
- xRet = static_cast<cppu::OWeakObject*>(SwXFieldMaster::CreateXFieldMaster(&rDoc, pType).get());
+ xRet = getXWeak(SwXFieldMaster::CreateXFieldMaster(&rDoc, pType).get());
}
break;
case SwServiceType::Paragraph:
- xRet = static_cast<cppu::OWeakObject*>(SwXParagraph::CreateXParagraph(rDoc, nullptr, nullptr).get());
+ xRet = getXWeak(SwXParagraph::CreateXParagraph(rDoc, nullptr, nullptr).get());
break;
case SwServiceType::NumberingRules:
- xRet = static_cast<cppu::OWeakObject*>(new SwXNumberingRules(rDoc));
+ xRet = getXWeak(new SwXNumberingRules(rDoc));
break;
case SwServiceType::TextColumns:
xRet = SvxXTextColumns_createInstance();
break;
case SwServiceType::Defaults:
- xRet = static_cast<cppu::OWeakObject*>(new SwXTextDefaults(&rDoc));
+ xRet = getXWeak(new SwXTextDefaults(&rDoc));
break;
case SwServiceType::IMapRectangle:
xRet = SvUnoImageMapRectangleObject_createInstance( sw_GetSupportedMacroItems() );
@@ -816,23 +816,23 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
// This should not happen during copy/paste, as this will unlink
// charts using table data.
if (rDoc.GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED)
- xRet = static_cast<cppu::OWeakObject*>(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ));
+ xRet = getXWeak(rDoc.getIDocumentChartDataProviderAccess().GetChartDataProvider( true /* create - if not yet available */ ));
else
SAL_WARN("sw.uno",
"not creating chart data provider for embedded object");
break;
case SwServiceType::TypeMeta:
- xRet = static_cast<cppu::OWeakObject*>(SwXMeta::CreateXMeta(rDoc, false).get());
+ xRet = getXWeak(SwXMeta::CreateXMeta(rDoc, false).get());
break;
case SwServiceType::FieldTypeMetafield:
- xRet = static_cast<cppu::OWeakObject*>(SwXMeta::CreateXMeta(rDoc, true).get());
+ xRet = getXWeak(SwXMeta::CreateXMeta(rDoc, true).get());
break;
case SwServiceType::LineBreak:
- xRet = static_cast<cppu::OWeakObject*>(SwXLineBreak::CreateXLineBreak(nullptr).get());
+ xRet = getXWeak(SwXLineBreak::CreateXLineBreak(nullptr).get());
break;
case SwServiceType::ContentControl:
- xRet = static_cast<cppu::OWeakObject*>(SwXContentControl::CreateXContentControl(rDoc).get());
+ xRet = getXWeak(SwXContentControl::CreateXContentControl(rDoc).get());
break;
default:
throw uno::RuntimeException();
diff --git a/sw/source/core/unocore/unocontentcontrol.cxx b/sw/source/core/unocore/unocontentcontrol.cxx
index 8492e0fc94f7..fd77b4a77f9e 100644
--- a/sw/source/core/unocore/unocontentcontrol.cxx
+++ b/sw/source/core/unocore/unocontentcontrol.cxx
@@ -376,7 +376,7 @@ void SAL_CALL SwXContentControl::dispose()
if (m_pImpl->m_bIsDescriptor)
{
m_pImpl->m_pTextPortions.reset();
- lang::EventObject aEvent(static_cast<::cppu::OWeakObject&>(*this));
+ lang::EventObject aEvent(getXWeak());
std::unique_lock aGuard(m_pImpl->m_Mutex);
m_pImpl->m_EventListeners.disposeAndClear(aGuard, aEvent);
m_pImpl->m_bIsDisposed = true;
@@ -417,7 +417,7 @@ void SwXContentControl::AttachImpl(const uno::Reference<text::XTextRange>& xText
if (!m_pImpl->m_bIsDescriptor)
{
throw uno::RuntimeException("SwXContentControl::AttachImpl(): already attached",
- static_cast<::cppu::OWeakObject*>(this));
+ getXWeak());
}
SwXTextRange* pRange = dynamic_cast<SwXTextRange*>(xTextRange.get());
@@ -426,16 +426,14 @@ void SwXContentControl::AttachImpl(const uno::Reference<text::XTextRange>& xText
if (!pRange && !pCursor)
{
throw lang::IllegalArgumentException(
- "SwXContentControl::AttachImpl(): argument not supported type",
- static_cast<::cppu::OWeakObject*>(this), 0);
+ "SwXContentControl::AttachImpl(): argument not supported type", getXWeak(), 0);
}
SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor->GetDoc();
if (!pDoc)
{
throw lang::IllegalArgumentException(
- "SwXContentControl::AttachImpl(): argument has no SwDoc",
- static_cast<::cppu::OWeakObject*>(this), 0);
+ "SwXContentControl::AttachImpl(): argument has no SwDoc", getXWeak(), 0);
}
SwUnoInternalPaM aPam(*pDoc);
@@ -486,14 +484,13 @@ void SwXContentControl::AttachImpl(const uno::Reference<text::XTextRange>& xText
{
throw lang::IllegalArgumentException(
"SwXContentControl::AttachImpl(): cannot create content control: invalid range",
- static_cast<::cppu::OWeakObject*>(this), 1);
+ getXWeak(), 1);
}
if (!pTextAttr)
{
SAL_WARN("sw.core", "content control inserted, but has no text attribute?");
throw uno::RuntimeException(
- "SwXContentControl::AttachImpl(): cannot create content control",
- static_cast<::cppu::OWeakObject*>(this));
+ "SwXContentControl::AttachImpl(): cannot create content control", getXWeak());
}
m_pImpl->EndListeningAll();
@@ -522,8 +519,7 @@ uno::Reference<text::XTextRange> SAL_CALL SwXContentControl::getAnchor()
}
if (m_pImpl->m_bIsDescriptor)
{
- throw uno::RuntimeException("SwXContentControl::getAnchor(): not inserted",
- static_cast<::cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("SwXContentControl::getAnchor(): not inserted", getXWeak());
}
SwTextNode* pTextNode;
@@ -533,8 +529,7 @@ uno::Reference<text::XTextRange> SAL_CALL SwXContentControl::getAnchor()
if (!bSuccess)
{
SAL_WARN("sw.core", "no pam");
- throw lang::DisposedException("SwXContentControl::getAnchor(): not attached",
- static_cast<::cppu::OWeakObject*>(this));
+ throw lang::DisposedException("SwXContentControl::getAnchor(): not attached", getXWeak());
}
SwPosition aStart(*pTextNode, nContentControlStart - 1); // -1 due to CH_TXTATR
@@ -1392,8 +1387,7 @@ uno::Reference<container::XEnumeration> SAL_CALL SwXContentControl::createEnumer
}
if (m_pImpl->m_bIsDescriptor)
{
- throw uno::RuntimeException("createEnumeration(): not inserted",
- static_cast<::cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("createEnumeration(): not inserted", getXWeak());
}
SwTextNode* pTextNode;
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index dca041d95129..a229c1f2031f 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -333,17 +333,17 @@ uno::Reference< drawing::XShape > SwFmDrawPage::CreateShape( SdrObject *pObj ) c
const SwNode* pNd = pDoc->GetNodes()[ pIdx->GetIndex() + 1 ];
if(!pNd->IsNoTextNode())
{
- xRet.set(static_cast<cppu::OWeakObject*>(SwXTextFrame::CreateXTextFrame(*pDoc, pFlyFormat).get()),
+ xRet.set(cppu::getXWeak(SwXTextFrame::CreateXTextFrame(*pDoc, pFlyFormat).get()),
uno::UNO_QUERY);
}
else if( pNd->IsGrfNode() )
{
- xRet.set(static_cast<cppu::OWeakObject*>(SwXTextGraphicObject::CreateXTextGraphicObject(
+ xRet.set(cppu::getXWeak(SwXTextGraphicObject::CreateXTextGraphicObject(
*pDoc, pFlyFormat).get()), uno::UNO_QUERY);
}
else if( pNd->IsOLENode() )
{
- xRet.set(static_cast<cppu::OWeakObject*>(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(
+ xRet.set(cppu::getXWeak(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(
*pDoc, pFlyFormat).get()), uno::UNO_QUERY);
}
}
@@ -420,7 +420,7 @@ void SwFmDrawPage::setPropertyValue(const OUString& rPropertyName, const uno::An
break;
default:
- throw beans::UnknownPropertyException(rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException(rPropertyName, getXWeak());
}
}
@@ -465,7 +465,7 @@ uno::Any SwFmDrawPage::getPropertyValue(const OUString& rPropertyName)
break;
default:
- throw beans::UnknownPropertyException(rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException(rPropertyName, getXWeak());
}
return aAny;
}
@@ -631,7 +631,7 @@ void SwFmDrawPage::add(const uno::Reference< drawing::XShape > & xShape)
// this is not a writer shape
if(!pShape)
throw uno::RuntimeException("illegal object",
- static_cast< cppu::OWeakObject * > ( this ) );
+ getXWeak() );
// we're already registered in the model / SwXDrawPage::add() already called
if(pShape->m_pPage || !pShape->m_bDescriptor )
@@ -927,7 +927,7 @@ SwXShape::SwXShape(
xShape = nullptr;
osl_atomic_increment(&m_refCount);
if( m_xShapeAgg.is() )
- m_xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
+ m_xShapeAgg->setDelegator( getXWeak() );
osl_atomic_decrement(&m_refCount);
}
@@ -1057,7 +1057,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a
if(pEntry)
{
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, getXWeak() );
// with the layout it is possible to move the anchor without changing the position
if(pFormat)
{
@@ -1933,7 +1933,7 @@ void SwXShape::setPropertyToDefault( const OUString& rPropertyName )
if(pEntry)
{
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw uno::RuntimeException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("Property is read-only: " + rPropertyName, getXWeak() );
if(pFormat)
{
const SfxItemSet& rSet = pFormat->GetAttrSet();
@@ -2091,7 +2091,7 @@ void SwXShape::attach(const uno::Reference< text::XTextRange > & xTextRange)
uno::Any aPos;
aPos <<= xTextRange;
setPropertyValue("TextRange", aPos);
- uno::Reference< drawing::XShape > xTemp( static_cast<cppu::OWeakObject*>(this), uno::UNO_QUERY );
+ uno::Reference< drawing::XShape > xTemp( getXWeak(), uno::UNO_QUERY );
xDP->add( xTemp );
}
}
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index cd493e615002..749678ec6b32 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -599,7 +599,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue(
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast< cppu::OWeakObject * >( this ) );
+ getXWeak() );
}
pType->PutValue( rValue, nMemberValueId );
@@ -756,7 +756,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue(
}
break;
default:
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
}
}
}
@@ -823,7 +823,7 @@ SwXFieldMaster::getPropertyValue(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
pType->QueryValue( aRet, nMId );
@@ -904,7 +904,7 @@ SwXFieldMaster::getPropertyValue(const OUString& rPropertyName)
}
break;
default:
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
}
}
}
@@ -2141,9 +2141,9 @@ SwXTextField::setPropertyValue(
const SfxItemPropertyMapEntry* pEntry = _pPropSet->getPropertyMap().getByName(rPropertyName);
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException( "Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException( "Property is read-only: " + rPropertyName, getXWeak() );
if(pField)
{
@@ -2306,7 +2306,7 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName)
pEntry = _pParaPropSet->getPropertyMap().getByName(rPropertyName);
}
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
switch( pEntry->nWID )
{
@@ -2863,7 +2863,7 @@ SwXTextFieldTypes::~SwXTextFieldTypes()
void SwXTextFieldTypes::Invalidate()
{
SwUnoCollection::Invalidate();
- lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ lang::EventObject const ev(getXWeak());
std::unique_lock aGuard(m_pImpl->m_Mutex);
m_pImpl->m_RefreshListeners.disposeAndClear(aGuard, ev);
}
@@ -2900,7 +2900,7 @@ void SAL_CALL SwXTextFieldTypes::refresh()
GetDoc()->getIDocumentFieldsAccess().UpdateFields(false);
}
// call refresh listeners (without SolarMutex locked)
- lang::EventObject const event(static_cast< ::cppu::OWeakObject*>(this));
+ lang::EventObject const event(getXWeak());
std::unique_lock aGuard(m_pImpl->m_Mutex);
m_pImpl->m_RefreshListeners.notifyEach(aGuard,
& util::XRefreshListener::refreshed, event);
@@ -2986,7 +2986,7 @@ SwXFieldEnumeration::SwXFieldEnumeration(SwDoc & rDoc)
IDocumentMarkAccess& rMarksAccess(*rDoc.getIDocumentMarkAccess());
for (auto iter = rMarksAccess.getFieldmarksBegin(); iter != rMarksAccess.getFieldmarksEnd(); ++iter)
{
- m_pImpl->m_Items.emplace_back(static_cast<cppu::OWeakObject*>(SwXFieldmark::CreateXFieldmark(rDoc, *iter).get()), uno::UNO_QUERY);
+ m_pImpl->m_Items.emplace_back(cppu::getXWeak(SwXFieldmark::CreateXFieldmark(rDoc, *iter).get()), uno::UNO_QUERY);
}
}
diff --git a/sw/source/core/unocore/unoflatpara.cxx b/sw/source/core/unocore/unoflatpara.cxx
index c5c2ef94e441..ac3ebb4c6698 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -93,7 +93,7 @@ void SAL_CALL
SwXFlatParagraph::setPropertyValue(const OUString&, const uno::Any&)
{
throw lang::IllegalArgumentException("no values can be set",
- static_cast< ::cppu::OWeakObject*>(this), 0);
+ getXWeak(), 0);
}
uno::Any SAL_CALL
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 329517cc11da..632b57698702 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1287,7 +1287,7 @@ SwXFrame::CreateXFrame(SwDoc & rDoc, SwFrameFormat *const pFrameFormat)
: new NameLookupIsHard(&rDoc);
if (pFrameFormat)
{
- pFrameFormat->SetXObject(static_cast<cppu::OWeakObject*>(xFrame.get()));
+ pFrameFormat->SetXObject(cppu::getXWeak(xFrame.get()));
}
// need a permanent Reference to initialize m_wThis
xFrame->SwXFrame::m_pImpl->m_wThis = uno::Reference<XWeak>(xFrame.get());
@@ -1426,7 +1426,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
{
// Hack to skip the dummy CursorNotIgnoreTables property
if (rPropertyName != "CursorNotIgnoreTables")
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast <cppu::OWeakObject*> (this));
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak());
return;
}
@@ -1467,7 +1467,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any&
{
bool bNextFrame = false;
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
SwDoc* pDoc = pFormat->GetDoc();
if ( ((m_eType == FLYCNTTYPE_GRF) && isGRFATR(pEntry->nWID)) ||
@@ -2014,7 +2014,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName)
SwFrameFormat* pFormat = GetFrameFormat();
const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
const sal_uInt8 nMemberId(pEntry->nMemberId);
@@ -2444,7 +2444,7 @@ uno::Sequence< beans::PropertyState > SwXFrame::getPropertyStates(
{
const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(pNames[i]);
if (!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + pNames[i], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + pNames[i], getXWeak() );
if(pEntry->nWID == FN_UNO_ANCHOR_TYPES||
pEntry->nWID == FN_PARAM_LINK_DISPLAY_NAME||
@@ -2522,9 +2522,9 @@ void SwXFrame::setPropertyToDefault( const OUString& rPropertyName )
{
const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw uno::RuntimeException("setPropertyToDefault: property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("setPropertyToDefault: property is read-only: " + rPropertyName, getXWeak() );
if(OWN_ATTR_FILLBMP_MODE == pEntry->nWID)
{
@@ -2614,7 +2614,7 @@ uno::Any SwXFrame::getPropertyDefault( const OUString& rPropertyName )
{
const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nWID < RES_FRMATR_END )
{
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 594778768cc0..2505050d8cae 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -375,7 +375,7 @@ void SwXDocumentIndex::Impl::Notify(const SfxHint& rHint)
return;
}
std::unique_lock g(m_Mutex);
- lang::EventObject const ev(static_cast<cppu::OWeakObject*>(xThis.get()));
+ lang::EventObject const ev(xThis->getXWeak());
m_RefreshListeners.disposeAndClear(g, ev);
m_EventListeners.disposeAndClear(g, ev);
}
@@ -416,7 +416,7 @@ SwXDocumentIndex::CreateXDocumentIndex(
: new SwXDocumentIndex(eTypes, rDoc);
if (pSection)
{
- pSection->GetFormat()->SetXObject(static_cast<cppu::OWeakObject*>(xIndex.get()));
+ pSection->GetFormat()->SetXObject(xIndex->getXWeak());
}
// need a permanent Reference to initialize m_wThis
xIndex->m_pImpl->m_wThis = xIndex.get();
@@ -523,13 +523,13 @@ SwXDocumentIndex::setPropertyValue(
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw beans::PropertyVetoException(
"Property is read-only: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
SwSectionFormat *const pSectionFormat(m_pImpl->GetSectionFormat());
@@ -873,7 +873,7 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast< cppu::OWeakObject * >(this));
+ getXWeak());
}
// TODO: is this the best approach to tell API clients about the change?
if (pEntry->nWID == RES_BACKGROUND && pEntry->nMemberId == MID_GRAPHIC_URL)
@@ -1271,7 +1271,7 @@ void SAL_CALL SwXDocumentIndex::refresh()
{
throw uno::RuntimeException(
"SwXDocumentIndex::refresh: must be in attached state",
- static_cast< ::cppu::OWeakObject*>(this));
+ getXWeak());
}
pTOXBase->Update(nullptr, m_pImpl->m_pDoc->getIDocumentLayoutAccess().GetCurrentLayout());
@@ -1285,7 +1285,7 @@ void SAL_CALL SwXDocumentIndex::refresh()
std::unique_lock g(m_pImpl->m_Mutex);
if (m_pImpl->m_RefreshListeners.getLength(g))
{
- lang::EventObject const event(static_cast< ::cppu::OWeakObject*>(this));
+ lang::EventObject const event(getXWeak());
m_pImpl->m_RefreshListeners.notifyEach(g, & util::XRefreshListener::refreshed, event);
}
}
@@ -1353,7 +1353,7 @@ SwXDocumentIndex::attach(const uno::Reference< text::XTextRange > & xTextRange)
// update page numbers
m_pImpl->SetSectionFormat(*pTOX->GetFormat());
- pTOX->GetFormat()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
+ pTOX->GetFormat()->SetXObject(getXWeak());
pTOX->UpdatePageNum();
m_pImpl->m_oProps.reset();
@@ -1575,8 +1575,7 @@ public:
InsertTOXMark(rTOXType, rMark, rPam, nullptr);
} catch (...) {
OSL_FAIL("ReplaceTOXMark() failed!");
- lang::EventObject const ev(
- static_cast< ::cppu::OWeakObject&>(m_rThis));
+ lang::EventObject const ev(m_rThis.getXWeak());
std::unique_lock aGuard(m_Mutex);
m_EventListeners.disposeAndClear(aGuard, ev);
throw;
@@ -1595,7 +1594,7 @@ void SwXDocumentIndexMark::Impl::Invalidate()
// fdo#72695: if UNO object is already dead, don't revive it with event
if (xThis.is())
{
- lang::EventObject const ev(static_cast<cppu::OWeakObject*>(xThis.get()));
+ lang::EventObject const ev(xThis->getXWeak());
std::unique_lock aGuard(m_Mutex);
m_EventListeners.disposeAndClear(aGuard, ev);
}
@@ -2051,13 +2050,13 @@ SwXDocumentIndexMark::setPropertyValue(
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw beans::PropertyVetoException(
"Property is read-only: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
SwTOXType *const pType = m_pImpl->GetTOXType();
@@ -2180,7 +2179,7 @@ SwXDocumentIndexMark::getPropertyValue(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (::sw::GetDefaultTextContentValue(aRet, rPropertyName, pEntry->nWID))
{
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index be8584202d78..b2f83fee30ea 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1862,8 +1862,7 @@ uno::Any SwUnoCursorHelper::GetPropertyValue(
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString::Concat("Unknown property: ") + rPropertyName,
- static_cast<cppu::OWeakObject *>(nullptr));
+ OUString::Concat("Unknown property: ") + rPropertyName);
}
beans::PropertyState eTemp;
@@ -1992,9 +1991,9 @@ void SwUnoCursorHelper::SetPropertyValues(
}
if (!aUnknownExMsg.isEmpty())
- throw beans::UnknownPropertyException(aUnknownExMsg, static_cast<cppu::OWeakObject *>(nullptr));
+ throw beans::UnknownPropertyException(aUnknownExMsg);
if (!aPropertyVetoExMsg.isEmpty())
- throw beans::PropertyVetoException(aPropertyVetoExMsg, static_cast<cppu::OWeakObject *>(nullptr));
+ throw beans::PropertyVetoException(aPropertyVetoExMsg);
}
namespace
@@ -2041,8 +2040,7 @@ SwUnoCursorHelper::GetPropertyStates(
else
{
throw beans::UnknownPropertyException(
- "Unknown property: " + pNames[i],
- static_cast<cppu::OWeakObject *>(nullptr));
+ "Unknown property: " + pNames[i]);
}
}
if (((SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION == eCaller) ||
@@ -2155,8 +2153,7 @@ void SwUnoCursorHelper::SetPropertyToDefault(
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString::Concat("Unknown property: ") + rPropertyName,
- static_cast<cppu::OWeakObject *>(nullptr));
+ OUString::Concat("Unknown property: ") + rPropertyName);
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
@@ -2193,8 +2190,7 @@ uno::Any SwUnoCursorHelper::GetPropertyDefault(
if (!pEntry)
{
throw beans::UnknownPropertyException(
- OUString::Concat("Unknown property: ") + rPropertyName,
- static_cast<cppu::OWeakObject *>(nullptr));
+ OUString::Concat("Unknown property: ") + rPropertyName);
}
uno::Any aRet;
@@ -2582,13 +2578,13 @@ SwXTextCursor::setPropertiesToDefault(
}
throw beans::UnknownPropertyException(
"Unknown property: " + rName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw uno::RuntimeException(
"setPropertiesToDefault: property is read-only: " + rName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (pEntry->nWID < RES_FRMATR_END)
@@ -2646,8 +2642,7 @@ SwXTextCursor::getPropertyDefaults(
continue;
}
throw beans::UnknownPropertyException(
- "Unknown property: " + pNames[i],
- static_cast<cppu::OWeakObject *>(nullptr));
+ "Unknown property: " + pNames[i]);
}
if (pEntry->nWID < RES_FRMATR_END)
{
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 198f23ff2272..68dbe34f55d5 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -389,12 +389,12 @@ void SwXParagraph::Impl::SetPropertyValues_Impl(
if (SfxItemPropertyMapEntry const* const pEntry = rMap.getByName(name); !pEntry)
{
throw beans::UnknownPropertyException("Unknown property: " + name,
- static_cast<cppu::OWeakObject*>(&m_rThis));
+ m_rThis.getXWeak());
}
else if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw beans::PropertyVetoException("Property is read-only: " + name,
- static_cast<cppu::OWeakObject*>(&m_rThis));
+ m_rThis.getXWeak());
}
return comphelper::makePropertyValue(name, value);
});
@@ -407,7 +407,7 @@ void SAL_CALL SwXParagraph::setPropertyValues(
{
if (rPropertyNames.getLength() != rValues.getLength())
throw lang::IllegalArgumentException("lengths do not match",
- static_cast<cppu::OWeakObject*>(this), -1);
+ getXWeak(), -1);
SolarMutexGuard aGuard;
@@ -556,7 +556,7 @@ uno::Sequence< uno::Any > SwXParagraph::Impl::GetPropertyValues_Impl(
{
throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProp],
- static_cast< cppu::OWeakObject * >(&m_rThis));
+ m_rThis.getXWeak());
}
if (! ::sw::GetDefaultTextContentValue(
pValues[nProp], pPropertyNames[nProp], pEntry->nWID))
@@ -588,13 +588,13 @@ SwXParagraph::getPropertyValues(const uno::Sequence< OUString >& rPropertyNames)
{
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException("Unknown property exception caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
catch (lang::WrappedTargetException &)
{
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException("WrappedTargetException caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
return aValues;
@@ -1031,7 +1031,7 @@ SwXParagraph::getPropertyState(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
bool bDummy = false;
const beans::PropertyState eRet =
@@ -1063,7 +1063,7 @@ SwXParagraph::getPropertyStates(
{
throw beans::UnknownPropertyException(
"Unknown property: " + *pNames,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (bAttrSetFetched && !pSet && isATR(pEntry->nWID))
@@ -1104,14 +1104,14 @@ SwXParagraph::setPropertyToDefault(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw uno::RuntimeException(
"Property is read-only: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
const bool bBelowFrameAtrEnd(pEntry->nWID < RES_FRMATR_END);
@@ -1187,7 +1187,7 @@ SwXParagraph::getPropertyDefault(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
const bool bBelowFrameAtrEnd(pEntry->nWID < RES_FRMATR_END);
@@ -1237,7 +1237,7 @@ void SAL_CALL SwXParagraph::dispose()
{
SwCursor aCursor( SwPosition( *pTextNode ), nullptr );
pTextNode->GetDoc().getIDocumentContentOperations().DelFullPara(aCursor);
- lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ lang::EventObject const ev(getXWeak());
std::unique_lock aGuard2(m_pImpl->m_Mutex);
m_pImpl->m_EventListeners.disposeAndClear(aGuard2, ev);
}
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 80de35b5f381..cfbe918ba2bb 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -427,7 +427,7 @@ uno::Sequence< uno::Any > SwXTextPortion::GetPropertyValues_Impl(
{
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(pPropertyNames[nProp]);
if(!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + pPropertyNames[nProp], getXWeak() );
GetPropertyValue( pValues[nProp], *pEntry, &rUnoCursor, pSet );
}
}
@@ -448,7 +448,7 @@ void SwXTextPortion::SetPropertyValues_Impl(
{
if (rPropertyNames.getLength() != rValues.getLength())
throw lang::IllegalArgumentException("lengths do not match",
- static_cast<cppu::OWeakObject*>(this), -1);
+ getXWeak(), -1);
SwUnoCursor& rUnoCursor = GetCursor();
@@ -462,9 +462,9 @@ void SwXTextPortion::SetPropertyValues_Impl(
{
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(pPropertyNames[nProp]);
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + pPropertyNames[nProp], getXWeak() );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException ("Property is read-only: " + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException ("Property is read-only: " + pPropertyNames[nProp], getXWeak() );
aValuesRange[nProp].Name = pPropertyNames[nProp];
aValuesRange[nProp].Value = pValues[nProp];
@@ -509,13 +509,13 @@ uno::Sequence< uno::Any > SwXTextPortion::getPropertyValues(
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
catch (lang::WrappedTargetException &)
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
return aValues;
@@ -675,7 +675,7 @@ uno::Sequence< beans::GetDirectPropertyTolerantResult > SwXTextPortion::GetPrope
{
const SfxItemPropertyMapEntry* pEntry = rPropMap.getByName( pProp[i] );
if (!pEntry)
- throw beans::UnknownPropertyException( "Unknown property: " + pProp[i], static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + pProp[i], getXWeak() );
aResult.State = pPropertyStates[i];
aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index feb403c05f0d..b86fbc675730 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -855,7 +855,7 @@ SwXMeta::dispose()
if (m_pImpl->m_bIsDescriptor)
{
m_pImpl->m_pTextPortions.reset();
- lang::EventObject const ev(static_cast< ::cppu::OWeakObject&>(*this));
+ lang::EventObject const ev(getXWeak());
std::unique_lock aGuard(m_pImpl->m_Mutex);
m_pImpl->m_EventListeners.disposeAndClear(aGuard, ev);
m_pImpl->m_bIsDisposed = true;
@@ -895,7 +895,7 @@ SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
{
throw uno::RuntimeException(
"SwXMeta::attach(): already attached",
- static_cast< ::cppu::OWeakObject* >(this));
+ getXWeak());
}
SwXTextRange *const pRange(dynamic_cast<SwXTextRange*>(i_xTextRange.get()));
@@ -904,7 +904,7 @@ SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
{
throw lang::IllegalArgumentException(
"SwXMeta::attach(): argument not supported type",
- static_cast< ::cppu::OWeakObject* >(this), 0);
+ getXWeak(), 0);
}
SwDoc * const pDoc(
@@ -913,7 +913,7 @@ SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
{
throw lang::IllegalArgumentException(
"SwXMeta::attach(): argument has no SwDoc",
- static_cast< ::cppu::OWeakObject* >(this), 0);
+ getXWeak(), 0);
}
SwUnoInternalPaM aPam(*pDoc);
@@ -940,14 +940,14 @@ SwXMeta::AttachImpl(const uno::Reference< text::XTextRange > & i_xTextRange,
{
throw lang::IllegalArgumentException(
"SwXMeta::attach(): cannot create meta: range invalid?",
- static_cast< ::cppu::OWeakObject* >(this), 1);
+ getXWeak(), 1);
}
if (!pTextAttr)
{
OSL_FAIL("meta inserted, but has no text attribute?");
throw uno::RuntimeException(
"SwXMeta::attach(): cannot create meta",
- static_cast< ::cppu::OWeakObject* >(this));
+ getXWeak());
}
m_pImpl->EndListeningAll();
@@ -980,7 +980,7 @@ SwXMeta::getAnchor()
{
throw uno::RuntimeException(
"SwXMeta::getAnchor(): not inserted",
- static_cast< ::cppu::OWeakObject* >(this));
+ getXWeak());
}
SwTextNode * pTextNode;
@@ -992,7 +992,7 @@ SwXMeta::getAnchor()
{
throw lang::DisposedException(
"SwXMeta::getAnchor(): not attached",
- static_cast< ::cppu::OWeakObject* >(this));
+ getXWeak());
}
const SwPosition start(*pTextNode, nMetaStart - 1); // -1 due to CH_TXTATR
@@ -1138,7 +1138,7 @@ SwXMeta::createEnumeration()
{
throw uno::RuntimeException(
"createEnumeration(): not inserted",
- static_cast< ::cppu::OWeakObject* >(this));
+ getXWeak());
}
SwTextNode * pTextNode;
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 490bd8d1c435..4439862002d3 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -389,10 +389,10 @@ SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::INSSECTION, nullptr );
throw lang::IllegalArgumentException(
"SwXTextSection::attach(): invalid TextRange",
- static_cast< ::cppu::OWeakObject*>(this), 0);
+ getXWeak(), 0);
}
m_pImpl->Attach(pRet->GetFormat());
- pRet->GetFormat()->SetXObject(static_cast<cppu::OWeakObject*>(this));
+ pRet->GetFormat()->SetXObject(getXWeak());
// XML import must hide sections depending on their old
// condition status
@@ -583,13 +583,13 @@ void SwXTextSection::Impl::SetPropertyValues_Impl(
{
throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProperty],
- static_cast<cppu::OWeakObject *>(& m_rThis));
+ m_rThis.getXWeak());
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw beans::PropertyVetoException(
"Property is read-only: " + pPropertyNames[nProperty],
- static_cast<cppu::OWeakObject *>(& m_rThis));
+ m_rThis.getXWeak());
}
switch (pEntry->nWID)
{
@@ -963,7 +963,7 @@ SwXTextSection::Impl::GetPropertyValues_Impl(
{
throw beans::UnknownPropertyException(
"Unknown property: " + pPropertyNames[nProperty],
- static_cast<cppu::OWeakObject *>(& m_rThis));
+ m_rThis.getXWeak());
}
switch(pEntry->nWID)
{
@@ -1260,13 +1260,13 @@ SwXTextSection::getPropertyValues(
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
catch (lang::WrappedTargetException &)
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
return aValues;
@@ -1366,7 +1366,7 @@ SwXTextSection::getPropertyStates(
{
throw beans::UnknownPropertyException(
"Unknown property: " + pNames[i],
- static_cast< cppu::OWeakObject* >(this));
+ getXWeak());
}
switch (pEntry->nWID)
{
@@ -1441,13 +1441,13 @@ SwXTextSection::setPropertyToDefault(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast< cppu::OWeakObject* >(this));
+ getXWeak());
}
if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
{
throw uno::RuntimeException(
"Property is read-only: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
std::unique_ptr<SwSectionData> const pSectionData(
@@ -1579,7 +1579,7 @@ SwXTextSection::getPropertyDefault(const OUString& rPropertyName)
{
throw beans::UnknownPropertyException(
"Unknown property: " + rPropertyName,
- static_cast<cppu::OWeakObject *>(this));
+ getXWeak());
}
switch(pEntry->nWID)
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 2430bf35fa49..1f25b8989402 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -287,10 +287,10 @@ void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, cons
const SfxItemPropertyMapEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & PropertyAttribute::READONLY)
- throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
SwFootnoteInfo aFootnoteInfo(m_pDoc->GetFootnoteInfo());
switch(pEntry->nWID)
{
@@ -408,7 +408,7 @@ uno::Any SwXFootnoteProperties::getPropertyValue(const OUString& rPropertyName)
const SfxItemPropertyMapEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
if(!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
const SwFootnoteInfo& rFootnoteInfo = m_pDoc->GetFootnoteInfo();
switch(pEntry->nWID)
@@ -566,10 +566,10 @@ void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const
const SfxItemPropertyMapEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
if(!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & PropertyAttribute::READONLY)
- throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
SwEndNoteInfo aEndInfo(m_pDoc->GetEndNoteInfo());
switch(pEntry->nWID)
{
@@ -640,7 +640,7 @@ uno::Any SwXEndnoteProperties::getPropertyValue(const OUString& rPropertyName)
{
const SfxItemPropertyMapEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
if(!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
const SwEndNoteInfo& rEndInfo = m_pDoc->GetEndNoteInfo();
switch(pEntry->nWID)
@@ -769,10 +769,10 @@ void SwXLineNumberingProperties::setPropertyValue(
const SfxItemPropertyMapEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
if(!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & PropertyAttribute::READONLY)
- throw PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
SwLineNumberInfo aFontMetric(m_pDoc->GetLineNumberInfo());
switch(pEntry->nWID)
{
@@ -883,7 +883,7 @@ Any SwXLineNumberingProperties::getPropertyValue(const OUString& rPropertyName)
const SfxItemPropertyMapEntry* pEntry = m_pPropertySet->getPropertyMap().getByName( rPropertyName );
if(!pEntry)
- throw UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
const SwLineNumberInfo& rInfo = m_pDoc->GetLineNumberInfo();
switch(pEntry->nWID)
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index f4ec332be90b..d41dccb0d07d 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -417,10 +417,10 @@ void SwXTextSearch::setPropertyValue(const OUString& rPropertyName, const uno::A
SolarMutexGuard aGuard;
const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException ("Property is read-only: " + rPropertyName, getXWeak() );
bool bVal = false;
if(auto b = o3tl::tryAccess<bool>(aValue))
bVal = *b;
@@ -450,7 +450,7 @@ uno::Any SwXTextSearch::getPropertyValue(const OUString& rPropertyName)
const SfxItemPropertyMapEntry* pEntry = m_pPropSet->getPropertyMap().getByName(rPropertyName);
bool bSet = false;
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
sal_Int16 nSet = 0;
switch(pEntry->nWID)
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 3be1ad0e23ec..94219281b562 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1213,7 +1213,7 @@ void XStyleFamily::removeByName(const OUString& rName)
uno::Any SAL_CALL XStyleFamily::getPropertyValue( const OUString& sPropertyName )
{
if(sPropertyName != "DisplayName")
- throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, static_cast<OWeakObject *>(this) );
+ throw beans::UnknownPropertyException( "unknown property: " + sPropertyName, getXWeak() );
SolarMutexGuard aGuard;
return uno::Any(SwResId(m_rEntry.resId()));
}
@@ -2049,9 +2049,9 @@ void SwXStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rPropertyNa
{
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(pNames[nProp]);
if(!pEntry || (!m_bIsConditional && pNames[nProp] == UNO_NAME_PARA_STYLE_CONDITIONS))
- throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + pNames[nProp], getXWeak());
if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], static_cast<cppu::OWeakObject*>(this));
+ throw beans::PropertyVetoException ("Property is read-only: " + pNames[nProp], getXWeak());
if(aBaseImpl.getNewBase().is())
SetStyleProperty(*pEntry, *pPropSet, pValues[nProp], aBaseImpl);
else if(!m_pPropertiesImpl->SetProperty(pNames[nProp], pValues[nProp]))
@@ -2362,7 +2362,7 @@ uno::Any SwXStyle::GetPropertyValue_Impl(const SfxItemPropertySet* pPropSet, SwS
const SfxItemPropertyMap& rMap = pPropSet->getPropertyMap();
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropertyName);
if(!pEntry || (!m_bIsConditional && rPropertyName == UNO_NAME_PARA_STYLE_CONDITIONS))
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak());
if(m_pBasePool)
return GetStyleProperty_Impl(*pEntry, *pPropSet, rBase);
const uno::Any* pAny = nullptr;
@@ -2435,13 +2435,13 @@ uno::Sequence<uno::Any> SwXStyle::getPropertyValues(const uno::Sequence<OUString
{
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException("Unknown property exception caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
catch(lang::WrappedTargetException&)
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
return aValues;
}
@@ -2504,7 +2504,7 @@ uno::Sequence<beans::PropertyState> SwXStyle::getPropertyStates(const uno::Seque
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + sPropName, getXWeak());
if (FN_UNO_NUM_RULES == pEntry->nWID || FN_UNO_FOLLOW_STYLE == pEntry->nWID
|| pEntry->nWID == FN_UNO_LINK_STYLE)
@@ -2634,12 +2634,12 @@ void SAL_CALL SwXStyle::setPropertiesToDefault(const uno::Sequence<OUString>& aP
{
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rName);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + rName, getXWeak());
if (pEntry->nWID == FN_UNO_FOLLOW_STYLE || pEntry->nWID == FN_UNO_LINK_STYLE
|| pEntry->nWID == FN_UNO_NUM_RULES)
- throw uno::RuntimeException("Cannot reset: " + rName, static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Cannot reset: " + rName, getXWeak());
if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw uno::RuntimeException("setPropertiesToDefault: property is read-only: " + rName, static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("setPropertiesToDefault: property is read-only: " + rName, getXWeak());
if(pEntry->nWID == RES_PARATR_OUTLINELEVEL)
{
static_cast<SwTextFormatColl*>(pTargetFormat)->DeleteAssignmentToListLevelOfOutlineStyle();
@@ -2756,7 +2756,7 @@ uno::Sequence<uno::Any> SAL_CALL SwXStyle::getPropertyDefaults(const uno::Sequen
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(aPropertyNames[i]);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + aPropertyNames[i], static_cast < cppu::OWeakObject * >(this));
+ throw beans::UnknownPropertyException("Unknown property: " + aPropertyNames[i], getXWeak());
// these cannot be in an item set, especially not the
// parent set, so the default value is void
if (pEntry->nWID >= RES_UNKNOWNATR_END)
@@ -2870,9 +2870,9 @@ void SwXPageStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rProper
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropName);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + rPropName, getXWeak());
if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::PropertyVetoException("Property is read-only: " + rPropName, getXWeak());
const bool bHeader(rPropName.startsWith("Header"));
const bool bFooter(rPropName.startsWith("Footer"));
@@ -3005,7 +3005,7 @@ void SwXPageStyle::SetPropertyValues_Impl(const uno::Sequence<OUString>& rProper
case SID_ATTR_PAGE_ON:
case RES_HEADER_FOOTER_EAT_SPACING:
// these slots are exclusive to Header/Footer, thus this is an error
- throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + rPropName, getXWeak());
case FN_UNO_HEADER:
case FN_UNO_HEADER_LEFT:
case FN_UNO_HEADER_RIGHT:
@@ -3116,7 +3116,7 @@ uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(rPropName);
if (!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropName, getXWeak() );
const bool bHeader(rPropName.startsWith("Header"));
const bool bFooter(rPropName.startsWith("Footer"));
const bool bFirstIsShared(rPropName == UNO_NAME_FIRST_IS_SHARED);
@@ -3207,7 +3207,7 @@ uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence
case SID_ATTR_PAGE_SHARED_FIRST:
case SID_ATTR_PAGE_ON:
case RES_HEADER_FOOTER_EAT_SPACING:
- throw beans::UnknownPropertyException( "Unknown property: " + rPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException( "Unknown property: " + rPropName, getXWeak() );
case FN_UNO_HEADER:
case FN_UNO_HEADER_LEFT:
case FN_UNO_HEADER_FIRST:
@@ -3286,13 +3286,13 @@ uno::Sequence<uno::Any> SwXPageStyle::getPropertyValues(const uno::Sequence<OUSt
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
catch(lang::WrappedTargetException &)
{
css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
- static_cast < cppu::OWeakObject * > ( this ), anyEx );
+ getXWeak(), anyEx );
}
return aValues;
@@ -3992,7 +3992,7 @@ uno::Sequence< uno::Any > SwXAutoStyle::GetPropertyValues_Impl(
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
if(!pEntry)
{
- throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + sPropName, getXWeak() );
}
uno::Any aTarget;
@@ -4110,12 +4110,12 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
catch (beans::UnknownPropertyException &)
{
css::uno::Any exc = cppu::getCaughtException();
- throw lang::WrappedTargetRuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ), exc );
+ throw lang::WrappedTargetRuntimeException("Unknown property exception caught", getXWeak(), exc );
}
catch (lang::WrappedTargetException &)
{
css::uno::Any exc = cppu::getCaughtException();
- throw lang::WrappedTargetRuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ), exc );
+ throw lang::WrappedTargetRuntimeException("WrappedTargetException caught", getXWeak(), exc );
}
return aValues;
@@ -4189,7 +4189,7 @@ uno::Sequence< beans::PropertyState > SwXAutoStyle::getPropertyStates(
const SfxItemPropertyMapEntry* pEntry = rMap.getByName(sPropName);
if(!pEntry)
{
- throw beans::UnknownPropertyException("Unknown property: " + sPropName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + sPropName, getXWeak() );
}
bool bDone(false);
@@ -4555,7 +4555,7 @@ uno::Any SAL_CALL SwXTextTableStyle::getByName(const OUString& rName)
throw css::container::NoSuchElementException();
auto nIdx = (*iter).second;
- return css::uno::Any(uno::Reference<XInterface>(static_cast<cppu::OWeakObject*>(m_aCellStyles[nIdx].get())));
+ return css::uno::Any(uno::Reference(cppu::getXWeak(m_aCellStyles[nIdx].get())));
}
css::uno::Sequence<OUString> SAL_CALL SwXTextTableStyle::getElementNames()
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 74aa98e6882f..c2f92df7f1cf 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -947,7 +947,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
comphelper::SequenceAsHashMap aPropMap(tableCellProperties);
OUString sRedlineType;
if(!(aPropMap.getValue("RedlineType") >>= sRedlineType))
- throw beans::UnknownPropertyException("No redline type property: ", static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("No redline type property: ", getXWeak());
// Create a 'Table Cell Redline' object
SwUnoCursorHelper::makeTableCellRedline(*m_pBox, sRedlineType, tableCellProperties);
@@ -981,7 +981,7 @@ void SwXCell::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
}
if(!pEntry)
- throw beans::UnknownPropertyException(rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException(rPropertyName, getXWeak());
if(pEntry->nWID != FN_UNO_CELL_ROW_SPAN)
{
SwFrameFormat* pBoxFormat = m_pBox->ClaimFrameFormat();
@@ -1001,7 +1001,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
return uno::Any();
auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
if(!pEntry)
- throw beans::UnknownPropertyException(rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException(rPropertyName, getXWeak());
switch(pEntry->nWID)
{
case FN_UNO_CELL_ROW_SPAN:
@@ -1058,16 +1058,16 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName)
}
void SwXCell::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXCell::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXCell::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXCell::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
uno::Reference<container::XEnumeration> SwXCell::createEnumeration()
{
@@ -1240,7 +1240,7 @@ uno::Reference< beans::XPropertySetInfo > SwXTextTableRow::getPropertySetInfo()
void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno::Any& aValue)
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
SwTable* pTable = SwTable::FindTable( pFormat );
SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, m_pLine);
if(!pLn)
@@ -1255,7 +1255,7 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno:
OUString sRedlineType;
if( !(aPropMap.getValue("RedlineType") >>= sRedlineType) )
{
- throw beans::UnknownPropertyException("No redline type property: ", static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("No redline type property: ", getXWeak() );
}
// Create a 'Table Row Redline' object
@@ -1268,9 +1268,9 @@ void SwXTextTableRow::setPropertyValue(const OUString& rPropertyName, const uno:
m_pPropSet->getPropertyMap().getByName(rPropertyName);
SwDoc* pDoc = pFormat->GetDoc();
if (!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
switch(pEntry->nWID)
{
@@ -1318,7 +1318,7 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName)
{
SolarMutexGuard aGuard;
uno::Any aRet;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
SwTable* pTable = SwTable::FindTable( pFormat );
SwTableLine* pLn = SwXTextTableRow::FindLine(pTable, m_pLine);
if(pLn)
@@ -1326,7 +1326,7 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName)
const SfxItemPropertyMapEntry* pEntry =
m_pPropSet->getPropertyMap().getByName(rPropertyName);
if (!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
switch(pEntry->nWID)
{
@@ -1360,16 +1360,16 @@ uno::Any SwXTextTableRow::getPropertyValue(const OUString& rPropertyName)
}
void SwXTextTableRow::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableRow::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableRow::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableRow::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableRow::Notify(const SfxHint& rHint)
{
@@ -1569,7 +1569,7 @@ sal_Bool SwXTextTableCursor::splitRange(sal_Int16 Count, sal_Bool Horizontal)
{
SolarMutexGuard aGuard;
if (Count <= 0)
- throw uno::RuntimeException("Illegal first argument: needs to be > 0", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal first argument: needs to be > 0", getXWeak());
SwUnoCursor& rUnoCursor = GetCursor();
SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor);
{
@@ -1598,9 +1598,9 @@ void SwXTextTableCursor::setPropertyValue(const OUString& rPropertyName, const u
SwUnoCursor& rUnoCursor = GetCursor();
auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak());
if(pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak());
{
auto pSttNode = rUnoCursor.GetPointNode().StartOfSectionNode();
const SwTableNode* pTableNode = pSttNode->FindTableNode();
@@ -1659,7 +1659,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
SwUnoTableCursor& rTableCursor = dynamic_cast<SwUnoTableCursor&>(rUnoCursor);
auto pEntry(m_pPropSet->getPropertyMap().getByName(rPropertyName));
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak());
rTableCursor.MakeBoxSels();
uno::Any aResult;
switch(pEntry->nWID)
@@ -1673,7 +1673,7 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
break;
case RES_BOXATR_FORMAT:
// TODO: GetAttr for table selections in a Doc is missing
- throw uno::RuntimeException("Unknown property: " + rPropertyName, static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Unknown property: " + rPropertyName, getXWeak());
break;
case FN_UNO_PARA_STYLE:
{
@@ -1696,16 +1696,16 @@ uno::Any SwXTextTableCursor::getPropertyValue(const OUString& rPropertyName)
}
void SwXTextTableCursor::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableCursor::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableCursor::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableCursor::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("not implemented", static_cast<cppu::OWeakObject*>(this)); };
+ { throw uno::RuntimeException("not implemented", getXWeak()); };
void SwXTextTableCursor::Notify( const SfxHint& rHint )
{
@@ -1921,8 +1921,7 @@ public:
sal_uInt16 const nColCount(rThis.m_pImpl->GetColumnCount());
if (!nRowCount || !nColCount)
{
- throw uno::RuntimeException("Table too complex",
- static_cast<cppu::OWeakObject*>(&rThis));
+ throw uno::RuntimeException("Table too complex", rThis.getXWeak());
}
return std::make_pair(nRowCount, nColCount);
}
@@ -1957,7 +1956,7 @@ rtl::Reference<SwXTextTable> SwXTextTable::CreateXTextTable(SwFrameFormat* const
return xTable;
xTable = pFrameFormat ? new SwXTextTable(*pFrameFormat) : new SwXTextTable();
if(pFrameFormat)
- pFrameFormat->SetXObject(static_cast<cppu::OWeakObject*>(xTable.get()));
+ pFrameFormat->SetXObject(xTable->getXWeak());
// need a permanent Reference to initialize m_wThis
xTable->m_pImpl->m_wThis = xTable.get();
return xTable;
@@ -2005,7 +2004,7 @@ uno::Reference<table::XTableColumns> SAL_CALL SwXTextTable::getColumns()
uno::Reference<table::XCell> SwXTextTable::getCellByName(const OUString& sCellName)
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
SwTable* pTable = SwTable::FindTable(pFormat);
SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTableBox(sCellName));
if(!pBox)
@@ -2030,7 +2029,7 @@ uno::Sequence<OUString> SwXTextTable::getCellNames()
uno::Reference<text::XTextTableCursor> SwXTextTable::createCursorByCellName(const OUString& sCellName)
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
SwTable* pTable = SwTable::FindTable(pFormat);
SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTableBox(sCellName));
if(!pBox || pBox->getRowSpan() == 0)
@@ -2045,7 +2044,7 @@ SwXTextTable::attach(const uno::Reference<text::XTextRange> & xTextRange)
// attach() must only be called once
if (!m_pImpl->IsDescriptor()) /* already attached ? */
- throw uno::RuntimeException("SwXTextTable: already attached to range.", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("SwXTextTable: already attached to range.", getXWeak());
SwXTextRange* pRange(dynamic_cast<SwXTextRange*>(xTextRange.get()));
OTextCursorHelper* pCursor(dynamic_cast<OTextCursorHelper*>(xTextRange.get()));
@@ -2111,14 +2110,14 @@ uno::Reference<text::XTextRange> SwXTextTable::getAnchor()
{
SolarMutexGuard aGuard;
SwTableFormat *const pFormat = static_cast<SwTableFormat*>(
- lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
+ lcl_EnsureCoreConnected(GetFrameFormat(), this));
return new SwXTextRange(*pFormat);
}
void SwXTextTable::dispose()
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
SwTable* pTable = SwTable::FindTable(pFormat);
SwSelBoxes aSelBoxes;
for(auto& rBox : pTable->GetTabSortBoxes() )
@@ -2217,8 +2216,8 @@ uno::Reference<table::XCellRange> SwXTextTable::getCellRangeByPosition(sal_Int3
uno::Reference<table::XCellRange> SwXTextTable::getCellRangeByName(const OUString& sRange)
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
- SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFormat), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
+ SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFormat), this);
sal_Int32 nPos = 0;
const OUString sTLName(sRange.getToken(0, ':', nPos));
const OUString sBRName(sRange.getToken(0, ':', nPos));
@@ -2393,8 +2392,8 @@ void SwXTextTable::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor
void SwXTextTable::autoFormat(const OUString& sAutoFormatName)
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
- SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFormat), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFormat = lcl_EnsureCoreConnected(GetFrameFormat(), this);
+ SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFormat), this);
SwTableAutoFormatTable aAutoFormatTable;
aAutoFormatTable.Load();
for (size_t i = aAutoFormatTable.size(); i;)
@@ -2432,7 +2431,7 @@ void SwXTextTable::setPropertyValue(const OUString& rPropertyName, const uno::An
if(pFormat)
{
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
if(0xBF == pEntry->nMemberId)
{
@@ -2686,7 +2685,7 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName)
m_pImpl->m_pPropSet->getPropertyMap().getByName(rPropertyName);
if (!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if(pFormat)
{
@@ -2924,16 +2923,16 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& rPropertyName)
}
void SwXTextTable::addPropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
void SwXTextTable::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
void SwXTextTable::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
void SwXTextTable::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*xListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
OUString SwXTextTable::getName()
{
@@ -3293,10 +3292,10 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV
const SfxItemPropertyMapEntry *const pEntry =
m_pImpl->m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
- throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::PropertyVetoException("Property is read-only: " + rPropertyName, getXWeak() );
SwDoc& rDoc = m_pImpl->m_pTableCursor->GetDoc();
SwUnoTableCursor& rCursor(dynamic_cast<SwUnoTableCursor&>(*m_pImpl->m_pTableCursor));
@@ -3413,7 +3412,7 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
const SfxItemPropertyMapEntry *const pEntry =
m_pImpl->m_pPropSet->getPropertyMap().getByName(rPropertyName);
if(!pEntry)
- throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw beans::UnknownPropertyException("Unknown property: " + rPropertyName, getXWeak() );
switch(pEntry->nWID )
{
@@ -3486,16 +3485,16 @@ uno::Any SAL_CALL SwXCellRange::getPropertyValue(const OUString& rPropertyName)
}
void SwXCellRange::addPropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
void SwXCellRange::removePropertyChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
void SwXCellRange::addVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
void SwXCellRange::removeVetoableChangeListener(const OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
///@see SwXCellRange::getData
uno::Sequence<uno::Sequence<uno::Any>> SAL_CALL SwXCellRange::getDataArray()
@@ -3504,8 +3503,8 @@ uno::Sequence<uno::Sequence<uno::Any>> SAL_CALL SwXCellRange::getDataArray()
const sal_Int32 nRowCount = m_pImpl->GetRowCount();
const sal_Int32 nColCount = m_pImpl->GetColumnCount();
if(!nRowCount || !nColCount)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
- lcl_EnsureCoreConnected(m_pImpl->GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Table too complex", getXWeak());
+ lcl_EnsureCoreConnected(m_pImpl->GetFrameFormat(), this);
uno::Sequence< uno::Sequence< uno::Any > > aRowSeq(nRowCount);
auto vCells(GetCells());
auto pCurrentCell(vCells.begin());
@@ -3516,7 +3515,7 @@ uno::Sequence<uno::Sequence<uno::Any>> SAL_CALL SwXCellRange::getDataArray()
{
auto pCell(static_cast<SwXCell*>(pCurrentCell->get()));
if(!pCell)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Table too complex", getXWeak());
rCellAny = pCell->GetAny();
++pCurrentCell;
}
@@ -3531,23 +3530,23 @@ void SAL_CALL SwXCellRange::setDataArray(const uno::Sequence< uno::Sequence< uno
const sal_Int32 nRowCount = m_pImpl->GetRowCount();
const sal_Int32 nColCount = m_pImpl->GetColumnCount();
if(!nRowCount || !nColCount)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Table too complex", getXWeak());
SwFrameFormat *const pFormat = m_pImpl->GetFrameFormat();
if(!pFormat)
return;
if(rArray.getLength() != nRowCount)
- throw uno::RuntimeException("Row count mismatch. expected: " + OUString::number(nRowCount) + " got: " + OUString::number(rArray.getLength()), static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Row count mismatch. expected: " + OUString::number(nRowCount) + " got: " + OUString::number(rArray.getLength()), getXWeak());
auto vCells(GetCells());
auto pCurrentCell(vCells.begin());
for(const auto& rColSeq : rArray)
{
if(rColSeq.getLength() != nColCount)
- throw uno::RuntimeException("Column count mismatch. expected: " + OUString::number(nColCount) + " got: " + OUString::number(rColSeq.getLength()), static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Column count mismatch. expected: " + OUString::number(nColCount) + " got: " + OUString::number(rColSeq.getLength()), getXWeak());
for(const auto& aValue : rColSeq)
{
auto pCell(static_cast<SwXCell*>(pCurrentCell->get()));
if(!pCell || !pCell->GetTableBox())
- throw uno::RuntimeException("Box for cell missing", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Box for cell missing", getXWeak());
if(aValue.isExtractableTo(cppu::UnoType<OUString>::get()))
sw_setString(*pCell, aValue.get<OUString>());
else if(aValue.isExtractableTo(cppu::UnoType<double>::get()))
@@ -3566,7 +3565,7 @@ SwXCellRange::getData()
const sal_Int32 nRowCount = m_pImpl->GetRowCount();
const sal_Int32 nColCount = m_pImpl->GetColumnCount();
if(!nRowCount || !nColCount)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Table too complex", getXWeak());
if (m_pImpl->m_bFirstColumnAsLabel || m_pImpl->m_bFirstRowAsLabel)
{
uno::Reference<chart::XChartDataArray> const xDataRange(
@@ -3584,7 +3583,7 @@ SwXCellRange::getData()
for(auto& rValue : asNonConstRange(rRow))
{
if(!(*pCurrentCell))
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Table too complex", getXWeak());
rValue = (*pCurrentCell)->getValue();
++pCurrentCell;
}
@@ -3599,7 +3598,7 @@ SwXCellRange::setData(const uno::Sequence< uno::Sequence<double> >& rData)
const sal_Int32 nRowCount = m_pImpl->GetRowCount();
const sal_Int32 nColCount = m_pImpl->GetColumnCount();
if(!nRowCount || !nColCount)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Table too complex", getXWeak());
if (m_pImpl->m_bFirstColumnAsLabel || m_pImpl->m_bFirstRowAsLabel)
{
uno::Reference<chart::XChartDataArray> const xDataRange(
@@ -3608,15 +3607,15 @@ SwXCellRange::setData(const uno::Sequence< uno::Sequence<double> >& rData)
nColCount-1, nRowCount-1), uno::UNO_QUERY_THROW);
return xDataRange->setData(rData);
}
- lcl_EnsureCoreConnected(m_pImpl->GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ lcl_EnsureCoreConnected(m_pImpl->GetFrameFormat(), this);
if(rData.getLength() != nRowCount)
- throw uno::RuntimeException("Row count mismatch. expected: " + OUString::number(nRowCount) + " got: " + OUString::number(rData.getLength()), static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Row count mismatch. expected: " + OUString::number(nRowCount) + " got: " + OUString::number(rData.getLength()), getXWeak());
auto vCells(GetCells());
auto pCurrentCell(vCells.begin());
for(const auto& rRow : rData)
{
if(rRow.getLength() != nColCount)
- throw uno::RuntimeException("Column count mismatch. expected: " + OUString::number(nColCount) + " got: " + OUString::number(rRow.getLength()), static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Column count mismatch. expected: " + OUString::number(nColCount) + " got: " + OUString::number(rRow.getLength()), getXWeak());
for(const auto& rValue : rRow)
{
uno::Reference<table::XCell>(*pCurrentCell, uno::UNO_SET_THROW)->setValue(rValue);
@@ -3650,8 +3649,8 @@ SwXCellRange::Impl::GetLabelDescriptions(SwXCellRange & rThis, bool bRow)
sal_uInt32 nLeft, nTop, nRight, nBottom;
std::tie(nLeft, nTop, nRight, nBottom) = GetLabelCoordinates(bRow);
if(!nRight && !nBottom)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(&rThis));
- lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(&rThis));
+ throw uno::RuntimeException("Table too complex", rThis.getXWeak());
+ lcl_EnsureCoreConnected(GetFrameFormat(), &rThis);
if (!(bRow ? m_bFirstColumnAsLabel : m_bFirstRowAsLabel))
return {}; // without labels we have no descriptions
auto xLabelRange(rThis.getCellRangeByPosition(nLeft, nTop, nRight, nBottom));
@@ -3676,19 +3675,19 @@ void SwXCellRange::Impl::SetLabelDescriptions(SwXCellRange & rThis,
const uno::Sequence<OUString>& rDesc, bool bRow)
{
SolarMutexGuard aGuard;
- lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(&rThis));
+ lcl_EnsureCoreConnected(GetFrameFormat(), &rThis);
if (!(bRow ? m_bFirstColumnAsLabel : m_bFirstRowAsLabel))
return; // if there are no labels we cannot set descriptions
sal_uInt32 nLeft, nTop, nRight, nBottom;
std::tie(nLeft, nTop, nRight, nBottom) = GetLabelCoordinates(bRow);
if(!nRight && !nBottom)
- throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(&rThis));
+ throw uno::RuntimeException("Table too complex", rThis.getXWeak());
auto xLabelRange(rThis.getCellRangeByPosition(nLeft, nTop, nRight, nBottom));
if (!xLabelRange.is())
- throw uno::RuntimeException("Missing Cell Range", static_cast<cppu::OWeakObject*>(&rThis));
+ throw uno::RuntimeException("Missing Cell Range", rThis.getXWeak());
auto vCells(static_cast<SwXCellRange*>(xLabelRange.get())->GetCells());
if (sal::static_int_cast<sal_uInt32>(rDesc.getLength()) != vCells.size())
- throw uno::RuntimeException("Too few or too many descriptions", static_cast<cppu::OWeakObject*>(&rThis));
+ throw uno::RuntimeException("Too few or too many descriptions", rThis.getXWeak());
auto pDescIterator(rDesc.begin());
for(auto& xCell : vCells)
uno::Reference<text::XText>(xCell, uno::UNO_QUERY_THROW)->setString(*pDescIterator++);
@@ -3723,10 +3722,10 @@ void SAL_CALL SwXCellRange::removeChartDataChangeEventListener(
}
sal_Bool SwXCellRange::isNotANumber(double /*fNumber*/)
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
double SwXCellRange::getNotANumber()
- { throw uno::RuntimeException("Not implemented", static_cast<cppu::OWeakObject*>(this)); }
+ { throw uno::RuntimeException("Not implemented", getXWeak()); }
uno::Sequence< beans::PropertyValue > SwXCellRange::createSortDescriptor()
{
@@ -3839,7 +3838,7 @@ sal_Int32 SwXTableRows::getCount()
uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
+ SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), this));
if(nIndex < 0)
throw lang::IndexOutOfBoundsException();
SwTable* pTable = SwTable::FindTable( pFrameFormat );
@@ -3874,11 +3873,11 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
SolarMutexGuard aGuard;
if (nCount == 0)
return;
- SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
- SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), this));
+ SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), this);
const size_t nRowCount = pTable->GetTabLines().size();
if (nCount <= 0 || 0 > nIndex || o3tl::make_unsigned(nIndex) > nRowCount)
- throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal arguments", getXWeak());
const OUString sTLName = sw_GetCellName(0, nIndex);
const SwTableBox* pTLBox = pTable->GetTableBox(sTLName);
bool bAppend = false;
@@ -3892,7 +3891,7 @@ void SwXTableRows::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
pTLBox = rBoxes.front();
}
if(!pTLBox)
- throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal arguments", getXWeak());
const SwStartNode* pSttNd = pTLBox->GetSttNd();
SwPosition aPos(*pSttNd);
// set cursor to the upper-left cell of the range
@@ -3913,14 +3912,14 @@ void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
SolarMutexGuard aGuard;
if (nCount == 0)
return;
- SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
+ SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), this));
if(nIndex < 0 || nCount <=0 )
throw uno::RuntimeException();
- SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), static_cast<cppu::OWeakObject*>(this));
+ SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), this);
OUString sTLName = sw_GetCellName(0, nIndex);
const SwTableBox* pTLBox = pTable->GetTableBox(sTLName);
if(!pTLBox)
- throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal arguments", getXWeak());
const SwStartNode* pSttNd = pTLBox->GetSttNd();
SwPosition aPos(*pSttNd);
// set cursor to the upper-left cell of the range
@@ -3930,7 +3929,7 @@ void SwXTableRows::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
const OUString sBLName = sw_GetCellName(0, nIndex + nCount - 1);
const SwTableBox* pBLBox = pTable->GetTableBox( sBLName );
if(!pBLBox)
- throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal arguments", getXWeak());
pUnoCursor->SetMark();
pUnoCursor->GetPoint()->Assign( *pBLBox->GetSttNd() );
pUnoCursor->Move(fnMoveForward, GoInNode);
@@ -3996,10 +3995,10 @@ SwFrameFormat* SwXTableColumns::GetFrameFormat() const
sal_Int32 SwXTableColumns::getCount()
{
SolarMutexGuard aGuard;
- SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
+ SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), this));
SwTable* pTable = SwTable::FindTable( pFrameFormat );
// if(!pTable->IsTableComplex())
-// throw uno::RuntimeException("Table too complex", static_cast<cppu::OWeakObject*>(this));
+// throw uno::RuntimeException("Table too complex", getXWeak());
SwTableLines& rLines = pTable->GetTabLines();
SwTableLine* pLine = rLines.front();
return pLine->GetTabBoxes().size();
@@ -4021,7 +4020,7 @@ uno::Type SAL_CALL SwXTableColumns::getElementType()
sal_Bool SwXTableColumns::hasElements()
{
SolarMutexGuard aGuard;
- lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this));
+ lcl_EnsureCoreConnected(GetFrameFormat(), this);
return true;
}
@@ -4031,13 +4030,13 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
SolarMutexGuard aGuard;
if (nCount == 0)
return;
- SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
- SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), static_cast<cppu::OWeakObject*>(this));
+ SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), this));
+ SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), this);
SwTableLines& rLines = pTable->GetTabLines();
SwTableLine* pLine = rLines.front();
const size_t nColCount = pLine->GetTabBoxes().size();
if (nCount <= 0 || 0 > nIndex || o3tl::make_unsigned(nIndex) > nColCount)
- throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal arguments", getXWeak());
const OUString sTLName = sw_GetCellName(nIndex, 0);
const SwTableBox* pTLBox = pTable->GetTableBox( sTLName );
bool bAppend = false;
@@ -4049,7 +4048,7 @@ void SwXTableColumns::insertByIndex(sal_Int32 nIndex, sal_Int32 nCount)
pTLBox = rBoxes.back();
}
if(!pTLBox)
- throw uno::RuntimeException("Illegal arguments", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Illegal arguments", getXWeak());
const SwStartNode* pSttNd = pTLBox->GetSttNd();
SwPosition aPos(*pSttNd);
UnoActionContext aAction(pFrameFormat->GetDoc());
@@ -4070,14 +4069,14 @@ void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
SolarMutexGuard aGuard;
if (nCount == 0)
return;
- SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), static_cast<cppu::OWeakObject*>(this)));
+ SwFrameFormat* pFrameFormat(lcl_EnsureCoreConnected(GetFrameFormat(), this));
if(nIndex < 0 || nCount <=0 )
throw uno::RuntimeException();
- SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), static_cast<cppu::OWeakObject*>(this));
+ SwTable* pTable = lcl_EnsureTableNotComplex(SwTable::FindTable(pFrameFormat), this);
const OUString sTLName = sw_GetCellName(nIndex, 0);
const SwTableBox* pTLBox = pTable->GetTableBox( sTLName );
if(!pTLBox)
- throw uno::RuntimeException("Cell not found", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Cell not found", getXWeak());
const SwStartNode* pSttNd = pTLBox->GetSttNd();
SwPosition aPos(*pSttNd);
// set cursor to the upper-left cell of the range
@@ -4087,7 +4086,7 @@ void SwXTableColumns::removeByIndex(sal_Int32 nIndex, sal_Int32 nCount)
const OUString sTRName = sw_GetCellName(nIndex + nCount - 1, 0);
const SwTableBox* pTRBox = pTable->GetTableBox(sTRName);
if(!pTRBox)
- throw uno::RuntimeException("Cell not found", static_cast<cppu::OWeakObject*>(this));
+ throw uno::RuntimeException("Cell not found", getXWeak());
pUnoCursor->SetMark();
pUnoCursor->GetPoint()->Assign( *pTRBox->GetSttNd() );
pUnoCursor->Move(fnMoveForward, GoInNode);
diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx
index fd3cb6e4a39c..a74f7329b26f 100644
--- a/sw/source/uibase/config/StoredChapterNumbering.cxx
+++ b/sw/source/uibase/config/StoredChapterNumbering.cxx
@@ -141,7 +141,7 @@ public:
uno::Sequence<beans::PropertyValue> props;
if (!(rElement >>= props))
throw lang::IllegalArgumentException("invalid type",
- static_cast< ::cppu::OWeakObject*>(this), 1);
+ getXWeak(), 1);
SolarMutexGuard g;
SwNumFormat aNumberFormat;
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 18ad84fa8834..3e40989828d1 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -365,7 +365,7 @@ void SwXDocumentSettings::_preSetValues ()
void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInfo, const uno::Any &rValue )
{
if (rInfo.mnAttributes & PropertyAttribute::READONLY)
- throw PropertyVetoException ("Property is read-only: " + rInfo.maName, static_cast < cppu::OWeakObject * > ( nullptr ) );
+ throw PropertyVetoException ("Property is read-only: " + rInfo.maName);
switch( rInfo.mnHandle )
{
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 071aef8c05ea..7ea3d9db4e40 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -384,7 +384,7 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const
css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"Error Getting AutoText!",
- static_cast < OWeakObject * > ( this ),
+ getXWeak(),
anyEx );
}
diff --git a/sw/source/uibase/uno/unodispatch.cxx b/sw/source/uibase/uno/unodispatch.cxx
index 64fb33f8d67f..bb9af96d48f6 100644
--- a/sw/source/uibase/uno/unodispatch.cxx
+++ b/sw/source/uibase/uno/unodispatch.cxx
@@ -222,7 +222,7 @@ void SwXDispatch::dispatch(const util::URL& aURL,
else if(aURL.Complete == cInternalDBChangeNotification)
{
frame::FeatureStateEvent aEvent;
- aEvent.Source = *static_cast<cppu::OWeakObject*>(this);
+ aEvent.Source = getXWeak();
const SwDBData& rData = m_pView->GetWrtShell().GetDBData();
svx::ODataAccessDescriptor aDescriptor;
@@ -264,7 +264,7 @@ void SwXDispatch::addStatusListener(
m_bOldEnable = bEnable;
frame::FeatureStateEvent aEvent;
aEvent.IsEnabled = bEnable;
- aEvent.Source = *static_cast<cppu::OWeakObject*>(this);
+ aEvent.Source = getXWeak();
aEvent.FeatureURL = aURL;
// one of the URLs requires a special state...
@@ -326,7 +326,7 @@ void SwXDispatch::selectionChanged( const lang::EventObject& )
m_bOldEnable = bEnable;
frame::FeatureStateEvent aEvent;
aEvent.IsEnabled = bEnable;
- aEvent.Source = *static_cast<cppu::OWeakObject*>(this);
+ aEvent.Source = getXWeak();
// calls to statusChanged may call addStatusListener or removeStatusListener
// so copy m_aStatusListenerVector on stack
@@ -348,7 +348,7 @@ void SwXDispatch::disposing( const lang::EventObject& rSource )
m_bListenerAdded = false;
lang::EventObject aObject;
- aObject.Source = static_cast<cppu::OWeakObject*>(this);
+ aObject.Source = getXWeak();
// calls to statusChanged may call addStatusListener or removeStatusListener
// so copy m_aStatusListenerVector on stack
auto copyStatusListenerVector = m_aStatusListenerVector;
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index c940a148afb9..2b5fecf21b65 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -467,7 +467,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
else if (rName == UNO_NAME_CONNECTION)
bOK = rValue >>= xCurConnection;
else if (rName == UNO_NAME_MODEL)
- throw PropertyVetoException("Property is read-only: " + rName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw PropertyVetoException("Property is read-only: " + rName, getXWeak() );
else if (rName == UNO_NAME_DATA_SOURCE_NAME)
bOK = rValue >>= aCurDataSourceName;
else if (rName == UNO_NAME_DAD_COMMAND)
@@ -479,7 +479,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
bOK = rValue >>= aCurDocumentURL;
if (!aCurDocumentURL.isEmpty()
&& !LoadFromURL_impl( xCurModel, xCurDocSh, aCurDocumentURL, false ))
- throw RuntimeException("Failed to create document from URL: " + aCurDocumentURL, static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException("Failed to create document from URL: " + aCurDocumentURL, getXWeak() );
}
else if (rName == UNO_NAME_OUTPUT_URL)
{
@@ -487,9 +487,9 @@ uno::Any SAL_CALL SwXMailMerge::execute(
if (!aCurOutputURL.isEmpty())
{
if (!UCB_IsDirectory(aCurOutputURL))
- throw IllegalArgumentException("URL does not point to a directory: " + aCurOutputURL, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("URL does not point to a directory: " + aCurOutputURL, getXWeak(), 0 );
if (UCB_IsReadOnlyFileName(aCurOutputURL))
- throw IllegalArgumentException("URL is read-only: " + aCurOutputURL, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("URL is read-only: " + aCurOutputURL, getXWeak(), 0 );
}
}
else if (rName == UNO_NAME_FILE_NAME_PREFIX)
@@ -537,10 +537,10 @@ uno::Any SAL_CALL SwXMailMerge::execute(
else if (rName == UNO_NAME_OUT_SERVER_PASSWORD)
bOK = rValue >>= m_sOutServerPassword;
else
- throw UnknownPropertyException( "Property is unknown: " + rName, static_cast < cppu::OWeakObject * > ( this ) );
+ throw UnknownPropertyException( "Property is unknown: " + rName, getXWeak() );
if (!bOK)
- throw IllegalArgumentException("Property type mismatch or property not set: " + rName, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("Property type mismatch or property not set: " + rName, getXWeak(), 0 );
}
// need to translate the selection: the API here requires a sequence of bookmarks, but the Merge
@@ -579,7 +579,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
{
throw IllegalArgumentException(
"The current 'Selection' does not describe a valid array of bookmarks, relative to the current 'ResultSet'.",
- static_cast < cppu::OWeakObject * > ( this ),
+ getXWeak(),
0
);
}
@@ -605,7 +605,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
if (aCurDataSourceName.isEmpty() || aCurDataCommand.isEmpty() )
{
OSL_FAIL("PropertyValues missing or unset");
- throw IllegalArgumentException("Either the ResultSet or DataSourceName and DataCommand must be set.", static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("Either the ResultSet or DataSourceName and DataCommand must be set.", getXWeak(), 0 );
}
// build ResultSet from DataSourceName, DataCommand and DataCommandType
@@ -658,7 +658,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
case MailMergeType::MAIL : nMergeType = DBMGR_MERGE_EMAIL; break;
case MailMergeType::SHELL : nMergeType = DBMGR_MERGE_SHELL; break;
default:
- throw IllegalArgumentException("Invalid value of property: OutputType", static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("Invalid value of property: OutputType", getXWeak(), 0 );
}
SwWrtShell &rSh = pView->GetWrtShell();
@@ -712,7 +712,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
else // default empty document without URL
{
if (aCurOutputURL.isEmpty())
- throw RuntimeException("OutputURL is not set and can not be obtained.", static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException("OutputURL is not set and can not be obtained.", getXWeak() );
}
aURLObj.SetSmartURL( aCurOutputURL );
@@ -739,7 +739,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
{
aMergeDesc.sDBcolumn = m_sAddressFromColumn;
if(m_sAddressFromColumn.isEmpty())
- throw RuntimeException("Mail address column not set.", static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException("Mail address column not set.", getXWeak() );
aMergeDesc.sSaveToFilter = m_sAttachmentFilter;
aMergeDesc.sSubject = m_sSubject;
aMergeDesc.sMailBody = m_sMailBody;
@@ -757,7 +757,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
xInService,
m_sInServerPassword, m_sOutServerPassword );
if( !aMergeDesc.xSmtpServer.is() || !aMergeDesc.xSmtpServer->isConnected())
- throw RuntimeException("Failed to connect to mail server.", static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException("Failed to connect to mail server.", getXWeak() );
}
break;
}
@@ -783,7 +783,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
}
}
if ( !bStoredAsTemporary )
- throw RuntimeException("Failed to save temporary file.", static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException("Failed to save temporary file.", getXWeak() );
pMgr->SetMergeSilent( true ); // suppress dialogs, message boxes, etc.
const SwXMailMerge *pOldSrc = pMgr->GetMailMergeEvtSrc();
@@ -804,7 +804,7 @@ uno::Any SAL_CALL SwXMailMerge::execute(
// (in case it wasn't a temporary model, it will be closed in the dtor, at the latest)
if (!bSucc)
- throw Exception("Mail merge failed. Sorry, no further information available.", static_cast < cppu::OWeakObject * > ( this ) );
+ throw Exception("Mail merge failed. Sorry, no further information available.", getXWeak() );
//de-initialize services
if(xInService.is() && xInService->isConnected())
@@ -930,7 +930,7 @@ void SAL_CALL SwXMailMerge::setPropertyValue(
bOK = rValue >>= aText;
if (!aText.isEmpty()
&& !LoadFromURL_impl( m_xModel, m_xDocSh, aText, true ))
- throw RuntimeException("Failed to create document from URL: " + aText, static_cast < cppu::OWeakObject * > ( this ) );
+ throw RuntimeException("Failed to create document from URL: " + aText, getXWeak() );
m_aDocumentURL = aText;
}
else if (pData == &m_aOutputURL)
@@ -940,9 +940,9 @@ void SAL_CALL SwXMailMerge::setPropertyValue(
if (!aText.isEmpty())
{
if (!UCB_IsDirectory(aText))
- throw IllegalArgumentException("URL does not point to a directory: " + aText, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("URL does not point to a directory: " + aText, getXWeak(), 0 );
if (UCB_IsReadOnlyFileName(aText))
- throw IllegalArgumentException("URL is read-only: " + aText, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("URL is read-only: " + aText, getXWeak(), 0 );
}
m_aOutputURL = aText;
}
@@ -997,7 +997,7 @@ void SAL_CALL SwXMailMerge::setPropertyValue(
bChanged = true;
}
if (!bOK)
- throw IllegalArgumentException("Property type mismatch or property not set: " + rPropertyName, static_cast < cppu::OWeakObject * > ( this ), 0 );
+ throw IllegalArgumentException("Property type mismatch or property not set: " + rPropertyName, getXWeak(), 0 );
if (bChanged)
{
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index c1a2ae573e2d..66a05836fa38 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -429,7 +429,7 @@ void SwXTextDocument::GetNumberFormatter()
m_xNumFormatAgg = pNumFormat;
}
if(m_xNumFormatAgg.is())
- m_xNumFormatAgg->setDelegator(static_cast<cppu::OWeakObject*>(static_cast<SwXTextDocumentBaseClass*>(this)));
+ m_xNumFormatAgg->setDelegator(getXWeak());
}
else
{
@@ -1631,7 +1631,7 @@ css::uno::Reference<css::uno::XInterface> SwXTextDocument::create(
}
if (rServiceName == "com.sun.star.document.ImportEmbeddedObjectResolver")
{
- return static_cast<cppu::OWeakObject *>(
+ return cppu::getXWeak(
new SvXMLEmbeddedObjectHelper(
*m_pDocShell, SvXMLEmbeddedObjectHelperMode::Read));
}
@@ -1790,8 +1790,7 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName, const Any&
case WID_DOC_WORD_COUNT :
throw RuntimeException(
"bad WID",
- static_cast< cppu::OWeakObject * >(
- static_cast< SwXTextDocumentBaseClass * >(this)));
+ getXWeak());
case WID_DOC_WORD_SEPARATOR :
{
OUString sDelim;
@@ -4710,7 +4709,7 @@ Reference<XInterface> SwXDocumentPropertyHelper::GetDrawTable(SwCreateDrawTable
break;
case SwCreateDrawTable::Defaults:
if(!m_xDrawDefaults.is())
- m_xDrawDefaults = static_cast<cppu::OWeakObject*>(new SwSvxUnoDrawPool(*m_pDoc));
+ m_xDrawDefaults = cppu::getXWeak(new SwSvxUnoDrawPool(*m_pDoc));
xRet = m_xDrawDefaults;
break;
#if OSL_DEBUG_LEVEL > 0
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 9483cfcb2d41..ab6aee132bbe 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -292,7 +292,7 @@ uno::Any SwXTextView::getSelection()
SwFrameFormat *const pFormat = rSh.GetFlyFrameFormat();
if (pFormat)
{
- aRef = static_cast<cppu::OWeakObject*>(SwXTextFrame::CreateXTextFrame(
+ aRef = cppu::getXWeak(SwXTextFrame::CreateXTextFrame(
*pFormat->GetDoc(), pFormat).get());
}
}
@@ -302,7 +302,7 @@ uno::Any SwXTextView::getSelection()
SwFrameFormat *const pFormat = rSh.GetFlyFrameFormat();
if (pFormat)
{
- aRef = static_cast<cppu::OWeakObject*>(SwXTextGraphicObject::CreateXTextGraphicObject(
+ aRef = cppu::getXWeak(SwXTextGraphicObject::CreateXTextGraphicObject(
*pFormat->GetDoc(), pFormat).get());
}
}
@@ -312,7 +312,7 @@ uno::Any SwXTextView::getSelection()
SwFrameFormat *const pFormat = rSh.GetFlyFrameFormat();
if (pFormat)
{
- aRef = static_cast<cppu::OWeakObject*>(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(
+ aRef = cppu::getXWeak(SwXTextEmbeddedObject::CreateXTextEmbeddedObject(
*pFormat->GetDoc(), pFormat).get());
}
}
@@ -641,10 +641,7 @@ void SwXTextView::NotifySelChanged()
{
OSL_ENSURE( m_pView, "view is missing" );
- uno::Reference<uno::XInterface> const xInt(
- static_cast<cppu::OWeakObject*>(static_cast<SfxBaseController*>(this)));
-
- lang::EventObject const aEvent(xInt);
+ lang::EventObject const aEvent(getXWeak());
m_SelChangedListeners.notifyEach(
&view::XSelectionChangeListener::selectionChanged, aEvent);
}
@@ -870,7 +867,7 @@ void SwXTextViewCursor::collapseToStart()
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
SwWrtShell& rSh = m_pView->GetWrtShell();
if(rSh.HasSelection())
@@ -892,7 +889,7 @@ void SwXTextViewCursor::collapseToEnd()
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
SwWrtShell& rSh = m_pView->GetWrtShell();
if(rSh.HasSelection())
@@ -915,7 +912,7 @@ sal_Bool SwXTextViewCursor::isCollapsed()
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
const SwWrtShell& rSh = m_pView->GetWrtShell();
bRet = !rSh.HasSelection();
@@ -932,7 +929,7 @@ sal_Bool SwXTextViewCursor::goLeft(sal_Int16 nCount, sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
bRet = m_pView->GetWrtShell().Left( SwCursorSkipMode::Chars, bExpand, nCount, true );
@@ -947,7 +944,7 @@ sal_Bool SwXTextViewCursor::goRight(sal_Int16 nCount, sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
bRet = m_pView->GetWrtShell().Right( SwCursorSkipMode::Chars, bExpand, nCount, true );
@@ -964,7 +961,7 @@ void SwXTextViewCursor::gotoRange(
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc());
if (!::sw::XTextRangeToSwPaM(rDestPam, xRange))
@@ -1092,7 +1089,7 @@ void SwXTextViewCursor::gotoStart(sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
m_pView->GetWrtShell().StartOfSection( bExpand );
@@ -1106,7 +1103,7 @@ void SwXTextViewCursor::gotoEnd(sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
m_pView->GetWrtShell().EndOfSection( bExpand );
@@ -1263,7 +1260,7 @@ uno::Reference< text::XText > SwXTextViewCursor::getText()
throw uno::RuntimeException();
if (!IsTextSelection( false ))
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCursor = rSh.GetCursor();
@@ -1281,7 +1278,7 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getStart()
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCursor = rSh.GetCursor();
@@ -1299,7 +1296,7 @@ uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd()
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
SwWrtShell& rSh = m_pView->GetWrtShell();
SwPaM* pShellCursor = rSh.GetCursor();
@@ -1317,7 +1314,7 @@ OUString SwXTextViewCursor::getString()
{
if (!IsTextSelection( false ))
{
- SAL_WARN("sw.uno", "no text selection in getString() " << static_cast<cppu::OWeakObject*>(this));
+ SAL_WARN("sw.uno", "no text selection in getString() " << getXWeak());
return uRet;
}
@@ -1352,7 +1349,7 @@ void SwXTextViewCursor::setString(const OUString& aString)
return;
if (!IsTextSelection( false ))
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
ShellMode eSelMode = m_pView->GetShellMode();
switch(eSelMode)
@@ -1499,7 +1496,7 @@ sal_Bool SwXTextViewCursor::goDown(sal_Int16 nCount, sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
bRet = m_pView->GetWrtShell().Down( bExpand, nCount, true );
@@ -1515,7 +1512,7 @@ sal_Bool SwXTextViewCursor::goUp(sal_Int16 nCount, sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection())
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
bRet = m_pView->GetWrtShell().Up( bExpand, nCount, true );
@@ -1530,7 +1527,7 @@ sal_Bool SwXTextViewCursor::isAtStartOfLine()
throw uno::RuntimeException();
if (!IsTextSelection( false ))
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
bRet = m_pView->GetWrtShell().IsAtLeftMargin();
@@ -1545,7 +1542,7 @@ sal_Bool SwXTextViewCursor::isAtEndOfLine()
throw uno::RuntimeException();
if (!IsTextSelection( false ))
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
bRet = m_pView->GetWrtShell().IsAtRightMargin();
@@ -1559,7 +1556,7 @@ void SwXTextViewCursor::gotoEndOfLine(sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection( false ))
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
m_pView->GetWrtShell().RightMargin(bExpand, true);
@@ -1572,7 +1569,7 @@ void SwXTextViewCursor::gotoStartOfLine(sal_Bool bExpand)
throw uno::RuntimeException();
if (!IsTextSelection( false ))
- throw uno::RuntimeException("no text selection", static_cast < cppu::OWeakObject * > ( this ) );
+ throw uno::RuntimeException("no text selection", getXWeak() );
m_pView->GetWrtShell().LeftMargin(bExpand, true);