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

Noel (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 22 12:40:38 UTC 2021


 accessibility/inc/extended/AccessibleBrowseBoxBase.hxx            |    2 
 accessibility/inc/extended/AccessibleBrowseBoxCheckBoxCell.hxx    |    2 
 accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx      |    2 
 accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx       |    2 
 accessibility/inc/extended/AccessibleGridControlBase.hxx          |    3 -
 accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx    |    2 
 accessibility/inc/extended/AccessibleGridControlTable.hxx         |    7 --
 accessibility/inc/extended/AccessibleGridControlTableCell.hxx     |    2 
 accessibility/source/extended/AccessibleBrowseBox.cxx             |    2 
 accessibility/source/extended/AccessibleBrowseBoxBase.cxx         |    4 -
 accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx |    4 -
 accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx   |    4 -
 accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx    |    4 -
 accessibility/source/extended/AccessibleGridControl.cxx           |   12 ----
 accessibility/source/extended/AccessibleGridControlBase.cxx       |    4 -
 accessibility/source/extended/AccessibleGridControlHeader.cxx     |    8 +-
 accessibility/source/extended/AccessibleGridControlHeaderCell.cxx |    4 -
 accessibility/source/extended/AccessibleGridControlTable.cxx      |   28 ++++------
 accessibility/source/extended/AccessibleGridControlTableCell.cxx  |    4 -
 accessibility/source/extended/accessibleiconchoicectrlentry.cxx   |    5 -
 accessibility/source/extended/accessiblelistbox.cxx               |    4 -
 accessibility/source/extended/accessiblelistboxentry.cxx          |    7 +-
 accessibility/source/extended/accessibletabbar.cxx                |   11 +--
 accessibility/source/extended/accessibletabbarpage.cxx            |    9 +--
 accessibility/source/extended/accessibletabbarpagelist.cxx        |    9 +--
 accessibility/source/extended/textwindowaccessibility.cxx         |    5 -
 accessibility/source/helper/acc_factory.cxx                       |    2 
 accessibility/source/standard/accessiblemenubasecomponent.cxx     |    7 +-
 accessibility/source/standard/accessiblemenucomponent.cxx         |    6 --
 accessibility/source/standard/accessiblemenuitemcomponent.cxx     |    4 -
 accessibility/source/standard/vclxaccessiblebox.cxx               |    2 
 accessibility/source/standard/vclxaccessiblebutton.cxx            |    5 -
 accessibility/source/standard/vclxaccessiblecheckbox.cxx          |    5 -
 accessibility/source/standard/vclxaccessibleheaderbaritem.cxx     |    9 +--
 accessibility/source/standard/vclxaccessiblelistitem.cxx          |   11 +--
 accessibility/source/standard/vclxaccessiblemenuitem.cxx          |    7 +-
 accessibility/source/standard/vclxaccessibleradiobutton.cxx       |    5 -
 accessibility/source/standard/vclxaccessiblestatusbaritem.cxx     |   11 +--
 accessibility/source/standard/vclxaccessibletabpage.cxx           |   11 +--
 accessibility/source/standard/vclxaccessibletextcomponent.cxx     |    2 
 accessibility/source/standard/vclxaccessibletoolbox.cxx           |    2 
 accessibility/source/standard/vclxaccessibletoolboxitem.cxx       |   11 +--
 42 files changed, 99 insertions(+), 151 deletions(-)

New commits:
commit 18aafdd0f936ab6bb4225447a328f5471d143b0d
Author:     Noel <noel.grandin at collabora.co.uk>
AuthorDate: Mon Feb 22 10:46:47 2021 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Feb 22 13:39:58 2021 +0100

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

diff --git a/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx b/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx
index ea2a011723f3..7f7788fe3d35 100644
--- a/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx
+++ b/accessibility/inc/extended/AccessibleBrowseBoxBase.hxx
@@ -254,7 +254,7 @@ protected:
         may overwrite this method and add more states.
         @attention  This method requires locked mutex's.
         @return  A filled AccessibleStateSetHelper. */
-    virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+    virtual rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper();
 
     // internal helper methods
 
diff --git a/accessibility/inc/extended/AccessibleBrowseBoxCheckBoxCell.hxx b/accessibility/inc/extended/AccessibleBrowseBoxCheckBoxCell.hxx
index 0ad34ba18ede..a550eed5e220 100644
--- a/accessibility/inc/extended/AccessibleBrowseBoxCheckBoxCell.hxx
+++ b/accessibility/inc/extended/AccessibleBrowseBoxCheckBoxCell.hxx
@@ -39,7 +39,7 @@ namespace accessibility
 
         virtual ~AccessibleCheckBoxCell() override {}
 
-        virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper() override;
+        virtual rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper() override;
 
     public:
         AccessibleCheckBoxCell(const css::uno::Reference< css::accessibility::XAccessible >& _rxParent,
diff --git a/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx b/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx
index 2987483ff65c..366a7c12997b 100644
--- a/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx
+++ b/accessibility/inc/extended/AccessibleBrowseBoxHeaderCell.hxx
@@ -59,7 +59,7 @@ namespace accessibility
             @return
                 A filled AccessibleStateSetHelper.
         */
-        ::utl::AccessibleStateSetHelper* implCreateStateSetHelper() override;
+        rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper() override;
 
     private:
         virtual tools::Rectangle implGetBoundingBox() override;
diff --git a/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx b/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
index 89569914c516..8518e5e62b9d 100644
--- a/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
+++ b/accessibility/inc/extended/AccessibleBrowseBoxTableCell.hxx
@@ -89,7 +89,7 @@ namespace accessibility
             @return
                 A filled AccessibleStateSetHelper.
         */
-        ::utl::AccessibleStateSetHelper* implCreateStateSetHelper() override;
+        rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper() override;
 
         // XAccessible ------------------------------------------------------------
 
diff --git a/accessibility/inc/extended/AccessibleGridControlBase.hxx b/accessibility/inc/extended/AccessibleGridControlBase.hxx
index b9b0a1b617a3..361c8d4d59f6 100644
--- a/accessibility/inc/extended/AccessibleGridControlBase.hxx
+++ b/accessibility/inc/extended/AccessibleGridControlBase.hxx
@@ -22,6 +22,7 @@
 
 #include <vcl/accessibletable.hxx>
 #include <rtl/ustring.hxx>
+#include <rtl/ref.hxx>
 #include <tools/gen.hxx>
 #include <cppuhelper/compbase4.hxx>
 #include <cppuhelper/implbase1.hxx>
@@ -219,7 +220,7 @@ protected:
         may overwrite this method and add more states.
         @attention  This method requires locked mutex's.
         @return  A filled AccessibleStateSetHelper. */
-    virtual ::utl::AccessibleStateSetHelper* implCreateStateSetHelper();
+    virtual rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper();
 
     // internal helper methods
 
diff --git a/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx b/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx
index 68dbc020ec07..699c7e37afa7 100644
--- a/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx
+++ b/accessibility/inc/extended/AccessibleGridControlHeaderCell.hxx
@@ -69,7 +69,7 @@ namespace accessibility
             @return
                 A filled AccessibleStateSetHelper.
         */
-        ::utl::AccessibleStateSetHelper* implCreateStateSetHelper() override;
+        rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper() override;
 
     private:
         virtual tools::Rectangle implGetBoundingBox() override;
diff --git a/accessibility/inc/extended/AccessibleGridControlTable.hxx b/accessibility/inc/extended/AccessibleGridControlTable.hxx
index db13b4a2197c..b4f2b7a7dba3 100644
--- a/accessibility/inc/extended/AccessibleGridControlTable.hxx
+++ b/accessibility/inc/extended/AccessibleGridControlTable.hxx
@@ -43,8 +43,7 @@ public:
 
 private:
     virtual ~AccessibleGridControlTable() override = default;
-    std::vector< AccessibleGridControlTableCell* > m_pCellVector;
-    std::vector< css::uno::Reference< css::accessibility::XAccessible> > m_pAccessCellVector;
+    std::vector< rtl::Reference<AccessibleGridControlTableCell> > m_aCellVector;
 public:
     // XAccessibleContext
 
@@ -141,9 +140,7 @@ public:
     virtual OUString SAL_CALL getImplementationName() override;
 
     /**@return m_pCellVector*/
-    std::vector< AccessibleGridControlTableCell* >& getCellVector() { return m_pCellVector;}
-    /**@return m_xAccessCellVector*/
-    std::vector< css::uno::Reference< css::accessibility::XAccessible > >& getAccessibleCellVector() { return m_pAccessCellVector;}
+    std::vector< rtl::Reference<AccessibleGridControlTableCell> >& getCellVector() { return m_aCellVector;}
 
 private:
     // internal virtual methods
diff --git a/accessibility/inc/extended/AccessibleGridControlTableCell.hxx b/accessibility/inc/extended/AccessibleGridControlTableCell.hxx
index 1c104d14933f..d811156fe909 100644
--- a/accessibility/inc/extended/AccessibleGridControlTableCell.hxx
+++ b/accessibility/inc/extended/AccessibleGridControlTableCell.hxx
@@ -113,7 +113,7 @@ namespace accessibility
             @return
                 A filled AccessibleStateSetHelper.
         */
-        ::utl::AccessibleStateSetHelper* implCreateStateSetHelper() override;
+        rtl::Reference<::utl::AccessibleStateSetHelper> implCreateStateSetHelper() override;
 
         // XAccessible ------------------------------------------------------------
 
diff --git a/accessibility/source/extended/AccessibleBrowseBox.cxx b/accessibility/source/extended/AccessibleBrowseBox.cxx
index 28698162ed48..c6fb251b849e 100644
--- a/accessibility/source/extended/AccessibleBrowseBox.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBox.cxx
@@ -212,7 +212,7 @@ AccessibleBrowseBox::implGetHeaderBar(vcl::AccessibleBrowseBoxObjType eObjType)
     {
         if( !pxMember->is() )
         {
-            AccessibleBrowseBoxHeaderBar* pHeaderBar = new AccessibleBrowseBoxHeaderBar(
+            rtl::Reference<AccessibleBrowseBoxHeaderBar> pHeaderBar = new AccessibleBrowseBoxHeaderBar(
                 m_aCreator, *mpBrowseBox, eObjType );
             *pxMember = pHeaderBar;
         }
diff --git a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
index 7b519e57ab4a..01b94d335857 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxBase.cxx
@@ -354,9 +354,9 @@ bool AccessibleBrowseBoxBase::implIsShowing()
     return bShowing;
 }
 
-::utl::AccessibleStateSetHelper* AccessibleBrowseBoxBase::implCreateStateSetHelper()
+rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleBrowseBoxBase::implCreateStateSetHelper()
 {
-    ::utl::AccessibleStateSetHelper*
+    rtl::Reference<::utl::AccessibleStateSetHelper>
         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
     if( isAlive() )
diff --git a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx
index de5c8a5d1686..2972b6e0002b 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxCheckBoxCell.cxx
@@ -52,9 +52,9 @@ namespace accessibility
         return this;
     }
 
-    ::utl::AccessibleStateSetHelper* AccessibleCheckBoxCell::implCreateStateSetHelper()
+    rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleCheckBoxCell::implCreateStateSetHelper()
     {
-        ::utl::AccessibleStateSetHelper* pStateSetHelper =
+        rtl::Reference<::utl::AccessibleStateSetHelper> pStateSetHelper =
             AccessibleBrowseBoxCell::implCreateStateSetHelper();
         if( isAlive() )
         {
diff --git a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
index 688f0283eae1..a88198d49f7f 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
@@ -48,11 +48,11 @@ AccessibleBrowseBoxHeaderCell::AccessibleBrowseBoxHeaderCell(sal_Int32 _nColumnR
     @return
         A filled AccessibleStateSetHelper.
 */
-::utl::AccessibleStateSetHelper* AccessibleBrowseBoxHeaderCell::implCreateStateSetHelper()
+rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleBrowseBoxHeaderCell::implCreateStateSetHelper()
 {
     SolarMethodGuard aGuard( getMutex() );
 
-    ::utl::AccessibleStateSetHelper*
+    rtl::Reference<::utl::AccessibleStateSetHelper>
         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
     if( isAlive() )
diff --git a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
index 1ff6fae2abd7..7827d686a3e8 100644
--- a/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
+++ b/accessibility/source/extended/AccessibleBrowseBoxTableCell.cxx
@@ -160,11 +160,11 @@ namespace accessibility
         @return
             A filled AccessibleStateSetHelper.
     */
-    ::utl::AccessibleStateSetHelper* AccessibleBrowseBoxTableCell::implCreateStateSetHelper()
+    rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleBrowseBoxTableCell::implCreateStateSetHelper()
     {
         SolarMethodGuard aGuard(getMutex());
 
-        ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+        rtl::Reference<::utl::AccessibleStateSetHelper> pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
         if( isAlive() )
         {
diff --git a/accessibility/source/extended/AccessibleGridControl.cxx b/accessibility/source/extended/AccessibleGridControl.cxx
index db7a1461a859..124ef5d4f69f 100644
--- a/accessibility/source/extended/AccessibleGridControl.cxx
+++ b/accessibility/source/extended/AccessibleGridControl.cxx
@@ -277,7 +277,7 @@ void AccessibleGridControl::commitCellEvent(sal_Int16 _nEventId,const Any& _rNew
             css::uno::Reference< css::accessibility::XAccessible > xAccessible = getAccessibleChild(i);
             if(css::uno::Reference< css::accessibility::XAccessible >(m_xTable) == xAccessible)
             {
-                std::vector< AccessibleGridControlTableCell* >& rCells =
+                std::vector< rtl::Reference<AccessibleGridControlTableCell> >& rCells =
                     m_xTable->getCellVector();
                 size_t nIndex = m_aTable.GetCurrentRow() * m_aTable.GetColumnCount()
                               + m_aTable.GetCurrentColumn();
@@ -320,10 +320,8 @@ void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNe
         {
             if(aChange.Type == AccessibleTableModelChangeType::DELETE)
             {
-                std::vector< AccessibleGridControlTableCell* >& rCells =
+                std::vector< rtl::Reference<AccessibleGridControlTableCell> >& rCells =
                     m_xTable->getCellVector();
-                std::vector< css::uno::Reference< css::accessibility::XAccessible > >& rAccCells =
-                    m_xTable->getAccessibleCellVector();
                 int nColCount = m_aTable.GetColumnCount();
                 // check valid index - entries are inserted lazily
                 size_t const nStart = nColCount * aChange.FirstRow;
@@ -334,12 +332,6 @@ void AccessibleGridControl::commitTableEvent(sal_Int16 _nEventId,const Any& _rNe
                         rCells.begin() + nStart,
                         rCells.begin() + std::min(rCells.size(), nEnd));
                 }
-                if (nStart < rAccCells.size())
-                {
-                    m_xTable->getAccessibleCellVector().erase(
-                        rAccCells.begin() + nStart,
-                        rAccCells.begin() + std::min(rAccCells.size(), nEnd));
-                }
                 m_xTable->commitEvent(_nEventId,_rNewValue,_rOldValue);
             }
             else
diff --git a/accessibility/source/extended/AccessibleGridControlBase.cxx b/accessibility/source/extended/AccessibleGridControlBase.cxx
index befe2b7c686b..34a6edadfa7d 100644
--- a/accessibility/source/extended/AccessibleGridControlBase.cxx
+++ b/accessibility/source/extended/AccessibleGridControlBase.cxx
@@ -279,9 +279,9 @@ bool AccessibleGridControlBase::implIsShowing()
     return bShowing;
 }
 
-::utl::AccessibleStateSetHelper* AccessibleGridControlBase::implCreateStateSetHelper()
+rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleGridControlBase::implCreateStateSetHelper()
 {
-    ::utl::AccessibleStateSetHelper*
+    rtl::Reference<::utl::AccessibleStateSetHelper>
         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
     if( isAlive() )
diff --git a/accessibility/source/extended/AccessibleGridControlHeader.cxx b/accessibility/source/extended/AccessibleGridControlHeader.cxx
index f276cfcfd053..d5f80820a4e3 100644
--- a/accessibility/source/extended/AccessibleGridControlHeader.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeader.cxx
@@ -61,12 +61,12 @@ AccessibleGridControlHeader::getAccessibleChild( sal_Int32 nChildIndex )
     Reference< XAccessible > xChild;
     if(m_eObjType == vcl::table::TCTYPE_COLUMNHEADERBAR)
     {
-        AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, vcl::table::TCTYPE_COLUMNHEADERCELL);
+        rtl::Reference<AccessibleGridControlHeaderCell> pColHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, vcl::table::TCTYPE_COLUMNHEADERCELL);
         xChild = pColHeaderCell;
     }
     else if(m_eObjType == vcl::table::TCTYPE_ROWHEADERBAR)
     {
-        AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, vcl::table::TCTYPE_ROWHEADERCELL);
+        rtl::Reference<AccessibleGridControlHeaderCell> pRowHeaderCell = new AccessibleGridControlHeaderCell(nChildIndex, this, m_aTable, vcl::table::TCTYPE_ROWHEADERCELL);
         xChild = pRowHeaderCell;
     }
     return xChild;
@@ -215,12 +215,12 @@ Reference< XAccessible > AccessibleGridControlHeader::implGetChild(
     Reference< XAccessible > xChild;
     if(m_eObjType == vcl::table::TCTYPE_COLUMNHEADERBAR)
     {
-        AccessibleGridControlHeaderCell* pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, vcl::table::TCTYPE_COLUMNHEADERCELL);
+        rtl::Reference<AccessibleGridControlHeaderCell> pColHeaderCell = new AccessibleGridControlHeaderCell(nColumnPos, this, m_aTable, vcl::table::TCTYPE_COLUMNHEADERCELL);
         xChild = pColHeaderCell;
     }
     else if(m_eObjType == vcl::table::TCTYPE_ROWHEADERBAR)
     {
-        AccessibleGridControlHeaderCell* pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, vcl::table::TCTYPE_ROWHEADERCELL);
+        rtl::Reference<AccessibleGridControlHeaderCell> pRowHeaderCell = new AccessibleGridControlHeaderCell(nRow, this, m_aTable, vcl::table::TCTYPE_ROWHEADERCELL);
         xChild = pRowHeaderCell;
     }
     return xChild;
diff --git a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
index c6a6a8a8eedc..2ad0e6c56d1f 100644
--- a/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlHeaderCell.cxx
@@ -44,9 +44,9 @@ AccessibleGridControlHeaderCell::AccessibleGridControlHeaderCell(sal_Int32 _nCol
     @return
         A filled AccessibleStateSetHelper.
 */
-::utl::AccessibleStateSetHelper* AccessibleGridControlHeaderCell::implCreateStateSetHelper()
+rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleGridControlHeaderCell::implCreateStateSetHelper()
 {
-    ::utl::AccessibleStateSetHelper*
+    rtl::Reference<::utl::AccessibleStateSetHelper>
         pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
     if( isAlive() )
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
index 75b96f4a825d..f147a7d364dd 100644
--- a/accessibility/source/extended/AccessibleGridControlTable.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -55,18 +55,16 @@ AccessibleGridControlTable::getAccessibleChild( sal_Int32 nChildIndex )
     ensureIsAlive();
     ensureIsValidIndex( nChildIndex );
     sal_Int32 nCount = getAccessibleChildCount();
-    if(m_pAccessCellVector.empty() || m_pAccessCellVector.size() != static_cast<unsigned>(nCount))
+    if(m_aCellVector.empty() || m_aCellVector.size() != static_cast<unsigned>(nCount))
     {
-        m_pAccessCellVector.resize(nCount);
-        m_pCellVector.resize(nCount);
+        m_aCellVector.resize(nCount);
     }
-    if(!m_pAccessCellVector[nChildIndex].is())
+    if(!m_aCellVector[nChildIndex].is())
     {
-        AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount());
-        m_pCellVector[nChildIndex] = pCell;
-        m_pAccessCellVector[nChildIndex] = pCell;
+        rtl::Reference<AccessibleGridControlTableCell> pCell = new AccessibleGridControlTableCell(this, m_aTable, nChildIndex/m_aTable.GetColumnCount(), nChildIndex%m_aTable.GetColumnCount());
+        m_aCellVector[nChildIndex] = pCell;
     }
-    return m_pAccessCellVector[nChildIndex];
+    return m_aCellVector[nChildIndex];
 }
 
 sal_Int32 SAL_CALL AccessibleGridControlTable::getAccessibleIndexInParent()
@@ -186,18 +184,16 @@ Reference< XAccessible > SAL_CALL AccessibleGridControlTable::getAccessibleCellA
     ensureIsValidAddress( nRow, nColumn );
     sal_Int32 nCount = getAccessibleChildCount();
     sal_Int32 nChildIndex = nRow*m_aTable.GetColumnCount() + nColumn;
-    if(m_pAccessCellVector.empty() || m_pAccessCellVector.size() != static_cast<unsigned>(nCount))
+    if(m_aCellVector.empty() || m_aCellVector.size() != static_cast<unsigned>(nCount))
     {
-        m_pAccessCellVector.resize(nCount);
-        m_pCellVector.resize(nCount);
+        m_aCellVector.resize(nCount);
     }
-    if(!m_pAccessCellVector[nChildIndex].is())
+    if(!m_aCellVector[nChildIndex].is())
     {
-        AccessibleGridControlTableCell* pCell = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn);
-        m_pCellVector[nChildIndex] = pCell;
-        m_pAccessCellVector[nChildIndex] = pCell;
+        rtl::Reference<AccessibleGridControlTableCell> pCell = new AccessibleGridControlTableCell(this, m_aTable, nRow, nColumn);
+        m_aCellVector[nChildIndex] = pCell;
     }
-    return m_pAccessCellVector[nChildIndex];
+    return m_aCellVector[nChildIndex];
 }
 
 sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
diff --git a/accessibility/source/extended/AccessibleGridControlTableCell.cxx b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
index 545df2f00d94..1096e24115f7 100644
--- a/accessibility/source/extended/AccessibleGridControlTableCell.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTableCell.cxx
@@ -174,9 +174,9 @@ namespace accessibility
         @return
             A filled AccessibleStateSetHelper.
     */
-    ::utl::AccessibleStateSetHelper* AccessibleGridControlTableCell::implCreateStateSetHelper()
+    rtl::Reference<::utl::AccessibleStateSetHelper> AccessibleGridControlTableCell::implCreateStateSetHelper()
     {
-        ::utl::AccessibleStateSetHelper* pStateSetHelper = new ::utl::AccessibleStateSetHelper;
+        rtl::Reference<::utl::AccessibleStateSetHelper> pStateSetHelper = new ::utl::AccessibleStateSetHelper;
 
         if( isAlive() )
         {
diff --git a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 09a14fe4b7c7..b4ed1db209ab 100644
--- a/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -302,8 +302,7 @@ namespace accessibility
         SolarMutexGuard aSolarGuard;
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-        Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+        rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
         if ( IsAlive_Impl() )
         {
@@ -323,7 +322,7 @@ namespace accessibility
         else
             pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
 
-        return xStateSet;
+        return pStateSetHelper;
     }
 
     Locale SAL_CALL AccessibleIconChoiceCtrlEntry::getLocale(  )
diff --git a/accessibility/source/extended/accessiblelistbox.cxx b/accessibility/source/extended/accessiblelistbox.cxx
index 345a4aa4e8d2..462f28664086 100644
--- a/accessibility/source/extended/accessiblelistbox.cxx
+++ b/accessibility/source/extended/accessiblelistbox.cxx
@@ -512,9 +512,7 @@ namespace accessibility
         }
         else
         {
-            AccessibleListBoxEntry *const pAccListBoxEntry =
-                new AccessibleListBoxEntry(*getListBox(), rEntry, *this);
-            pAccessible = pAccListBoxEntry;
+            pAccessible = new AccessibleListBoxEntry(*getListBox(), rEntry, *this);
             m_mapEntry.emplace(&rEntry, pAccessible);
         }
         assert(pAccessible.is());
diff --git a/accessibility/source/extended/accessiblelistboxentry.cxx b/accessibility/source/extended/accessiblelistboxentry.cxx
index 854c0495a565..32c77a3d11db 100644
--- a/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/accessibility/source/extended/accessiblelistboxentry.cxx
@@ -487,7 +487,7 @@ namespace accessibility
             xParent = implGetParentAccessible();
         if ( xParent.is() )
         {
-            utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+            rtl::Reference<utl::AccessibleRelationSetHelper> pRelationSetHelper = new utl::AccessibleRelationSetHelper;
             Sequence< Reference< XInterface > > aSequence { xParent };
             pRelationSetHelper->AddRelation(
                 AccessibleRelation( AccessibleRelationType::NODE_CHILD_OF, aSequence ) );
@@ -500,8 +500,7 @@ namespace accessibility
     {
         ::osl::MutexGuard aGuard( m_aMutex );
 
-        utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-        Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+        rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
         if ( IsAlive_Impl() )
         {
@@ -531,7 +530,7 @@ namespace accessibility
         else
             pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
 
-        return xStateSet;
+        return pStateSetHelper;
     }
 
     Locale SAL_CALL AccessibleListBoxEntry::getLocale(  )
diff --git a/accessibility/source/extended/accessibletabbar.cxx b/accessibility/source/extended/accessibletabbar.cxx
index a1393d067a59..218ed1cab071 100644
--- a/accessibility/source/extended/accessibletabbar.cxx
+++ b/accessibility/source/extended/accessibletabbar.cxx
@@ -336,9 +336,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-        Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-        return xSet;
+        return new utl::AccessibleRelationSetHelper;
     }
 
 
@@ -346,8 +344,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-        Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+        rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
         if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
         {
@@ -358,7 +355,7 @@ namespace accessibility
             pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
         }
 
-        return xSet;
+        return pStateSetHelper;
     }
 
 
@@ -469,7 +466,7 @@ namespace accessibility
                     aFont = m_pTabBar->GetControlFont();
                 else
                     aFont = m_pTabBar->GetFont();
-                VCLXFont* pVCLXFont = new VCLXFont;
+                rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
                 pVCLXFont->Init( *xDev, aFont );
                 xFont = pVCLXFont;
             }
diff --git a/accessibility/source/extended/accessibletabbarpage.cxx b/accessibility/source/extended/accessibletabbarpage.cxx
index 0f6f08270774..197ad78d9777 100644
--- a/accessibility/source/extended/accessibletabbarpage.cxx
+++ b/accessibility/source/extended/accessibletabbarpage.cxx
@@ -307,9 +307,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-        Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-        return xSet;
+        return new utl::AccessibleRelationSetHelper;
     }
 
 
@@ -317,8 +315,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-        Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+        rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
         if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
         {
@@ -329,7 +326,7 @@ namespace accessibility
             pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
         }
 
-        return xSet;
+        return pStateSetHelper;
     }
 
 
diff --git a/accessibility/source/extended/accessibletabbarpagelist.cxx b/accessibility/source/extended/accessibletabbarpagelist.cxx
index 7fd901037c07..37b1ab279522 100644
--- a/accessibility/source/extended/accessibletabbarpagelist.cxx
+++ b/accessibility/source/extended/accessibletabbarpagelist.cxx
@@ -465,9 +465,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-        Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-        return xSet;
+        return new utl::AccessibleRelationSetHelper;
     }
 
 
@@ -475,8 +473,7 @@ namespace accessibility
     {
         OExternalLockGuard aGuard( this );
 
-        utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-        Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+        rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
         if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
         {
@@ -487,7 +484,7 @@ namespace accessibility
             pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
         }
 
-        return xSet;
+        return pStateSetHelper;
     }
 
 
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index e975b62688b3..4b37b1c78dd7 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -1296,8 +1296,7 @@ Document::retrieveParagraphRelationSet( Paragraph const * pParagraph )
 {
     ::osl::MutexGuard aInternalGuard( GetMutex() );
 
-    ::utl::AccessibleRelationSetHelper* pRelationSetHelper = new ::utl::AccessibleRelationSetHelper();
-    css::uno::Reference< css::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+    rtl::Reference<::utl::AccessibleRelationSetHelper> pRelationSetHelper = new ::utl::AccessibleRelationSetHelper();
 
     Paragraphs::iterator aPara( m_xParagraphs->begin() + pParagraph->getNumber() );
 
@@ -1315,7 +1314,7 @@ Document::retrieveParagraphRelationSet( Paragraph const * pParagraph )
         pRelationSetHelper->AddRelation( aRelation );
     }
 
-    return xSet;
+    return pRelationSetHelper;
 }
 
 // virtual
diff --git a/accessibility/source/helper/acc_factory.cxx b/accessibility/source/helper/acc_factory.cxx
index a4648485c2dc..fef3214b321f 100644
--- a/accessibility/source/helper/acc_factory.cxx
+++ b/accessibility/source/helper/acc_factory.cxx
@@ -212,7 +212,7 @@ AccessibleFactory::~AccessibleFactory()
 
 Reference< XAccessible > AccessibleFactory::createAccessible( Menu* _pMenu, bool _bIsMenuBar )
 {
-    OAccessibleMenuBaseComponent* pAccessible;
+    rtl::Reference<OAccessibleMenuBaseComponent> pAccessible;
     if ( _bIsMenuBar )
         pAccessible = new VCLXAccessibleMenuBar( _pMenu );
     else
diff --git a/accessibility/source/standard/accessiblemenubasecomponent.cxx b/accessibility/source/standard/accessiblemenubasecomponent.cxx
index 4dbb71c554cf..7d5d2eebdd3e 100644
--- a/accessibility/source/standard/accessiblemenubasecomponent.cxx
+++ b/accessibility/source/standard/accessiblemenubasecomponent.cxx
@@ -313,7 +313,7 @@ Reference< XAccessible > OAccessibleMenuBaseComponent::GetChild( sal_Int32 i )
         if ( m_pMenu )
         {
             // create a new child
-            OAccessibleMenuBaseComponent* pChild;
+            rtl::Reference<OAccessibleMenuBaseComponent> pChild;
 
             if ( m_pMenu->GetItemType( static_cast<sal_uInt16>(i) ) == MenuItemType::SEPARATOR )
             {
@@ -691,8 +691,7 @@ Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStat
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     {
@@ -703,7 +702,7 @@ Reference< XAccessibleStateSet > OAccessibleMenuBaseComponent::getAccessibleStat
         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     }
 
-    return xSet;
+    return pStateSetHelper;
 }
 
 
diff --git a/accessibility/source/standard/accessiblemenucomponent.cxx b/accessibility/source/standard/accessiblemenucomponent.cxx
index ff927df47d14..be9b1e6f453e 100644
--- a/accessibility/source/standard/accessiblemenucomponent.cxx
+++ b/accessibility/source/standard/accessiblemenucomponent.cxx
@@ -212,9 +212,7 @@ Reference< XAccessibleRelationSet > OAccessibleMenuComponent::getAccessibleRelat
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 
@@ -307,7 +305,7 @@ Reference< awt::XFont > OAccessibleMenuComponent::getFont(  )
             if ( xDev.is() )
             {
                 const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
-                VCLXFont* pVCLXFont = new VCLXFont;
+                rtl::Reference<VCLXFont> pVCLXFont = new VCLXFont;
                 pVCLXFont->Init( *xDev, rStyleSettings.GetMenuFont() );
                 xFont = pVCLXFont;
             }
diff --git a/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
index 951d913e20c3..4b0707291eff 100644
--- a/accessibility/source/standard/accessiblemenuitemcomponent.cxx
+++ b/accessibility/source/standard/accessiblemenuitemcomponent.cxx
@@ -354,9 +354,7 @@ Reference< XAccessibleRelationSet > OAccessibleMenuItemComponent::getAccessibleR
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 
diff --git a/accessibility/source/standard/vclxaccessiblebox.cxx b/accessibility/source/standard/vclxaccessiblebox.cxx
index d8edd7e206bf..50bb06247509 100644
--- a/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -305,7 +305,7 @@ Reference<XAccessible> SAL_CALL VCLXAccessibleBox::getAccessibleChild (sal_Int32
             // List.
             if ( ! m_xList.is())
             {
-                VCLXAccessibleList* pList = new VCLXAccessibleList ( GetVCLXWindow(),
+                rtl::Reference<VCLXAccessibleList> pList = new VCLXAccessibleList ( GetVCLXWindow(),
                     (m_aBoxType == LISTBOX ? VCLXAccessibleList::LISTBOX : VCLXAccessibleList::COMBOBOX),
                                                                     this);
                 pList->SetIndexInParent (i);
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx
index 4c912530f8bf..50e81669b86a 100644
--- a/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -203,8 +203,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB
     if ( nIndex != 0 )
         throw IndexOutOfBoundsException();
 
-    OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
-    Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+    rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
 
     VclPtr<vcl::Window> pWindow = GetWindow();
     if ( pWindow )
@@ -230,7 +229,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleButton::getAccessibleActionKeyB
         }
     }
 
-    return xKeyBinding;
+    return pKeyBindingHelper;
 }
 
 
diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index a15ae4013ceb..f38bc3881b87 100644
--- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -226,8 +226,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe
     if ( nIndex != 0 )
         throw IndexOutOfBoundsException();
 
-    OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
-    Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+    rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
 
     VclPtr<vcl::Window> pWindow = GetWindow();
     if ( pWindow )
@@ -253,7 +252,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleCheckBox::getAccessibleActionKe
         }
     }
 
-    return xKeyBinding;
+    return pKeyBindingHelper;
 }
 
 
diff --git a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx
index a6fd0a7e3f8d..5c9bf5c9ad58 100644
--- a/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx
+++ b/accessibility/source/standard/vclxaccessibleheaderbaritem.cxx
@@ -184,9 +184,7 @@ Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRe
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 
@@ -194,8 +192,7 @@ Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleState
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     {
@@ -206,7 +203,7 @@ Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleState
         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     }
 
-    return xSet;
+    return pStateSetHelper;
 }
 
 
diff --git a/accessibility/source/standard/vclxaccessiblelistitem.cxx b/accessibility/source/standard/vclxaccessiblelistitem.cxx
index db783b2ccd65..e25c1070f8ed 100644
--- a/accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -237,17 +237,14 @@ OUString SAL_CALL VCLXAccessibleListItem::getAccessibleName(  )
 
 Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleListItem::getAccessibleRelationSet(  )
 {
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleStateSet(  )
 {
     ::osl::MutexGuard aGuard( m_aMutex );
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     {
@@ -272,7 +269,7 @@ Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleListItem::getAccessibleS
     else
         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
 
-    return xStateSet;
+    return pStateSetHelper;
 }
 
 Locale SAL_CALL VCLXAccessibleListItem::getLocale(  )
@@ -545,7 +542,7 @@ sal_Bool SAL_CALL VCLXAccessibleListItem::copyText( sal_Int32 nStartIndex, sal_I
         if ( xClipboard.is() )
         {
             OUString sText( getTextRange( nStartIndex, nEndIndex ) );
-            vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+            rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
 
             SolarMutexReleaser aReleaser;
             xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
index d278dae976e8..c12fdc985f7a 100644
--- a/accessibility/source/standard/vclxaccessiblemenuitem.cxx
+++ b/accessibility/source/standard/vclxaccessiblemenuitem.cxx
@@ -367,7 +367,7 @@ sal_Bool VCLXAccessibleMenuItem::copyText( sal_Int32 nStartIndex, sal_Int32 nEnd
             {
                 OUString sText( getTextRange( nStartIndex, nEndIndex ) );
 
-                vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+                rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
 
                 SolarMutexReleaser aReleaser;
                 xClipboard->setContents( pDataObj, nullptr );
@@ -429,8 +429,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe
     if ( nIndex != 0 )
         throw IndexOutOfBoundsException();
 
-    OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
-    Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+    rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
 
     if ( m_pParent )
     {
@@ -494,7 +493,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleMenuItem::getAccessibleActionKe
         }
     }
 
-    return xKeyBinding;
+    return pKeyBindingHelper;
 }
 
 
diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index aae9c76731f7..49901a8fbe17 100644
--- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -174,8 +174,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio
     if ( nIndex != 0 )
         throw IndexOutOfBoundsException();
 
-    OAccessibleKeyBindingHelper* pKeyBindingHelper = new OAccessibleKeyBindingHelper();
-    Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+    rtl::Reference<OAccessibleKeyBindingHelper> pKeyBindingHelper = new OAccessibleKeyBindingHelper();
 
     VclPtr<vcl::Window> pWindow = GetWindow();
     if ( pWindow )
@@ -201,7 +200,7 @@ Reference< XAccessibleKeyBinding > VCLXAccessibleRadioButton::getAccessibleActio
         }
     }
 
-    return xKeyBinding;
+    return pKeyBindingHelper;
 }
 
 
diff --git a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
index aee6f9e46737..b647036c316d 100644
--- a/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
+++ b/accessibility/source/standard/vclxaccessiblestatusbaritem.cxx
@@ -306,9 +306,7 @@ Reference< XAccessibleRelationSet > VCLXAccessibleStatusBarItem::getAccessibleRe
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 
@@ -316,8 +314,7 @@ Reference< XAccessibleStateSet > VCLXAccessibleStatusBarItem::getAccessibleState
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     {
@@ -328,7 +325,7 @@ Reference< XAccessibleStateSet > VCLXAccessibleStatusBarItem::getAccessibleState
         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     }
 
-    return xSet;
+    return pStateSetHelper;
 }
 
 
@@ -565,7 +562,7 @@ sal_Bool VCLXAccessibleStatusBarItem::copyText( sal_Int32 nStartIndex, sal_Int32
         {
             OUString sText( implGetTextRange( GetItemText(), nStartIndex, nEndIndex ) );
 
-            vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+            rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
 
             SolarMutexReleaser aReleaser;
             xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessibletabpage.cxx b/accessibility/source/standard/vclxaccessibletabpage.cxx
index ab981634a7db..3c0a9ada8e1d 100644
--- a/accessibility/source/standard/vclxaccessibletabpage.cxx
+++ b/accessibility/source/standard/vclxaccessibletabpage.cxx
@@ -372,9 +372,7 @@ Reference< XAccessibleRelationSet > VCLXAccessibleTabPage::getAccessibleRelation
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 
@@ -382,8 +380,7 @@ Reference< XAccessibleStateSet > VCLXAccessibleTabPage::getAccessibleStateSet(
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
     if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
     {
@@ -394,7 +391,7 @@ Reference< XAccessibleStateSet > VCLXAccessibleTabPage::getAccessibleStateSet(
         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
     }
 
-    return xSet;
+    return pStateSetHelper;
 }
 
 
@@ -653,7 +650,7 @@ sal_Bool VCLXAccessibleTabPage::copyText( sal_Int32 nStartIndex, sal_Int32 nEndI
         {
             OUString sText( implGetTextRange( GetPageText(), nStartIndex, nEndIndex ) );
 
-            vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+            rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
 
             SolarMutexReleaser aReleaser;
             xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
index a84c810223c3..c5dba0df978a 100644
--- a/accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ b/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -352,7 +352,7 @@ sal_Bool VCLXAccessibleTextComponent::copyText( sal_Int32 nStartIndex, sal_Int32
         {
             OUString sText( OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ) );
 
-            vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+            rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
 
             SolarMutexReleaser aReleaser;
             xClipboard->setContents( pDataObj, nullptr );
diff --git a/accessibility/source/standard/vclxaccessibletoolbox.cxx b/accessibility/source/standard/vclxaccessibletoolbox.cxx
index 1b63c38b373b..b04f2a7417de 100644
--- a/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -702,7 +702,7 @@ Reference< XAccessible > SAL_CALL VCLXAccessibleToolBox::getAccessibleChild( sal
         sal_uInt16 nHighlightItemId = pToolBox->GetHighlightItemId();
         vcl::Window* pItemWindow = pToolBox->GetItemWindow( nItemId );
         // not found -> create a new child
-        VCLXAccessibleToolBoxItem* pChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
+        rtl::Reference<VCLXAccessibleToolBoxItem> pChild = new VCLXAccessibleToolBoxItem( pToolBox, i );
         Reference< XAccessible> xParent = pChild;
         if ( pItemWindow )
         {
diff --git a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 64a08300ce59..cc613bbe4ec3 100644
--- a/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ b/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -381,17 +381,14 @@ Reference< XAccessibleRelationSet > SAL_CALL VCLXAccessibleToolBoxItem::getAcces
 {
     OContextEntryGuard aGuard( this );
 
-    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
-    Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
-    return xSet;
+    return new utl::AccessibleRelationSetHelper;
 }
 
 Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessibleStateSet(  )
 {
     OExternalLockGuard aGuard( this );
 
-    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
-    Reference< XAccessibleStateSet > xStateSet = pStateSetHelper;
+    rtl::Reference<utl::AccessibleStateSetHelper> pStateSetHelper = new utl::AccessibleStateSetHelper;
 
     if ( m_pToolBox && !rBHelper.bDisposed && !rBHelper.bInDispose )
     {
@@ -415,7 +412,7 @@ Reference< XAccessibleStateSet > SAL_CALL VCLXAccessibleToolBoxItem::getAccessib
     else
         pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
 
-    return xStateSet;
+    return pStateSetHelper;
 }
 
 // XAccessibleText
@@ -539,7 +536,7 @@ sal_Bool SAL_CALL VCLXAccessibleToolBoxItem::copyText( sal_Int32 nStartIndex, sa
         {
             OUString sText( OCommonAccessibleText::implGetTextRange( implGetText(), nStartIndex, nEndIndex ) );
 
-            vcl::unohelper::TextDataObject* pDataObj = new vcl::unohelper::TextDataObject( sText );
+            rtl::Reference<vcl::unohelper::TextDataObject> pDataObj = new vcl::unohelper::TextDataObject( sText );
 
             SolarMutexReleaser aReleaser;
             xClipboard->setContents( pDataObj, nullptr );


More information about the Libreoffice-commits mailing list