sc/inc/afmtuno.hxx                                  |    6 +++---
 sc/inc/cellsuno.hxx                                 |    2 +-
 sc/inc/chartuno.hxx                                 |    4 ++--
 sc/inc/dapiuno.hxx                                  |    8 ++++----
 sc/inc/datauno.hxx                                  |    6 +++---
 sc/inc/docuno.hxx                                   |   16 ++++++++--------
 sc/inc/linkuno.hxx                                  |   10 +++++-----
 sc/inc/nameuno.hxx                                  |   14 +++++++-------
 sc/inc/styleuno.hxx                                 |   10 +++++-----
 sc/inc/viewuno.hxx                                  |    2 +-
 sc/source/ui/Accessibility/AccessibleCsvControl.cxx |    2 +-
 sc/source/ui/inc/AccessibleCsvControl.hxx           |    2 +-
 sc/source/ui/unoobj/afmtuno.cxx                     |    6 +++---
 sc/source/ui/unoobj/cellsuno.cxx                    |    2 +-
 sc/source/ui/unoobj/chartuno.cxx                    |    4 ++--
 sc/source/ui/unoobj/dapiuno.cxx                     |    8 ++++----
 sc/source/ui/unoobj/datauno.cxx                     |    6 +++---
 sc/source/ui/unoobj/docuno.cxx                      |   20 ++++++++++----------
 sc/source/ui/unoobj/linkuno.cxx                     |   10 +++++-----
 sc/source/ui/unoobj/nameuno.cxx                     |   10 +++++-----
 sc/source/ui/unoobj/styleuno.cxx                    |   10 +++++-----
 sc/source/ui/unoobj/viewuno.cxx                     |    2 +-
 sc/source/ui/vba/vbarange.cxx                       |    2 +-
 sc/source/ui/vba/vbasheetobjects.cxx                |    6 +++---
 24 files changed, 84 insertions(+), 84 deletions(-)

New commits:
commit 4adfd75021d50e8e91c71bbe1526a1c752343059
Author:     Noel <noel.gran...@collabora.co.uk>
AuthorDate: Tue Mar 2 09:20:47 2021 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Wed Mar 3 07:36:59 2021 +0100

    loplugin:refcounting in sc
    
    Change-Id: I0b808785e54bf1dfc9387a649aacf731b2f34d12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111801
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/afmtuno.hxx b/sc/inc/afmtuno.hxx
index f3d9ba2a3d20..f005773d9c91 100644
--- a/sc/inc/afmtuno.hxx
+++ b/sc/inc/afmtuno.hxx
@@ -45,8 +45,8 @@ class ScAutoFormatsObj final : public ::cppu::WeakImplHelper<
                             css::lang::XServiceInfo >
 {
 private:
-    static ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
-    static ScAutoFormatObj* GetObjectByName_Impl(std::u16string_view aName);
+    static rtl::Reference<ScAutoFormatObj> GetObjectByIndex_Impl(sal_uInt16 
nIndex);
+    static rtl::Reference<ScAutoFormatObj> 
GetObjectByName_Impl(std::u16string_view aName);
 
 public:
                             ScAutoFormatsObj();
@@ -96,7 +96,7 @@ private:
     SfxItemPropertySet      aPropSet;
     sal_uInt16              nFormatIndex;
 
-    ScAutoFormatFieldObj*   GetObjectByIndex_Impl(sal_uInt16 nIndex);
+    rtl::Reference<ScAutoFormatFieldObj> GetObjectByIndex_Impl(sal_uInt16 
nIndex);
 
 public:
                             ScAutoFormatObj(sal_uInt16 nIndex);
diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx
index 3c19e9ff88de..87bca6b02a29 100644
--- a/sc/inc/cellsuno.hxx
+++ b/sc/inc/cellsuno.hxx
@@ -387,7 +387,7 @@ private:
     struct Impl;
     std::unique_ptr<Impl> m_pImpl;
 
-    ScCellRangeObj*         GetObjectByIndex_Impl(sal_Int32 nIndex) const;
+    rtl::Reference<ScCellRangeObj> GetObjectByIndex_Impl(sal_Int32 nIndex) 
const;
 
 public:
                             ScCellRangesObj(ScDocShell* pDocSh, const 
ScRangeList& rR);
diff --git a/sc/inc/chartuno.hxx b/sc/inc/chartuno.hxx
index aac210fb1314..5a3ed1f1e2ac 100644
--- a/sc/inc/chartuno.hxx
+++ b/sc/inc/chartuno.hxx
@@ -50,8 +50,8 @@ private:
     ScDocShell*             pDocShell;
     SCTAB                   nTab;           // Charts are per sheet
 
-    ScChartObj*             GetObjectByIndex_Impl(tools::Long nIndex) const;
-    ScChartObj*             GetObjectByName_Impl(const OUString& aName) const;
+    rtl::Reference<ScChartObj> GetObjectByIndex_Impl(tools::Long nIndex) const;
+    rtl::Reference<ScChartObj> GetObjectByName_Impl(const OUString& aName) 
const;
 
 public:
                             ScChartsObj(ScDocShell* pDocSh, SCTAB nT);
diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx
index c32c2d6bf01e..613d114128ff 100644
--- a/sc/inc/dapiuno.hxx
+++ b/sc/inc/dapiuno.hxx
@@ -87,8 +87,8 @@ private:
     ScDocShell*             pDocShell;
     SCTAB                   nTab;
 
-    ScDataPilotTableObj*    GetObjectByIndex_Impl( sal_Int32 nIndex );
-    ScDataPilotTableObj*    GetObjectByName_Impl(const OUString& aName);
+    rtl::Reference<ScDataPilotTableObj> GetObjectByIndex_Impl( sal_Int32 
nIndex );
+    rtl::Reference<ScDataPilotTableObj> GetObjectByName_Impl(const OUString& 
aName);
 
 public:
                             ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT);
@@ -374,8 +374,8 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
 private:
-    ScDataPilotFieldObj*    GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
-    ScDataPilotFieldObj*    GetObjectByName_Impl( const OUString& rName ) 
const;
+    rtl::Reference<ScDataPilotFieldObj> GetObjectByIndex_Impl( sal_Int32 
nIndex ) const;
+    rtl::Reference<ScDataPilotFieldObj> GetObjectByName_Impl( const OUString& 
rName ) const;
 
 private:
     css::uno::Any maOrient;    /// Field orientation, no value = all fields.
diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx
index b3d27827b77c..17b5fb63e61f 100644
--- a/sc/inc/datauno.hxx
+++ b/sc/inc/datauno.hxx
@@ -117,7 +117,7 @@ class ScSubTotalDescriptorBase : public 
cppu::WeakImplHelper<
 private:
     SfxItemPropertySet      aPropSet;
 
-    ScSubTotalFieldObj*     GetObjectByIndex_Impl(sal_uInt16 nIndex);
+    rtl::Reference<ScSubTotalFieldObj> GetObjectByIndex_Impl(sal_uInt16 
nIndex);
 
 public:
                             ScSubTotalDescriptorBase();
@@ -489,8 +489,8 @@ class ScDatabaseRangesObj final : public 
cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
 
-    ScDatabaseRangeObj*     GetObjectByIndex_Impl(size_t nIndex);
-    ScDatabaseRangeObj*     GetObjectByName_Impl(const OUString& aName);
+    rtl::Reference<ScDatabaseRangeObj> GetObjectByIndex_Impl(size_t nIndex);
+    rtl::Reference<ScDatabaseRangeObj> GetObjectByName_Impl(const OUString& 
aName);
 
 public:
                             ScDatabaseRangesObj(ScDocShell* pDocSh);
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 6c80b3f0f2c7..490589446522 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -441,8 +441,8 @@ class ScTableSheetsObj final : public cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
 
-    ScTableSheetObj*        GetObjectByIndex_Impl(sal_Int32 nIndex) const;
-    ScTableSheetObj*        GetObjectByName_Impl(const OUString& aName) const;
+    rtl::Reference<ScTableSheetObj> GetObjectByIndex_Impl(sal_Int32 nIndex) 
const;
+    rtl::Reference<ScTableSheetObj> GetObjectByName_Impl(const OUString& 
aName) const;
 
 public:
                             ScTableSheetsObj(ScDocShell* pDocSh);
@@ -519,8 +519,8 @@ private:
     SCCOL                   nStartCol;
     SCCOL                   nEndCol;
 
-    ScTableColumnObj*       GetObjectByIndex_Impl(sal_Int32 nIndex) const;
-    ScTableColumnObj*       GetObjectByName_Impl(const OUString& aName) const;
+    rtl::Reference<ScTableColumnObj> GetObjectByIndex_Impl(sal_Int32 nIndex) 
const;
+    rtl::Reference<ScTableColumnObj> GetObjectByName_Impl(const OUString& 
aName) const;
 
 public:
                             ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT,
@@ -585,7 +585,7 @@ private:
     SCROW                   nStartRow;
     SCROW                   nEndRow;
 
-    ScTableRowObj*          GetObjectByIndex_Impl(sal_Int32 nIndex) const;
+    rtl::Reference<ScTableRowObj> GetObjectByIndex_Impl(sal_Int32 nIndex) 
const;
 
 public:
                             ScTableRowsObj(ScDocShell* pDocSh, SCTAB nT,
@@ -671,7 +671,7 @@ private:
     SCTAB                   nTab;           ///< Collection belongs to the 
sheet
 
     bool                    GetAddressByIndex_Impl( sal_Int32 nIndex, 
ScAddress& rPos ) const;
-    ScAnnotationObj*        GetObjectByIndex_Impl( sal_Int32 nIndex ) const;
+    rtl::Reference<ScAnnotationObj> GetObjectByIndex_Impl( sal_Int32 nIndex ) 
const;
 
 public:
                             ScAnnotationsObj(ScDocShell* pDocSh, SCTAB nT);
@@ -716,8 +716,8 @@ private:
     SCTAB                   nTab;
 
     bool                    GetScenarioIndex_Impl( std::u16string_view rName, 
SCTAB& rIndex );
-    ScTableSheetObj*        GetObjectByIndex_Impl(sal_Int32 nIndex);
-    ScTableSheetObj*        GetObjectByName_Impl(std::u16string_view aName);
+    rtl::Reference<ScTableSheetObj> GetObjectByIndex_Impl(sal_Int32 nIndex);
+    rtl::Reference<ScTableSheetObj> GetObjectByName_Impl(std::u16string_view 
aName);
 
 public:
                             ScScenariosObj(ScDocShell* pDocSh, SCTAB nT);
diff --git a/sc/inc/linkuno.hxx b/sc/inc/linkuno.hxx
index 34e0d7e5584c..5b84f9bcf444 100644
--- a/sc/inc/linkuno.hxx
+++ b/sc/inc/linkuno.hxx
@@ -122,8 +122,8 @@ class ScSheetLinksObj final : public cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
 
-    ScSheetLinkObj*         GetObjectByIndex_Impl(sal_Int32 nIndex);
-    ScSheetLinkObj*         GetObjectByName_Impl(const OUString& aName);
+    rtl::Reference<ScSheetLinkObj> GetObjectByIndex_Impl(sal_Int32 nIndex);
+    rtl::Reference<ScSheetLinkObj> GetObjectByName_Impl(const OUString& aName);
 
 public:
                             ScSheetLinksObj(ScDocShell* pDocSh);
@@ -230,7 +230,7 @@ class ScAreaLinksObj final : public cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
 
-    ScAreaLinkObj*          GetObjectByIndex_Impl(sal_Int32 nIndex);
+    rtl::Reference<ScAreaLinkObj> GetObjectByIndex_Impl(sal_Int32 nIndex);
 
 public:
                             ScAreaLinksObj(ScDocShell* pDocSh);
@@ -326,8 +326,8 @@ class ScDDELinksObj final : public cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
 
-    ScDDELinkObj*           GetObjectByIndex_Impl(sal_Int32 nIndex);
-    ScDDELinkObj*           GetObjectByName_Impl(std::u16string_view aName);
+    rtl::Reference<ScDDELinkObj> GetObjectByIndex_Impl(sal_Int32 nIndex);
+    rtl::Reference<ScDDELinkObj> GetObjectByName_Impl(std::u16string_view 
aName);
 
 public:
                             ScDDELinksObj(ScDocShell* pDocSh);
diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx
index ab4b4b32e4ff..40451808dd6c 100644
--- a/sc/inc/nameuno.hxx
+++ b/sc/inc/nameuno.hxx
@@ -137,8 +137,8 @@ private:
          import. */
     bool                    mbModifyAndBroadcast;
 
-    virtual ScNamedRangeObj* GetObjectByIndex_Impl(sal_uInt16 nIndex) = 0;
-    virtual ScNamedRangeObj* GetObjectByName_Impl(const OUString& aName) = 0;
+    virtual rtl::Reference<ScNamedRangeObj> GetObjectByIndex_Impl(sal_uInt16 
nIndex) = 0;
+    virtual rtl::Reference<ScNamedRangeObj> GetObjectByName_Impl(const 
OUString& aName) = 0;
 
     virtual ScRangeName*    GetRangeName_Impl() = 0;
     virtual SCTAB           GetTab_Impl() = 0;
@@ -219,8 +219,8 @@ class ScGlobalNamedRangesObj final : public ScNamedRangesObj
 {
 private:
 
-    virtual ScNamedRangeObj* GetObjectByIndex_Impl(sal_uInt16 nIndex) override;
-    virtual ScNamedRangeObj* GetObjectByName_Impl(const OUString& aName) 
override;
+    virtual rtl::Reference<ScNamedRangeObj> GetObjectByIndex_Impl(sal_uInt16 
nIndex) override;
+    virtual rtl::Reference<ScNamedRangeObj> GetObjectByName_Impl(const 
OUString& aName) override;
 
     virtual ScRangeName*    GetRangeName_Impl() override;
     virtual SCTAB           GetTab_Impl() override;
@@ -234,8 +234,8 @@ class ScLocalNamedRangesObj final : public ScNamedRangesObj
 {
 private:
 
-    virtual ScNamedRangeObj* GetObjectByIndex_Impl(sal_uInt16 nIndex) override;
-    virtual ScNamedRangeObj* GetObjectByName_Impl(const OUString& aName) 
override;
+    virtual rtl::Reference<ScNamedRangeObj> GetObjectByIndex_Impl(sal_uInt16 
nIndex) override;
+    virtual rtl::Reference<ScNamedRangeObj> GetObjectByName_Impl(const 
OUString& aName) override;
 
     virtual ScRangeName*    GetRangeName_Impl() override;
     virtual SCTAB           GetTab_Impl() override;
@@ -288,7 +288,7 @@ private:
     ScDocShell*             pDocShell;
     bool                    bColumn;
 
-    ScLabelRangeObj*        GetObjectByIndex_Impl(size_t nIndex);
+    rtl::Reference<ScLabelRangeObj> GetObjectByIndex_Impl(size_t nIndex);
 
 public:
                             ScLabelRangesObj(ScDocShell* pDocSh, bool bCol);
diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx
index 84179f8a27fb..ee9adbeecbd2 100644
--- a/sc/inc/styleuno.hxx
+++ b/sc/inc/styleuno.hxx
@@ -56,9 +56,9 @@ class ScStyleFamiliesObj final : public 
::cppu::WeakImplHelper<
 private:
     ScDocShell*             pDocShell;
 
-    ScStyleFamilyObj*       GetObjectByType_Impl(SfxStyleFamily nType) const;
-    ScStyleFamilyObj*       GetObjectByIndex_Impl(sal_uInt32 nIndex) const;
-    ScStyleFamilyObj*       GetObjectByName_Impl(std::u16string_view aName) 
const;
+    rtl::Reference<ScStyleFamilyObj> GetObjectByType_Impl(SfxStyleFamily 
nType) const;
+    rtl::Reference<ScStyleFamilyObj> GetObjectByIndex_Impl(sal_uInt32 nIndex) 
const;
+    rtl::Reference<ScStyleFamilyObj> GetObjectByName_Impl(std::u16string_view 
aName) const;
 
 public:
                             ScStyleFamiliesObj(ScDocShell* pDocSh);
@@ -110,8 +110,8 @@ private:
     ScDocShell*             pDocShell;
     SfxStyleFamily          eFamily;        // Family
 
-    ScStyleObj*             GetObjectByIndex_Impl(sal_Int32 nIndex);
-    ScStyleObj*             GetObjectByName_Impl(const OUString& Name);
+    rtl::Reference<ScStyleObj> GetObjectByIndex_Impl(sal_Int32 nIndex);
+    rtl::Reference<ScStyleObj> GetObjectByName_Impl(const OUString& Name);
 
 public:
                             ScStyleFamilyObj(ScDocShell* pDocSh, 
SfxStyleFamily eFam);
diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx
index 4b4842966ac6..bdf97fb7cc7e 100644
--- a/sc/inc/viewuno.hxx
+++ b/sc/inc/viewuno.hxx
@@ -159,7 +159,7 @@ private:
     bool                                    bDrawSelModeSet;
     bool                                    bFilteredRangeSelection;
 
-    ScViewPaneObj*          GetObjectByIndex_Impl(sal_uInt16 nIndex) const;
+    rtl::Reference<ScViewPaneObj> GetObjectByIndex_Impl(sal_uInt16 nIndex) 
const;
     sal_Int16                   GetZoom() const;
     void                    SetZoom(sal_Int16 Zoom);
     sal_Int16                   GetZoomType() const;
diff --git a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx 
b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
index 6c5867c12093..2d16ba97311b 100644
--- a/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCsvControl.cxx
@@ -1270,7 +1270,7 @@ OUString ScAccessibleCsvGrid::implGetCellText( sal_Int32 
nRow, sal_Int32 nColumn
     return aCellStr;
 }
 
-ScAccessibleCsvCell* ScAccessibleCsvGrid::implCreateCellObj( sal_Int32 nRow, 
sal_Int32 nColumn )
+rtl::Reference<ScAccessibleCsvCell> ScAccessibleCsvGrid::implCreateCellObj( 
sal_Int32 nRow, sal_Int32 nColumn )
 {
     return new ScAccessibleCsvCell(implGetGrid(), implGetCellText(nRow, 
nColumn), nRow, nColumn);
 }
diff --git a/sc/source/ui/inc/AccessibleCsvControl.hxx 
b/sc/source/ui/inc/AccessibleCsvControl.hxx
index 9cdd4c021d7d..bb83a39e651c 100644
--- a/sc/source/ui/inc/AccessibleCsvControl.hxx
+++ b/sc/source/ui/inc/AccessibleCsvControl.hxx
@@ -423,7 +423,7 @@ private:
     /** Returns the contents of the specified cell (including header). Indexes 
must be valid. */
     OUString implGetCellText( sal_Int32 nRow, sal_Int32 nColumn ) const;
     /** Creates a new accessible object of the specified cell. Indexes must be 
valid. */
-    ScAccessibleCsvCell* implCreateCellObj(sal_Int32 nRow, sal_Int32 nColumn);
+    rtl::Reference<ScAccessibleCsvCell> implCreateCellObj(sal_Int32 nRow, 
sal_Int32 nColumn);
 
     css::uno::Reference<css::accessibility::XAccessible> 
getAccessibleCell(sal_Int32 nRow, sal_Int32 nColumn);
 };
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index d56c6d545d0c..b343fd1afe36 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -165,7 +165,7 @@ 
ScAutoFormatsObj_get_implementation(css::uno::XComponentContext*, css::uno::Sequ
 
 // XTableAutoFormats
 
-ScAutoFormatObj* ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
+rtl::Reference<ScAutoFormatObj> 
ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
 {
     if (nIndex < ScGlobal::GetOrCreateAutoFormat()->size())
         return new ScAutoFormatObj(nIndex);
@@ -173,7 +173,7 @@ ScAutoFormatObj* 
ScAutoFormatsObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
     return nullptr;    // wrong index
 }
 
-ScAutoFormatObj* ScAutoFormatsObj::GetObjectByName_Impl(std::u16string_view 
aName)
+rtl::Reference<ScAutoFormatObj> 
ScAutoFormatsObj::GetObjectByName_Impl(std::u16string_view aName)
 {
     sal_uInt16 nIndex;
     if (lcl_FindAutoFormatIndex(
@@ -362,7 +362,7 @@ UNO3_GETIMPLEMENTATION_IMPL(ScAutoFormatObj);
 
 // XTableAutoFormat
 
-ScAutoFormatFieldObj* ScAutoFormatObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
+rtl::Reference<ScAutoFormatFieldObj> 
ScAutoFormatObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
 {
     if ( IsInserted() && nIndex < SC_AF_FIELD_COUNT )
         return new ScAutoFormatFieldObj( nFormatIndex, nIndex );
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 993cc5babce5..8365bd4013f1 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4060,7 +4060,7 @@ uno::Sequence<sal_Int8> SAL_CALL 
ScCellRangesObj::getImplementationId()
 
 // XCellRanges
 
-ScCellRangeObj* ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
+rtl::Reference<ScCellRangeObj> 
ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
 {
     ScDocShell* pDocSh = GetDocShell();
     const ScRangeList& rRanges = GetRangeList();
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index 638d517b4083..d701437bcda3 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -81,7 +81,7 @@ void ScChartsObj::Notify( SfxBroadcaster&, const SfxHint& 
rHint )
     }
 }
 
-ScChartObj* ScChartsObj::GetObjectByIndex_Impl(tools::Long nIndex) const
+rtl::Reference<ScChartObj> ScChartsObj::GetObjectByIndex_Impl(tools::Long 
nIndex) const
 {
     OUString aName;
     if ( pDocShell )
@@ -121,7 +121,7 @@ ScChartObj* ScChartsObj::GetObjectByIndex_Impl(tools::Long 
nIndex) const
     return nullptr;
 }
 
-ScChartObj* ScChartsObj::GetObjectByName_Impl(const OUString& aName) const
+rtl::Reference<ScChartObj> ScChartsObj::GetObjectByName_Impl(const OUString& 
aName) const
 {
     if (sc::tools::findChartsByName(pDocShell, nTab, aName, 
sc::tools::ChartSourceType::CELL_RANGE))
         return new ScChartObj( pDocShell, nTab, aName );
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 3840745882ac..36c40bb3b60c 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -322,7 +322,7 @@ void ScDataPilotTablesObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XDataPilotTables
 
-ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 
nIndex )
+rtl::Reference<ScDataPilotTableObj> 
ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nIndex )
 {
     if (pDocShell)
     {
@@ -350,7 +350,7 @@ ScDataPilotTableObj* 
ScDataPilotTablesObj::GetObjectByIndex_Impl( sal_Int32 nInd
     return nullptr;
 }
 
-ScDataPilotTableObj* ScDataPilotTablesObj::GetObjectByName_Impl(const 
OUString& rName)
+rtl::Reference<ScDataPilotTableObj> 
ScDataPilotTablesObj::GetObjectByName_Impl(const OUString& rName)
 {
     if (hasByName(rName))
         return new ScDataPilotTableObj( pDocShell, nTab, rName );
@@ -1536,7 +1536,7 @@ static bool lcl_GetFieldDataByName( ScDPObject* pDPObj, 
const OUString& rFieldNa
 
 // XDataPilotFields
 
-ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByIndex_Impl( sal_Int32 
nIndex ) const
+rtl::Reference<ScDataPilotFieldObj> 
ScDataPilotFieldsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) const
 {
     if (ScDPObject* pObj = GetDPObject())
     {
@@ -1547,7 +1547,7 @@ ScDataPilotFieldObj* 
ScDataPilotFieldsObj::GetObjectByIndex_Impl( sal_Int32 nInd
     return nullptr;
 }
 
-ScDataPilotFieldObj* ScDataPilotFieldsObj::GetObjectByName_Impl(const 
OUString& aName) const
+rtl::Reference<ScDataPilotFieldObj> 
ScDataPilotFieldsObj::GetObjectByName_Impl(const OUString& aName) const
 {
     if (ScDPObject* pDPObj = GetDPObject())
     {
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 8e8e54536037..6828d503a3d8 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -537,7 +537,7 @@ ScSubTotalDescriptorBase::~ScSubTotalDescriptorBase()
 
 // XSubTotalDescriptor
 
-ScSubTotalFieldObj* ScSubTotalDescriptorBase::GetObjectByIndex_Impl(sal_uInt16 
nIndex)
+rtl::Reference<ScSubTotalFieldObj> 
ScSubTotalDescriptorBase::GetObjectByIndex_Impl(sal_uInt16 nIndex)
 {
     if ( nIndex < getCount() )
         return new ScSubTotalFieldObj( this, nIndex );
@@ -2127,7 +2127,7 @@ void ScDatabaseRangesObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XDatabaseRanges
 
-ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex)
+rtl::Reference<ScDatabaseRangeObj> 
ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex)
 {
     if (!pDocShell)
         return nullptr;
@@ -2145,7 +2145,7 @@ ScDatabaseRangeObj* 
ScDatabaseRangesObj::GetObjectByIndex_Impl(size_t nIndex)
     return new ScDatabaseRangeObj(pDocShell, (*itr)->GetName());
 }
 
-ScDatabaseRangeObj* ScDatabaseRangesObj::GetObjectByName_Impl(const OUString& 
aName)
+rtl::Reference<ScDatabaseRangeObj> 
ScDatabaseRangesObj::GetObjectByName_Impl(const OUString& aName)
 {
     if ( pDocShell && hasByName(aName) )
     {
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 5ba795cf5298..6780821b6cab 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -3564,7 +3564,7 @@ void ScTableSheetsObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XSpreadsheets
 
-ScTableSheetObj* ScTableSheetsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) 
const
+rtl::Reference<ScTableSheetObj> 
ScTableSheetsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
 {
     if ( pDocShell && nIndex >= 0 && nIndex < 
pDocShell->GetDocument().GetTableCount() )
         return new ScTableSheetObj( pDocShell, static_cast<SCTAB>(nIndex) );
@@ -3572,7 +3572,7 @@ ScTableSheetObj* 
ScTableSheetsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
     return nullptr;
 }
 
-ScTableSheetObj* ScTableSheetsObj::GetObjectByName_Impl(const OUString& aName) 
const
+rtl::Reference<ScTableSheetObj> ScTableSheetsObj::GetObjectByName_Impl(const 
OUString& aName) const
 {
     if (pDocShell)
     {
@@ -3783,7 +3783,7 @@ sal_Int32 ScTableSheetsObj::importSheet(
 uno::Reference< table::XCell > SAL_CALL ScTableSheetsObj::getCellByPosition( 
sal_Int32 nColumn, sal_Int32 nRow, sal_Int32 nSheet )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XCellRange> 
xSheet(static_cast<ScCellRangeObj*>(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet))));
+    rtl::Reference<ScTableSheetObj> xSheet = 
GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet));
     if (! xSheet.is())
         throw lang::IndexOutOfBoundsException();
 
@@ -3793,7 +3793,7 @@ uno::Reference< table::XCell > SAL_CALL 
ScTableSheetsObj::getCellByPosition( sal
 uno::Reference< table::XCellRange > SAL_CALL 
ScTableSheetsObj::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, 
sal_Int32 nRight, sal_Int32 nBottom, sal_Int32 nSheet )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XCellRange> 
xSheet(static_cast<ScCellRangeObj*>(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet))));
+    rtl::Reference<ScTableSheetObj> xSheet = 
GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet));
     if (! xSheet.is())
         throw lang::IndexOutOfBoundsException();
 
@@ -3941,7 +3941,7 @@ void ScTableColumnsObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XTableColumns
 
-ScTableColumnObj* ScTableColumnsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) 
const
+rtl::Reference<ScTableColumnObj> 
ScTableColumnsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
 {
     SCCOL nCol = static_cast<SCCOL>(nIndex) + nStartCol;
     if ( pDocShell && nCol <= nEndCol )
@@ -3950,7 +3950,7 @@ ScTableColumnObj* 
ScTableColumnsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) con
     return nullptr;    // wrong index
 }
 
-ScTableColumnObj* ScTableColumnsObj::GetObjectByName_Impl(const OUString& 
aName) const
+rtl::Reference<ScTableColumnObj> ScTableColumnsObj::GetObjectByName_Impl(const 
OUString& aName) const
 {
     SCCOL nCol = 0;
     if ( ::AlphaToCol( pDocShell->GetDocument(), nCol, aName) )
@@ -4198,7 +4198,7 @@ void ScTableRowsObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XTableRows
 
-ScTableRowObj* ScTableRowsObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
+rtl::Reference<ScTableRowObj> ScTableRowsObj::GetObjectByIndex_Impl(sal_Int32 
nIndex) const
 {
     SCROW nRow = static_cast<SCROW>(nIndex) + nStartRow;
     if ( pDocShell && nRow <= nEndRow )
@@ -4502,7 +4502,7 @@ bool ScAnnotationsObj::GetAddressByIndex_Impl( sal_Int32 
nIndex, ScAddress& rPos
     return rPos.IsValid();
 }
 
-ScAnnotationObj* ScAnnotationsObj::GetObjectByIndex_Impl( sal_Int32 nIndex ) 
const
+rtl::Reference<ScAnnotationObj> ScAnnotationsObj::GetObjectByIndex_Impl( 
sal_Int32 nIndex ) const
 {
     if (pDocShell)
     {
@@ -4641,7 +4641,7 @@ bool ScScenariosObj::GetScenarioIndex_Impl( 
std::u16string_view rName, SCTAB& rI
     return false;
 }
 
-ScTableSheetObj* ScScenariosObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
+rtl::Reference<ScTableSheetObj> 
ScScenariosObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
 {
     sal_uInt16 nCount = static_cast<sal_uInt16>(getCount());
     if ( pDocShell && nIndex >= 0 && nIndex < nCount )
@@ -4650,7 +4650,7 @@ ScTableSheetObj* 
ScScenariosObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
     return nullptr;    // no document or wrong index
 }
 
-ScTableSheetObj* ScScenariosObj::GetObjectByName_Impl(std::u16string_view 
aName)
+rtl::Reference<ScTableSheetObj> 
ScScenariosObj::GetObjectByName_Impl(std::u16string_view aName)
 {
     SCTAB nIndex;
     if ( pDocShell && GetScenarioIndex_Impl( aName, nIndex ) )
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index fedc5af6ba66..d58e19fc0b3e 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -383,7 +383,7 @@ void ScSheetLinksObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XSheetLinks
 
-ScSheetLinkObj* ScSheetLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
+rtl::Reference<ScSheetLinkObj> 
ScSheetLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
 {
     if (!pDocShell)
         return nullptr;
@@ -411,7 +411,7 @@ ScSheetLinkObj* 
ScSheetLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
     return nullptr;    // no document or index too large
 }
 
-ScSheetLinkObj* ScSheetLinksObj::GetObjectByName_Impl(const OUString& aName)
+rtl::Reference<ScSheetLinkObj> ScSheetLinksObj::GetObjectByName_Impl(const 
OUString& aName)
 {
     //  Name is the same as file name
 
@@ -898,7 +898,7 @@ void ScAreaLinksObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XAreaLinks
 
-ScAreaLinkObj* ScAreaLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
+rtl::Reference<ScAreaLinkObj> ScAreaLinksObj::GetObjectByIndex_Impl(sal_Int32 
nIndex)
 {
     if ( pDocShell && nIndex >= 0 && nIndex < getCount() )
         return new ScAreaLinkObj( pDocShell, static_cast<size_t>(nIndex) );
@@ -1208,7 +1208,7 @@ void ScDDELinksObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XDDELinks
 
-ScDDELinkObj* ScDDELinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
+rtl::Reference<ScDDELinkObj> ScDDELinksObj::GetObjectByIndex_Impl(sal_Int32 
nIndex)
 {
     if (pDocShell)
     {
@@ -1219,7 +1219,7 @@ ScDDELinkObj* 
ScDDELinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
     return nullptr;
 }
 
-ScDDELinkObj* ScDDELinksObj::GetObjectByName_Impl(std::u16string_view aName)
+rtl::Reference<ScDDELinkObj> 
ScDDELinksObj::GetObjectByName_Impl(std::u16string_view aName)
 {
     if (pDocShell)
     {
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index 26b16368ef25..ef322f64590d 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -785,7 +785,7 @@ ScGlobalNamedRangesObj::~ScGlobalNamedRangesObj()
 
 }
 
-ScNamedRangeObj* ScGlobalNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 
nIndex)
+rtl::Reference<ScNamedRangeObj> 
ScGlobalNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex)
 {
     if (!pDocShell)
         return nullptr;
@@ -807,7 +807,7 @@ ScNamedRangeObj* 
ScGlobalNamedRangesObj::GetObjectByIndex_Impl(sal_uInt16 nIndex
     return nullptr;
 }
 
-ScNamedRangeObj* ScGlobalNamedRangesObj::GetObjectByName_Impl(const OUString& 
aName)
+rtl::Reference<ScNamedRangeObj> 
ScGlobalNamedRangesObj::GetObjectByName_Impl(const OUString& aName)
 {
     if ( pDocShell && hasByName(aName) )
         return new ScNamedRangeObj(this, pDocShell, aName);
@@ -836,7 +836,7 @@ ScLocalNamedRangesObj::~ScLocalNamedRangesObj()
 
 }
 
-ScNamedRangeObj* ScLocalNamedRangesObj::GetObjectByName_Impl(const OUString& 
aName)
+rtl::Reference<ScNamedRangeObj> 
ScLocalNamedRangesObj::GetObjectByName_Impl(const OUString& aName)
 {
     if ( pDocShell && hasByName( aName ) )
         return new ScNamedRangeObj( this, pDocShell, aName, mxSheet);
@@ -844,7 +844,7 @@ ScNamedRangeObj* 
ScLocalNamedRangesObj::GetObjectByName_Impl(const OUString& aNa
 
 }
 
-ScNamedRangeObj* ScLocalNamedRangesObj::GetObjectByIndex_Impl( sal_uInt16 
nIndex )
+rtl::Reference<ScNamedRangeObj> ScLocalNamedRangesObj::GetObjectByIndex_Impl( 
sal_uInt16 nIndex )
 {
     if (!pDocShell)
         return nullptr;
@@ -1026,7 +1026,7 @@ void ScLabelRangesObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // sheet::XLabelRanges
 
-ScLabelRangeObj* ScLabelRangesObj::GetObjectByIndex_Impl(size_t nIndex)
+rtl::Reference<ScLabelRangeObj> ScLabelRangesObj::GetObjectByIndex_Impl(size_t 
nIndex)
 {
     if (pDocShell)
     {
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 81cf3a048067..de1563ed8f58 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -430,7 +430,7 @@ void ScStyleFamiliesObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XStyleFamilies
 
-ScStyleFamilyObj*ScStyleFamiliesObj::GetObjectByType_Impl(SfxStyleFamily 
nType) const
+rtl::Reference<ScStyleFamilyObj> 
ScStyleFamiliesObj::GetObjectByType_Impl(SfxStyleFamily nType) const
 {
     if ( pDocShell )
     {
@@ -443,7 +443,7 @@ 
ScStyleFamilyObj*ScStyleFamiliesObj::GetObjectByType_Impl(SfxStyleFamily nType)
     return nullptr;
 }
 
-ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) 
const
+rtl::Reference<ScStyleFamilyObj> 
ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) const
 {
     if ( nIndex < SC_STYLE_FAMILY_COUNT )
         return GetObjectByType_Impl(aStyleFamilyTypes[nIndex]);
@@ -451,7 +451,7 @@ ScStyleFamilyObj* 
ScStyleFamiliesObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) c
     return nullptr;    // invalid index
 }
 
-ScStyleFamilyObj* ScStyleFamiliesObj::GetObjectByName_Impl(std::u16string_view 
aName) const
+rtl::Reference<ScStyleFamilyObj> 
ScStyleFamiliesObj::GetObjectByName_Impl(std::u16string_view aName) const
 {
     if ( pDocShell )
     {
@@ -634,7 +634,7 @@ void ScStyleFamilyObj::Notify( SfxBroadcaster&, const 
SfxHint& rHint )
 
 // XStyleFamily
 
-ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
+rtl::Reference<ScStyleObj> ScStyleFamilyObj::GetObjectByIndex_Impl(sal_Int32 
nIndex)
 {
     if ( pDocShell )
     {
@@ -654,7 +654,7 @@ ScStyleObj* 
ScStyleFamilyObj::GetObjectByIndex_Impl(sal_Int32 nIndex)
     return nullptr;
 }
 
-ScStyleObj* ScStyleFamilyObj::GetObjectByName_Impl(const OUString& aName)
+rtl::Reference<ScStyleObj> ScStyleFamilyObj::GetObjectByName_Impl(const 
OUString& aName)
 {
     if ( pDocShell )
     {
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 5007ae4eda39..df01cd42855d 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -979,7 +979,7 @@ sal_Bool SAL_CALL ScTabViewObj::hasElements()
 
 // XSpreadsheetView
 
-ScViewPaneObj* ScTabViewObj::GetObjectByIndex_Impl(sal_uInt16 nIndex) const
+rtl::Reference<ScViewPaneObj> ScTabViewObj::GetObjectByIndex_Impl(sal_uInt16 
nIndex) const
 {
     static const ScSplitPos ePosHV[4] =
         { SC_SPLIT_TOPLEFT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_TOPRIGHT, 
SC_SPLIT_BOTTOMRIGHT };
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 10cbc01b9a11..138857b54dfb 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -1223,7 +1223,7 @@ bool getScRangeListForAddress( const OUString& sName, 
ScDocShell* pDocSh, const
 }
 
 /// @throws uno::RuntimeException
-static ScVbaRange*
+static rtl::Reference<ScVbaRange>
 getRangeForName( const uno::Reference< uno::XComponentContext >& xContext, 
const OUString& sName, ScDocShell* pDocSh, const table::CellRangeAddress& 
pAddr, formula::FormulaGrammar::AddressConvention eConv = 
formula::FormulaGrammar::CONV_XL_A1 )
 {
     ScRangeList aCellRanges;
diff --git a/sc/source/ui/vba/vbasheetobjects.cxx 
b/sc/source/ui/vba/vbasheetobjects.cxx
index a325343437a6..32e025a3ca7e 100644
--- a/sc/source/ui/vba/vbasheetobjects.cxx
+++ b/sc/source/ui/vba/vbasheetobjects.cxx
@@ -137,7 +137,7 @@ protected:
 
         @throws uno::RuntimeException
     */
-    virtual ScVbaSheetObjectBase* implCreateVbaObject( const uno::Reference< 
drawing::XShape >& rxShape ) = 0;
+    virtual rtl::Reference<ScVbaSheetObjectBase> implCreateVbaObject( const 
uno::Reference< drawing::XShape >& rxShape ) = 0;
     /** Derived classes return the service name of the UNO shape. */
     virtual OUString implGetShapeServiceName() const = 0;
 
@@ -499,7 +499,7 @@ public:
         bool bOptionButtons);
 
 protected:
-    virtual ScVbaSheetObjectBase* implCreateVbaObject( const uno::Reference< 
drawing::XShape >& rxShape ) override;
+    virtual rtl::Reference<ScVbaSheetObjectBase> implCreateVbaObject( const 
uno::Reference< drawing::XShape >& rxShape ) override;
     virtual bool implCheckProperties( const uno::Reference< 
beans::XPropertySet >& rxModelProps ) const override;
 };
 
@@ -524,7 +524,7 @@ ScVbaButtonContainer::ScVbaButtonContainer(
 {
 }
 
-ScVbaSheetObjectBase* ScVbaButtonContainer::implCreateVbaObject( const 
uno::Reference< drawing::XShape >& rxShape )
+rtl::Reference<ScVbaSheetObjectBase> 
ScVbaButtonContainer::implCreateVbaObject( const uno::Reference< 
drawing::XShape >& rxShape )
 {
     uno::Reference< drawing::XControlShape > xControlShape( rxShape, 
uno::UNO_QUERY_THROW );
     return new ScVbaButton( mxParent, mxContext, mxModel, createForm(), 
xControlShape );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to