[Libreoffice-commits] core.git: sw/inc sw/source

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Mar 2 19:48:10 UTC 2021


 sw/inc/unoparagraph.hxx                      |    2 +-
 sw/inc/unotextbodyhf.hxx                     |    2 +-
 sw/inc/unotextrange.hxx                      |    2 +-
 sw/source/core/inc/unoparaframeenum.hxx      |    2 +-
 sw/source/core/unocore/unoobj.cxx            |    4 ++--
 sw/source/core/unocore/unoobj2.cxx           |    6 +++---
 sw/source/core/unocore/unotext.cxx           |    6 +++---
 sw/source/ui/vba/vbaapplication.cxx          |    2 +-
 sw/source/ui/vba/vbaapplication.hxx          |    3 ++-
 sw/source/uibase/uno/SwXDocumentSettings.cxx |    4 ++--
 sw/source/uibase/uno/unomod.cxx              |    8 ++++----
 sw/source/uibase/uno/unotxdoc.cxx            |    4 ++--
 12 files changed, 23 insertions(+), 22 deletions(-)

New commits:
commit 5e4e39b2a3db18b5f06070d01d15b35576e4b2cc
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Tue Mar 2 09:22:44 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Mar 2 20:47:18 2021 +0100

    loplugin:refcounting in sw
    
    Change-Id: I5d3768503effa002c4a308bfad30d9b56d5365f0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111802
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/unoparagraph.hxx b/sw/inc/unoparagraph.hxx
index eb89ce47249e..dc4d22f896cd 100644
--- a/sw/inc/unoparagraph.hxx
+++ b/sw/inc/unoparagraph.hxx
@@ -212,7 +212,7 @@ public:
 struct SwXParagraphEnumeration
     : public SwSimpleEnumeration_Base
 {
-    static SwXParagraphEnumeration* Create(
+    static rtl::Reference<SwXParagraphEnumeration> Create(
         css::uno::Reference< css::text::XText > const & xParent,
         const std::shared_ptr<SwUnoCursor>& pCursor,
         const CursorType eType,
diff --git a/sw/inc/unotextbodyhf.hxx b/sw/inc/unotextbodyhf.hxx
index 5b3c518e79b9..7bbffae58d20 100644
--- a/sw/inc/unotextbodyhf.hxx
+++ b/sw/inc/unotextbodyhf.hxx
@@ -48,7 +48,7 @@ public:
 
     SwXBodyText(SwDoc *const pDoc);
 
-    SwXTextCursor * CreateTextCursor(const bool bIgnoreTables = false);
+    rtl::Reference<SwXTextCursor> CreateTextCursor(const bool bIgnoreTables = false);
 
     // XInterface
     virtual css::uno::Any SAL_CALL queryInterface(
diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
index 693595e76eef..f3ed06fb4a06 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -217,7 +217,7 @@ typedef ::cppu::WeakImplHelper
 struct SwXTextRanges : public SwXTextRanges_Base
 {
     virtual SwUnoCursor* GetCursor() =0;
-    static SwXTextRanges* Create(SwPaM* const pCursor);
+    static rtl::Reference<SwXTextRanges> Create(SwPaM* const pCursor);
     static const css::uno::Sequence< sal_Int8 >& getUnoTunnelId();
 };
 
diff --git a/sw/source/core/inc/unoparaframeenum.hxx b/sw/source/core/inc/unoparaframeenum.hxx
index f68c55f6d317..017232c5a46b 100644
--- a/sw/source/core/inc/unoparaframeenum.hxx
+++ b/sw/source/core/inc/unoparaframeenum.hxx
@@ -69,7 +69,7 @@ enum ParaFrameMode
 struct SwXParaFrameEnumeration
     : public SwSimpleEnumeration_Base
 {
-    static SwXParaFrameEnumeration* Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat = nullptr);
+    static rtl::Reference<SwXParaFrameEnumeration> Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat = nullptr);
 };
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNOPARAFRAMEENUM_HXX
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 43d976a20dba..c5e67bac1ae4 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2082,9 +2082,9 @@ SwXTextCursor::getPropertySetInfo()
             m_pImpl->m_rPropSet.getPropertySetInfo();
         // extend PropertySetInfo!
         const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
-        return new SfxExtItemPropertySetInfo(
+        return rtl::Reference<SfxExtItemPropertySetInfo>(new SfxExtItemPropertySetInfo(
             aCursorExtMap_Impl,
-            aPropSeq );
+            aPropSeq ));
     }();
     return xRef;
 }
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 6afc81076269..7f5cc2c6b0ad 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -446,7 +446,7 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration
 
 }
 
-SwXParagraphEnumeration* SwXParagraphEnumeration::Create(
+rtl::Reference<SwXParagraphEnumeration> SwXParagraphEnumeration::Create(
     uno::Reference< text::XText > const& xParent,
     const std::shared_ptr<SwUnoCursor>& pCursor,
     const CursorType eType,
@@ -1606,7 +1606,7 @@ void SwXTextRangesImpl::MakeRanges()
     }
 }
 
-SwXTextRanges* SwXTextRanges::Create(SwPaM *const pPaM)
+rtl::Reference<SwXTextRanges> SwXTextRanges::Create(SwPaM *const pPaM)
     { return new SwXTextRangesImpl(pPaM); }
 
 namespace
@@ -1714,7 +1714,7 @@ struct SwXParaFrameEnumerationImpl final : public SwXParaFrameEnumeration
 
 }
 
-SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat)
+rtl::Reference<SwXParaFrameEnumeration> SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat)
     { return new SwXParaFrameEnumerationImpl(rPaM, eParaFrameMode, pFormat); }
 
 SwXParaFrameEnumerationImpl::SwXParaFrameEnumerationImpl(
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 651413ad7929..1f516d038be1 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2369,7 +2369,7 @@ SwXBodyText::queryInterface(const uno::Type& rType)
         :   ret;
 }
 
-SwXTextCursor * SwXBodyText::CreateTextCursor(const bool bIgnoreTables)
+rtl::Reference<SwXTextCursor> SwXBodyText::CreateTextCursor(const bool bIgnoreTables)
 {
     if(!IsValid())
     {
@@ -2402,8 +2402,8 @@ SwXBodyText::createTextCursor()
 {
     SolarMutexGuard aGuard;
 
-    const uno::Reference< text::XTextCursor > xRef(
-            static_cast<text::XWordCursor*>(CreateTextCursor()) );
+    const uno::Reference< text::XTextCursor > xRef =
+            static_cast<text::XWordCursor*>(CreateTextCursor().get());
     if (!xRef.is())
     {
         uno::RuntimeException aRuntime;
diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx
index c2e01d75f48d..71c1bd5d3f69 100644
--- a/sw/source/ui/vba/vbaapplication.cxx
+++ b/sw/source/ui/vba/vbaapplication.cxx
@@ -175,7 +175,7 @@ SwVbaApplication::getActiveDocument()
     return new SwVbaDocument( this, mxContext, getCurrentDocument() );
 }
 
-SwVbaWindow *
+rtl::Reference<SwVbaWindow>
 SwVbaApplication::getActiveSwVbaWindow()
 {
     // #FIXME so far can't determine Parent
diff --git a/sw/source/ui/vba/vbaapplication.hxx b/sw/source/ui/vba/vbaapplication.hxx
index 77c58e5d86d7..43cf30bc1a20 100644
--- a/sw/source/ui/vba/vbaapplication.hxx
+++ b/sw/source/ui/vba/vbaapplication.hxx
@@ -31,6 +31,7 @@
 #include <ooo/vba/word/XSelection.hpp>
 #include <vbahelper/vbaapplicationbase.hxx>
 #include <cppuhelper/implbase.hxx>
+#include <rtl/ref.hxx>
 
 #include "vbawindow.hxx"
 
@@ -55,7 +56,7 @@ public:
     sal_uInt32 AddSink( const css::uno::Reference< ooo::vba::XSink >& xSink );
     void RemoveSink( sal_uInt32 nNumber );
 
-    SwVbaWindow* getActiveSwVbaWindow();
+    rtl::Reference<SwVbaWindow> getActiveSwVbaWindow();
     css::uno::Reference< css::uno::XComponentContext > const & getContext() const;
 
     // XApplication
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index 19dabb9ea6b8..ebe7579830e1 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -151,7 +151,7 @@ enum SwDocumentSettingsPropertyHandles
 
 }
 
-static MasterPropertySetInfo * lcl_createSettingsInfo()
+static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo()
 {
     static PropertyInfo const aWriterSettingsInfoMap[] =
     {
@@ -272,7 +272,7 @@ static MasterPropertySetInfo * lcl_createSettingsInfo()
 }
 
 SwXDocumentSettings::SwXDocumentSettings ( SwXTextDocument * pModel )
-: MasterPropertySet ( lcl_createSettingsInfo (),
+: MasterPropertySet ( lcl_createSettingsInfo().get(),
                       &Application::GetSolarMutex () )
 , mpModel ( pModel )
 , mpDocSh ( nullptr )
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 7138f5b6af01..40b30bebaf1d 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -124,7 +124,7 @@ enum SwPrintSettingsPropertyHandles
 
 }
 
-static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
+static rtl::Reference<ChainablePropertySetInfo> lcl_createViewSettingsInfo()
 {
     static PropertyInfo const aViewSettingsMap_Impl[] =
     {
@@ -181,7 +181,7 @@ static ChainablePropertySetInfo * lcl_createViewSettingsInfo()
     return new ChainablePropertySetInfo ( aViewSettingsMap_Impl );
 }
 
-static ChainablePropertySetInfo * lcl_createPrintSettingsInfo()
+static rtl::Reference<ChainablePropertySetInfo> lcl_createPrintSettingsInfo()
 {
     static PropertyInfo const aPrintSettingsMap_Impl[] =
     {
@@ -256,7 +256,7 @@ Sequence< OUString > SwXModule::getSupportedServiceNames()
 }
 
 SwXPrintSettings::SwXPrintSettings(SwXPrintSettingsType eType, SwDoc* pDoc)
-: ChainablePropertySet ( lcl_createPrintSettingsInfo (), &Application::GetSolarMutex() )
+: ChainablePropertySet ( lcl_createPrintSettingsInfo().get(), &Application::GetSolarMutex() )
 , meType(eType)
 , mpPrtOpt ( nullptr )
 , mpDoc ( pDoc )
@@ -522,7 +522,7 @@ Sequence< OUString > SwXPrintSettings::getSupportedServiceNames()
 }
 
 SwXViewSettings::SwXViewSettings(SwView* pVw)
-    : ChainablePropertySet( lcl_createViewSettingsInfo (), &Application::GetSolarMutex() )
+    : ChainablePropertySet( lcl_createViewSettingsInfo().get(), &Application::GetSolarMutex() )
     , pView(pVw)
     , mpConstViewOption(nullptr)
     , bObjectValid(true)
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 4eb4e50e697e..ec2b23aeb6fc 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -706,8 +706,8 @@ SwUnoCursor* SwXTextDocument::CreateCursorForSearch(Reference< XTextCursor > & x
     getText();
     XText *const pText = m_xBodyText.get();
     SwXBodyText* pBText = static_cast<SwXBodyText*>(pText);
-    SwXTextCursor *const pXTextCursor = pBText->CreateTextCursor(true);
-    xCursor.set( static_cast<text::XWordCursor*>(pXTextCursor) );
+    rtl::Reference<SwXTextCursor> pXTextCursor = pBText->CreateTextCursor(true);
+    xCursor.set( static_cast<text::XWordCursor*>(pXTextCursor.get()) );
 
     auto& rUnoCursor(pXTextCursor->GetCursor());
     rUnoCursor.SetRemainInSection(false);


More information about the Libreoffice-commits mailing list