[Libreoffice-commits] core.git: basic/source comphelper/source compilerplugins/clang cppu/qa cui/source dbaccess/source desktop/source drawinglayer/source editeng/qa editeng/source extensions/source filter/source i18npool/inc i18npool/source include/sfx2 oox/source reportdesign/source sax/qa sc/source sdext/source sd/source svtools/source svx/source sw/source ucb/source UnoControls/source writerfilter/source xmloff/source

Noel Grandin noel at peralex.com
Tue May 31 06:26:16 UTC 2016


 UnoControls/source/inc/framecontrol.hxx                               |    3 
 basic/source/inc/namecont.hxx                                         |    5 
 comphelper/source/misc/documentiologring.cxx                          |    2 
 compilerplugins/clang/refcounting.cxx                                 |  109 +++++++---
 cppu/qa/test_reference.cxx                                            |   11 -
 cui/source/inc/cuigaldlg.hxx                                          |    2 
 cui/source/inc/optpath.hxx                                            |    2 
 cui/source/options/optjava.hxx                                        |    2 
 dbaccess/source/core/dataaccess/ComponentDefinition.hxx               |    2 
 dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx              |    3 
 dbaccess/source/core/dataaccess/datasource.hxx                        |    2 
 dbaccess/source/ext/macromigration/migrationengine.cxx                |    2 
 dbaccess/source/ui/app/AppController.cxx                              |    4 
 dbaccess/source/ui/misc/singledoccontroller.cxx                       |    2 
 desktop/source/deployment/gui/dp_gui_extlistbox.cxx                   |    8 
 desktop/source/deployment/gui/dp_gui_extlistbox.hxx                   |    2 
 drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx            |   14 -
 editeng/qa/unit/core-test.cxx                                         |   28 +-
 editeng/source/accessibility/AccessibleEditableTextPara.cxx           |   10 
 editeng/source/misc/svxacorr.cxx                                      |    4 
 editeng/source/xml/xmltxtexp.cxx                                      |    2 
 extensions/source/scanner/sanedlg.cxx                                 |    2 
 extensions/source/update/feed/updatefeed.cxx                          |    4 
 filter/source/svg/svgwriter.cxx                                       |    2 
 i18npool/inc/calendar_gregorian.hxx                                   |    3 
 i18npool/source/characterclassification/cclass_unicode.cxx            |    3 
 i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx |    3 
 i18npool/source/indexentry/indexentrysupplier.cxx                     |    3 
 i18npool/source/transliteration/ignoreKana.cxx                        |    9 
 i18npool/source/transliteration/ignoreSize_ja_JP.cxx                  |    9 
 i18npool/source/transliteration/ignoreWidth.cxx                       |    9 
 i18npool/source/transliteration/transliteration_body.cxx              |    3 
 i18npool/source/transliteration/transliteration_caseignore.cxx        |    5 
 include/sfx2/filedlghelper.hxx                                        |    7 
 oox/source/core/xmlfilterbase.cxx                                     |    4 
 reportdesign/source/ui/dlg/GroupsSorting.cxx                          |    2 
 sax/qa/cppunit/attributes.cxx                                         |    3 
 sax/qa/cppunit/parser.cxx                                             |    4 
 sax/qa/cppunit/xmlimport.cxx                                          |    4 
 sc/source/ui/unoobj/cellsuno.cxx                                      |    2 
 sc/source/ui/unoobj/chart2uno.cxx                                     |    4 
 sc/source/ui/unoobj/docuno.cxx                                        |    2 
 sc/source/ui/unoobj/warnpassword.cxx                                  |    2 
 sc/source/ui/vba/vbafont.cxx                                          |    8 
 sc/source/ui/vba/vbawindow.cxx                                        |    6 
 sc/source/ui/vba/vbawindows.cxx                                       |    2 
 sd/source/ui/dlg/RemoteDialogClientBox.hxx                            |    2 
 sd/source/ui/inc/EventMultiplexer.hxx                                 |    6 
 sd/source/ui/view/drviews5.cxx                                        |    2 
 sdext/source/pdfimport/test/pdf2xml.cxx                               |    3 
 sdext/source/pdfimport/test/tests.cxx                                 |    8 
 svtools/source/edit/svmedit.cxx                                       |    4 
 svx/source/sdr/contact/viewcontactofgraphic.cxx                       |    2 
 svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx                  |    3 
 svx/source/table/accessibletableshape.cxx                             |   20 -
 svx/source/xml/xmlxtexp.cxx                                           |    2 
 sw/source/core/layout/paintfrm.cxx                                    |   18 -
 sw/source/core/swg/SwXMLTextBlocks1.cxx                               |    4 
 sw/source/core/unocore/unorefmk.cxx                                   |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx                          |   64 ++---
 sw/source/filter/ww8/docxattributeoutput.hxx                          |   36 +--
 sw/source/filter/ww8/docxsdrexport.cxx                                |   16 -
 sw/source/filter/ww8/docxsdrexport.hxx                                |    9 
 sw/source/ui/vba/vbawindow.cxx                                        |    6 
 sw/source/uibase/config/StoredChapterNumbering.cxx                    |    2 
 sw/source/uibase/dbui/dbtree.cxx                                      |    2 
 ucb/source/ucp/cmis/cmis_content.cxx                                  |    2 
 ucb/source/ucp/gio/gio_datasupplier.cxx                               |    2 
 ucb/source/ucp/gio/gio_datasupplier.hxx                               |    4 
 ucb/source/ucp/gio/gio_mount.cxx                                      |    2 
 ucb/source/ucp/gio/gio_resultset.cxx                                  |    2 
 ucb/source/ucp/gio/gio_resultset.hxx                                  |    4 
 ucb/source/ucp/tdoc/tdoc_storage.cxx                                  |    2 
 writerfilter/source/filter/WriterFilter.cxx                           |    3 
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.cxx                |    4 
 writerfilter/source/ooxml/OOXMLFastDocumentHandler.hxx                |    7 
 xmloff/source/meta/xmlversion.cxx                                     |    2 
 77 files changed, 327 insertions(+), 242 deletions(-)

New commits:
commit 0b23eec200c8c12db5778405df44f4bf8e38e4ad
Author: Noel Grandin <noel at peralex.com>
Date:   Thu May 26 16:02:39 2016 +0200

    teach refcounting clang plugin about uno::Reference
    
    uno::Reference is only allowed to used with classes that have a
    ::static_type member.
    So convert all those places to rtl::Reference.
    
    Maybe we need some LIBO_INTERNAL_ONLY constructors on rtl::Reference and
    uno::Reference to make this a little smoother?
    
    Change-Id: Icdcb35d71ca40a87b1dc474096776412adbfc7e3
    Reviewed-on: https://gerrit.libreoffice.org/25516
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/UnoControls/source/inc/framecontrol.hxx b/UnoControls/source/inc/framecontrol.hxx
index 00c16a5..fa17ebf 100644
--- a/UnoControls/source/inc/framecontrol.hxx
+++ b/UnoControls/source/inc/framecontrol.hxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/lang/XServiceInfo.hpp>
 #include <com/sun/star/lang/XConnectionPointContainer.hpp>
 #include <cppuhelper/propshlp.hxx>
+#include <rtl/ref.hxx>
 
 #include "basecontrol.hxx"
 #include "OConnectionPointContainerHelper.hxx"
@@ -213,7 +214,7 @@ private:
     css::uno::Reference< css::frame::XFrame2 >              m_xFrame;
     OUString                                                m_sComponentURL;
     css::uno::Sequence< css::beans::PropertyValue >         m_seqLoaderArguments;
-    css::uno::Reference<OConnectionPointContainerHelper>    m_aConnectionPointContainer;
+    rtl::Reference<OConnectionPointContainerHelper>         m_aConnectionPointContainer;
 
 };  // class FrameControl
 
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 7e00e29..3166b87 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -52,6 +52,7 @@
 #include <cppuhelper/component.hxx>
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/basemutex.hxx>
+#include <rtl/ref.hxx>
 #include <sot/storage.hxx>
 #include <comphelper/listenernotification.hxx>
 #include <xmlscript/xmllib_imexp.hxx>
@@ -227,7 +228,7 @@ protected:
     ::osl::Mutex        maMutex;
     ModifiableHelper    maModifiable;
 
-    css::uno::Reference<NameContainer> maNameContainer;
+    rtl::Reference<NameContainer> maNameContainer;
     bool    mbOldInfoFormat;
     bool    mbOasis2OOoFormat;
 
@@ -557,7 +558,7 @@ class SfxLibrary
     css::uno::Reference< css::ucb::XSimpleFileAccess3 >   mxSFI;
 
     ModifiableHelper&                                     mrModifiable;
-    css::uno::Reference<NameContainer>                    maNameContainer;
+    rtl::Reference<NameContainer>                         maNameContainer;
 
     bool mbLoaded;
     bool mbIsModified;
diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx
index 3940d1d..424f86c 100644
--- a/comphelper/source/misc/documentiologring.cxx
+++ b/comphelper/source/misc/documentiologring.cxx
@@ -131,7 +131,7 @@ struct Instance {
         instance(new comphelper::OSimpleLogRing())
     {}
 
-    css::uno::Reference<cppu::OWeakObject> instance;
+    rtl::Reference<cppu::OWeakObject> instance;
 };
 
 struct Singleton:
diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx
index 663fcb7..9bb9485 100644
--- a/compilerplugins/clang/refcounting.cxx
+++ b/compilerplugins/clang/refcounting.cxx
@@ -12,6 +12,7 @@
 
 #include "plugin.hxx"
 #include "compat.hxx"
+#include "typecheck.hxx"
 #include "clang/AST/CXXInheritance.h"
 
 /**
@@ -50,6 +51,7 @@ public:
 
     bool VisitFieldDecl(const FieldDecl *);
     bool VisitVarDecl(const VarDecl *);
+    bool VisitFunctionDecl(const FunctionDecl *);
 
     bool WalkUpFromObjCIvarDecl(ObjCIvarDecl * decl) {
         // Don't recurse into WalkUpFromFieldDecl, as VisitFieldDecl calls
@@ -58,6 +60,9 @@ public:
         // ObjCIvarDecl.
         return VisitObjCIvarDecl(decl);
     }
+private:
+    void checkUnoReference(QualType qt, const Decl* decl,
+                           const std::string& rParentName, const std::string& rDeclName);
 };
 
 bool BaseCheckNotSubclass(const CXXRecordDecl *BaseDefinition, void *p) {
@@ -287,6 +292,39 @@ bool containsSalhelperReferenceObjectSubclass(const Type* pType0) {
     }
 }
 
+static bool containsStaticTypeMethod(const CXXRecordDecl* x)
+{
+    for (auto it = x->method_begin(); it != x->method_end(); ++it) {
+        auto i = *it;
+        if ( !i->isStatic() )
+            continue;
+        auto ident = i->getIdentifier();
+        if ( ident && ident->isStr("static_type") ) {
+            return true;
+        }
+    }
+    return false;
+}
+
+void RefCounting::checkUnoReference(QualType qt, const Decl* decl, const std::string& rParentName, const std::string& rDeclName)
+{
+    if (loplugin::TypeCheck(qt).Class("Reference").Namespace("uno").Namespace("star").Namespace("sun").Namespace("com").GlobalNamespace()) {
+        const CXXRecordDecl* pRecordDecl = qt->getAsCXXRecordDecl();
+        const ClassTemplateSpecializationDecl* pTemplate = dyn_cast<ClassTemplateSpecializationDecl>(pRecordDecl);
+        const TemplateArgument& rArg = pTemplate->getTemplateArgs()[0];
+        const CXXRecordDecl* templateParam = rArg.getAsType()->getAsCXXRecordDecl()->getDefinition();
+        if (templateParam && !containsStaticTypeMethod(templateParam)) {
+            report(
+                DiagnosticsEngine::Warning,
+                "uno::Reference " + rDeclName + " with template parameter that does not contain ::static_type() "
+                + qt.getAsString()
+                + ", parent is " + rParentName,
+                decl->getLocation())
+              << decl->getSourceRange();
+        }
+    }
+}
+
 bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
     if (ignoreLocation(fieldDecl)) {
         return true;
@@ -334,6 +372,9 @@ bool RefCounting::VisitFieldDecl(const FieldDecl * fieldDecl) {
             fieldDecl->getLocation())
           << fieldDecl->getSourceRange();
     }
+
+    checkUnoReference(fieldDecl->getType(), fieldDecl, aParentName, "field");
+
     return true;
 }
 
@@ -342,37 +383,51 @@ bool RefCounting::VisitVarDecl(const VarDecl * varDecl) {
     if (ignoreLocation(varDecl)) {
         return true;
     }
-    if (isa<ParmVarDecl>(varDecl)) {
-        return true;
+    if (!isa<ParmVarDecl>(varDecl)) {
+        if (containsSvRefBaseSubclass(varDecl->getType().getTypePtr())) {
+            report(
+                DiagnosticsEngine::Warning,
+                "SvRefBase subclass being directly stack managed, should be managed via tools::SvRef, "
+                + varDecl->getType().getAsString(),
+                varDecl->getLocation())
+              << varDecl->getSourceRange();
+        }
+        if (containsSalhelperReferenceObjectSubclass(varDecl->getType().getTypePtr())) {
+            StringRef name { compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())) };
+            // this is playing games that it believes is safe
+            if (name == SRCDIR "/stoc/source/security/permissions.cxx")
+                return true;
+            report(
+                DiagnosticsEngine::Warning,
+                "salhelper::SimpleReferenceObject subclass being directly stack managed, should be managed via rtl::Reference, "
+                + varDecl->getType().getAsString(),
+                varDecl->getLocation())
+              << varDecl->getSourceRange();
+        }
+        if (containsXInterfaceSubclass(varDecl->getType())) {
+            report(
+                DiagnosticsEngine::Warning,
+                "XInterface subclass being directly stack managed, should be managed via uno::Reference, "
+                + varDecl->getType().getAsString(),
+                varDecl->getLocation())
+              << varDecl->getSourceRange();
+        }
     }
-    if (containsSvRefBaseSubclass(varDecl->getType().getTypePtr())) {
-        report(
-            DiagnosticsEngine::Warning,
-            "SvRefBase subclass being directly stack managed, should be managed via tools::SvRef, "
-            + varDecl->getType().getAsString(),
-            varDecl->getLocation())
-          << varDecl->getSourceRange();
+    checkUnoReference(varDecl->getType(), varDecl, "", "var");
+    return true;
+}
+
+bool RefCounting::VisitFunctionDecl(const FunctionDecl * functionDecl) {
+    if (ignoreLocation(functionDecl)) {
+        return true;
     }
-    if (containsSalhelperReferenceObjectSubclass(varDecl->getType().getTypePtr())) {
-        StringRef name { compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(varDecl->getLocation())) };
-        // this is playing games that it believes is safe
-        if (name == SRCDIR "/stoc/source/security/permissions.cxx")
+    // only consider base declarations, not overriden ones, or we warn on methods that
+    // are overriding stuff from external libraries
+    const CXXMethodDecl * methodDecl = dyn_cast<CXXMethodDecl>(functionDecl);
+    if (methodDecl && methodDecl->size_overridden_methods() > 0) {
             return true;
-        report(
-            DiagnosticsEngine::Warning,
-            "salhelper::SimpleReferenceObject subclass being directly stack managed, should be managed via rtl::Reference, "
-            + varDecl->getType().getAsString(),
-            varDecl->getLocation())
-          << varDecl->getSourceRange();
-    }
-    if (containsXInterfaceSubclass(varDecl->getType())) {
-        report(
-            DiagnosticsEngine::Warning,
-            "XInterface subclass being directly stack managed, should be managed via uno::Reference, "
-            + varDecl->getType().getAsString(),
-            varDecl->getLocation())
-          << varDecl->getSourceRange();
     }
+    checkUnoReference(functionDecl->getReturnType(), functionDecl, "", "return");
     return true;
 }
 
diff --git a/cppu/qa/test_reference.cxx b/cppu/qa/test_reference.cxx
index df57eab..16d14d9 100644
--- a/cppu/qa/test_reference.cxx
+++ b/cppu/qa/test_reference.cxx
@@ -90,8 +90,12 @@ private:
 
 struct Base1: public css::uno::XInterface {
     virtual ~Base1() = delete;
+    static ::css::uno::Type const & SAL_CALL static_type(void * = nullptr) // loplugin:refcounting
+    { return ::cppu::UnoType<Base1>::get(); }
+};
+struct Base2: public Base1 {
+    virtual ~Base2() = delete;
 };
-struct Base2: public Base1 { virtual ~Base2() = delete; };
 struct Base3: public Base1 { virtual ~Base3() = delete; };
 struct Derived: public Base2, public Base3 {
     virtual ~Derived() = delete;
@@ -100,7 +104,10 @@ struct Derived: public Base2, public Base3 {
 // The special case using the conversion operator instead:
 css::uno::Reference< css::uno::XInterface > testUpcast1(
     css::uno::Reference< Derived > const & ref)
-{ return ref; }
+{
+    Base1::static_type(); // prevent loplugin:unreffun firing
+    return ref;
+}
 
 // The normal up-cast case:
 css::uno::Reference< Base1 > testUpcast2(
diff --git a/cui/source/inc/cuigaldlg.hxx b/cui/source/inc/cuigaldlg.hxx
index 1e39b37..5d81841 100644
--- a/cui/source/inc/cuigaldlg.hxx
+++ b/cui/source/inc/cuigaldlg.hxx
@@ -265,7 +265,7 @@ class TPGalleryThemeProperties : public SfxTabPage
     bool                    bTakeAll;
     bool                    bSearchRecursive;
 
-    css::uno::Reference< ::svt::DialogClosedListener >      xDialogListener;
+    rtl::Reference< ::svt::DialogClosedListener >           xDialogListener;
     css::uno::Reference< css::media::XPlayer >              xMediaPlayer;
     css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
 
diff --git a/cui/source/inc/optpath.hxx b/cui/source/inc/optpath.hxx
index 790da15..59828a1 100644
--- a/cui/source/inc/optpath.hxx
+++ b/cui/source/inc/optpath.hxx
@@ -48,7 +48,7 @@ private:
     VclPtr<svx::OptHeaderTabListBox> pPathBox;
     std::unique_ptr<OptPath_Impl>               pImpl;
 
-    css::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
+    rtl::Reference< ::svt::DialogClosedListener > xDialogListener;
     css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
 
     void        ChangeCurrentEntry( const OUString& _rFolder );
diff --git a/cui/source/options/optjava.hxx b/cui/source/options/optjava.hxx
index bee6894..081509e 100644
--- a/cui/source/options/optjava.hxx
+++ b/cui/source/options/optjava.hxx
@@ -81,7 +81,7 @@ private:
     ::std::vector< JavaInfo* >
                             m_aAddedInfos;
 
-    css::uno::Reference< ::svt::DialogClosedListener > xDialogListener;
+    rtl::Reference< ::svt::DialogClosedListener >           xDialogListener;
     css::uno::Reference< css::ui::dialogs::XFolderPicker2 > xFolderPicker;
 
     DECL_LINK_TYPED(        EnableHdl_Impl, Button*, void);
diff --git a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
index 9856351..3b21c42 100644
--- a/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
+++ b/dbaccess/source/core/dataaccess/ComponentDefinition.hxx
@@ -86,7 +86,7 @@ class OComponentDefinition  :public OContentHelper
                             ,public ::comphelper::OPropertyArrayUsageHelper< OComponentDefinition >
 {
 protected:
-    css::uno::Reference< OColumns >     m_xColumns;
+    rtl::Reference< OColumns >     m_xColumns;
     rtl::Reference<OColumnPropertyListener> m_xColumnPropertyListener;
     bool                        m_bTable;
 
diff --git a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
index 13df4cf..93b93cc 100644
--- a/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
+++ b/dbaccess/source/core/dataaccess/dataaccessdescriptor.cxx
@@ -34,6 +34,7 @@
 #include <comphelper/uno3.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#include <rtl/ref.hxx>
 
 namespace
 {
@@ -247,7 +248,7 @@ struct Instance {
         instance(new DataAccessDescriptorFactory())
     {}
 
-    css::uno::Reference<cppu::OWeakObject> instance;
+    rtl::Reference<cppu::OWeakObject> instance;
 };
 
 struct Singleton:
diff --git a/dbaccess/source/core/dataaccess/datasource.hxx b/dbaccess/source/core/dataaccess/datasource.hxx
index 5c898ae..d9e0b50 100644
--- a/dbaccess/source/core/dataaccess/datasource.hxx
+++ b/dbaccess/source/core/dataaccess/datasource.hxx
@@ -82,7 +82,7 @@ class ODatabaseSource   :public ModelDependentComponent // must be first
 
 private:
     using ODatabaseSource_Base::rBHelper;
-    css::uno::Reference<OBookmarkContainer> m_xBookmarks;
+    rtl::Reference<OBookmarkContainer> m_xBookmarks;
     ::comphelper::OInterfaceContainerHelper2       m_aFlushListeners;
 
 private:
diff --git a/dbaccess/source/ext/macromigration/migrationengine.cxx b/dbaccess/source/ext/macromigration/migrationengine.cxx
index e2c0992..60b8a59 100644
--- a/dbaccess/source/ext/macromigration/migrationengine.cxx
+++ b/dbaccess/source/ext/macromigration/migrationengine.cxx
@@ -1045,7 +1045,7 @@ namespace dbmm
         m_rProgress.startObject( sObjectName, OUString(), DEFAULT_DOC_PROGRESS_RANGE );
 
         // load the document
-        Reference< ProgressCapture > pStatusIndicator( new ProgressCapture( sObjectName, m_rProgress ) );
+        rtl::Reference< ProgressCapture > pStatusIndicator( new ProgressCapture( sObjectName, m_rProgress ) );
         SubDocument aSubDocument( _rDocument );
         OpenDocResult eResult = lcl_loadSubDocument_nothrow( aSubDocument, pStatusIndicator.get(), m_rLogger );
         if ( eResult != eOpenedDoc )
diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx
index d1ed43c..c3294b2 100644
--- a/dbaccess/source/ui/app/AppController.cxx
+++ b/dbaccess/source/ui/app/AppController.cxx
@@ -953,8 +953,8 @@ namespace
         Reference< XInteractionHandler > xHandler( aArgs.getOrDefault( "InteractionHandler", Reference< XInteractionHandler >() ) );
         if ( xHandler.is() )
         {
-            Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( _rException ) );
-            Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove );
+            rtl::Reference< ::comphelper::OInteractionRequest > pRequest( new ::comphelper::OInteractionRequest( _rException ) );
+            rtl::Reference< ::comphelper::OInteractionApprove > pApprove( new ::comphelper::OInteractionApprove );
             pRequest->addContinuation( pApprove.get() );
 
             try
diff --git a/dbaccess/source/ui/misc/singledoccontroller.cxx b/dbaccess/source/ui/misc/singledoccontroller.cxx
index 4db5a73..76c1245 100644
--- a/dbaccess/source/ui/misc/singledoccontroller.cxx
+++ b/dbaccess/source/ui/misc/singledoccontroller.cxx
@@ -42,7 +42,7 @@ namespace dbaui
     // OSingleDocumentController_Data
     struct OSingleDocumentController_Data
     {
-        Reference< UndoManager >  m_xUndoManager;
+        rtl::Reference< UndoManager >  m_xUndoManager;
 
         OSingleDocumentController_Data( ::cppu::OWeakObject& i_parent, ::osl::Mutex& i_mutex )
             :m_xUndoManager( new UndoManager( i_parent, i_mutex ) )
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 34b3fc2..47a89d2 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -256,7 +256,7 @@ void ExtensionBox_Impl::dispose()
     for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
     {
         (*iIndex)->m_pPublisher.disposeAndClear();
-        (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
+        (*iIndex)->m_xPackage->removeEventListener( m_xRemoveListener.get() );
     }
 
     m_vEntries.clear();
@@ -912,8 +912,7 @@ void ExtensionBox_Impl::addEventListenerOnce(
     if ( ::std::none_of(m_vListenerAdded.begin(), m_vListenerAdded.end(),
                         FindWeakRef(extension)) )
     {
-        extension->addEventListener( uno::Reference< lang::XEventListener > (
-                                         m_xRemoveListener, uno::UNO_QUERY ) );
+        extension->addEventListener( m_xRemoveListener.get() );
         m_vListenerAdded.push_back(extension);
     }
 }
@@ -1026,8 +1025,7 @@ void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage
                 // the entry will be moved into the m_vRemovedEntries list which will be
                 // cleared on the next paint event
                 m_vRemovedEntries.push_back( *iIndex );
-                (*iIndex)->m_xPackage->removeEventListener(
-                    uno::Reference<lang::XEventListener>(m_xRemoveListener, uno::UNO_QUERY));
+                (*iIndex)->m_xPackage->removeEventListener(m_xRemoveListener.get());
                 m_vEntries.erase( iIndex );
 
                 m_bNeedsRecalc = true;
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
index 1f927f3..3cee982 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx
@@ -130,7 +130,7 @@ class ExtensionBox_Impl : public ::svt::IExtensionListBox
 
     VclPtr<ScrollBar>      m_pScrollBar;
 
-    css::uno::Reference<ExtensionRemovedListener> m_xRemoveListener;
+    rtl::Reference<ExtensionRemovedListener> m_xRemoveListener;
 
     TheExtensionManager      *m_pManager;
     //This mutex is used for synchronizing access to m_vEntries.
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 6d069d3..37218e0 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -1160,8 +1160,8 @@ namespace drawinglayer
                         // per polygon. If there are more, split the polygon in half and call recursively
                         basegfx::B2DPolygon aLeft, aRight;
                         splitLinePolygon(rBasePolygon, aLeft, aRight);
-                        uno::Reference< primitive2d::PolygonHairlinePrimitive2D > xPLeft(new primitive2d::PolygonHairlinePrimitive2D(aLeft, rHairlinePrimitive.getBColor()));
-                        uno::Reference< primitive2d::PolygonHairlinePrimitive2D > xPRight(new primitive2d::PolygonHairlinePrimitive2D(aRight, rHairlinePrimitive.getBColor()));
+                        rtl::Reference< primitive2d::PolygonHairlinePrimitive2D > xPLeft(new primitive2d::PolygonHairlinePrimitive2D(aLeft, rHairlinePrimitive.getBColor()));
+                        rtl::Reference< primitive2d::PolygonHairlinePrimitive2D > xPRight(new primitive2d::PolygonHairlinePrimitive2D(aRight, rHairlinePrimitive.getBColor()));
 
                         processBasePrimitive2D(*xPLeft.get());
                         processBasePrimitive2D(*xPRight.get());
@@ -1208,9 +1208,9 @@ namespace drawinglayer
                         // per polygon. If there are more, split the polygon in half and call recursively
                         basegfx::B2DPolygon aLeft, aRight;
                         splitLinePolygon(rBasePolygon, aLeft, aRight);
-                        uno::Reference< primitive2d::PolygonStrokePrimitive2D > xPLeft(new primitive2d::PolygonStrokePrimitive2D(
+                        rtl::Reference< primitive2d::PolygonStrokePrimitive2D > xPLeft(new primitive2d::PolygonStrokePrimitive2D(
                             aLeft, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute()));
-                        uno::Reference< primitive2d::PolygonStrokePrimitive2D > xPRight(new primitive2d::PolygonStrokePrimitive2D(
+                        rtl::Reference< primitive2d::PolygonStrokePrimitive2D > xPRight(new primitive2d::PolygonStrokePrimitive2D(
                             aRight, rStrokePrimitive.getLineAttribute(), rStrokePrimitive.getStrokeAttribute()));
 
                         processBasePrimitive2D(*xPLeft.get());
@@ -1289,13 +1289,13 @@ namespace drawinglayer
                         basegfx::B2DPolygon aLeft, aRight;
                         splitLinePolygon(rBasePolygon, aLeft, aRight);
                         const attribute::LineStartEndAttribute aEmpty;
-                        uno::Reference< primitive2d::PolygonStrokeArrowPrimitive2D > xPLeft(new primitive2d::PolygonStrokeArrowPrimitive2D(
+                        rtl::Reference< primitive2d::PolygonStrokeArrowPrimitive2D > xPLeft(new primitive2d::PolygonStrokeArrowPrimitive2D(
                             aLeft,
                             rStrokeArrowPrimitive.getLineAttribute(),
                             rStrokeArrowPrimitive.getStrokeAttribute(),
                             rStrokeArrowPrimitive.getStart(),
                             aEmpty));
-                        uno::Reference< primitive2d::PolygonStrokeArrowPrimitive2D > xPRight(new primitive2d::PolygonStrokeArrowPrimitive2D(
+                        rtl::Reference< primitive2d::PolygonStrokeArrowPrimitive2D > xPRight(new primitive2d::PolygonStrokeArrowPrimitive2D(
                             aRight,
                             rStrokeArrowPrimitive.getLineAttribute(),
                             rStrokeArrowPrimitive.getStrokeAttribute(),
@@ -1367,7 +1367,7 @@ namespace drawinglayer
                     {
                         // #i112245# Metafiles use tools Polygon and are not able to have more than 65535 points
                         // per polygon. If there are more use the splitted polygon and call recursively
-                        uno::Reference< primitive2d::PolyPolygonGraphicPrimitive2D > xSplitted(new primitive2d::PolyPolygonGraphicPrimitive2D(
+                        rtl::Reference< primitive2d::PolyPolygonGraphicPrimitive2D > xSplitted(new primitive2d::PolyPolygonGraphicPrimitive2D(
                             aLocalPolyPolygon,
                             rBitmapCandidate.getFillGraphic()));
 
diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx
index d1c73af..d303805 100644
--- a/editeng/qa/unit/core-test.cxx
+++ b/editeng/qa/unit/core-test.cxx
@@ -110,7 +110,7 @@ void Test::testUnoTextFields()
 {
     {
         // DATE
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::DATE));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::DATE));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -118,7 +118,7 @@ void Test::testUnoTextFields()
 
     {
         // URL
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::URL));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::URL));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.URL");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -126,7 +126,7 @@ void Test::testUnoTextFields()
 
     {
         // PAGE
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PAGE));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PAGE));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.PageNumber");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -134,7 +134,7 @@ void Test::testUnoTextFields()
 
     {
         // PAGES
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PAGES));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PAGES));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.PageCount");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -142,7 +142,7 @@ void Test::testUnoTextFields()
 
     {
         // TIME
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::TIME));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::TIME));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -150,7 +150,7 @@ void Test::testUnoTextFields()
 
     {
         // FILE
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::DOCINFO_TITLE));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::DOCINFO_TITLE));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.docinfo.Title");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -158,7 +158,7 @@ void Test::testUnoTextFields()
 
     {
         // TABLE
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::TABLE));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::TABLE));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.SheetName");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -166,7 +166,7 @@ void Test::testUnoTextFields()
 
     {
         // EXTENDED TIME
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_TIME));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.DateTime");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -174,7 +174,7 @@ void Test::testUnoTextFields()
 
     {
         // EXTENDED FILE
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::EXTENDED_FILE));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.FileName");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -182,7 +182,7 @@ void Test::testUnoTextFields()
 
     {
         // AUTHOR
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::AUTHOR));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::AUTHOR));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.Author");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -190,7 +190,7 @@ void Test::testUnoTextFields()
 
     {
         // MEASURE
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::MEASURE));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::MEASURE));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.text.textfield.Measure");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -198,7 +198,7 @@ void Test::testUnoTextFields()
 
     {
         // PRESENTATION HEADER
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_HEADER));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_HEADER));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.Header");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -206,7 +206,7 @@ void Test::testUnoTextFields()
 
     {
         // PRESENTATION FOOTER
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_FOOTER));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_FOOTER));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.Footer");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
@@ -214,7 +214,7 @@ void Test::testUnoTextFields()
 
     {
         // PRESENTATION DATE TIME
-        uno::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_DATE_TIME));
+        rtl::Reference<SvxUnoTextField> xField(new SvxUnoTextField(text::textfield::Type::PRESENTATION_DATE_TIME));
         uno::Sequence<OUString> aSvcs = xField->getSupportedServiceNames();
         bool bGood = includes(aSvcs, "com.sun.star.presentation.textfield.DateTime");
         CPPUNIT_ASSERT_MESSAGE("expected service is not present.", bGood);
diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index b036de0..f17996f 100644
--- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -1596,7 +1596,7 @@ namespace accessibility
 //                  SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
 //                      ImplGetSvxCharAndParaPropertiesMap() );
                     // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap
-                    uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ) );
+                    rtl::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ) );
 
                     xPropSet->SetSelection( MakeSelection( 0, GetTextLen() ) );
                     rRes.Value = xPropSet->_getPropertyValue( rRes.Name, mnParagraphIndex );
@@ -1619,7 +1619,7 @@ namespace accessibility
                 else
                 {
                     // MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap
-                    uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ) );
+                    rtl::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() ) );
                     xPropSet->SetSelection( MakeSelection( 0, GetTextLen() ) );
                     rRes.Value = xPropSet->_getPropertyValue( rRes.Name, mnParagraphIndex );
                     rRes.State = xPropSet->_getPropertyState( rRes.Name, mnParagraphIndex );
@@ -2399,7 +2399,7 @@ namespace accessibility
 
             // do the indices span the whole paragraph? Then use the outliner map
             // TODO: hold it as a member?
-            uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(),
+            rtl::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(),
                                                    0 == nStartIndex &&
                                                    rCacheTF.GetTextLen(nPara) == nEndIndex ?
                                                    ImplGetSvxUnoOutlinerTextCursorSvxPropertySet() :
@@ -2464,7 +2464,7 @@ namespace accessibility
 
         // get XPropertySetInfo for paragraph attributes and
         // character attributes that span all the paragraphs text.
-        uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(),
+        rtl::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(),
                 ImplGetSvxCharAndParaPropertiesSet() ) );
         xPropSet->SetSelection( MakeSelection( 0, GetTextLen() ) );
         uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
@@ -2566,7 +2566,7 @@ namespace accessibility
         else
             CheckPosition(nIndex);
 
-        uno::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(),
+        rtl::Reference< SvxAccessibleTextPropertySet > xPropSet( new SvxAccessibleTextPropertySet( &GetEditSource(),
                                                ImplGetSvxCharAndParaPropertiesSet() ) );
         xPropSet->SetSelection( MakeSelection( nIndex ) );
         uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 5545432..8658967 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2060,7 +2060,7 @@ void SvxAutoCorrectLanguageLists::SaveExceptList_Imp(
                 xWriter->setOutputStream(xOut);
 
                 uno::Reference < xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
-                uno::Reference< SvXMLExceptionListExport > xExp( new SvXMLExceptionListExport( xContext, rLst, sStrmName, xHandler ) );
+                rtl::Reference< SvXMLExceptionListExport > xExp( new SvXMLExceptionListExport( xContext, rLst, sStrmName, xHandler ) );
 
                 xExp->exportDoc( XML_BLOCK_LIST );
 
@@ -2427,7 +2427,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg )
             xWriter->setOutputStream(xOut);
 
             uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
-            uno::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List, sStrmName, xHandler ) );
+            rtl::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List, sStrmName, xHandler ) );
 
             xExp->exportDoc( XML_BLOCK_LIST );
 
diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx
index 28e4f49..a291f76 100644
--- a/editeng/source/xml/xmltxtexp.cxx
+++ b/editeng/source/xml/xmltxtexp.cxx
@@ -395,7 +395,7 @@ void SvxWriteXML( EditEngine& rEditEngine, SvStream& rStream, const ESelection&
 
             // SvxXMLTextExportComponent aExporter( &rEditEngine, rSel, aName, xHandler );
             uno::Reference< xml::sax::XDocumentHandler > xHandler(xWriter, UNO_QUERY_THROW);
-            uno::Reference< SvxXMLTextExportComponent > xExporter( new SvxXMLTextExportComponent( xContext, &rEditEngine, rSel, aName, xHandler ) );
+            rtl::Reference< SvxXMLTextExportComponent > xExporter( new SvxXMLTextExportComponent( xContext, &rEditEngine, rSel, aName, xHandler ) );
 
             xExporter->exportDoc();
 
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index eb3f6f5..df077f8 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -897,7 +897,7 @@ void SaneDlg::AcquirePreview()
     else
         mrSane.SetOptionValue( nOption, true );
 
-    Reference<BitmapTransporter> xTransporter(new BitmapTransporter);
+    rtl::Reference<BitmapTransporter> xTransporter(new BitmapTransporter);
     if( ! mrSane.Start( *xTransporter.get() ) )
     {
         ScopedVclPtrInstance< MessageDialog > aErrorBox(this, SaneResId(STR_ERROR_SCAN));
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 13fdcda..155b0ff 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -225,7 +225,7 @@ class UpdateInformationEnumeration : public ::cppu::WeakImplHelper< container::X
 {
 public:
     UpdateInformationEnumeration(const uno::Reference< xml::dom::XNodeList >& xNodeList,
-                                 const uno::Reference< UpdateInformationProvider >& xUpdateInformationProvider) :
+                                 const rtl::Reference< UpdateInformationProvider >& xUpdateInformationProvider) :
         m_xUpdateInformationProvider(xUpdateInformationProvider),
         m_xNodeList(xNodeList),
         m_nNodes(xNodeList.is() ? xNodeList->getLength() : 0),
@@ -280,7 +280,7 @@ public:
     }
 
 private:
-    const uno::Reference< UpdateInformationProvider > m_xUpdateInformationProvider;
+    const rtl::Reference< UpdateInformationProvider > m_xUpdateInformationProvider;
     const uno::Reference< xml::dom::XNodeList > m_xNodeList;
     const sal_Int32 m_nNodes;
     sal_Int32 m_nCount;
diff --git a/filter/source/svg/svgwriter.cxx b/filter/source/svg/svgwriter.cxx
index 2aaf55f..902cd31 100644
--- a/filter/source/svg/svgwriter.cxx
+++ b/filter/source/svg/svgwriter.cxx
@@ -3683,7 +3683,7 @@ void SAL_CALL SVGWriter::write( const Reference<XDocumentHandler>& rxDocHandler,
 
     ReadGDIMetaFile( aMemStm, aMtf );
 
-    Reference<SVGExport> pWriter(new SVGExport( mxContext, rxDocHandler, maFilterData ));
+    rtl::Reference<SVGExport> pWriter(new SVGExport( mxContext, rxDocHandler, maFilterData ));
     pWriter->writeMtf( aMtf );
 }
 
diff --git a/i18npool/inc/calendar_gregorian.hxx b/i18npool/inc/calendar_gregorian.hxx
index 31883d6..4f33381 100644
--- a/i18npool/inc/calendar_gregorian.hxx
+++ b/i18npool/inc/calendar_gregorian.hxx
@@ -23,6 +23,7 @@
 #include "nativenumbersupplier.hxx"
 
 #include <unicode/calendar.h>
+#include <rtl/ref.hxx>
 
 
 //  class Calendar_gregorian
@@ -97,7 +98,7 @@ public:
 protected:
     const Era *eraArray;
     icu::Calendar *body;
-    css::uno::Reference<NativeNumberSupplierService> mxNatNum;
+    rtl::Reference<NativeNumberSupplierService> mxNatNum;
     const sal_Char* cCalendar;
     css::lang::Locale aLocale;
     sal_uInt32 fieldSet;
diff --git a/i18npool/source/characterclassification/cclass_unicode.cxx b/i18npool/source/characterclassification/cclass_unicode.cxx
index c4a8bab..a67023f 100644
--- a/i18npool/source/characterclassification/cclass_unicode.cxx
+++ b/i18npool/source/characterclassification/cclass_unicode.cxx
@@ -27,6 +27,7 @@
 #include <cppuhelper/exc_hlp.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <breakiteratorImpl.hxx>
+#include <rtl/ref.hxx>
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -92,7 +93,7 @@ cclass_Unicode::toTitle( const OUString& Text, sal_Int32 nPos, sal_Int32 nCount,
         trans->setMappingType(MappingType::ToTitle, rLocale);
         rtl_uString* pStr = rtl_uString_alloc(nCount);
         sal_Unicode* out = pStr->buffer;
-        Reference< BreakIteratorImpl > xBrk(new BreakIteratorImpl(m_xContext));
+        rtl::Reference< BreakIteratorImpl > xBrk(new BreakIteratorImpl(m_xContext));
         Boundary bdy = xBrk->getWordBoundary(Text, nPos, rLocale,
                     WordType::ANYWORD_IGNOREWHITESPACES, true);
         for (sal_Int32 i = nPos; i < nCount + nPos; i++, out++) {
diff --git a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
index 5428d2a..82f3fa4 100644
--- a/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
+++ b/i18npool/source/defaultnumberingprovider/defaultnumberingprovider.cxx
@@ -23,6 +23,7 @@
 #include <com/sun/star/configuration/theDefaultProvider.hpp>
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <osl/diagnose.h>
+#include <rtl/ref.hxx>
 #include <localedata.hxx>
 #include <nativenumbersupplier.hxx>
 #include <stdio.h>
@@ -858,7 +859,7 @@ DefaultNumberingProvider::makeNumberingString( const Sequence<beans::PropertyVal
       }
 
         if (natNum) {
-            uno::Reference<NativeNumberSupplierService> xNatNum(new NativeNumberSupplierService);
+            rtl::Reference<NativeNumberSupplierService> xNatNum(new NativeNumberSupplierService);
             result += xNatNum->getNativeNumberString(OUString::number( number ), locale, natNum);
         } else if (tableSize) {
             if ( number > tableSize && !bRecycleSymbol)
diff --git a/i18npool/source/indexentry/indexentrysupplier.cxx b/i18npool/source/indexentry/indexentrysupplier.cxx
index 71a61ba..ed3dbe7 100644
--- a/i18npool/source/indexentry/indexentrysupplier.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <rtl/ustrbuf.hxx>
+#include <rtl/ref.hxx>
 #include <cppuhelper/supportsservice.hxx>
 #include <indexentrysupplier.hxx>
 #include <localedata.hxx>
@@ -116,7 +117,7 @@ IndexEntrySupplier::getLocaleSpecificIndexEntrySupplier(const Locale& rLocale, c
             rLocale.Country == aLocale.Country && rLocale.Variant == aLocale.Variant)
         return xIES;
     else {
-        uno::Reference<LocaleDataImpl> ld(new LocaleDataImpl);
+        rtl::Reference<LocaleDataImpl> ld(new LocaleDataImpl);
         aLocale = rLocale;
         if (rSortAlgorithm.isEmpty())
             aSortAlgorithm = ld->getDefaultIndexAlgorithm( rLocale );
diff --git a/i18npool/source/transliteration/ignoreKana.cxx b/i18npool/source/transliteration/ignoreKana.cxx
index 6aa1e90..1e1707c 100644
--- a/i18npool/source/transliteration/ignoreKana.cxx
+++ b/i18npool/source/transliteration/ignoreKana.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/ref.hxx>
 
 #include <transliteration_Ignore.hxx>
 #include <transliteration_OneToOne.hxx>
@@ -31,7 +32,7 @@ OUString SAL_CALL
 ignoreKana::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
   throw(RuntimeException, std::exception)
 {
-    Reference< hiraganaToKatakana > t1(new hiraganaToKatakana);
+    rtl::Reference< hiraganaToKatakana > t1(new hiraganaToKatakana);
     return t1->transliterate(inStr, startPos, nCount, offset);
 }
 
@@ -39,8 +40,8 @@ Sequence< OUString > SAL_CALL
 ignoreKana::transliterateRange( const OUString& str1, const OUString& str2 )
   throw(RuntimeException, std::exception)
 {
-    Reference< hiraganaToKatakana > t1(new hiraganaToKatakana);
-    Reference< katakanaToHiragana > t2(new katakanaToHiragana);
+    rtl::Reference< hiraganaToKatakana > t1(new hiraganaToKatakana);
+    rtl::Reference< katakanaToHiragana > t2(new katakanaToHiragana);
 
     return transliteration_Ignore::transliterateRange(str1, str2, *t1.get(), *t2.get());
 }
@@ -48,7 +49,7 @@ ignoreKana::transliterateRange( const OUString& str1, const OUString& str2 )
 sal_Unicode SAL_CALL
 ignoreKana::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception)
 {
-    Reference< hiraganaToKatakana > t1(new hiraganaToKatakana);
+    rtl::Reference< hiraganaToKatakana > t1(new hiraganaToKatakana);
     return t1->transliterateChar2Char(inChar);
 }
 
diff --git a/i18npool/source/transliteration/ignoreSize_ja_JP.cxx b/i18npool/source/transliteration/ignoreSize_ja_JP.cxx
index 45f10be..be2f4e8 100644
--- a/i18npool/source/transliteration/ignoreSize_ja_JP.cxx
+++ b/i18npool/source/transliteration/ignoreSize_ja_JP.cxx
@@ -19,6 +19,7 @@
 
 #include <transliteration_Ignore.hxx>
 #include <transliteration_OneToOne.hxx>
+#include <rtl/ref.hxx>
 
 using namespace com::sun::star::uno;
 using namespace com::sun::star::lang;
@@ -29,7 +30,7 @@ OUString SAL_CALL
 ignoreSize_ja_JP::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
   throw(RuntimeException, std::exception)
 {
-    Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP);
+    rtl::Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP);
     return t1->transliterate(inStr, startPos, nCount, offset);
 }
 
@@ -38,8 +39,8 @@ Sequence< OUString > SAL_CALL
 ignoreSize_ja_JP::transliterateRange( const OUString& str1, const OUString& str2 )
   throw(RuntimeException, std::exception)
 {
-    Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP);
-    Reference< largeToSmall_ja_JP > t2(new largeToSmall_ja_JP);
+    rtl::Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP);
+    rtl::Reference< largeToSmall_ja_JP > t2(new largeToSmall_ja_JP);
 
     return transliteration_Ignore::transliterateRange(str1, str2, *t1.get(), *t2.get());
 }
@@ -47,7 +48,7 @@ ignoreSize_ja_JP::transliterateRange( const OUString& str1, const OUString& str2
 sal_Unicode SAL_CALL
 ignoreSize_ja_JP::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception)
 {
-    Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP);
+    rtl::Reference< smallToLarge_ja_JP > t1(new smallToLarge_ja_JP);
     return t1->transliterateChar2Char(inChar);
 }
 
diff --git a/i18npool/source/transliteration/ignoreWidth.cxx b/i18npool/source/transliteration/ignoreWidth.cxx
index ab4ade0..15f6815 100644
--- a/i18npool/source/transliteration/ignoreWidth.cxx
+++ b/i18npool/source/transliteration/ignoreWidth.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/ref.hxx>
 
 #include <transliteration_Ignore.hxx>
 #include <transliteration_OneToOne.hxx>
@@ -31,7 +32,7 @@ OUString SAL_CALL
 ignoreWidth::folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, Sequence< sal_Int32 >& offset )
   throw(RuntimeException, std::exception)
 {
-    Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth);
+    rtl::Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth);
     return t1->transliterate(inStr, startPos, nCount, offset);
 }
 
@@ -39,8 +40,8 @@ Sequence< OUString > SAL_CALL
 ignoreWidth::transliterateRange( const OUString& str1, const OUString& str2 )
   throw(RuntimeException, std::exception)
 {
-    Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth);
-    Reference< halfwidthToFullwidth > t2(new halfwidthToFullwidth);
+    rtl::Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth);
+    rtl::Reference< halfwidthToFullwidth > t2(new halfwidthToFullwidth);
 
     return transliteration_Ignore::transliterateRange(str1, str2, *t1.get(), *t2.get());
 }
@@ -48,7 +49,7 @@ ignoreWidth::transliterateRange( const OUString& str1, const OUString& str2 )
 sal_Unicode SAL_CALL
 ignoreWidth::transliterateChar2Char( sal_Unicode inChar) throw(RuntimeException, MultipleCharsOutputException, std::exception)
 {
-    Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth);
+    rtl::Reference< fullwidthToHalfwidth > t1(new fullwidthToHalfwidth);
     return t1->transliterateChar2Char(inChar);
 }
 
diff --git a/i18npool/source/transliteration/transliteration_body.cxx b/i18npool/source/transliteration/transliteration_body.cxx
index 0470ed4..0e2d4c5 100644
--- a/i18npool/source/transliteration/transliteration_body.cxx
+++ b/i18npool/source/transliteration/transliteration_body.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <rtl/ustrbuf.hxx>
+#include <rtl/ref.hxx>
 #include <i18nutil/casefolding.hxx>
 #include <i18nutil/unicode.hxx>
 
@@ -269,7 +270,7 @@ static OUString transliterate_titlecase_Impl(
     if (!aText.isEmpty())
     {
         Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-        Reference< CharacterClassificationImpl > xCharClassImpl( new CharacterClassificationImpl( xContext ) );
+        rtl::Reference< CharacterClassificationImpl > xCharClassImpl( new CharacterClassificationImpl( xContext ) );
 
         // because xCharClassImpl.toTitle does not handle ligatures or Beta but will raise
         // an exception we need to handle the first chara manually...
diff --git a/i18npool/source/transliteration/transliteration_caseignore.cxx b/i18npool/source/transliteration/transliteration_caseignore.cxx
index e01eb1f..77d5a80 100644
--- a/i18npool/source/transliteration/transliteration_caseignore.cxx
+++ b/i18npool/source/transliteration/transliteration_caseignore.cxx
@@ -18,6 +18,7 @@
  */
 
 #include <com/sun/star/uno/XComponentContext.hpp>
+#include <rtl/ref.hxx>
 
 #include <i18nutil/oneToOneMapping.hxx>
 #include <i18nutil/casefolding.hxx>
@@ -59,8 +60,8 @@ Transliteration_caseignore::transliterateRange( const OUString& str1, const OUSt
     if (str1.getLength() != 1 || str2.getLength() != 1)
         throw RuntimeException();
 
-    static Reference< Transliteration_u2l > u2l(new Transliteration_u2l);
-    static Reference< Transliteration_l2u > l2u(new Transliteration_l2u);
+    static rtl::Reference< Transliteration_u2l > u2l(new Transliteration_u2l);
+    static rtl::Reference< Transliteration_l2u > l2u(new Transliteration_l2u);
 
     u2l->loadModule((TransliterationModules)0, aLocale);
     l2u->loadModule((TransliterationModules)0, aLocale);
diff --git a/include/sfx2/filedlghelper.hxx b/include/sfx2/filedlghelper.hxx
index 13a34d5..9c7e3b3 100644
--- a/include/sfx2/filedlghelper.hxx
+++ b/include/sfx2/filedlghelper.hxx
@@ -24,6 +24,7 @@
 #include <sal/types.h>
 #include <com/sun/star/uno/Reference.hxx>
 #include <com/sun/star/uno/Sequence.hxx>
+#include <rtl/ref.hxx>
 #include <rtl/ustring.hxx>
 #include <tools/errcode.hxx>
 #include <vcl/dialog.hxx>
@@ -100,7 +101,7 @@ private:
     Link<FileDialogHelper*,void>  m_aDialogClosedLink;
     ErrCode m_nError;
 
-    css::uno::Reference< FileDialogHelper_Impl > mpImpl;
+    rtl::Reference< FileDialogHelper_Impl > mpImpl;
 
 
 public:
@@ -132,9 +133,11 @@ public:
                                               const css::uno::Sequence< OUString >& rBlackList,
                                               vcl::Window* _pPreferredParent = nullptr );
 
-
     virtual                 ~FileDialogHelper();
 
+    FileDialogHelper& operator=(const FileDialogHelper &) = delete;
+    FileDialogHelper(const FileDialogHelper &) = delete;
+
     ErrCode                 Execute();
     void                    StartExecuteModal( const Link<FileDialogHelper*,void>& rEndDialogHdl );
     inline ErrCode          GetError() const { return m_nError; }
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index b668cf8..d179616 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -245,7 +245,7 @@ void XmlFilterBase::importDocumentProperties()
     MediaDescriptor aMediaDesc( getMediaDescriptor() );
     Reference< XInputStream > xInputStream;
     Reference< XComponentContext > xContext = getComponentContext();
-    Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) );
+    rtl::Reference< ::oox::core::FilterDetect > xDetector( new ::oox::core::FilterDetect( xContext ) );
     xInputStream = xDetector->extractUnencryptedPackage( aMediaDesc );
     Reference< XComponent > xModel( getModel(), UNO_QUERY );
     Reference< XStorage > xDocumentStorage (
@@ -820,7 +820,7 @@ Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rM
     /*  Get the input stream directly from the media descriptor, or decrypt the
         package again. The latter is needed e.g. when the document is reloaded.
         All this is implemented in the detector service. */
-    Reference< FilterDetect > xDetector( new FilterDetect( getComponentContext() ) );
+    rtl::Reference< FilterDetect > xDetector( new FilterDetect( getComponentContext() ) );
     return xDetector->extractUnencryptedPackage( rMediaDesc );
 }
 
diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx
index 7cd7e96..83b28b2 100644
--- a/reportdesign/source/ui/dlg/GroupsSorting.cxx
+++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx
@@ -107,7 +107,7 @@ class OFieldExpressionControl : public ::svt::EditBrowseBox
     ImplSVEvent *                   m_nDeleteEvent;
     VclPtr<OGroupsSortingDialog>    m_pParent;
     bool                            m_bIgnoreEvent;
-    css::uno::Reference<OFieldExpressionControlContainerListener> aContainerListener;
+    rtl::Reference<OFieldExpressionControlContainerListener> aContainerListener;
 
     bool SaveModified(bool _bAppend);
 
diff --git a/sax/qa/cppunit/attributes.cxx b/sax/qa/cppunit/attributes.cxx
index 3697190..7bd09b5 100644
--- a/sax/qa/cppunit/attributes.cxx
+++ b/sax/qa/cppunit/attributes.cxx
@@ -13,6 +13,7 @@
 #include <cppunit/extensions/HelperMacros.h>
 #include <cppunit/plugin/TestPlugIn.h>
 
+#include <rtl/ref.hxx>
 #include <sax/fastattribs.hxx>
 
 using namespace css;
@@ -32,7 +33,7 @@ public:
 
 void AttributesTest::test()
 {
-    uno::Reference<sax_fastparser::FastAttributeList> xAttributeList( new sax_fastparser::FastAttributeList(nullptr) );
+    rtl::Reference<sax_fastparser::FastAttributeList> xAttributeList( new sax_fastparser::FastAttributeList(nullptr) );
     xAttributeList->add(1, "1");
     xAttributeList->add(2, OString("2"));
 
diff --git a/sax/qa/cppunit/parser.cxx b/sax/qa/cppunit/parser.cxx
index 5381f36..a94d595 100644
--- a/sax/qa/cppunit/parser.cxx
+++ b/sax/qa/cppunit/parser.cxx
@@ -45,8 +45,8 @@ public:
 class ParserTest: public test::BootstrapFixture
 {
     InputSource maInput;
-    uno::Reference< sax_fastparser::FastSaxParser > mxParser;
-    uno::Reference< DummyTokenHandler > mxTokenHandler;
+    rtl::Reference< sax_fastparser::FastSaxParser > mxParser;
+    rtl::Reference< DummyTokenHandler > mxTokenHandler;
 
 public:
     virtual void setUp() override;
diff --git a/sax/qa/cppunit/xmlimport.cxx b/sax/qa/cppunit/xmlimport.cxx
index bf7cd15..ab8a759 100644
--- a/sax/qa/cppunit/xmlimport.cxx
+++ b/sax/qa/cppunit/xmlimport.cxx
@@ -194,7 +194,7 @@ class XMLImportTest : public test::BootstrapFixture
 {
 private:
     OUString m_sDirPath;
-    Reference< TestDocumentHandler > m_xDocumentHandler;
+    rtl::Reference< TestDocumentHandler > m_xDocumentHandler;
     Reference< xml::sax::XParser > m_xParser;
     Reference< lang::XMultiServiceFactory > m_xSMgr;
 
@@ -217,7 +217,7 @@ void XMLImportTest::setUp()
     m_xSMgr = getMultiServiceFactory();
     m_xParser = xml::sax::Parser::create(
         ::comphelper::getProcessComponentContext() );
-    m_xParser->setDocumentHandler( m_xDocumentHandler );
+    m_xParser->setDocumentHandler( m_xDocumentHandler.get() );
     m_sDirPath = m_directories.getPathFromSrc( "/sax/qa/data/" );
 }
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 238da0d..16f81fa 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -5645,7 +5645,7 @@ void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDe
     //! wenn es schon ein ScFilterDescriptor ist, direkt per getImplementation?
 
     ScDocShell* pDocSh = GetDocShell();
-    uno::Reference<ScFilterDescriptor> xImpl(new ScFilterDescriptor(pDocSh));
+    rtl::Reference<ScFilterDescriptor> xImpl(new ScFilterDescriptor(pDocSh));
     uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
     if ( xDescriptor2.is() )
     {
diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx
index afe109d..784bacc 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -3292,9 +3292,9 @@ uno::Reference< util::XCloneable > SAL_CALL ScChart2DataSequence::createClone()
         aTokensNew.push_back(p);
     }
 
-    uno::Reference<ScChart2DataSequence> p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, std::move(aTokensNew), m_bIncludeHiddenCells));
+    rtl::Reference<ScChart2DataSequence> p(new ScChart2DataSequence(m_pDocument, m_xDataProvider, std::move(aTokensNew), m_bIncludeHiddenCells));
     p->CopyData(*this);
-    Reference< util::XCloneable > xClone(p);
+    Reference< util::XCloneable > xClone(p.get());
 
     return xClone;
 }
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 064c8b6..43f5897 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -2025,7 +2025,7 @@ void SAL_CALL ScModelObj::consolidate(
     //  die Daten in ein ScConsolidationDescriptor Objekt zu kopieren:
     //! wenn es schon ein ScConsolidationDescriptor ist, direkt per getImplementation?
 
-    uno::Reference< ScConsolidationDescriptor > xImpl(new ScConsolidationDescriptor);
+    rtl::Reference< ScConsolidationDescriptor > xImpl(new ScConsolidationDescriptor);
     xImpl->setFunction( xDescriptor->getFunction() );
     xImpl->setSources( xDescriptor->getSources() );
     xImpl->setStartOutputPosition( xDescriptor->getStartOutputPosition() );
diff --git a/sc/source/ui/unoobj/warnpassword.cxx b/sc/source/ui/unoobj/warnpassword.cxx
index 27a197f..b35a81c 100644
--- a/sc/source/ui/unoobj/warnpassword.cxx
+++ b/sc/source/ui/unoobj/warnpassword.cxx
@@ -49,7 +49,7 @@ bool ScWarnPassword::WarningOnPassword( SfxMedium& rMedium )
                 InteractionClassification_QUERY,
                  ERRCODE_SVX_EXPORT_FILTER_CRYPT)));
 
-        Reference< ucbhelper::SimpleInteractionRequest > xRequest
+        rtl::Reference< ucbhelper::SimpleInteractionRequest > xRequest
                     = new ucbhelper::SimpleInteractionRequest(
                         aException,
                         ucbhelper::CONTINUATION_APPROVE
diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx
index a661989..b5d3bd6 100644
--- a/sc/source/ui/vba/vbafont.cxx
+++ b/sc/source/ui/vba/vbafont.cxx
@@ -84,7 +84,7 @@ ScVbaFont::setSuperscript( const uno::Any& aValue ) throw ( uno::RuntimeExceptio
             for ( sal_Int32 row = 0; row < nRows; ++row )
             {
                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW );
-                uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
+                rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
                 aFont->setSuperscript( aValue );
             }
         }
@@ -124,7 +124,7 @@ ScVbaFont::getSuperscript() throw ( uno::RuntimeException, std::exception )
             for ( sal_Int32 row = 0; row < nRows; ++row )
             {
                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW );
-                uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
+                rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
                 if ( !col && !row )
                     aRes = aFont->getSuperscript();
                 else if ( aRes != aFont->getSuperscript() )
@@ -156,7 +156,7 @@ ScVbaFont::setSubscript( const uno::Any& aValue ) throw ( uno::RuntimeException,
             for ( sal_Int32 row = 0; row < nRows; ++row )
             {
                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ) , uno::UNO_QUERY_THROW );
-                uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
+                rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
                 aFont->setSubscript( aValue );
             }
         }
@@ -198,7 +198,7 @@ ScVbaFont::getSubscript() throw ( uno::RuntimeException, std::exception )
             for ( sal_Int32 row = 0; row < nRows; ++row )
             {
                 uno::Reference< beans::XPropertySet > xProps( xCellRange->getCellByPosition( col, row ), uno::UNO_QUERY_THROW );
-                uno::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
+                rtl::Reference< ScVbaFont > aFont( new ScVbaFont( getParent(), mxContext, mPalette, xProps ) );
                 if ( !col && !row )
                     aRes = aFont->getSubscript();
                 else if ( aRes != aFont->getSubscript() )
diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx
index edd48dc..8e46e0a 100644
--- a/sc/source/ui/vba/vbawindow.cxx
+++ b/sc/source/ui/vba/vbawindow.cxx
@@ -307,7 +307,7 @@ ScVbaWindow::getCaption() throw (uno::RuntimeException, std::exception)
         if ( ( nCrudLen + nCrudIndex ) == sTitle.getLength() )
         {
             sTitle = sTitle.copy( 0, nCrudIndex );
-            uno::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
+            rtl::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
             OUString sName = workbook->getName();
             // rather bizarre hack to make sure the name behavior
             // is like XL
@@ -439,7 +439,7 @@ ScVbaWindow::setWindowState( const uno::Any& _windowstate ) throw (uno::RuntimeE
 void
 ScVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception)
 {
-    uno::Reference<ScVbaWorkbook> workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
+    rtl::Reference<ScVbaWorkbook> workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
 
     workbook->Activate();
 }
@@ -447,7 +447,7 @@ ScVbaWindow::Activate() throw (css::uno::RuntimeException, std::exception)
 void
 ScVbaWindow::Close( const uno::Any& SaveChanges, const uno::Any& FileName, const uno::Any& RouteWorkBook ) throw (uno::RuntimeException, std::exception)
 {
-    uno::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
+    rtl::Reference< ScVbaWorkbook > workbook( new ScVbaWorkbook( uno::Reference< XHelperInterface >( Application(), uno::UNO_QUERY_THROW ), mxContext, m_xModel ) );
     workbook->Close(SaveChanges, FileName, RouteWorkBook );
 }
 
diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx
index 230aaf5..d367134 100644
--- a/sc/source/ui/vba/vbawindows.cxx
+++ b/sc/source/ui/vba/vbawindows.cxx
@@ -128,7 +128,7 @@ public:
                 // !! TODO !! iterate over all controllers
                 uno::Reference< frame::XController > xController( xModel->getCurrentController(), uno::UNO_SET_THROW );
                 uno::Reference< XHelperInterface > xTemp;  // temporary needed for g++ 3.3.5
-                uno::Reference< ScVbaWindow > window( new ScVbaWindow( xTemp, m_xContext, xModel, xController ) );
+                rtl::Reference< ScVbaWindow > window( new ScVbaWindow( xTemp, m_xContext, xModel, xController ) );
                 OUString sCaption;
                 window->getCaption() >>= sCaption;
                 namesToIndices[ sCaption ] = nIndex++;
diff --git a/sd/source/ui/dlg/RemoteDialogClientBox.hxx b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
index a4b072e..b2d5718 100644
--- a/sd/source/ui/dlg/RemoteDialogClientBox.hxx
+++ b/sd/source/ui/dlg/RemoteDialogClientBox.hxx
@@ -105,7 +105,7 @@ class ClientBox : public Control
 
     VclPtr<ScrollBar> m_aScrollBar;
 
-    css::uno::Reference< ClientRemovedListener > m_xRemoveListener;
+    rtl::Reference< ClientRemovedListener > m_xRemoveListener;
 
     //This mutex is used for synchronizing access to m_vEntries.
     //Currently it is used to synchronize adding, removing entries and
diff --git a/sd/source/ui/inc/EventMultiplexer.hxx b/sd/source/ui/inc/EventMultiplexer.hxx
index 541f7e5..f6f38ce 100644
--- a/sd/source/ui/inc/EventMultiplexer.hxx
+++ b/sd/source/ui/inc/EventMultiplexer.hxx
@@ -20,9 +20,11 @@
 #ifndef INCLUDED_SD_SOURCE_UI_INC_EVENTMULTIPLEXER_HXX
 #define INCLUDED_SD_SOURCE_UI_INC_EVENTMULTIPLEXER_HXX
 
+#include <sal/config.h>
+
+#include <rtl/ref.hxx>
 #include <svl/lstner.hxx>
 #include <tools/link.hxx>
-#include <com/sun/star/uno/Reference.hxx>
 
 #include <set>
 #include <memory>
@@ -203,7 +205,7 @@ public:
 
 private:
     class Implementation;
-    css::uno::Reference<Implementation> mpImpl;
+    rtl::Reference<Implementation> mpImpl;
 };
 
 } } // end of namespace ::sd::tools
diff --git a/sd/source/ui/view/drviews5.cxx b/sd/source/ui/view/drviews5.cxx
index d8dc8a2..de08b44 100644
--- a/sd/source/ui/view/drviews5.cxx
+++ b/sd/source/ui/view/drviews5.cxx
@@ -575,7 +575,7 @@ void DrawViewShell::SetActiveTabLayerIndex (int nIndex)
             // Tell the draw view and the tab control of the new active layer.
             mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
             pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
-            css::uno::Reference<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
+            rtl::Reference<SdUnoDrawView> pUnoDrawView(new SdUnoDrawView (
                 *this,
                 *GetView()));
             css::uno::Reference< css::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
diff --git a/sdext/source/pdfimport/test/pdf2xml.cxx b/sdext/source/pdfimport/test/pdf2xml.cxx
index 574a81a..f0caa1d 100644
--- a/sdext/source/pdfimport/test/pdf2xml.cxx
+++ b/sdext/source/pdfimport/test/pdf2xml.cxx
@@ -27,6 +27,7 @@
 
 #include <sal/main.h>
 #include <osl/process.h>
+#include <rtl/ref.hxx>
 #include <unotest/bootstrapfixturebase.hxx>
 #include <comphelper/processfactory.hxx>
 #include <cppuhelper/bootstrap.hxx>
@@ -74,7 +75,7 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
         test::BootstrapFixtureBase aEnv;
         aEnv.setUp();
 
-        uno::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), aEnv.getComponentContext()) );
+        rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), aEnv.getComponentContext()) );
         xAdaptor->setTreeVisitorFactory(pTreeFactory);
         nRet = xAdaptor->odfConvert(aSrcURL, new OutputWrap(aDstURL), nullptr) ? 0 : 1;
     }
diff --git a/sdext/source/pdfimport/test/tests.cxx b/sdext/source/pdfimport/test/tests.cxx
index e489623..38f0956 100644
--- a/sdext/source/pdfimport/test/tests.cxx
+++ b/sdext/source/pdfimport/test/tests.cxx
@@ -468,7 +468,7 @@ namespace
 
         void testOdfDrawExport()
         {
-            uno::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
+            rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
             xAdaptor->setTreeVisitorFactory( createDrawTreeVisitorFactory() );
 
             OUString tempFileURL;
@@ -483,7 +483,7 @@ namespace
 
         void testOdfWriterExport()
         {
-            uno::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
+            rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor( new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()) );
             xAdaptor->setTreeVisitorFactory( createWriterTreeVisitorFactory() );
 
             OUString tempFileURL;
@@ -498,7 +498,7 @@ namespace
 
         void testTdf96993()
         {
-            uno::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+            rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
             xAdaptor->setTreeVisitorFactory(createDrawTreeVisitorFactory());
 
             OString aOutput;
@@ -512,7 +512,7 @@ namespace
 
         void testTdf98421()
         {
-            uno::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
+            rtl::Reference<pdfi::PDFIRawAdaptor> xAdaptor(new pdfi::PDFIRawAdaptor(OUString(), getComponentContext()));
             xAdaptor->setTreeVisitorFactory(createWriterTreeVisitorFactory());
 
             OString aOutput;
diff --git a/svtools/source/edit/svmedit.cxx b/svtools/source/edit/svmedit.cxx
index 67a2fe3..afe0adc 100644
--- a/svtools/source/edit/svmedit.cxx
+++ b/svtools/source/edit/svmedit.cxx
@@ -33,9 +33,9 @@ MultiLineEdit::GetComponentInterface(bool bCreate)
         VclMultiLineEdit::GetComponentInterface(false));
     if (!xPeer.is() && bCreate)
     {
-        css::uno::Reference< VCLXMultiLineEdit > xVCLMEdit(new VCLXMultiLineEdit);
+        rtl::Reference< VCLXMultiLineEdit > xVCLMEdit(new VCLXMultiLineEdit);
         xVCLMEdit->SetWindow(this);
-        xPeer = xVCLMEdit;
+        xPeer = xVCLMEdit.get();
         SetComponentInterface(xPeer);
     }
     return xPeer;
diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx
index ba098897..8cb0902 100644
--- a/svx/source/sdr/contact/viewcontactofgraphic.cxx
+++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx
@@ -268,7 +268,7 @@ namespace sdr
                         aScale, fShearX, fRotate, aTranslate));
 
                     // directly create temp SdrBlockTextPrimitive2D
-                    css::uno::Reference< drawinglayer::primitive2d::SdrBlockTextPrimitive2D > xBlockTextPrimitive(new drawinglayer::primitive2d::SdrBlockTextPrimitive2D(
+                    rtl::Reference< drawinglayer::primitive2d::SdrBlockTextPrimitive2D > xBlockTextPrimitive(new drawinglayer::primitive2d::SdrBlockTextPrimitive2D(
                         pSdrText,
                         *pOPO,
                         aTextRangeTransform,
diff --git a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
index c9cf3f5..ecedcea 100644
--- a/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
+++ b/svx/source/sdr/primitive2d/sdrmeasureprimitive2d.cxx
@@ -25,6 +25,7 @@
 #include <basegfx/polygon/b2dpolypolygontools.hxx>
 #include <basegfx/tools/canvastools.hxx>
 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
+#include <rtl/ref.hxx>
 #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
 #include <basegfx/matrix/b2dhommatrixtools.hxx>
 #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
@@ -84,7 +85,7 @@ namespace drawinglayer
         Primitive2DContainer SdrMeasurePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& aViewInformation) const
         {
             Primitive2DContainer aRetval;
-            css::uno::Reference<SdrBlockTextPrimitive2D> xBlockText;
+            rtl::Reference<SdrBlockTextPrimitive2D> xBlockText;
             basegfx::B2DRange aTextRange;
             const basegfx::B2DVector aLine(getEnd() - getStart());
             const double fDistance(aLine.getLength());
diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx
index cf50fcf..b00e0bf 100644
--- a/svx/source/table/accessibletableshape.cxx
+++ b/svx/source/table/accessibletableshape.cxx
@@ -84,8 +84,8 @@ public:
     Reference< XAccessible> mxAccessible;
     sal_Int32 mRowCount, mColCount;
     //get the cached AccessibleCell from XCell
-    Reference< AccessibleCell > getAccessibleCell (const Reference< XCell >& xCell);
-    Reference< AccessibleCell > getAccessibleCell (sal_Int32 nRow, sal_Int32 nColumn) throw (IndexOutOfBoundsException, RuntimeException);
+    rtl::Reference< AccessibleCell > getAccessibleCell (const Reference< XCell >& xCell);
+    rtl::Reference< AccessibleCell > getAccessibleCell (sal_Int32 nRow, sal_Int32 nColumn) throw (IndexOutOfBoundsException, RuntimeException);
 };
 
 
@@ -136,23 +136,23 @@ void AccessibleTableShapeImpl::dispose()
 
 
 //get the cached AccessibleCell from XCell
-Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (const Reference< XCell >& xCell)
+rtl::Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (const Reference< XCell >& xCell)
 {
     AccessibleCellMap::iterator iter( maChildMap.find( xCell ) );
 
     if( iter != maChildMap.end() )
     {
-        Reference< AccessibleCell > xChild( (*iter).second.get() );
+        rtl::Reference< AccessibleCell > xChild( (*iter).second.get() );
         return xChild;
     }
-    return Reference< AccessibleCell >();
+    return rtl::Reference< AccessibleCell >();
 }
 
-Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (sal_Int32 nRow, sal_Int32 nColumn)
+rtl::Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (sal_Int32 nRow, sal_Int32 nColumn)
     throw (IndexOutOfBoundsException, RuntimeException)
 {
     Reference< XCell > xCell( mxTable->getCellByPosition( nColumn, nRow ) );
-    Reference< AccessibleCell > xChild = getAccessibleCell( xCell );
+    rtl::Reference< AccessibleCell > xChild = getAccessibleCell( xCell );
 
     if( !xChild.is() && mxTable.is() )
     {
@@ -164,7 +164,7 @@ Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (sal_Int
         xAccessibleCell->Init();
         maChildMap[xCell] = xAccessibleCell;
 
-        xChild = Reference< AccessibleCell >( xAccessibleCell.get() );
+        xChild = rtl::Reference< AccessibleCell >( xAccessibleCell.get() );
     }
     return xChild;
 }
@@ -918,7 +918,7 @@ void  SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent
     Reference< XCell > xCell(rEvent.Source, UNO_QUERY);
     if (xCell.is())
     {
-        Reference< AccessibleCell > xAccCell = mxImpl->getAccessibleCell( xCell );
+        rtl::Reference< AccessibleCell > xAccCell = mxImpl->getAccessibleCell( xCell );
         if (xAccCell.is())
         {
             sal_Int32 nIndex = xAccCell->getAccessibleIndexInParent(),
@@ -946,7 +946,7 @@ void  SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent
 // Get the currently active cell which is text editing
 AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell()
 {
-    Reference< AccessibleCell > xAccCell;
+    rtl::Reference< AccessibleCell > xAccCell;
     AccessibleCell* pAccCell = nullptr;
     SvxTableController* pController = getTableController();
     if (pController)
diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx
index 171e27c..d5998b3 100644
--- a/svx/source/xml/xmlxtexp.cxx
+++ b/svx/source/xml/xmlxtexp.cxx
@@ -293,7 +293,7 @@ bool SvxXMLXTableExportComponent::save(
 
         // Finally do the export
         const OUString aName;
-        uno::Reference< SvxXMLXTableExportComponent > xExporter( new SvxXMLXTableExportComponent( xContext, aName, xHandler, xTable, xGrfResolver ) );
+        rtl::Reference< SvxXMLXTableExportComponent > xExporter( new SvxXMLXTableExportComponent( xContext, aName, xHandler, xTable, xGrfResolver ) );
         bRet = xExporter->exportTable();
 
         if( pGraphicHelper )
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index a7e5a63..612b1be 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -502,7 +502,7 @@ static sal_uInt8 lcl_TryMergeLines(
  * @param[in]   rEnd        ending point of merged primitive
  * @return      merged primitive
 **/
-static css::uno::Reference<BorderLinePrimitive2D>
+static rtl::Reference<BorderLinePrimitive2D>
 lcl_MergeBorderLines(
     BorderLinePrimitive2D const& rLine, BorderLinePrimitive2D const& rOther,
     basegfx::B2DPoint const& rStart, basegfx::B2DPoint const& rEnd)
@@ -530,7 +530,7 @@ lcl_MergeBorderLines(
  * @return      merged borderline including the two input primitive, if they can be merged
  *              0, otherwise
 **/
-static css::uno::Reference<BorderLinePrimitive2D>
+static rtl::Reference<BorderLinePrimitive2D>
 lcl_TryMergeBorderLine(BorderLinePrimitive2D const& rThis,
                        BorderLinePrimitive2D const& rOther,
                        SwPaintProperties& properties)
@@ -586,7 +586,7 @@ lcl_TryMergeBorderLine(BorderLinePrimitive2D const& rThis,
                 rThis.getStart().getX(), rThis.getStart().getY());
             basegfx::B2DPoint const end(
                 rOther.getEnd().getX(), rOther.getEnd().getY());
-            return lcl_MergeBorderLines(rThis, rOther, start, end);
+            return lcl_MergeBorderLines(rThis, rOther, start, end).get();
         }
         // The merged primitive starts with rOther and ends with rThis
         else if(nRet == 2)
@@ -595,7 +595,7 @@ lcl_TryMergeBorderLine(BorderLinePrimitive2D const& rThis,
                 rOther.getStart().getX(), rOther.getStart().getY());
             basegfx::B2DPoint const end(
                 rThis.getEnd().getX(), rThis.getEnd().getY());
-            return lcl_MergeBorderLines(rOther, rThis, start, end);
+            return lcl_MergeBorderLines(rOther, rThis, start, end).get();
         }
     }
     return nullptr;
@@ -607,11 +607,11 @@ void BorderLines::AddBorderLine(
     for (drawinglayer::primitive2d::Primitive2DContainer::reverse_iterator it = m_Lines.rbegin(); it != m_Lines.rend();
          ++it)
     {
-        css::uno::Reference<BorderLinePrimitive2D> const xMerged(
-            lcl_TryMergeBorderLine(*static_cast<BorderLinePrimitive2D*>((*it).get()), *xLine.get(), properties));
+        rtl::Reference<BorderLinePrimitive2D> const xMerged(
+            lcl_TryMergeBorderLine(*static_cast<BorderLinePrimitive2D*>((*it).get()), *xLine.get(), properties).get());
         if (xMerged.is())
         {
-            *it = xMerged; // replace existing line with merged
+            *it = xMerged.get(); // replace existing line with merged
             return;
         }
     }
@@ -4918,7 +4918,7 @@ static void lcl_MakeBorderLine(SwRect const& rRect,
     Color const aLeftColor = rBorder.GetColorOut(isLeftOrTopBorder);
     Color const aRightColor = rBorder.GetColorIn(isLeftOrTopBorder);
 
-    css::uno::Reference<BorderLinePrimitive2D> const xLine =
+    rtl::Reference<BorderLinePrimitive2D> const xLine =
         new BorderLinePrimitive2D(
             aStart, aEnd, nLeftWidth, rBorder.GetDistance(), nRightWidth,
             nExtentLeftStart, nExtentLeftEnd,
@@ -4926,7 +4926,7 @@ static void lcl_MakeBorderLine(SwRect const& rRect,
             aLeftColor.getBColor(), aRightColor.getBColor(),
             rBorder.GetColorGap().getBColor(), rBorder.HasGapColor(),
             rBorder.GetBorderLineStyle() );
-    properties.pBLines->AddBorderLine(xLine, properties);
+    properties.pBLines->AddBorderLine(xLine.get(), properties);
 }
 
 /**
diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx
index b2f50ac..0112748 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -369,7 +369,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString&
        uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter,
         uno::UNO_QUERY);
 
-    uno::Reference<SwXMLTextBlockExport> xExp( new SwXMLTextBlockExport( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler) );
+    rtl::Reference<SwXMLTextBlockExport> xExp( new SwXMLTextBlockExport( xContext, *this, GetXMLToken ( XML_UNFORMATTED_TEXT ), xHandler) );
 
     xExp->exportDoc( rText );
 
@@ -488,7 +488,7 @@ void SwXMLTextBlocks::WriteInfo()
 
         uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY);
 
-        uno::Reference<SwXMLBlockListExport> xExp(new SwXMLBlockListExport( xContext, *this, OUString(XMLN_BLOCKLIST), xHandler) );
+        rtl::Reference<SwXMLBlockListExport> xExp(new SwXMLBlockListExport( xContext, *this, OUString(XMLN_BLOCKLIST), xHandler) );
 
         xExp->exportDoc( XML_BLOCK_LIST );
 
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index bcf505b..d03d6a3 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -646,7 +646,7 @@ public:
     bool m_bIsDisposed;
     bool m_bIsDescriptor;
     uno::Reference<text::XText> m_xParentText;
-    uno::Reference<SwXMetaText> m_xText;
+    rtl::Reference<SwXMetaText> m_xText;
 
     Impl(   SwXMeta & rThis, SwDoc & rDoc,
             ::sw::Meta * const pMeta,
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 417fead..7e66549 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -338,7 +338,7 @@ void DocxAttributeOutput::StartParagraph( ww8::WW8TableNodeInfo::Pointer_t pText
     m_bIsFirstParagraph = false;
 }
 
-static void lcl_deleteAndResetTheLists( uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren, uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
+static void lcl_deleteAndResetTheLists( rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren, rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs, OUString& rSdtPrAlias)
 {
     if( pSdtPrTokenChildren.is() )
         pSdtPrTokenChildren.clear();
@@ -607,9 +607,9 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT
 }
 
 void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
-                                         uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
-                                         uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
-                                         uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
+                                         rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
+                                         rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
+                                         rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
                                          OUString& rSdtPrAlias,
                                          bool bPara )
 {
@@ -629,7 +629,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
                 m_pSerializer->startElement( nSdtPrToken, FSEND );
             else
             {
-                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get());
                 pSdtPrTokenAttributes.clear();
                 m_pSerializer->startElement(nSdtPrToken, xAttrList);
             }
@@ -651,7 +651,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
                 m_pSerializer->singleElement( nSdtPrToken, FSEND );
             else
             {
-                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes);
+                XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get());
                 pSdtPrTokenAttributes.clear();
                 m_pSerializer->singleElement(nSdtPrToken, xAttrList);
             }
@@ -665,7 +665,7 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
 
         if( pSdtPrDataBindingAttrs.is() && !m_rExport.SdrExporter().IsParagraphHasDrawing())
         {
-            XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs );
+            XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.get() );
             pSdtPrDataBindingAttrs.clear();
             m_pSerializer->singleElementNS( XML_w, XML_dataBinding, xAttrList );
         }
@@ -907,7 +907,7 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties()
 {
     if ( m_rExport.SdrExporter().getFlyAttrList().is() )
     {
-        XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList() );
+        XFastAttributeListRef xAttrList( m_rExport.SdrExporter().getFlyAttrList().get() );
         m_rExport.SdrExporter().getFlyAttrList().clear();
 
         m_pSerializer->singleElementNS( XML_w, XML_framePr, xAttrList );
@@ -915,7 +915,7 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties()
 
     if ( m_pParagraphSpacingAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList );
+        XFastAttributeListRef xAttrList( m_pParagraphSpacingAttrList.get() );
         m_pParagraphSpacingAttrList.clear();
 
         m_pSerializer->singleElementNS( XML_w, XML_spacing, xAttrList );
@@ -923,7 +923,7 @@ void DocxAttributeOutput::WriteCollectedParagraphProperties()
 
     if ( m_pBackgroundAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pBackgroundAttrList );
+        XFastAttributeListRef xAttrList( m_pBackgroundAttrList.get() );
         m_pBackgroundAttrList.clear();
 
         m_pSerializer->singleElementNS( XML_w, XML_shd, xAttrList );
@@ -992,11 +992,11 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
     // to the DOCX when the function 'WriteCollectedRunProperties' gets called.
     // So we need to store the current status of these lists, so that we can revert back to them when
     // we are done exporting the redline attributes.
-    uno::Reference<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList);
+    rtl::Reference<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList);
     m_pFontsAttrList.clear();
-    uno::Reference<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList);
+    rtl::Reference<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList);
     m_pEastAsianLayoutAttrList.clear();
-    uno::Reference<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList);
+    rtl::Reference<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList);
     m_pCharLangAttrList.clear();
 
     lcl_writeParagraphMarkerProperties(*this, rParagraphMarkerProperties);
@@ -1005,9 +1005,9 @@ void DocxAttributeOutput::EndParagraphProperties(const SfxItemSet& rParagraphMar
     WriteCollectedRunProperties();
 
     // Revert back the original values that were stored in 'm_pFontsAttrList', 'm_pEastAsianLayoutAttrList', 'm_pCharLangAttrList'
-    m_pFontsAttrList = pFontsAttrList_Original;
-    m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original;
-    m_pCharLangAttrList = pCharLangAttrList_Original;
+    m_pFontsAttrList = pFontsAttrList_Original.get();
+    m_pEastAsianLayoutAttrList = pEastAsianLayoutAttrList_Original.get();
+    m_pCharLangAttrList = pCharLangAttrList_Original.get();
 
     if ( pRedlineParagraphMarkerDeleted )
     {
@@ -1209,7 +1209,7 @@ void DocxAttributeOutput::EndRun()
     // Start the hyperlink after the fields separators or we would generate invalid file
     if ( m_pHyperlinkAttrList.is() )
     {
-        XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList );
+        XFastAttributeListRef xAttrList ( m_pHyperlinkAttrList.get() );
         m_pHyperlinkAttrList.clear();
 
         m_pSerializer->startElementNS( XML_w, XML_hyperlink, xAttrList );
@@ -1277,7 +1277,7 @@ void DocxAttributeOutput::EndRun()
     // (so on export sdt blocks are never nested ATM)
     if ( !m_bAnchorLinkedToNode && !m_bStartedCharSdt )
     {
-        uno::Reference<sax_fastparser::FastAttributeList> pRunSdtPrTokenAttributes;
+        rtl::Reference<sax_fastparser::FastAttributeList> pRunSdtPrTokenAttributes;
         WriteSdtBlock( m_nRunSdtPrToken, m_pRunSdtPrTokenChildren, pRunSdtPrTokenAttributes, m_pRunSdtPrDataBindingAttrs, m_aRunSdtPrAlias, /*bPara=*/false );
     }
     else
@@ -1969,14 +1969,14 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
     // Write all differed properties
     if ( m_pFontsAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pFontsAttrList );
+        XFastAttributeListRef xAttrList( m_pFontsAttrList.get() );
         m_pFontsAttrList.clear();
         m_pSerializer->singleElementNS( XML_w, XML_rFonts, xAttrList );
     }
 
     if ( m_pColorAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pColorAttrList );
+        XFastAttributeListRef xAttrList( m_pColorAttrList.get() );
         m_pColorAttrList.clear();
 
         m_pSerializer->singleElementNS( XML_w, XML_color, xAttrList );
@@ -1984,14 +1984,14 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
 
     if ( m_pEastAsianLayoutAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList );
+        XFastAttributeListRef xAttrList( m_pEastAsianLayoutAttrList.get() );
         m_pEastAsianLayoutAttrList.clear();
         m_pSerializer->singleElementNS( XML_w, XML_eastAsianLayout, xAttrList );
     }
 
     if ( m_pCharLangAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pCharLangAttrList );
+        XFastAttributeListRef xAttrList( m_pCharLangAttrList.get() );
         m_pCharLangAttrList.clear();
         m_pSerializer->singleElementNS( XML_w, XML_lang, xAttrList );
     }
@@ -2430,11 +2430,11 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
                     // to the DOCX when the function 'WriteCollectedRunProperties' gets called.
                     // So we need to store the current status of these lists, so that we can revert back to them when
                     // we are done exporting the redline attributes.
-                    uno::Reference<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList);
+                    rtl::Reference<sax_fastparser::FastAttributeList> pFontsAttrList_Original(m_pFontsAttrList);
                     m_pFontsAttrList.clear();
-                    uno::Reference<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList);
+                    rtl::Reference<sax_fastparser::FastAttributeList> pEastAsianLayoutAttrList_Original(m_pEastAsianLayoutAttrList);
                     m_pEastAsianLayoutAttrList.clear();
-                    uno::Reference<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList);
+                    rtl::Reference<sax_fastparser::FastAttributeList> pCharLangAttrList_Original(m_pCharLangAttrList);
                     m_pCharLangAttrList.clear();
 
                     // Output the redline item set
@@ -2486,9 +2486,9 @@ void DocxAttributeOutput::Redline( const SwRedlineData* pRedlineData)
                     // to the DOCX when the function 'WriteCollectedParagraphProperties' gets called.
                     // So we need to store the current status of these lists, so that we can revert back to them when
                     // we are done exporting the redline attributes.
-                    uno::Reference<sax_fastparser::FastAttributeList> pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList());
+                    rtl::Reference<sax_fastparser::FastAttributeList> pFlyAttrList_Original(m_rExport.SdrExporter().getFlyAttrList());
                     m_rExport.SdrExporter().getFlyAttrList().clear();
-                    uno::Reference<sax_fastparser::FastAttributeList> pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList);
+                    rtl::Reference<sax_fastparser::FastAttributeList> pParagraphSpacingAttrList_Original(m_pParagraphSpacingAttrList);
                     m_pParagraphSpacingAttrList.clear();
 
                     // Output the redline item set
@@ -3506,7 +3506,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
     }
     else
     {
-        css::uno::Reference<sax_fastparser::FastAttributeList> pAttrList;
+        rtl::Reference<sax_fastparser::FastAttributeList> pAttrList;
 
         for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != aGrabBag.end(); ++aGrabBagElement )
         {
@@ -3533,7 +3533,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
             else if( aGrabBagElement->first == "val")
                 AddToAttrList( pAttrList, FSNS( XML_w, XML_val ), sValue.getStr() );
         }
-        m_pSerializer->singleElementNS( XML_w, XML_shd, pAttrList );
+        m_pSerializer->singleElementNS( XML_w, XML_shd, pAttrList.get() );
     }
 }
 
@@ -5495,7 +5495,7 @@ void DocxAttributeOutput::EndSection()
     // Write the section properties
     if ( m_pSectionSpacingAttrList.is() )
     {
-        XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList );
+        XFastAttributeListRef xAttrList( m_pSectionSpacingAttrList.get() );
         m_pSectionSpacingAttrList.clear();
 
         m_pSerializer->singleElementNS( XML_w, XML_pgMar, xAttrList );
@@ -8550,12 +8550,12 @@ void DocxAttributeOutput::BulletDefinition(int nId, const Graphic& rGraphic, Siz
     m_pSerializer->endElementNS(XML_w, XML_numPicBullet);
 }
 
-void DocxAttributeOutput::AddToAttrList( uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue )
+void DocxAttributeOutput::AddToAttrList( rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue )
 {
     AddToAttrList( pAttrList, 1, nAttrName, sAttrValue );
 }
 
-void DocxAttributeOutput::AddToAttrList( uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrs, ... )
+void DocxAttributeOutput::AddToAttrList( rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrs, ... )
 {
     if( !pAttrList.is() )
         pAttrList = FastSerializerHelper::createAttrList();
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 1190d3a..611ad01 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -704,9 +704,9 @@ private:
     void WritePostponedCustomShape();
 
     void WriteSdtBlock(sal_Int32& nSdtPrToken,
-                       css::uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
-                       css::uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
-                       css::uno::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
+                       rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenChildren,
+                       rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrTokenAttributes,
+                       rtl::Reference<sax_fastparser::FastAttributeList>& pSdtPrDataBindingAttrs,
                        OUString& rSdtPrAlias,
                        bool bPara);
     /// Closes a currently open SDT block.
@@ -717,15 +717,15 @@ private:
     void CmdField_Impl( FieldInfos& rInfos );
     void EndField_Impl( FieldInfos& rInfos );
 
-    static void AddToAttrList( css::uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue );
-    static void AddToAttrList( css::uno::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nArgs, ... );
+    static void AddToAttrList( rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nAttrName, const sal_Char* sAttrValue );
+    static void AddToAttrList( rtl::Reference<sax_fastparser::FastAttributeList>& pAttrList, sal_Int32 nArgs, ... );
 
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pFontsAttrList;
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList;
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pCharLangAttrList;
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pSectionSpacingAttrList;
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pParagraphSpacingAttrList;
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pFontsAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pEastAsianLayoutAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pCharLangAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pSectionSpacingAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pParagraphSpacingAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pHyperlinkAttrList;
     /// If the current SDT around runs should be ended before the current run.
     bool m_bEndCharSdt;
     /// If an SDT around runs is currently open.
@@ -733,9 +733,9 @@ private:
     /// If an SDT around paragraphs is currently open.
     bool m_bStartedParaSdt;
     /// Attributes of the run color
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pColorAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pColorAttrList;
     /// Attributes of the paragraph background
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pBackgroundAttrList;
+    rtl::Reference<sax_fastparser::FastAttributeList> m_pBackgroundAttrList;
     OUString m_sOriginalBackgroundColor;
     OUString m_hyperLinkAnchor;
     bool m_endPageRef;
@@ -917,15 +917,15 @@ private:
 
     /// members to control the existence of grabbagged SDT properties in the paragraph
     sal_Int32 m_nParagraphSdtPrToken;
-    css::uno::Reference<sax_fastparser::FastAttributeList> m_pParagraphSdtPrTokenChildren;

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list