[Libreoffice-commits] core.git: sw/inc sw/qa sw/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Sat Feb 20 09:21:49 UTC 2021
sw/inc/SwSmartTagMgr.hxx | 3 +
sw/inc/unodraw.hxx | 3 -
sw/inc/unotbl.hxx | 2 -
sw/inc/unotxdoc.hxx | 6 +--
sw/qa/extras/tiledrendering/tiledrendering.cxx | 12 +++----
sw/source/core/access/acccontext.cxx | 5 +--
sw/source/core/access/acchyperlink.cxx | 2 -
sw/source/core/access/accmap.cxx | 2 -
sw/source/core/access/accnotexthyperlink.cxx | 2 -
sw/source/core/access/accpara.cxx | 11 ++----
sw/source/core/access/accpara.hxx | 2 -
sw/source/core/access/acctable.cxx | 5 +--
sw/source/core/access/acctextframe.cxx | 2 -
sw/source/core/bastyp/SwSmartTagMgr.cxx | 2 -
sw/source/core/doc/notxtfrm.cxx | 14 +++-----
sw/source/core/layout/paintfrm.cxx | 24 ++++----------
sw/source/core/swg/SwXMLTextBlocks1.cxx | 5 +--
sw/source/core/txtnode/fmtatr2.cxx | 5 +--
sw/source/core/unocore/unobkm.cxx | 4 +-
sw/source/core/unocore/unochart.cxx | 9 +----
sw/source/core/unocore/unocoll.cxx | 7 +---
sw/source/core/unocore/unodraw.cxx | 29 +++++++----------
sw/source/core/unocore/unoframe.cxx | 7 +---
sw/source/core/unocore/unoftn.cxx | 6 +--
sw/source/core/unocore/unoobj.cxx | 8 ++--
sw/source/core/unocore/unoportenum.cxx | 39 +++++++++++-------------
sw/source/core/unocore/unoredline.cxx | 10 ++----
sw/source/core/unocore/unorefmk.cxx | 4 +-
sw/source/core/unocore/unosect.cxx | 2 -
sw/source/core/unocore/unotbl.cxx | 21 ++++++------
sw/source/core/unocore/unotext.cxx | 7 +---
sw/source/filter/ww8/ww8par.cxx | 5 +--
sw/source/filter/ww8/ww8par5.cxx | 4 +-
sw/source/filter/xml/XMLRedlineImportHelper.cxx | 4 +-
sw/source/ui/dbui/dbinsdlg.cxx | 5 +--
sw/source/ui/dbui/mmaddressblockpage.cxx | 7 +---
sw/source/ui/dbui/mmoutputtypepage.cxx | 5 +--
sw/source/ui/vba/vbadocuments.cxx | 3 +
sw/source/uibase/dbui/dbmgr.cxx | 9 ++---
sw/source/uibase/dochdl/swdtflvr.cxx | 2 -
sw/source/uibase/docvw/AnnotationWin2.cxx | 9 +----
sw/source/uibase/docvw/DashedLine.cxx | 8 +---
sw/source/uibase/docvw/SidebarWinAcc.cxx | 5 +--
sw/source/uibase/table/chartins.cxx | 5 +--
sw/source/uibase/uno/unotxdoc.cxx | 35 +++++++--------------
sw/source/uibase/uno/unotxvw.cxx | 8 ++--
46 files changed, 153 insertions(+), 221 deletions(-)
New commits:
commit 7d7d4cf217e82db8839dbc49dcab1ab72c203b4e
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Fri Feb 19 14:33:17 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat Feb 20 10:21:07 2021 +0100
loplugin:refcounting in sw
Change-Id: I56f2f5aa4d9105e93f28701b8352d1fb97829ead
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111215
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/SwSmartTagMgr.hxx b/sw/inc/SwSmartTagMgr.hxx
index e6d60c530f84..f1c254f93e45 100644
--- a/sw/inc/SwSmartTagMgr.hxx
+++ b/sw/inc/SwSmartTagMgr.hxx
@@ -21,12 +21,13 @@
#define INCLUDED_SW_INC_SWSMARTTAGMGR_HXX
#include <svx/SmartTagMgr.hxx>
+#include <rtl/ref.hxx>
// Wrapper for the svx SmartTagMgr
class SwSmartTagMgr final : public SmartTagMgr
{
private:
- static SwSmartTagMgr* spTheSwSmartTagMgr;
+ static rtl::Reference<SwSmartTagMgr> spTheSwSmartTagMgr;
SwSmartTagMgr(const OUString& rModuleName);
virtual ~SwSmartTagMgr() override;
diff --git a/sw/inc/unodraw.hxx b/sw/inc/unodraw.hxx
index 22ddffda5881..e9e69318cdea 100644
--- a/sw/inc/unodraw.hxx
+++ b/sw/inc/unodraw.hxx
@@ -80,8 +80,7 @@ SwXDrawPageBaseClass;
class SwXDrawPage final : public SwXDrawPageBaseClass
{
SwDoc* m_pDoc;
- css::uno::Reference< css::uno::XAggregation > m_xPageAgg;
- SwFmDrawPage* m_pDrawPage;
+ rtl::Reference<SwFmDrawPage> m_pDrawPage;
public:
SwXDrawPage(SwDoc* pDoc);
virtual ~SwXDrawPage() override;
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index 7ec4121a9ad8..e7d9a224e259 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -141,7 +141,7 @@ public:
virtual sal_Bool SAL_CALL hasElements( ) override;
SwTableBox* GetTableBox() const { return m_pBox; }
- static SwXCell* CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr );
+ static rtl::Reference<SwXCell> CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable = nullptr );
SwTableBox* FindBox(SwTable* pTable, SwTableBox* pBox);
SwFrameFormat* GetFrameFormat() const { return m_pTableFormat; }
double GetForcedNumericalValue() const;
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 48f49a2694b7..df6309d7125e 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -146,11 +146,9 @@ private:
SwDocShell* m_pDocShell;
bool m_bObjectValid;
- SwXDrawPage* m_pDrawPage;
- css::uno::Reference< css::drawing::XDrawPage > mxXDrawPage;
+ rtl::Reference<SwXDrawPage> m_xDrawPage;
- css::uno::Reference< css::text::XText > m_xBodyText;
- SwXBodyText* m_pBodyText;
+ rtl::Reference<SwXBodyText> m_xBodyText;
css::uno::Reference< css::uno::XAggregation > m_xNumFormatAgg;
css::uno::Reference< css::container::XIndexAccess > mxXNumberingRules;
diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx
index 5477e3e24a36..41249cd9f3ac 100644
--- a/sw/qa/extras/tiledrendering/tiledrendering.cxx
+++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx
@@ -1778,8 +1778,7 @@ void SwTiledRenderingTest::testUndoRepairResult()
SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
int nView1 = SfxLokHelper::getView();
SfxLokHelper::createView();
- TestResultListener* pResult2 = new TestResultListener();
- css::uno::Reference< css::frame::XDispatchResultListener > xListener(static_cast< css::frame::XDispatchResultListener* >(pResult2), css::uno::UNO_QUERY);
+ rtl::Reference<TestResultListener> pResult2 = new TestResultListener();
pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
int nView2 = SfxLokHelper::getView();
@@ -1797,7 +1796,7 @@ void SwTiledRenderingTest::testUndoRepairResult()
// Assert that by default the second view can't undo the action.
SfxLokHelper::setView(nView2);
- comphelper::dispatchCommand(".uno:Undo", {}, xListener);
+ comphelper::dispatchCommand(".uno:Undo", {}, pResult2);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pResult2->m_nDocRepair);
@@ -1813,8 +1812,7 @@ void SwTiledRenderingTest::testRedoRepairResult()
SwXTextDocument* pXTextDocument = createDoc("dummy.fodt");
int nView1 = SfxLokHelper::getView();
SfxLokHelper::createView();
- TestResultListener* pResult2 = new TestResultListener();
- css::uno::Reference< css::frame::XDispatchResultListener > xListener(static_cast< css::frame::XDispatchResultListener* >(pResult2), css::uno::UNO_QUERY);
+ rtl::Reference<TestResultListener> pResult2 = new TestResultListener();
pXTextDocument->initializeForTiledRendering(uno::Sequence<beans::PropertyValue>());
int nView2 = SfxLokHelper::getView();
@@ -1830,12 +1828,12 @@ void SwTiledRenderingTest::testRedoRepairResult()
pXTextDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 'a', 0);
Scheduler::ProcessEventsToIdle();
- comphelper::dispatchCommand(".uno:Undo", {}, xListener);
+ comphelper::dispatchCommand(".uno:Undo", {}, pResult2);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(0), pResult2->m_nDocRepair);
// Assert that by default the second view can't redo the action.
SfxLokHelper::setView(nView2);
- comphelper::dispatchCommand(".uno:Redo", {}, xListener);
+ comphelper::dispatchCommand(".uno:Redo", {}, pResult2);
Scheduler::ProcessEventsToIdle();
CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(SID_REPAIRPACKAGE), pResult2->m_nDocRepair);
diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx
index 225b21424a85..78b9371f5a7e 100644
--- a/sw/source/core/access/acccontext.cxx
+++ b/sw/source/core/access/acccontext.cxx
@@ -739,16 +739,15 @@ uno::Reference<XAccessibleStateSet> SAL_CALL
ThrowIfDisposed();
- ::utl::AccessibleStateSetHelper *pStateSet =
+ rtl::Reference<::utl::AccessibleStateSetHelper> pStateSet =
new ::utl::AccessibleStateSetHelper;
if (m_isSelectedInDoc)
pStateSet->AddState( AccessibleStateType::SELECTED );
- uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
GetStates( *pStateSet );
- return xStateSet;
+ return pStateSet;
}
lang::Locale SAL_CALL SwAccessibleContext::getLocale()
diff --git a/sw/source/core/access/acchyperlink.cxx b/sw/source/core/access/acchyperlink.cxx
index 1866b844f7c9..76a2721ec172 100644
--- a/sw/source/core/access/acchyperlink.cxx
+++ b/sw/source/core/access/acchyperlink.cxx
@@ -124,7 +124,7 @@ uno::Reference< XAccessibleKeyBinding > SAL_CALL
if( isValid() )
{
- ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+ rtl::Reference<::comphelper::OAccessibleKeyBindingHelper> pKeyBindingHelper =
new ::comphelper::OAccessibleKeyBindingHelper();
xKeyBinding = pKeyBindingHelper;
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index ae1e6e29b06c..cfb598f6cd32 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1880,7 +1880,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame,
if( !xAcc.is() && bCreate )
{
- SwAccessibleContext *pAcc = nullptr;
+ rtl::Reference<SwAccessibleContext> pAcc;
switch( pFrame->GetType() )
{
case SwFrameType::Txt:
diff --git a/sw/source/core/access/accnotexthyperlink.cxx b/sw/source/core/access/accnotexthyperlink.cxx
index 5fbe826c92cc..36ded739007e 100644
--- a/sw/source/core/access/accnotexthyperlink.cxx
+++ b/sw/source/core/access/accnotexthyperlink.cxx
@@ -152,7 +152,7 @@ Reference< XAccessibleKeyBinding > SAL_CALL
if(bIsValid)
{
- ::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+ rtl::Reference<::comphelper::OAccessibleKeyBindingHelper> pKeyBindingHelper =
new ::comphelper::OAccessibleKeyBindingHelper();
xKeyBinding = pKeyBindingHelper;
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 05cd3f4e2bc4..67b97f784282 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -479,7 +479,7 @@ void SwAccessibleParagraph::ExecuteAtViewShell( sal_uInt16 nSlot )
pDispatcher->Execute( nSlot );
}
-SwXTextPortion* SwAccessibleParagraph::CreateUnoPortion(
+rtl::Reference<SwXTextPortion> SwAccessibleParagraph::CreateUnoPortion(
sal_Int32 nStartIndex,
sal_Int32 nEndIndex )
{
@@ -502,10 +502,7 @@ SwXTextPortion* SwAccessibleParagraph::CreateUnoPortion(
// create a (dummy) text portion to be returned
uno::Reference<text::XText> aEmpty;
- SwXTextPortion* pPortion =
- new SwXTextPortion ( pUnoCursor.get(), aEmpty, PORTION_TEXT);
-
- return pPortion;
+ return new SwXTextPortion ( pUnoCursor.get(), aEmpty, PORTION_TEXT);
}
// range checking for parameter
@@ -740,7 +737,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleParagraph::getAccess
ThrowIfDisposed();
- utl::AccessibleRelationSetHelper* pHelper = new utl::AccessibleRelationSetHelper();
+ rtl::Reference<utl::AccessibleRelationSetHelper> pHelper = new utl::AccessibleRelationSetHelper();
const SwTextFrame* pTextFrame = dynamic_cast<const SwTextFrame*>(GetFrame());
OSL_ENSURE( pTextFrame,
@@ -2666,7 +2663,7 @@ sal_Bool SwAccessibleParagraph::setAttributes(
// create a (dummy) text portion for the sole purpose of calling
// setPropertyValue on it
- uno::Reference<XMultiPropertySet> xPortion = CreateUnoPortion( nStartIndex,
+ rtl::Reference<SwXTextPortion> xPortion = CreateUnoPortion( nStartIndex,
nEndIndex );
// build sorted index array
diff --git a/sw/source/core/access/accpara.hxx b/sw/source/core/access/accpara.hxx
index ee5288cd25c3..dade5606d0ea 100644
--- a/sw/source/core/access/accpara.hxx
+++ b/sw/source/core/access/accpara.hxx
@@ -116,7 +116,7 @@ class SwAccessibleParagraph :
// helper method for get/setAttributes
// (for the special case of (nEndIndex==-1) a single character will
// be selected)
- SwXTextPortion* CreateUnoPortion( sal_Int32 nStart, sal_Int32 nEnd );
+ rtl::Reference<SwXTextPortion> CreateUnoPortion( sal_Int32 nStart, sal_Int32 nEnd );
// methods for checking the parameter range:
diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx
index 679b23fc9d37..7fab0396050c 100644
--- a/sw/source/core/access/acctable.cxx
+++ b/sw/source/core/access/acctable.cxx
@@ -901,16 +901,15 @@ uno::Reference< XAccessibleTable > SAL_CALL
// #i87532# - assure that return accessible object is empty,
// if no column header exists.
- SwAccessibleTableColHeaders* pTableColHeaders =
+ rtl::Reference<SwAccessibleTableColHeaders> pTableColHeaders =
new SwAccessibleTableColHeaders(GetMap()->shared_from_this(),
static_cast<const SwTabFrame *>(GetFrame()));
- uno::Reference< XAccessibleTable > xTableColumnHeaders( pTableColHeaders );
if ( pTableColHeaders->getAccessibleChildCount() <= 0 )
{
return uno::Reference< XAccessibleTable >();
}
- return xTableColumnHeaders;
+ return pTableColHeaders;
}
uno::Sequence< sal_Int32 > SAL_CALL SwAccessibleTable::getSelectedAccessibleRows()
diff --git a/sw/source/core/access/acctextframe.cxx b/sw/source/core/access/acctextframe.cxx
index 95937bbd1e99..d9e2e2bc4c96 100644
--- a/sw/source/core/access/acctextframe.cxx
+++ b/sw/source/core/access/acctextframe.cxx
@@ -299,7 +299,7 @@ uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleTextFrame::getAccess
// get the frame, and insert prev/next relations into helper
- AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
+ rtl::Reference<AccessibleRelationSetHelper> pHelper = new AccessibleRelationSetHelper();
SwFlyFrame* pFlyFrame = getFlyFrame();
assert(pFlyFrame);
diff --git a/sw/source/core/bastyp/SwSmartTagMgr.cxx b/sw/source/core/bastyp/SwSmartTagMgr.cxx
index cbe194fc005c..cc769d870da7 100644
--- a/sw/source/core/bastyp/SwSmartTagMgr.cxx
+++ b/sw/source/core/bastyp/SwSmartTagMgr.cxx
@@ -26,7 +26,7 @@
using namespace com::sun::star;
using namespace com::sun::star::uno;
-SwSmartTagMgr* SwSmartTagMgr::spTheSwSmartTagMgr = nullptr;
+rtl::Reference<SwSmartTagMgr> SwSmartTagMgr::spTheSwSmartTagMgr;
SwSmartTagMgr& SwSmartTagMgr::Get()
{
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 0a9225fd93f5..ca834fdb7b23 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -1023,12 +1023,11 @@ void paintGraphicUsingPrimitivesHelper(
aTarget.append(aClip);
}
- drawinglayer::primitive2d::MaskPrimitive2D* pNew(
+ rContent.resize(1);
+ rContent[0] =
new drawinglayer::primitive2d::MaskPrimitive2D(
aTarget,
- rContent));
- rContent.resize(1);
- rContent[0] = pNew;
+ rContent);
}
}
@@ -1036,14 +1035,13 @@ void paintGraphicUsingPrimitivesHelper(
{
// Embed to ObjectInfoPrimitive2D when we have Name/Title/Description
// information available
- drawinglayer::primitive2d::ObjectInfoPrimitive2D* pNew(
+ rContent.resize(1);
+ rContent[0] =
new drawinglayer::primitive2d::ObjectInfoPrimitive2D(
rContent,
rName,
rTitle,
- rDescription));
- rContent.resize(1);
- rContent[0] = pNew;
+ rDescription);
}
basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0);
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index dd3def6e8dc9..ef69c5ff81ba 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -3548,12 +3548,10 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateDashedIndicator
const basegfx::BColor aOtherColor = basegfx::utils::hsl2rgb( aHslLine );
// Compute the plain line
- drawinglayer::primitive2d::PolygonHairlinePrimitive2D * pPlainLine =
+ aSeq[0] =
new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
aLinePolygon, aOtherColor );
- aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pPlainLine );
-
// Dashed line in twips
aStrokePattern.push_back( 40 );
aStrokePattern.push_back( 40 );
@@ -3562,13 +3560,12 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateDashedIndicator
}
// Compute the dashed line primitive
- drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine =
+ aSeq[ aSeq.size( ) - 1 ] =
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D (
basegfx::B2DPolyPolygon( aLinePolygon ),
drawinglayer::attribute::LineAttribute( aColor ),
drawinglayer::attribute::StrokeAttribute( aStrokePattern ) );
- aSeq[ aSeq.size( ) - 1 ] = drawinglayer::primitive2d::Primitive2DReference( pLine );
return aSeq;
}
@@ -3683,15 +3680,14 @@ void SwColumnFrame::PaintBreak( ) const
aRect.Right(), aRect.Top() + nTextOff );
}
- drawinglayer::primitive2d::TextSimplePortionPrimitive2D * pText =
+ aSeq.push_back(
new drawinglayer::primitive2d::TextSimplePortionPrimitive2D(
aTextMatrix,
aBreakText, 0, aBreakText.getLength(),
std::vector< double >(),
aFontAttr,
lang::Locale(),
- aLineColor );
- aSeq.push_back( drawinglayer::primitive2d::Primitive2DReference( pText ) );
+ aLineColor ) );
ProcessPrimitives( aSeq );
}
@@ -6660,10 +6656,8 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreatePageAreaDelimit
aPolygon.append( aBPoint );
aPolygon.append( aBPoint + aVertVector * nLineLength );
- drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine =
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aSeq[i] = new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
aPolygon, aLineColor );
- aSeq[i] = drawinglayer::primitive2d::Primitive2DReference( pLine );
}
return aSeq;
@@ -6682,10 +6676,8 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateRectangleDelimi
aPolygon.append( basegfx::B2DPoint( rRect.Left(), rRect.Bottom() ) );
aPolygon.setClosed( true );
- drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine =
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aSeq[0] = new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
aPolygon, aLineColor );
- aSeq[0] = drawinglayer::primitive2d::Primitive2DReference( pLine );
return aSeq;
}
@@ -6715,10 +6707,8 @@ static drawinglayer::primitive2d::Primitive2DContainer lcl_CreateColumnAreaDelim
aPolygon.append( aBPoint );
aPolygon.append( aBPoint + aVertVector * nLineLength );
- drawinglayer::primitive2d::PolygonHairlinePrimitive2D* pLine =
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
+ aSeq[i] = new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
aPolygon, aLineColor );
- aSeq[i] = drawinglayer::primitive2d::Primitive2DReference( pLine );
}
return aSeq;
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index 75786448d64b..0297d68fa442 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -197,11 +197,10 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx,
// create descriptor and reference to it. Either
// both or neither must be kept because of the
// reference counting!
- SvMacroTableEventDescriptor* pDescriptor =
+ rtl::Reference<SvMacroTableEventDescriptor> pDescriptor =
new SvMacroTableEventDescriptor(aAutotextEvents);
- uno::Reference<XNameReplace> xReplace = pDescriptor;
Sequence<Any> aFilterArguments( 1 );
- aFilterArguments[0] <<= xReplace;
+ aFilterArguments[0] <<= uno::Reference<XNameReplace>(pDescriptor);
// get filter
OUString sFilterComponent = bOasis
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index 2ce3928a1c71..a474f7a639cf 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -296,13 +296,12 @@ bool SwFormatINetFormat::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
case MID_URL_HYPERLINKEVENTS:
{
// create (and return) event descriptor
- SwHyperlinkEventDescriptor* pEvents =
+ rtl::Reference<SwHyperlinkEventDescriptor> pEvents =
new SwHyperlinkEventDescriptor();
pEvents->copyMacrosFromINetFormat(*this);
- uno::Reference<container::XNameReplace> xNameReplace(pEvents);
// all others return a string; so we just set rVal here and exit
- rVal <<= xNameReplace;
+ rVal <<= uno::Reference<container::XNameReplace>(pEvents);
}
break;
default:
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 853418742a72..99ddb365bf78 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -704,7 +704,7 @@ SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::IMark *const pMark,
if (!xMark.is())
{
// FIXME: These belong in XTextFieldsSupplier
- SwXFieldmark* pXBkmk = nullptr;
+ rtl::Reference<SwXFieldmark> pXBkmk;
if (dynamic_cast< ::sw::mark::TextFieldmark* >(pMark))
pXBkmk = new SwXFieldmark(false, &rDoc);
else if (dynamic_cast< ::sw::mark::CheckboxFieldmark* >(pMark))
@@ -716,7 +716,7 @@ SwXFieldmark::CreateXFieldmark(SwDoc & rDoc, ::sw::mark::IMark *const pMark,
else
pXBkmk = new SwXFieldmark(isReplacementObject, &rDoc);
- xMark.set(static_cast<::cppu::OWeakObject*>(pXBkmk), uno::UNO_QUERY); // work around ambiguous base
+ xMark.set(static_cast<::cppu::OWeakObject*>(pXBkmk.get()), uno::UNO_QUERY); // work around ambiguous base
pXBkmk->registerInMark(*pXBkmk, pMarkBase);
}
return xMark;
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 143f4e9eec61..6d06ad82b402 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -859,7 +859,7 @@ uno::Reference< chart2::data::XDataSource > SwChartDataProvider::Impl_createData
uno::Reference<chart2::data::XLabeledDataSequence>* pLDS = aLDS.getArray();
for (sal_Int32 i = 0; i < nNumLDS; ++i)
{
- SwChartLabeledDataSequence* pLabeledDtaSeq = new SwChartLabeledDataSequence;
+ rtl::Reference<SwChartLabeledDataSequence> pLabeledDtaSeq = new SwChartLabeledDataSequence;
pLabeledDtaSeq->setLabel(pLabelSeqs[i]);
pLabeledDtaSeq->setValues(pDataSeqs[i]);
pLDS[i] = pLabeledDtaSeq;
@@ -2604,11 +2604,9 @@ uno::Reference< util::XCloneable > SAL_CALL SwChartLabeledDataSequence::createCl
if (m_bDisposed)
throw lang::DisposedException();
- uno::Reference< util::XCloneable > xRes;
-
uno::Reference< util::XCloneable > xDataCloneable( m_xData, uno::UNO_QUERY );
uno::Reference< util::XCloneable > xLabelsCloneable( m_xLabels, uno::UNO_QUERY );
- SwChartLabeledDataSequence *pRes = new SwChartLabeledDataSequence();
+ rtl::Reference<SwChartLabeledDataSequence > pRes = new SwChartLabeledDataSequence();
if (xDataCloneable.is())
{
uno::Reference< chart2::data::XDataSequence > xDataClone( xDataCloneable->createClone(), uno::UNO_QUERY );
@@ -2620,8 +2618,7 @@ uno::Reference< util::XCloneable > SAL_CALL SwChartLabeledDataSequence::createCl
uno::Reference< chart2::data::XDataSequence > xLabelsClone( xLabelsCloneable->createClone(), uno::UNO_QUERY );
pRes->setLabel( xLabelsClone );
}
- xRes = pRes;
- return xRes;
+ return pRes;
}
OUString SAL_CALL SwChartLabeledDataSequence::getImplementationName( )
diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx
index a6287cbd714d..9eaefe985b6f 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -555,9 +555,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
case SwServiceType::VbaObjectProvider :
#if HAVE_FEATURE_SCRIPTING
{
- SwVbaObjectForCodeNameProvider* pObjProv =
- new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell());
- xRet = static_cast<cppu::OWeakObject*>(pObjProv);
+ xRet = static_cast<cppu::OWeakObject*>(new SwVbaObjectForCodeNameProvider(rDoc.GetDocShell()));
}
#endif
break;
@@ -566,8 +564,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc)
{
if (rDoc.GetDocShell() && ooo::vba::isAlienWordDoc(*rDoc.GetDocShell()))
{
- SwVbaCodeNameProvider* pObjProv = new SwVbaCodeNameProvider(rDoc.GetDocShell());
- xRet = static_cast<cppu::OWeakObject*>(pObjProv);
+ xRet = static_cast<cppu::OWeakObject*>(new SwVbaCodeNameProvider(rDoc.GetDocShell()));
}
}
#endif
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 781a62d78a81..cf1059dd9fbc 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -360,7 +360,7 @@ uno::Reference< drawing::XShape > SwFmDrawPage::CreateShape( SdrObject *pObj ) c
}
uno::Reference< XUnoTunnel > xShapeTunnel(xRet, uno::UNO_QUERY);
//don't create an SwXShape if it already exists
- SwXShape* pShape = nullptr;
+ rtl::Reference<SwXShape> pShape;
if(xShapeTunnel.is())
pShape = reinterpret_cast< SwXShape * >(
sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SwXShape::getUnoTunnelId()) ));
@@ -373,10 +373,9 @@ uno::Reference< drawing::XShape > SwFmDrawPage::CreateShape( SdrObject *pObj ) c
pShape = new SwXGroupShape(xCreate, nullptr);
else
pShape = new SwXShape(xCreate, nullptr);
- uno::Reference<beans::XPropertySet> xPrSet = pShape;
- xRet.set(xPrSet, uno::UNO_QUERY);
+ xRet = pShape;
}
- const_cast<std::vector<SwXShape*>*>(&m_vShapes)->push_back(pShape);
+ const_cast<std::vector<SwXShape*>*>(&m_vShapes)->push_back(pShape.get());
pShape->m_pPage = this;
}
return xRet;
@@ -472,17 +471,16 @@ uno::Sequence< OUString > SwXDrawPage::getSupportedServiceNames()
}
SwXDrawPage::SwXDrawPage(SwDoc* pDc) :
- m_pDoc(pDc),
- m_pDrawPage(nullptr)
+ m_pDoc(pDc)
{
}
SwXDrawPage::~SwXDrawPage()
{
- if(m_xPageAgg.is())
+ if(m_pDrawPage.is())
{
uno::Reference< uno::XInterface > xInt;
- m_xPageAgg->setDelegator(xInt);
+ m_pDrawPage->setDelegator(xInt);
}
}
@@ -756,7 +754,7 @@ uno::Reference< drawing::XShapeGroup > SwXDrawPage::group(const uno::Reference<
if(!m_pDoc || !xShapes.is())
throw uno::RuntimeException();
uno::Reference< drawing::XShapeGroup > xRet;
- if(m_xPageAgg.is())
+ if(m_pDrawPage.is())
{
SwFmDrawPage* pPage = GetSvxPage();
@@ -802,7 +800,7 @@ void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & rShapeG
SolarMutexGuard aGuard;
if(!m_pDoc)
throw uno::RuntimeException();
- if(!m_xPageAgg.is())
+ if(!m_pDrawPage.is())
return;
SwFmDrawPage* pPage = GetSvxPage();
@@ -823,7 +821,7 @@ void SwXDrawPage::ungroup(const uno::Reference< drawing::XShapeGroup > & rShapeG
SwFmDrawPage* SwXDrawPage::GetSvxPage()
{
- if(!m_xPageAgg.is() && m_pDoc)
+ if(!m_pDrawPage.is() && m_pDoc)
{
SolarMutexGuard aGuard;
// #i52858#
@@ -834,14 +832,11 @@ SwFmDrawPage* SwXDrawPage::GetSvxPage()
// We need a Ref to the object during queryInterface or else
// it will be deleted
m_pDrawPage = new SwFmDrawPage(pPage);
- uno::Reference< drawing::XDrawPage > xPage = m_pDrawPage;
- uno::Any aAgg = xPage->queryInterface(cppu::UnoType<uno::XAggregation>::get());
- aAgg >>= m_xPageAgg;
}
- if( m_xPageAgg.is() )
- m_xPageAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
+ if( m_pDrawPage.is() )
+ m_pDrawPage->setDelegator( static_cast<cppu::OWeakObject*>(this) );
}
- return m_pDrawPage;
+ return m_pDrawPage.get();
}
/**
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index c853a6653d3b..ee69f96187dd 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -3290,11 +3290,8 @@ uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursor()
throw aExcept;
}
- SwXTextCursor *const pXCursor = new SwXTextCursor(
- *pFormat->GetDoc(), this, CursorType::Frame, *aPam.GetPoint());
- aRef = static_cast<text::XWordCursor*>(pXCursor);
-
- return aRef;
+ return static_cast<text::XWordCursor*>(new SwXTextCursor(
+ *pFormat->GetDoc(), this, CursorType::Frame, *aPam.GetPoint()));
}
uno::Reference< text::XTextCursor > SwXTextFrame::createTextCursorByRange(const uno::Reference< text::XTextRange > & aTextPosition)
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 2cf0d0b507f9..5d1923d799e8 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -423,13 +423,11 @@ SwXFootnote::createTextCursor()
SwTextFootnote const*const pTextFootnote = rFormat.GetTextFootnote();
SwPosition aPos( *pTextFootnote->GetStartNode() );
- SwXTextCursor *const pXCursor =
+ rtl::Reference<SwXTextCursor> pXCursor =
new SwXTextCursor(*GetDoc(), this, CursorType::Footnote, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
- const uno::Reference< text::XTextCursor > xRet =
- static_cast<text::XWordCursor*>(pXCursor);
- return xRet;
+ return static_cast<text::XWordCursor*>(pXCursor.get());
}
uno::Reference< text::XTextCursor > SAL_CALL
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 964471ded48c..43d976a20dba 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1658,11 +1658,11 @@ SwXTextCursor::getStart()
if (CursorType::Meta == m_pImpl->m_eType)
{
// return cursor to prevent modifying SwXTextRange for META
- SwXTextCursor * const pXCursor(
+ rtl::Reference<SwXTextCursor> pXCursor(
new SwXTextCursor(rUnoCursor.GetDoc(), xParent, CursorType::Meta,
*rUnoCursor.GetPoint()) );
pXCursor->gotoStart(false);
- xRet = static_cast<text::XWordCursor*>(pXCursor);
+ xRet = static_cast<text::XWordCursor*>(pXCursor.get());
}
else
{
@@ -1684,11 +1684,11 @@ SwXTextCursor::getEnd()
if (CursorType::Meta == m_pImpl->m_eType)
{
// return cursor to prevent modifying SwXTextRange for META
- SwXTextCursor * const pXCursor(
+ rtl::Reference<SwXTextCursor> pXCursor(
new SwXTextCursor(rUnoCursor.GetDoc(), xParent, CursorType::Meta,
*rUnoCursor.GetPoint()) );
pXCursor->gotoEnd(false);
- xRet = static_cast<text::XWordCursor*>(pXCursor);
+ xRet = static_cast<text::XWordCursor*>(pXCursor.get());
}
else
{
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 748091ff4252..cdfe6fa9b168 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -407,7 +407,7 @@ lcl_ExportFieldMark(
::sw::mark::IFieldmark* pFieldmark = nullptr;
pFieldmark = rDoc.getIDocumentMarkAccess()->
getFieldmarkAt(*pUnoCursor->GetMark());
- SwXTextPortion* pPortion = new SwXTextPortion(
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_START);
xRef = pPortion;
if (pFieldmark)
@@ -419,16 +419,15 @@ lcl_ExportFieldMark(
else if (CH_TXT_ATR_FIELDSEP == Char)
{
// TODO how to get the field?
- SwXTextPortion* pPortion = new SwXTextPortion(
+ xRef = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_SEP);
- xRef = pPortion;
}
else if (CH_TXT_ATR_FIELDEND == Char)
{
::sw::mark::IFieldmark* pFieldmark = nullptr;
pFieldmark = rDoc.getIDocumentMarkAccess()->
getFieldmarkAt(*pUnoCursor->GetMark());
- SwXTextPortion* pPortion = new SwXTextPortion(
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_END);
xRef = pPortion;
if (pFieldmark)
@@ -441,7 +440,7 @@ lcl_ExportFieldMark(
{
::sw::mark::IFieldmark* pFieldmark =
rDoc.getIDocumentMarkAccess()->getFieldmarkAt(*pUnoCursor->GetMark());
- SwXTextPortion* pPortion = new SwXTextPortion(
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion(
pUnoCursor, i_xParentText, PORTION_FIELD_START_END);
xRef = pPortion;
if (pFieldmark)
@@ -472,7 +471,7 @@ lcl_CreateRefMarkPortion(
xContent = SwXReferenceMark::CreateXReferenceMark(rDoc, &rRefMark);
}
- SwXTextPortion* pPortion = nullptr;
+ rtl::Reference<SwXTextPortion> pPortion;
if (!bEnd)
{
pPortion = new SwXTextPortion(pUnoCursor, xParent, PORTION_REFMARK_START);
@@ -494,7 +493,7 @@ lcl_InsertRubyPortion(
const SwUnoCursor * const pUnoCursor,
const SwTextAttr & rAttr, const bool bEnd)
{
- SwXTextPortion* pPortion = new SwXTextPortion(pUnoCursor,
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion(pUnoCursor,
static_txtattr_cast<const SwTextRuby&>(rAttr), xParent, bEnd);
rPortions.emplace_back(pPortion);
pPortion->SetCollapsed(rAttr.End() == nullptr);
@@ -512,7 +511,7 @@ lcl_CreateTOXMarkPortion(
const Reference<XTextContent> xContent =
SwXDocumentIndexMark::CreateXDocumentIndexMark(rDoc, & rTOXMark);
- SwXTextPortion* pPortion = nullptr;
+ rtl::Reference<SwXTextPortion> pPortion;
if (!bEnd)
{
pPortion = new SwXTextPortion(pUnoCursor, xParent, PORTION_TOXMARK_START);
@@ -536,7 +535,7 @@ lcl_CreateMetaPortion(
const uno::Reference<rdf::XMetadatable> xMeta( SwXMeta::CreateXMeta(
*static_cast<SwFormatMeta &>(rAttr.GetAttr()).GetMeta(),
xParent, std::move(pPortions)));
- SwXTextPortion * pPortion(nullptr);
+ rtl::Reference<SwXTextPortion> pPortion;
if (RES_TXTATR_META == rAttr.Which())
{
const uno::Reference<text::XTextContent> xContent(xMeta,
@@ -604,7 +603,7 @@ static void lcl_ExportBookmark(
// - this is the start or end (depending on bOnlyFrameStarts)
// of a collapsed bookmark at the same position as an at-char
// anchored frame
- SwXTextPortion* pPortion =
+ rtl::Reference<SwXTextPortion> pPortion =
new SwXTextPortion(pUnoCursor, xParent, bEnd ? PORTION_BOOKMARK_END : PORTION_BOOKMARK_START);
rPortions.emplace_back(pPortion);
pPortion->SetBookmark(pPtr->xBookmark);
@@ -613,7 +612,7 @@ static void lcl_ExportBookmark(
}
else if (BkmType::End == pPtr->nBkmType && !bOnlyFrameStarts)
{
- SwXTextPortion* pPortion =
+ rtl::Reference<SwXTextPortion> pPortion =
new SwXTextPortion(pUnoCursor, xParent, PORTION_BOOKMARK_END);
rPortions.emplace_back(pPortion);
pPortion->SetBookmark(pPtr->xBookmark);
@@ -812,10 +811,10 @@ lcl_ExportHints(
pUnoCursor->Right(1);
if( *pUnoCursor->GetMark() == *pUnoCursor->GetPoint() )
break;
- SwXTextPortion* pPortion;
- xRef = pPortion =
+ rtl::Reference<SwXTextPortion> pPortion =
new SwXTextPortion(
pUnoCursor, xParent, PORTION_FIELD);
+ xRef = pPortion;
Reference<XTextField> const xField =
SwXTextField::CreateXTextField(&rDoc,
&pAttr->GetFormatField());
@@ -834,14 +833,14 @@ lcl_ExportHints(
::sw::mark::IMark* pAnnotationMark = pTextAnnotationField ? pTextAnnotationField->GetAnnotationMark() : nullptr;
if ( pAnnotationMark != nullptr )
{
- SwXTextPortion* pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION_END );
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION_END );
pPortion->SetBookmark(SwXBookmark::CreateXBookmark(
rDoc, pAnnotationMark));
xRef = pPortion;
}
else
{
- SwXTextPortion* pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION );
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION );
Reference<XTextField> xField =
SwXTextField::CreateXTextField(&rDoc,
&pAttr->GetFormatField());
@@ -859,7 +858,7 @@ lcl_ExportHints(
pAttr->GetFormatField().GetField()->ExpandField(true, nullptr).getLength() + 2 );
if( *pUnoCursor->GetMark() == *pUnoCursor->GetPoint() )
break;
- SwXTextPortion* pPortion =
+ rtl::Reference<SwXTextPortion> pPortion =
new SwXTextPortion( pUnoCursor, xParent, PORTION_FIELD);
xRef = pPortion;
Reference<XTextField> xField =
@@ -892,9 +891,9 @@ lcl_ExportHints(
pUnoCursor->Right(1);
if( *pUnoCursor->GetMark() == *pUnoCursor->GetPoint() )
break;
- SwXTextPortion* pPortion;
- xRef = pPortion = new SwXTextPortion(
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion(
pUnoCursor, xParent, PORTION_FOOTNOTE);
+ xRef = pPortion;
Reference<XFootnote> xContent =
SwXFootnotes::GetObject(rDoc, pAttr->GetFootnote());
pPortion->SetFootnote(xContent);
@@ -1175,7 +1174,7 @@ static void lcl_ExportAnnotationStarts(
bool bFrameStart = rFramePositions.find(nIndex) != rFramePositions.end();
if (bFrameStart || !bOnlyFrame)
{
- SwXTextPortion* pPortion =
+ rtl::Reference<SwXTextPortion> pPortion =
new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION );
pPortion->SetTextField( pPtr->mxAnnotationField );
rPortions.emplace_back(pPortion);
@@ -1238,7 +1237,7 @@ static sal_Int32 lcl_ExportFrames(
auto pFrame = static_cast<SwFrameFormat*>(i_rFrames.front().pFrameClient->GetRegisteredIn());
if (pFrame) // Frame could be disposed
{
- SwXTextPortion* pPortion = new SwXTextPortion(i_pUnoCursor, i_xParent, *pFrame );
+ rtl::Reference<SwXTextPortion> pPortion = new SwXTextPortion(i_pUnoCursor, i_xParent, *pFrame );
rPortions.emplace_back(pPortion);
}
i_rFrames.pop_front();
diff --git a/sw/source/core/unocore/unoredline.cxx b/sw/source/core/unocore/unoredline.cxx
index df3ad38cfffd..f1c7a6d3fe10 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -94,7 +94,7 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor()
SolarMutexGuard aGuard;
SwPosition aPos(aNodeIndex);
- SwXTextCursor *const pXCursor =
+ rtl::Reference<SwXTextCursor> pXCursor =
new SwXTextCursor(*GetDoc(), this, CursorType::Redline, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
@@ -128,7 +128,7 @@ uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursor()
throw aExcept;
}
- return static_cast<text::XWordCursor*>(pXCursor);
+ return static_cast<text::XWordCursor*>(pXCursor.get());
}
uno::Reference<text::XTextCursor> SwXRedlineText::createTextCursorByRange(
@@ -532,7 +532,6 @@ uno::Reference< text::XTextCursor > SwXRedline::createTextCursor()
if(!pDoc)
throw uno::RuntimeException();
- uno::Reference< text::XTextCursor > xRet;
SwNodeIndex* pNodeIndex = pRedline->GetContentIdx();
if(!pNodeIndex)
{
@@ -540,7 +539,7 @@ uno::Reference< text::XTextCursor > SwXRedline::createTextCursor()
}
SwPosition aPos(*pNodeIndex);
- SwXTextCursor *const pXCursor =
+ rtl::Reference<SwXTextCursor> pXCursor =
new SwXTextCursor(*pDoc, this, CursorType::Redline, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
@@ -556,9 +555,8 @@ uno::Reference< text::XTextCursor > SwXRedline::createTextCursor()
}
if(pCont)
rUnoCursor.GetPoint()->nContent.Assign(pCont, 0);
- xRet = static_cast<text::XWordCursor*>(pXCursor);
- return xRet;
+ return static_cast<text::XWordCursor*>(pXCursor.get());
}
uno::Reference< text::XTextCursor > SwXRedline::createTextCursorByRange(
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 62b34a61cd4f..a87dc245a8e3 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -137,8 +137,8 @@ SwXReferenceMark::CreateXReferenceMark(
}
if (!xMark.is())
{
- SwXReferenceMark *const pMark(new SwXReferenceMark(&rDoc, pMarkFormat));
- xMark.set(pMark);
+ rtl::Reference<SwXReferenceMark> pMark(new SwXReferenceMark(&rDoc, pMarkFormat));
+ xMark = pMark;
if (pMarkFormat)
{
pMarkFormat->SetXRefMark(xMark);
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 422619dae051..ada86e6df4ca 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -206,7 +206,7 @@ SwXTextSection::CreateXTextSection(
}
if ( !xSection.is() )
{
- SwXTextSection *const pNew = new SwXTextSection(pFormat, bIndexHeader);
+ rtl::Reference<SwXTextSection> pNew = new SwXTextSection(pFormat, bIndexHeader);
xSection.set(pNew);
if (pFormat)
{
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 6392d16cd786..b03f513a1e70 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -117,7 +117,7 @@ namespace
{
FindUnoInstanceHint(Tcoretype* pCore) : m_pCore(pCore), m_pResult(nullptr) {};
const Tcoretype* const m_pCore;
- mutable Tunotype* m_pResult;
+ mutable rtl::Reference<Tunotype> m_pResult;
};
SwFrameFormat* lcl_EnsureCoreConnected(SwFrameFormat* pFormat, cppu::OWeakObject* pObject)
{
@@ -551,7 +551,7 @@ void SwRangeDescriptor::Normalize()
std::swap(nLeft, nRight);
}
-static SwXCell* lcl_CreateXCell(SwFrameFormat* pFormat, sal_Int32 nColumn, sal_Int32 nRow)
+static rtl::Reference<SwXCell> lcl_CreateXCell(SwFrameFormat* pFormat, sal_Int32 nColumn, sal_Int32 nRow)
{
const OUString sCellName = sw_GetCellName(nColumn, nRow);
SwTable* pTable = SwTable::FindTable(pFormat);
@@ -941,11 +941,11 @@ uno::Reference<text::XTextCursor> SwXCell::createTextCursor()
throw uno::RuntimeException();
const SwStartNode* pSttNd = m_pStartNode ? m_pStartNode : m_pBox->GetSttNd();
SwPosition aPos(*pSttNd);
- SwXTextCursor* const pXCursor =
+ rtl::Reference<SwXTextCursor> const pXCursor =
new SwXTextCursor(*GetDoc(), this, CursorType::TableText, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
- return static_cast<text::XWordCursor*>(pXCursor);
+ return static_cast<text::XWordCursor*>(pXCursor.get());
}
uno::Reference<text::XTextCursor> SwXCell::createTextCursorByRange(const uno::Reference< text::XTextRange > & xTextPosition)
@@ -1137,7 +1137,7 @@ void SwXCell::Notify(const SfxHint& rHint)
}
}
-SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable )
+rtl::Reference<SwXCell> SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwTable *pTable )
{
if(!pTableFormat || !pBox)
return nullptr;
@@ -1149,7 +1149,7 @@ SwXCell* SwXCell::CreateXCell(SwFrameFormat* pTableFormat, SwTableBox* pBox, SwT
size_t const nPos = it - pTable->GetTabSortBoxes().begin();
FindUnoInstanceHint<SwTableBox, SwXCell> aHint{pBox};
pTableFormat->GetNotifier().Broadcast(aHint);
- return aHint.m_pResult ? aHint.m_pResult : new SwXCell(pTableFormat, pBox, nPos);
+ return aHint.m_pResult ? aHint.m_pResult.get() : new SwXCell(pTableFormat, pBox, nPos);
}
/** search if a box exists in a table
@@ -3232,10 +3232,9 @@ rtl::Reference<SwXCellRange> SwXCellRange::CreateXCellRange(
sw::UnoCursorPointer const& pCursor, SwFrameFormat& rFrameFormat,
SwRangeDescriptor const & rDesc)
{
- SwXCellRange *const pCellRange(new SwXCellRange(pCursor, rFrameFormat, rDesc));
- uno::Reference<table::XCellRange> xCellRange(pCellRange);
+ rtl::Reference<SwXCellRange> pCellRange(new SwXCellRange(pCursor, rFrameFormat, rDesc));
// need a permanent Reference to initialize m_wThis
- pCellRange->m_pImpl->m_wThis = xCellRange;
+ pCellRange->m_pImpl->m_wThis = uno::Reference<table::XCellRange>(pCellRange);
return pCellRange;
}
@@ -3269,7 +3268,7 @@ SwXCellRange::getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow)
if(nColumn >= 0 && nRow >= 0 &&
m_pImpl->GetColumnCount() > nColumn && m_pImpl->GetRowCount() > nRow )
{
- SwXCell* pXCell = lcl_CreateXCell(pFormat,
+ rtl::Reference<SwXCell> pXCell = lcl_CreateXCell(pFormat,
m_pImpl->m_RangeDescriptor.nLeft + nColumn,
m_pImpl->m_RangeDescriptor.nTop + nRow);
if(pXCell)
@@ -3920,7 +3919,7 @@ uno::Any SwXTableRows::getByIndex(sal_Int32 nIndex)
pFrameFormat->GetNotifier().Broadcast(aHint);
if(!aHint.m_pResult)
aHint.m_pResult = new SwXTextTableRow(pFrameFormat, pLine);
- uno::Reference<beans::XPropertySet> xRet = static_cast<beans::XPropertySet*>(aHint.m_pResult);
+ uno::Reference<beans::XPropertySet> xRet = static_cast<beans::XPropertySet*>(aHint.m_pResult.get());
return uno::makeAny(xRet);
}
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 4c0f0afda5f6..651413ad7929 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2539,8 +2539,7 @@ uno::Reference<text::XText> SwXHeadFootText::CreateXHeadFootText(
uno::Reference<text::XText> xText(rHeadFootFormat.GetXObject(), uno::UNO_QUERY);
if(!xText.is())
{
- const auto pXHFT(new SwXHeadFootText(rHeadFootFormat, bIsHeader));
- xText.set(pXHFT);
+ xText = new SwXHeadFootText(rHeadFootFormat, bIsHeader);
rHeadFootFormat.SetXObject(xText);
}
return xText;
@@ -2624,7 +2623,7 @@ SwXHeadFootText::createTextCursor()
const SwFormatContent& rFlyContent = rHeadFootFormat.GetContent();
const SwNode& rNode = rFlyContent.GetContentIdx()->GetNode();
SwPosition aPos(rNode);
- SwXTextCursor *const pXCursor = new SwXTextCursor(*GetDoc(), this,
+ rtl::Reference<SwXTextCursor> pXCursor = new SwXTextCursor(*GetDoc(), this,
(m_pImpl->m_bIsHeader) ? CursorType::Header : CursorType::Footer, aPos);
auto& rUnoCursor(pXCursor->GetCursor());
rUnoCursor.Move(fnMoveForward, GoInNode);
@@ -2654,7 +2653,7 @@ SwXHeadFootText::createTextCursor()
aExcept.Message = "no text available";
throw aExcept;
}
- return static_cast<text::XWordCursor*>(pXCursor);
+ return static_cast<text::XWordCursor*>(pXCursor.get());
}
uno::Reference<text::XTextCursor> SAL_CALL SwXHeadFootText::createTextCursorByRange(
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index 10430ebdefc1..f872e84f2629 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -5593,13 +5593,12 @@ namespace
uno::Reference< task::XInteractionHandler > xHandler( rMedium.GetInteractionHandler() );
if( xHandler.is() )
{
- ::comphelper::DocPasswordRequest* pRequest = new ::comphelper::DocPasswordRequest(
+ rtl::Reference<::comphelper::DocPasswordRequest> pRequest = new ::comphelper::DocPasswordRequest(
::comphelper::DocPasswordRequestType::MS, task::PasswordRequestMode_PASSWORD_ENTER,
INetURLObject(rMedium.GetOrigURL())
.GetLastName(INetURLObject::DecodeMechanism::WithCharset));
- uno::Reference< task::XInteractionRequest > xRequest( pRequest );
- xHandler->handle( xRequest );
+ xHandler->handle( pRequest );
if( pRequest->isPassword() )
aPassw = pRequest->getPassword();
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 7c67e6702d3a..88b952099e6a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2372,11 +2372,11 @@ bool CanUseRemoteLink(const OUString &rGrfName)
task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr));
uno::Reference< ucb::XProgressHandler > xProgress;
- ::ucbhelper::CommandEnvironment* pCommandEnv =
+ rtl::Reference<::ucbhelper::CommandEnvironment> pCommandEnv =
new ::ucbhelper::CommandEnvironment(new comphelper::SimpleFileAccessInteraction( xIH ), xProgress);
::ucbhelper::Content aCnt(rGrfName,
- static_cast< ucb::XCommandEnvironment* >(pCommandEnv),
+ static_cast< ucb::XCommandEnvironment* >(pCommandEnv.get()),
comphelper::getProcessComponentContext());
if ( !INetURLObject( rGrfName ).isAnyKnownWebDAVScheme() )
diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
index d368b812a199..aae8843adc59 100644
--- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx
+++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx
@@ -476,11 +476,11 @@ Reference<XTextCursor> XMLRedlineImportHelper::CreateRedlineTextSection(
// create (UNO-) cursor
SwPosition aPos(*pRedlineNode);
- SwXTextCursor *const pXCursor =
+ rtl::Reference<SwXTextCursor> pXCursor =
new SwXTextCursor(*pDoc, pXText, CursorType::Redline, aPos);
pXCursor->GetCursor().Move(fnMoveForward, GoInNode);
// cast to avoid ambiguity
- xReturn = static_cast<text::XWordCursor*>(pXCursor);
+ xReturn = static_cast<text::XWordCursor*>(pXCursor.get());
}
// else: unknown redline -> Ignore
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 15a77cdabb82..a48dfeea4726 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -212,9 +212,8 @@ SwInsertDBColAutoPilot::SwInsertDBColAutoPilot( SwView& rView,
{
SwWrtShell& rSh = pView->GetWrtShell();
SvNumberFormatter* pNumFormatr = rSh.GetNumberFormatter();
- SvNumberFormatsSupplierObj* pNumFormat = new SvNumberFormatsSupplierObj( pNumFormatr );
- Reference< util::XNumberFormatsSupplier > xDocNumFormatsSupplier = pNumFormat;
- Reference< util::XNumberFormats > xDocNumberFormats = xDocNumFormatsSupplier->getNumberFormats();
+ rtl::Reference<SvNumberFormatsSupplierObj> pNumFormat = new SvNumberFormatsSupplierObj( pNumFormatr );
+ Reference< util::XNumberFormats > xDocNumberFormats = pNumFormat->getNumberFormats();
Reference< util::XNumberFormatTypes > xDocNumberFormatTypes(xDocNumberFormats, UNO_QUERY);
Reference<XPropertySet> xSourceProps(xDataSource, UNO_QUERY);
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index 876f5e5bf27d..a75bd92bf467 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1546,10 +1546,9 @@ css::uno::Reference<css::datatransfer::dnd::XDropTarget> AddressMultiLineEdit::G
if (!m_xDropTarget.is())
{
auto xRealDropTarget = GetDrawingArea()->get_drop_target();
- DropTargetListener* pProxy = new DropTargetListener(xRealDropTarget, m_pParentDialog);
- uno::Reference<css::datatransfer::dnd::XDropTargetListener> xListener(pProxy);
- xRealDropTarget->addDropTargetListener(xListener);
- m_xDropTarget = uno::Reference<css::datatransfer::dnd::XDropTarget>(pProxy);
+ rtl::Reference<DropTargetListener> pProxy = new DropTargetListener(xRealDropTarget, m_pParentDialog);
+ xRealDropTarget->addDropTargetListener(pProxy);
+ m_xDropTarget = pProxy;
}
return m_xDropTarget;
}
diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx
index 7a8730acfe34..d55275d02ff7 100644
--- a/sw/source/ui/dbui/mmoutputtypepage.cxx
+++ b/sw/source/ui/dbui/mmoutputtypepage.cxx
@@ -396,8 +396,7 @@ void SwSendMailDialog::IterateMails()
pCurrentMailDescriptor = m_pImpl->GetNextDescriptor();
continue;
}
- SwMailMessage* pMessage = new SwMailMessage;
- uno::Reference< mail::XMailMessage > xMessage = pMessage;
+ rtl::Reference<SwMailMessage> pMessage = new SwMailMessage;
if(m_pConfigItem->IsMailReplyTo())
pMessage->setReplyToAddress(m_pConfigItem->GetMailReplyTo());
pMessage->addRecipient( pCurrentMailDescriptor->sEMail );
@@ -444,7 +443,7 @@ void SwSendMailDialog::IterateMails()
}
while (nPos >= 0);
}
- m_pImpl->xMailDispatcher->enqueueMailMessage( xMessage );
+ m_pImpl->xMailDispatcher->enqueueMailMessage( pMessage );
pCurrentMailDescriptor = m_pImpl->GetNextDescriptor();
}
UpdateTransferStatus();
diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx
index 5c8dea110a85..1478a1f17caf 100644
--- a/sw/source/ui/vba/vbadocuments.cxx
+++ b/sw/source/ui/vba/vbadocuments.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/frame/XModel.hpp>
#include <tools/urlobj.hxx>
+#include <rtl/ref.hxx>
#include "vbadocument.hxx"
#include "vbadocuments.hxx"
@@ -37,7 +38,7 @@ getDocument( uno::Reference< uno::XComponentContext > const & xContext, const un
if( !xDoc.is() )
return uno::Any();
- SwVbaDocument *pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xDoc );
+ rtl::Reference<SwVbaDocument> pWb = new SwVbaDocument( uno::Reference< XHelperInterface >( aApplication, uno::UNO_QUERY_THROW ), xContext, xDoc );
return uno::Any( uno::Reference< word::XDocument > (pWb) );
}
diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx
index b7805d8b5707..b7a4dda755c4 100644
--- a/sw/source/uibase/dbui/dbmgr.cxx
+++ b/sw/source/uibase/dbui/dbmgr.cxx
@@ -950,13 +950,13 @@ static SfxObjectShell* lcl_CreateWorkingDocument(
return xWorkObjectShell.get();
}
-static SwMailMessage* lcl_CreateMailFromDoc(
+static rtl::Reference<SwMailMessage> lcl_CreateMailFromDoc(
const SwMergeDescriptor &rMergeDescriptor,
const OUString &sFileURL, const OUString &sMailRecipient,
const OUString &sMailBodyMimeType, rtl_TextEncoding sMailEncoding,
const OUString &sAttachmentMimeType )
{
- SwMailMessage* pMessage = new SwMailMessage;
+ rtl::Reference<SwMailMessage> pMessage = new SwMailMessage;
if( rMergeDescriptor.pMailMergeConfigItem->IsMailReplyTo() )
pMessage->setReplyToAddress(rMergeDescriptor.pMailMergeConfigItem->GetMailReplyTo());
pMessage->addRecipient( sMailRecipient );
@@ -1744,9 +1744,8 @@ sal_uLong SwDBManager::GetColumnFormat( uno::Reference< sdbc::XDataSource> const
}
if(xSource.is() && xConnection.is() && xColumn.is() && pNFormatr)
{
- SvNumberFormatsSupplierObj* pNumFormat = new SvNumberFormatsSupplierObj( pNFormatr );
- uno::Reference< util::XNumberFormatsSupplier > xDocNumFormatsSupplier = pNumFormat;
- uno::Reference< util::XNumberFormats > xDocNumberFormats = xDocNumFormatsSupplier->getNumberFormats();
+ rtl::Reference<SvNumberFormatsSupplierObj> pNumFormat = new SvNumberFormatsSupplierObj( pNFormatr );
+ uno::Reference< util::XNumberFormats > xDocNumberFormats = pNumFormat->getNumberFormats();
uno::Reference< util::XNumberFormatTypes > xDocNumberFormatTypes(xDocNumberFormats, uno::UNO_QUERY);
css::lang::Locale aLocale( LanguageTag( nLanguage ).getLocale());
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index dbb641f08e41..1e0e01acbc59 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3268,7 +3268,7 @@ bool SwTransferable::PasteFileList( TransferableDataHelper& rData,
// iterate over the filelist
for( sal_uLong n = 0, nEnd = aFileList.Count(); n < nEnd; ++n )
{
- TransferDataContainer* pHlp = new TransferDataContainer;
+ rtl::Reference<TransferDataContainer> pHlp = new TransferDataContainer;
pHlp->CopyString( SotClipboardFormatId::SIMPLE_FILE, aFileList.GetFile( n ));
TransferableDataHelper aData( pHlp );
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 8d0546a6d972..cee5d859ae57 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -1380,14 +1380,11 @@ void SwAnnotationWin::ChangeSidebarItem( SwSidebarItem const & rSidebarItem )
css::uno::Reference< css::accessibility::XAccessible > SwAnnotationWin::CreateAccessible()
{
- SidebarWinAccessible* pAcc( new SidebarWinAccessible( *this,
+ rtl::Reference<SidebarWinAccessible> pAcc( new SidebarWinAccessible( *this,
mrView.GetWrtShell(),
mrSidebarItem ) );
- css::uno::Reference< css::awt::XWindowPeer > xWinPeer( pAcc );
- SetWindowPeer( xWinPeer, pAcc );
-
- css::uno::Reference< css::accessibility::XAccessible > xAcc( xWinPeer, css::uno::UNO_QUERY );
- return xAcc;
+ SetWindowPeer( pAcc, pAcc.get() );
+ return pAcc;
}
} // eof of namespace sw::sidebarwindows
diff --git a/sw/source/uibase/docvw/DashedLine.cxx b/sw/source/uibase/docvw/DashedLine.cxx
index eb7d59066e2c..629f77330aa7 100644
--- a/sw/source/uibase/docvw/DashedLine.cxx
+++ b/sw/source/uibase/docvw/DashedLine.cxx
@@ -69,10 +69,8 @@ void SwDashedLine::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
const basegfx::BColor aOtherColor = basegfx::utils::hsl2rgb(aHslLine);
// Compute the plain line
- drawinglayer::primitive2d::PolygonHairlinePrimitive2D * pPlainLine =
- new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPolygon, aOtherColor);
+ aSeq[0] = new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(aPolygon, aOtherColor);
- aSeq[0] = drawinglayer::primitive2d::Primitive2DReference(pPlainLine);
// Dashed line in twips
aStrokePattern.push_back(3);
aStrokePattern.push_back(3);
@@ -81,14 +79,12 @@ void SwDashedLine::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
}
// Compute the dashed line primitive
- drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D * pLine =
+ aSeq[aSeq.size() - 1] =
new drawinglayer::primitive2d::PolyPolygonStrokePrimitive2D(
basegfx::B2DPolyPolygon(aPolygon),
drawinglayer::attribute::LineAttribute(m_pColorFn().getBColor()),
drawinglayer::attribute::StrokeAttribute(aStrokePattern));
- aSeq[aSeq.size() - 1] = drawinglayer::primitive2d::Primitive2DReference(pLine);
-
pProcessor->process(aSeq);
}
diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx b/sw/source/uibase/docvw/SidebarWinAcc.cxx
index 9ca77ffdc1ba..4e52b471aa4b 100644
--- a/sw/source/uibase/docvw/SidebarWinAcc.cxx
+++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx
@@ -130,13 +130,12 @@ void SidebarWinAccessible::ChangeSidebarItem( const SwSidebarItem& rSidebarItem
css::uno::Reference< css::accessibility::XAccessibleContext > SidebarWinAccessible::CreateAccessibleContext()
{
- SidebarWinAccessibleContext* pAccContext =
+ rtl::Reference<SidebarWinAccessibleContext> pAccContext =
new SidebarWinAccessibleContext( mrSidebarWin,
mrViewShell,
mpAnchorFrame );
- css::uno::Reference< css::accessibility::XAccessibleContext > xAcc( pAccContext );
bAccContextCreated = true;
- return xAcc;
+ return pAccContext;
}
} // end of namespace sw::sidebarwindows
diff --git a/sw/source/uibase/table/chartins.cxx b/sw/source/uibase/table/chartins.cxx
index f2d78c2bf1fb..8c1737f11305 100644
--- a/sw/source/uibase/table/chartins.cxx
+++ b/sw/source/uibase/table/chartins.cxx
@@ -209,11 +209,10 @@ SwInsertChart::SwInsertChart( const Link<css::ui::dialogs::DialogClosedEvent*, v
}
}
- ::svt::DialogClosedListener* pListener = new ::svt::DialogClosedListener();
+ rtl::Reference<::svt::DialogClosedListener> pListener = new ::svt::DialogClosedListener();
pListener->SetDialogClosedLink( rLink );
- css::uno::Reference<css::ui::dialogs::XDialogClosedListener> xListener( pListener );
- xDialog->startExecuteModal( xListener );
+ xDialog->startExecuteModal( pListener );
}
else
{
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 2ba12a2f6943..4eb4e50e697e 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -381,9 +381,6 @@ SwXTextDocument::SwXTextDocument(SwDocShell* pShell)
m_bObjectValid(pShell != nullptr),
- m_pDrawPage(nullptr),
- mxXDrawPage(),
- m_pBodyText(nullptr),
mxXNumberingRules(),
mxXFootnotes(),
mxXFootnoteSettings(),
@@ -456,10 +453,9 @@ void SwXTextDocument::GetNumberFormatter()
{
if ( m_pDocShell->GetDoc() )
{
- SvNumberFormatsSupplierObj* pNumFormat = new SvNumberFormatsSupplierObj(
+ rtl::Reference<SvNumberFormatsSupplierObj> pNumFormat = new SvNumberFormatsSupplierObj(
m_pDocShell->GetDoc()->GetNumberFormatter());
- Reference< util::XNumberFormatsSupplier > xTmp = pNumFormat;
- m_xNumFormatAgg.set(xTmp, UNO_QUERY);
+ m_xNumFormatAgg = pNumFormat;
}
if(m_xNumFormatAgg.is())
m_xNumFormatAgg->setDelegator(static_cast<cppu::OWeakObject*>(static_cast<SwXTextDocumentBaseClass*>(this)));
@@ -489,8 +485,7 @@ Reference< XText > SwXTextDocument::getText()
throw DisposedException("", static_cast< XTextDocument* >(this));
if(!m_xBodyText.is())
{
- m_pBodyText = new SwXBodyText(m_pDocShell->GetDoc());
- m_xBodyText = m_pBodyText;
+ m_xBodyText = new SwXBodyText(m_pDocShell->GetDoc());
}
return m_xBodyText;
}
@@ -1337,17 +1332,16 @@ Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage()
SolarMutexGuard aGuard;
if(!IsValid())
throw DisposedException("", static_cast< XTextDocument* >(this));
- if(!mxXDrawPage.is())
+ if(!m_xDrawPage.is())
{
- m_pDrawPage = new SwXDrawPage(m_pDocShell->GetDoc());
- mxXDrawPage = m_pDrawPage;
+ m_xDrawPage = new SwXDrawPage(m_pDocShell->GetDoc());
// Create a Reference to trigger the complete initialization of the
// object. Otherwise in some corner cases it would get initialized
// at ::InitNewDoc -> which would get called during
// close() or dispose() -> n#681746
- uno::Reference<lang::XComponent> xTriggerInit( mxXDrawPage, uno::UNO_QUERY );
+ uno::Reference<lang::XComponent> xTriggerInit( static_cast<cppu::OWeakObject*>(m_xDrawPage.get()), uno::UNO_QUERY );
}
- return mxXDrawPage;
+ return m_xDrawPage;
}
namespace {
@@ -1478,11 +1472,7 @@ void SwXTextDocument::InitNewDoc()
mxXEmbeddedObjects.clear();
}
- if(m_xBodyText.is())
- {
- m_xBodyText = nullptr;
- m_pBodyText = nullptr;
- }
+ m_xBodyText = nullptr;
if(m_xNumFormatAgg.is())
{
@@ -1522,14 +1512,13 @@ void SwXTextDocument::InitNewDoc()
mxXTextSections.clear();
}
- if(mxXDrawPage.is())
+ if(m_xDrawPage.is())
{
// #i91798#, #i91895#
// dispose XDrawPage here. We are the owner and know that it is no longer in a valid condition.
- uno::Reference<lang::XComponent> xComp( mxXDrawPage, uno::UNO_QUERY );
- xComp->dispose();
- m_pDrawPage->InvalidateSwDoc();
- mxXDrawPage.clear();
+ Reference<XComponent>(static_cast<cppu::OWeakObject*>(m_xDrawPage.get()), UNO_QUERY_THROW)->dispose();
+ m_xDrawPage->InvalidateSwDoc();
+ m_xDrawPage.clear();
}
if ( mxXNumberingRules.is() )
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 589ad2fc8644..e6621293391d 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1725,12 +1725,12 @@ SwXTextView::getTransferableForTextRange(uno::Reference<text::XTextRange> const&
//force immediate shell update
GetView()->StopShellTimer();
SwWrtShell& rSh = GetView()->GetWrtShell();
- SwTransferable *const pTransfer = new SwTransferable(rSh);
+ rtl::Reference<SwTransferable> pTransfer = new SwTransferable(rSh);
const bool bLockedView = rSh.IsViewLocked();
rSh.LockView( true );
pTransfer->PrepareForCopyTextRange(aPam);
rSh.LockView( bLockedView );
- return uno::Reference<datatransfer::XTransferable>(pTransfer);
+ return pTransfer;
}
uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransferable()
@@ -1748,12 +1748,12 @@ uno::Reference< datatransfer::XTransferable > SAL_CALL SwXTextView::getTransfera
}
else
{
- SwTransferable* pTransfer = new SwTransferable( rSh );
+ rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
const bool bLockedView = rSh.IsViewLocked();
rSh.LockView( true ); //lock visible section
pTransfer->PrepareForCopy();
rSh.LockView( bLockedView );
- return uno::Reference< datatransfer::XTransferable >( pTransfer );
+ return pTransfer;
}
}
More information about the Libreoffice-commits
mailing list