connectivity/source/commontools/predicateinput.cxx           |    3 -
 connectivity/source/drivers/dbase/DTable.cxx                 |    3 -
 connectivity/source/drivers/file/FResultSet.cxx              |    3 -
 connectivity/source/drivers/hsqldb/HDriver.cxx               |    2 
 connectivity/source/drivers/jdbc/JConnection.cxx             |   15 ++---
 connectivity/source/drivers/postgresql/pq_xcolumns.cxx       |    3 -
 connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx  |    3 -
 connectivity/source/drivers/postgresql/pq_xindexes.cxx       |    3 -
 connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx    |    3 -
 connectivity/source/drivers/postgresql/pq_xkeys.cxx          |    3 -
 connectivity/source/drivers/postgresql/pq_xtables.cxx        |    3 -
 connectivity/source/drivers/postgresql/pq_xusers.cxx         |    3 -
 connectivity/source/drivers/postgresql/pq_xviews.cxx         |    3 -
 sc/source/core/data/attrib.cxx                               |    4 -
 sc/source/filter/oox/commentsbuffer.cxx                      |    3 -
 sc/source/filter/xml/XMLTrackedChangesContext.cxx            |   16 ++---
 sc/source/filter/xml/xmlimprt.cxx                            |   13 ++--
 sc/source/filter/xml/xmlwrap.cxx                             |    5 -
 sc/source/ui/Accessibility/AccessibleDocument.cxx            |   11 +--
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |    6 --
 sc/source/ui/unoobj/TablePivotCharts.cxx                     |    4 -
 sc/source/ui/unoobj/afmtuno.cxx                              |    8 +-
 sc/source/ui/unoobj/cellsuno.cxx                             |    8 +-
 sc/source/ui/unoobj/chartuno.cxx                             |    8 +-
 sc/source/ui/unoobj/dapiuno.cxx                              |   16 ++---
 sc/source/ui/unoobj/datauno.cxx                              |   12 ++--
 sc/source/ui/unoobj/docuno.cxx                               |   32 +++++------
 sc/source/ui/unoobj/fielduno.cxx                             |    2 
 sc/source/ui/unoobj/linkuno.cxx                              |   20 +++---
 sc/source/ui/unoobj/nameuno.cxx                              |   12 ++--
 sc/source/ui/unoobj/styleuno.cxx                             |   16 ++---
 sc/source/ui/unoobj/viewuno.cxx                              |    4 -
 sc/source/ui/vba/vbasheetobjects.cxx                         |    4 -
 33 files changed, 112 insertions(+), 142 deletions(-)

New commits:
commit d1c1b9cfe6dcb257d7fbb091fabffcef15cadf39
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Feb 25 13:11:24 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 25 15:36:34 2025 +0100

    use more concrete UNO types in some local vars
    
    found by a little plugin I created.
    
    Change-Id: If89a8fa349bb823c4e8dfa5cd9732950149d06cd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182162
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/connectivity/source/commontools/predicateinput.cxx 
b/connectivity/source/commontools/predicateinput.cxx
index c4360f981222..b03bda56184a 100644
--- a/connectivity/source/commontools/predicateinput.cxx
+++ b/connectivity/source/commontools/predicateinput.cxx
@@ -312,11 +312,10 @@ namespace dbtools
                                                                 OUString(),
                                                                 OUString(),
                                                                 OUString());
-        Reference<XPropertySet> xColumn = pColumn;
         pColumn->setFunction(true);
         pColumn->setRealName(sField);
 
-        std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, 
_rPredicateValue, xColumn );
+        std::unique_ptr<OSQLParseNode> pParseNode = implPredicateTree( sError, 
_rPredicateValue, pColumn );
         if(pParseNode)
         {
             implParseNode(std::move(pParseNode), true) >>= sReturn;
diff --git a/connectivity/source/drivers/dbase/DTable.cxx 
b/connectivity/source/drivers/dbase/DTable.cxx
index cd42c6d8fa42..c7b6802209fd 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -2170,7 +2170,6 @@ void ODbaseTable::alterColumn(sal_Int32 index,
         OUString sTempName = createTempFile();
 
         rtl::Reference<ODbaseTable> pNewTable = new 
ODbaseTable(m_pTables,static_cast<ODbaseConnection*>(m_pConnection));
-        Reference<XPropertySet> xHoldTable = pNewTable;
         
pNewTable->setPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME),Any(sTempName));
         Reference<XAppend> xAppend(pNewTable->getColumns(),UNO_QUERY);
         OSL_ENSURE(xAppend.is(),"ODbaseTable::alterColumn: No XAppend 
interface!");
@@ -2239,8 +2238,8 @@ void ODbaseTable::alterColumn(sal_Int32 index,
                 ::dbtools::throwGenericSQLException( sError, *this );
             }
             // release the temp file
+            ::comphelper::disposeComponent(pNewTable);
             pNewTable = nullptr;
-            ::comphelper::disposeComponent(xHoldTable);
         }
         else
         {
diff --git a/connectivity/source/drivers/file/FResultSet.cxx 
b/connectivity/source/drivers/file/FResultSet.cxx
index 85064f8a4e16..56ca7ed0063a 100644
--- a/connectivity/source/drivers/file/FResultSet.cxx
+++ b/connectivity/source/drivers/file/FResultSet.cxx
@@ -1563,8 +1563,7 @@ bool OResultSet::isRowDeleted() const
 
 void SAL_CALL OResultSet::disposing( const EventObject& Source )
 {
-    Reference<XPropertySet> xProp = m_pTable;
-    if(m_pTable.is() && Source.Source == xProp)
+    if(m_pTable.is() && Source.Source == Reference<XPropertySet>(m_pTable))
     {
         m_pTable.clear();
     }
diff --git a/connectivity/source/drivers/hsqldb/HDriver.cxx 
b/connectivity/source/drivers/hsqldb/HDriver.cxx
index 9bf1da6a99d2..fa06af4d24bd 100644
--- a/connectivity/source/drivers/hsqldb/HDriver.cxx
+++ b/connectivity/source/drivers/hsqldb/HDriver.cxx
@@ -370,7 +370,7 @@ namespace connectivity
                         xComp->addEventListener(this);
 
                     // we want to close all connections when the office shuts 
down
-                    static Reference< XTerminateListener> s_xTerminateListener 
= [&]()
+                    static rtl::Reference< OConnectionController > 
s_xTerminateListener = [&]()
                     {
                         Reference< XDesktop2 > xDesktop = Desktop::create( 
m_xContext );
 
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx 
b/connectivity/source/drivers/jdbc/JConnection.cxx
index 00a868d92595..f99737c8ddfc 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -436,11 +436,10 @@ Reference< XStatement > SAL_CALL 
java_sql_Connection::createStatement(  )
 
     SDBThreadAttach t;
     rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( 
t.pEnv, *this );
-    Reference< XStatement > xStmt = pStatement;
-    m_aStatements.emplace_back(xStmt);
+    m_aStatements.emplace_back(Reference< XStatement >(pStatement));
 
     m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, 
pStatement->getStatementObjectID() );
-    return xStmt;
+    return pStatement;
 }
 
 Reference< XPreparedStatement > SAL_CALL 
java_sql_Connection::prepareStatement( const OUString& sql )
@@ -452,11 +451,10 @@ Reference< XPreparedStatement > SAL_CALL 
java_sql_Connection::prepareStatement(
     SDBThreadAttach t;
 
     rtl::Reference<java_sql_PreparedStatement> pStatement = new 
java_sql_PreparedStatement( t.pEnv, *this, sql );
-    Reference< XPreparedStatement > xReturn( pStatement );
-    m_aStatements.emplace_back(xReturn);
+    m_aStatements.emplace_back(Reference< XPreparedStatement >( pStatement ));
 
     m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, 
pStatement->getStatementObjectID() );
-    return xReturn;
+    return pStatement;
 }
 
 Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( 
const OUString& sql )
@@ -468,11 +466,10 @@ Reference< XPreparedStatement > SAL_CALL 
java_sql_Connection::prepareCall( const
     SDBThreadAttach t;
 
     rtl::Reference<java_sql_CallableStatement> pStatement = new 
java_sql_CallableStatement( t.pEnv, *this, sql );
-    Reference< XPreparedStatement > xStmt( pStatement );
-    m_aStatements.emplace_back(xStmt);
+    m_aStatements.emplace_back(Reference< XPreparedStatement >( pStatement ));
 
     m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, 
pStatement->getStatementObjectID() );
-    return xStmt;
+    return pStatement;
 }
 
 OUString SAL_CALL java_sql_Connection::nativeSQL( const OUString& sql )
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx 
b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index 962449368aaf..5d98a452bfd7 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -303,7 +303,6 @@ void Columns::refresh()
         {
             rtl::Reference<Column> pColumn =
                 new Column( m_xMutex, m_origin, m_pSettings );
-            Reference< css::beans::XPropertySet > prop = pColumn;
 
             OUString name = columnMetaData2SDBCX( pColumn.get(), xRow );
 //             pColumn->addPropertyChangeListener(
@@ -317,7 +316,7 @@ void Columns::refresh()
 //                     name ) );
 
             {
-                m_values.emplace_back(prop);
+                m_values.emplace_back(Reference< css::beans::XPropertySet 
>(pColumn));
                 map[ name ] = columnIndex;
                 ++columnIndex;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx 
b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
index 5237f64e9b45..eb004b565c3e 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
@@ -127,13 +127,12 @@ void IndexColumns::refresh()
 
             rtl::Reference<IndexColumn> pIndexColumn =
                 new IndexColumn( m_xMutex, m_origin, m_pSettings );
-            Reference< css::beans::XPropertySet > prop = pIndexColumn;
 
             columnMetaData2SDBCX( pIndexColumn.get(), xRow );
             pIndexColumn->setPropertyValue_NoBroadcast_public(
                 st.IS_ASCENDING , Any( false ) );
 
-            m_values[ index ] <<= prop;
+            m_values[ index ] <<= Reference< css::beans::XPropertySet 
>(pIndexColumn);
             m_name2index[ columnName ] = index;
         }
     }
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx 
b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 6c44c8875604..c74929eab2fa 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -142,7 +142,6 @@ void Indexes::refresh()
             bool isUnique = row->getBoolean( C_IS_UNIQUE );
             bool isPrimary = row->getBoolean( C_IS_PRIMARY );
             bool isClusterd = row->getBoolean( C_IS_CLUSTERED );
-            Reference< css::beans::XPropertySet > prop = pIndex;
             pIndex->setPropertyValue_NoBroadcast_public(
                 st.IS_UNIQUE, Any( isUnique ) );
             pIndex->setPropertyValue_NoBroadcast_public(
@@ -164,7 +163,7 @@ void Indexes::refresh()
                 st.PRIVATE_COLUMN_INDEXES, Any( columnNames ));
 
             {
-                m_values.emplace_back(prop);
+                m_values.emplace_back(Reference< css::beans::XPropertySet 
>(pIndex));
                 map[ currentIndexName ] = index;
                 ++index;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx 
b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
index f44899d41a2f..e53e84605aa8 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
@@ -120,7 +120,6 @@ void KeyColumns::refresh()
 
             rtl::Reference<KeyColumn> pKeyColumn =
                 new KeyColumn( m_xMutex, m_origin, m_pSettings );
-            Reference< css::beans::XPropertySet > prop = pKeyColumn;
 
             OUString name = columnMetaData2SDBCX( pKeyColumn.get(), xRow );
             if( keyindex < m_foreignColumnNames.getLength() )
@@ -130,7 +129,7 @@ void KeyColumns::refresh()
             }
 
             {
-                m_values.emplace_back(prop);
+                m_values.emplace_back(Reference< css::beans::XPropertySet 
>(pKeyColumn));
                 map[ name ] = columnIndex;
                 ++columnIndex;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx 
b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index c3daebfff617..5dde7d22fdf5 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -155,7 +155,6 @@ void Keys::refresh()
         {
             rtl::Reference<Key> pKey =
                 new Key( m_xMutex, m_origin, m_pSettings , m_schemaName, 
m_tableName );
-            Reference< css::beans::XPropertySet > prop = pKey;
 
             pKey->setPropertyValue_NoBroadcast_public(
                 st.NAME, Any( xRow->getString( 1 ) ) );
@@ -191,7 +190,7 @@ void Keys::refresh()
 
             {
                 map[ xRow->getString( 1 ) ] = keyIndex;
-                m_values.push_back( Any( prop ) );
+                m_values.push_back( Any( Reference< css::beans::XPropertySet 
>(pKey) ) );
                 ++keyIndex;
             }
         }
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx 
b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 423ec81f2166..6b5214bf9596 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -106,7 +106,6 @@ void Tables::refresh()
             // instead offer a factory interface
             rtl::Reference<Table> pTable =
                 new Table( m_xMutex, m_origin, m_pSettings );
-            Reference< css::beans::XPropertySet > prop = pTable;
 
             OUString name = xRow->getString( TABLE_INDEX_NAME+1);
             OUString schema = xRow->getString( TABLE_INDEX_SCHEMA+1);
@@ -131,7 +130,7 @@ void Tables::refresh()
                            css::sdbcx::Privilege::DROP ) ) );
 
             {
-                m_values.push_back( Any( prop ) );
+                m_values.push_back( Any( Reference< css::beans::XPropertySet 
>(pTable) ) );
                 map[ schema + "." + name ] = tableIndex;
                 ++tableIndex;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xusers.cxx 
b/connectivity/source/drivers/postgresql/pq_xusers.cxx
index 701adc76600d..5a80ee8727ab 100644
--- a/connectivity/source/drivers/postgresql/pq_xusers.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xusers.cxx
@@ -95,14 +95,13 @@ void Users::refresh()
         {
             rtl::Reference<User> pUser =
                 new User( m_xMutex, m_origin, m_pSettings );
-            Reference< css::beans::XPropertySet > prop = pUser;
 
             OUString name = xRow->getString( 1);
             pUser->setPropertyValue_NoBroadcast_public(
                 st.NAME , Any(xRow->getString( TABLE_INDEX_CATALOG+1) ) );
 
             {
-                m_values.push_back( Any( prop ) );
+                m_values.push_back( Any( Reference< css::beans::XPropertySet 
>(pUser) ) );
                 map[ name ] = tableIndex;
                 ++tableIndex;
             }
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx 
b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index b50fb9510746..9d0d875510ad 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -109,14 +109,13 @@ void Views::refresh()
             command = xRow->getString( 3 );
 
             rtl::Reference<View> pView = new View (m_xMutex, m_origin, 
m_pSettings );
-            Reference< css::beans::XPropertySet > prop = pView;
 
             pView->setPropertyValue_NoBroadcast_public(st.NAME , Any(table) );
             pView->setPropertyValue_NoBroadcast_public(st.SCHEMA_NAME, 
Any(schema) );
             pView->setPropertyValue_NoBroadcast_public(st.COMMAND, 
Any(command) );
 
             {
-                m_values.push_back( Any( prop ) );
+                m_values.push_back( Any( Reference< css::beans::XPropertySet 
>(pView) ) );
                 map[ schema + "." + table ] = viewIndex;
                 ++viewIndex;
             }
commit 9b07819fbaaefacf7668560ce8872e6e34d024b3
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Tue Feb 25 13:11:01 2025 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Tue Feb 25 15:36:26 2025 +0100

    use more concrete UNO types in some local vars
    
    found by a little plugin I created.
    
    Change-Id: I5ff1f279c3510dbec2d6b208b09f3cd7f55e75b2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182161
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 21e7cb350756..81f2f598ef89 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -417,9 +417,7 @@ bool ScPageHFItem::QueryValue( uno::Any& rVal, sal_uInt8 /* 
nMemberId */ ) const
         new ScHeaderFooterContentObj();
     xContent->Init(pLeftArea.get(), pCenterArea.get(), pRightArea.get());
 
-    uno::Reference<sheet::XHeaderFooterContent> xCont(xContent);
-
-    rVal <<= xCont;
+    rVal <<= uno::Reference<sheet::XHeaderFooterContent>(xContent);
     return true;
 }
 
diff --git a/sc/source/filter/oox/commentsbuffer.cxx 
b/sc/source/filter/oox/commentsbuffer.cxx
index 6f650d5cb00e..83f9f9ac0304 100644
--- a/sc/source/filter/oox/commentsbuffer.cxx
+++ b/sc/source/filter/oox/commentsbuffer.cxx
@@ -174,9 +174,8 @@ namespace
             }
 
             // insert text and convert text formatting
-            Reference< XText > xAnnoText( xAnnoShape );
             xAnnoShape->addActionLock();
-            mxText->convert( xAnnoText );
+            mxText->convert( Reference< XText >( xAnnoShape ) );
             xAnnoShape->removeActionLock();
         }
 
diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx 
b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
index 29d0ab99740d..ee30c04ca084 100644
--- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx
+++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx
@@ -830,18 +830,14 @@ void ScXMLChangeCellContext::CreateTextPContext(bool 
bIsNewParagraph)
 
     mpEditTextObj = new ScEditEngineTextObj();
     mpEditTextObj->GetEditEngine()->SetEditTextObjectPool(pDoc->GetEditPool());
-    uno::Reference <text::XText> xText(mpEditTextObj);
-    if (xText.is())
+    uno::Reference<text::XTextCursor> 
xTextCursor(mpEditTextObj->createTextCursor());
+    if (bIsNewParagraph)
     {
-        uno::Reference<text::XTextCursor> 
xTextCursor(xText->createTextCursor());
-        if (bIsNewParagraph)
-        {
-            xText->setString(sText);
-            xTextCursor->gotoEnd(false);
-            xText->insertControlCharacter(xTextCursor, 
text::ControlCharacter::PARAGRAPH_BREAK, false);
-        }
-        GetScImport().GetTextImport()->SetCursor(xTextCursor);
+        mpEditTextObj->setString(sText);
+        xTextCursor->gotoEnd(false);
+        mpEditTextObj->insertControlCharacter(xTextCursor, 
text::ControlCharacter::PARAGRAPH_BREAK, false);
     }
+    GetScImport().GetTextImport()->SetCursor(xTextCursor);
 }
 
 void SAL_CALL ScXMLChangeCellContext::endFastElement( sal_Int32 /*nElement*/ )
diff --git a/sc/source/filter/xml/xmlimprt.cxx 
b/sc/source/filter/xml/xmlimprt.cxx
index d992fd2c5f84..0fb17cee4921 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -976,8 +976,7 @@ void ScXMLImport::SetStyleToRanges()
 
     if (!sPrevStyleName.isEmpty())
     {
-        uno::Reference <beans::XPropertySet> xProperties (mxSheetCellRanges);
-        if (xProperties.is())
+        if (mxSheetCellRanges.is())
         {
             XMLTableStylesContext *pStyles(static_cast<XMLTableStylesContext 
*>(GetAutoStyles()));
             XMLTableStyleContext* pStyle = nullptr;
@@ -986,12 +985,12 @@ void ScXMLImport::SetStyleToRanges()
                         XmlStyleFamily::TABLE_CELL, sPrevStyleName, true)));
             if (pStyle)
             {
-                pStyle->FillPropertySet(xProperties);
+                pStyle->FillPropertySet(mxSheetCellRanges);
                 // here needs to be the cond format import method
                 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
-                SetType(xProperties, nNumberFormat, nPrevCellType, 
sPrevCurrency);
+                SetType(mxSheetCellRanges, nNumberFormat, nPrevCellType, 
sPrevCurrency);
 
-                css::uno::Any aAny = 
xProperties->getPropertyValue(u"FormatID"_ustr);
+                css::uno::Any aAny = 
mxSheetCellRanges->getPropertyValue(u"FormatID"_ustr);
                 sal_uInt64 nKey = 0;
                 if ((aAny >>= nKey) && nKey)
                 {
@@ -1016,10 +1015,10 @@ void ScXMLImport::SetStyleToRanges()
             }
             else
             {
-                xProperties->setPropertyValue(SC_UNONAME_CELLSTYL, 
uno::Any(GetStyleDisplayName( XmlStyleFamily::TABLE_CELL, sPrevStyleName )));
+                mxSheetCellRanges->setPropertyValue(SC_UNONAME_CELLSTYL, 
uno::Any(GetStyleDisplayName( XmlStyleFamily::TABLE_CELL, sPrevStyleName )));
                 sal_Int32 
nNumberFormat(GetStyleNumberFormats()->GetStyleNumberFormat(sPrevStyleName));
                 bool bInsert(nNumberFormat == -1);
-                SetType(xProperties, nNumberFormat, nPrevCellType, 
sPrevCurrency);
+                SetType(mxSheetCellRanges, nNumberFormat, nPrevCellType, 
sPrevCurrency);
                 if (bInsert)
                     
GetStyleNumberFormats()->AddStyleNumberFormat(sPrevStyleName, nNumberFormat);
             }
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index bf4e055440db..e601675fb1fc 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -890,7 +890,6 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
 
         auto xObjectHelper = SvXMLEmbeddedObjectHelper::Create(
             xStorage, *pObjSh, SvXMLEmbeddedObjectHelperMode::Write);
-        uno::Reference<document::XEmbeddedObjectResolver> 
xObjectResolver(xObjectHelper);
 
         // styles export
 
@@ -901,7 +900,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
                 Any(xGraphicStorageHandler),
                 Any(xStatusIndicator),
                 Any(xWriter),
-                Any(xObjectResolver)
+                
Any(uno::Reference<document::XEmbeddedObjectResolver>(xObjectHelper))
             };
 
             SAL_INFO( "sc.filter", "styles export start" );
@@ -926,7 +925,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
                 Any(xGraphicStorageHandler),
                 Any(xStatusIndicator),
                 Any(xWriter),
-                Any(xObjectResolver)
+                
Any(uno::Reference<document::XEmbeddedObjectResolver>(xObjectHelper))
             };
 
             SAL_INFO( "sc.filter", "content export start" );
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx 
b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 5658ee2a27a9..55e031c18dc7 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -487,7 +487,7 @@ ScChildrenShapes::GetAccessibleCaption (const 
css::uno::Reference < css::drawing
     if (it == maShapesMap.end())
         return nullptr;
     ScAccessibleShapeData* pShape = it->second;
-    css::uno::Reference< css::accessibility::XAccessible > xNewChild( 
pShape->pAccShape );
+    rtl::Reference< ::accessibility::AccessibleShape > xNewChild( 
pShape->pAccShape );
     if(xNewChild)
         return xNewChild;
     return nullptr;
@@ -1089,8 +1089,7 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const 
uno::Reference<drawing::X
                 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
             }
             aEvent.Source = uno::Reference< XAccessible 
>(mpAccessibleDocument);
-            uno::Reference< XAccessible > xChild( rpShape->pAccShape );
-            aEvent.NewValue <<= xChild;
+            aEvent.NewValue <<= uno::Reference< XAccessible >( 
rpShape->pAccShape );
             mpAccessibleDocument->CommitChange(aEvent);
         }
     }
@@ -1099,8 +1098,7 @@ bool ScChildrenShapes::FindSelectedShapesChanges(const 
uno::Reference<drawing::X
         AccessibleEventObject aEvent;
         aEvent.EventId =  AccessibleEventId::SELECTION_CHANGED_REMOVE;
         aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
-        uno::Reference< XAccessible > xChild( rpShape->pAccShape );
-        aEvent.NewValue <<= xChild;
+        aEvent.NewValue <<= uno::Reference< XAccessible >( rpShape->pAccShape 
);
         mpAccessibleDocument->CommitChange(aEvent);
     }
     for(ScAccessibleShapeData*& pShapeData : aShapesList)
@@ -1505,9 +1503,8 @@ void ScAccessibleDocument::Notify( SfxBroadcaster& rBC, 
const SfxHint& rHint )
                 mpTempAccEdit = new ScAccessibleEditObject(this, 
rViewData.GetEditView(meSplitPos),
                     mpViewShell->GetWindowByPos(meSplitPos), 
GetCurrentCellName(),
                     ScResId(STR_ACC_EDITLINE_DESCR), 
ScAccessibleEditObject::CellInEditMode);
-                uno::Reference<XAccessible> xAcc = mpTempAccEdit;
 
-                AddChild(xAcc, true);
+                AddChild(uno::Reference<XAccessible>(mpTempAccEdit), true);
 
                 if (mpAccessibleSpreadsheet.is())
                     mpAccessibleSpreadsheet->LostFocus();
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx 
b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index 5ba18208d110..fa2c3d975d86 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1216,11 +1216,10 @@ void ScAccessibleDocumentPagePreview::Notify( 
SfxBroadcaster& rBC, const SfxHint
         if (mpTable.is()) // if there is no table there is nothing to notify, 
because no one recognizes the change
         {
             {
-                uno::Reference<XAccessible> xAcc = mpTable;
                 AccessibleEventObject aEvent;
                 aEvent.EventId = AccessibleEventId::CHILD;
                 aEvent.Source = uno::Reference< XAccessibleContext >(this);
-                aEvent.OldValue <<= xAcc;
+                aEvent.OldValue <<= uno::Reference<XAccessible>(mpTable);
                 aEvent.IndexHint = -1;
                 CommitChange(aEvent);
             }
@@ -1250,11 +1249,10 @@ void ScAccessibleDocumentPagePreview::Notify( 
SfxBroadcaster& rBC, const SfxHint
             mpTable->Init();
 
             {
-                uno::Reference<XAccessible> xAcc = mpTable;
                 AccessibleEventObject aEvent;
                 aEvent.EventId = AccessibleEventId::CHILD;
                 aEvent.Source = uno::Reference< XAccessibleContext >(this);
-                aEvent.NewValue <<= xAcc;
+                aEvent.NewValue <<= uno::Reference<XAccessible>(mpTable);
                 aEvent.IndexHint = -1;
                 CommitChange(aEvent);
             }
diff --git a/sc/source/ui/unoobj/TablePivotCharts.cxx 
b/sc/source/ui/unoobj/TablePivotCharts.cxx
index c08c5aa78bc4..688d872ef864 100644
--- a/sc/source/ui/unoobj/TablePivotCharts.cxx
+++ b/sc/source/ui/unoobj/TablePivotCharts.cxx
@@ -128,8 +128,6 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const 
& rName,
     rtl::Reference<sc::PivotTableDataProvider> pPivotTableDataProvider(new 
sc::PivotTableDataProvider(rDoc));
     pPivotTableDataProvider->setPivotTableName(rDataPilotName);
 
-    uno::Reference<chart2::data::XDataProvider> 
xDataProvider(pPivotTableDataProvider);
-
     uno::Reference<chart2::data::XDataReceiver> xReceiver;
 
     if (xObject.is())
@@ -137,7 +135,7 @@ void SAL_CALL TablePivotCharts::addNewByName(OUString const 
& rName,
 
     if (xReceiver.is())
     {
-        xReceiver->attachDataProvider(xDataProvider);
+        
xReceiver->attachDataProvider(uno::Reference<chart2::data::XDataProvider>(pPivotTableDataProvider));
 
         uno::Reference<util::XNumberFormatsSupplier> 
xNumberFormatsSupplier(cppu::getXWeak(m_pDocShell->GetModel()), uno::UNO_QUERY);
         xReceiver->attachNumberFormatsSupplier(xNumberFormatsSupplier);
diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx
index bd1776fd0760..696fc32815c8 100644
--- a/sc/source/ui/unoobj/afmtuno.cxx
+++ b/sc/source/ui/unoobj/afmtuno.cxx
@@ -275,10 +275,10 @@ sal_Int32 SAL_CALL ScAutoFormatsObj::getCount()
 uno::Any SAL_CALL ScAutoFormatsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< container::XNamed >  
xFormat(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
+    rtl::Reference< ScAutoFormatObj > 
xFormat(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
     if (!xFormat.is())
         throw lang::IndexOutOfBoundsException();
-    return uno::Any(xFormat);
+    return uno::Any(uno::Reference< container::XNamed >(xFormat));
 }
 
 uno::Type SAL_CALL ScAutoFormatsObj::getElementType()
@@ -297,10 +297,10 @@ sal_Bool SAL_CALL ScAutoFormatsObj::hasElements()
 uno::Any SAL_CALL ScAutoFormatsObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< container::XNamed >  xFormat(GetObjectByName_Impl(aName));
+    rtl::Reference< ScAutoFormatObj > xFormat(GetObjectByName_Impl(aName));
     if (!xFormat.is())
         throw container::NoSuchElementException();
-    return uno::Any(xFormat);
+    return uno::Any(uno::Reference< container::XNamed >(xFormat));
 }
 
 uno::Sequence<OUString> SAL_CALL ScAutoFormatsObj::getElementNames()
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 5bacf8a856b8..83f8953010e1 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -4398,11 +4398,11 @@ sal_Int32 SAL_CALL ScCellRangesObj::getCount()
 uno::Any SAL_CALL ScCellRangesObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScCellRangeObj> xRange(GetObjectByIndex_Impl(nIndex));
     if (!xRange.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference<table::XCellRange>(xRange));
 
 }
 
@@ -8575,11 +8575,11 @@ uno::Any SAL_CALL ScCellFormatsObj::getByIndex( 
sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
 
-    uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScCellRangeObj> xRange(GetObjectByIndex_Impl(nIndex));
     if (!xRange.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference<table::XCellRange>(xRange));
 
 }
 
diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx
index c0d88b031789..1e61358bf429 100644
--- a/sc/source/ui/unoobj/chartuno.cxx
+++ b/sc/source/ui/unoobj/chartuno.cxx
@@ -325,11 +325,11 @@ sal_Int32 SAL_CALL ScChartsObj::getCount()
 uno::Any SAL_CALL ScChartsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XTableChart> xChart(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScChartObj> xChart(GetObjectByIndex_Impl(nIndex));
     if (!xChart.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xChart);
+    return uno::Any(uno::Reference<table::XTableChart>(xChart));
 }
 
 uno::Type SAL_CALL ScChartsObj::getElementType()
@@ -346,11 +346,11 @@ sal_Bool SAL_CALL ScChartsObj::hasElements()
 uno::Any SAL_CALL ScChartsObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XTableChart> xChart(GetObjectByName_Impl(aName));
+    rtl::Reference<ScChartObj> xChart(GetObjectByName_Impl(aName));
     if (!xChart.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xChart);
+    return uno::Any(uno::Reference<table::XTableChart>(xChart));
 }
 
 uno::Sequence<OUString> SAL_CALL ScChartsObj::getElementNames()
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index e8ace63308bd..a1d59b5faa87 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -490,10 +490,10 @@ sal_Int32 SAL_CALL ScDataPilotTablesObj::getCount()
 Any SAL_CALL ScDataPilotTablesObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    Reference<XDataPilotTable2> xTable(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScDataPilotTableObj> xTable(GetObjectByIndex_Impl(nIndex));
     if (!xTable.is())
         throw IndexOutOfBoundsException();
-    return Any( xTable );
+    return Any( Reference<XDataPilotTable2>(xTable) );
 }
 
 uno::Type SAL_CALL ScDataPilotTablesObj::getElementType()
@@ -512,10 +512,10 @@ sal_Bool SAL_CALL ScDataPilotTablesObj::hasElements()
 Any SAL_CALL ScDataPilotTablesObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    Reference<XDataPilotTable2> xTable(GetObjectByName_Impl(aName));
+    rtl::Reference<ScDataPilotTableObj> xTable(GetObjectByName_Impl(aName));
     if (!xTable.is())
         throw NoSuchElementException();
-    return Any( xTable );
+    return Any( Reference<XDataPilotTable2>(xTable) );
 }
 
 Sequence<OUString> SAL_CALL ScDataPilotTablesObj::getElementNames()
@@ -1559,10 +1559,10 @@ sal_Int32 SAL_CALL ScDataPilotFieldsObj::getCount()
 Any SAL_CALL ScDataPilotFieldsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    Reference< XPropertySet > xField( GetObjectByIndex_Impl( nIndex ) );
+    rtl::Reference< ScDataPilotFieldObj > xField( GetObjectByIndex_Impl( 
nIndex ) );
     if (!xField.is())
         throw IndexOutOfBoundsException();
-    return Any( xField );
+    return Any( Reference< XPropertySet >(xField) );
 }
 
 // XElementAccess
@@ -1583,10 +1583,10 @@ sal_Bool SAL_CALL ScDataPilotFieldsObj::hasElements()
 Any SAL_CALL ScDataPilotFieldsObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    Reference<XPropertySet> xField(GetObjectByName_Impl(aName));
+    rtl::Reference<ScDataPilotFieldObj> xField(GetObjectByName_Impl(aName));
     if (!xField.is())
         throw NoSuchElementException();
-    return Any( xField );
+    return Any( Reference<XPropertySet>(xField) );
 }
 
 Sequence<OUString> SAL_CALL ScDataPilotFieldsObj::getElementNames()
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 99cb53d48222..5a8e16395f3c 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -587,11 +587,11 @@ sal_Int32 SAL_CALL ScSubTotalDescriptorBase::getCount()
 uno::Any SAL_CALL ScSubTotalDescriptorBase::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XSubTotalField> 
xField(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
+    rtl::Reference<ScSubTotalFieldObj> 
xField(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
     if (!xField.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xField);
+    return uno::Any(uno::Reference<sheet::XSubTotalField>(xField));
 }
 
 uno::Type SAL_CALL ScSubTotalDescriptorBase::getElementType()
@@ -2187,11 +2187,11 @@ uno::Any SAL_CALL ScDatabaseRangesObj::getByIndex( 
sal_Int32 nIndex )
     if (nIndex < 0)
         throw lang::IndexOutOfBoundsException();
 
-    uno::Reference<sheet::XDatabaseRange> 
xRange(GetObjectByIndex_Impl(static_cast<size_t>(nIndex)));
+    rtl::Reference<ScDatabaseRangeObj> 
xRange(GetObjectByIndex_Impl(static_cast<size_t>(nIndex)));
     if (!xRange.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference<sheet::XDatabaseRange>(xRange));
 }
 
 uno::Type SAL_CALL ScDatabaseRangesObj::getElementType()
@@ -2210,11 +2210,11 @@ sal_Bool SAL_CALL ScDatabaseRangesObj::hasElements()
 uno::Any SAL_CALL ScDatabaseRangesObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XDatabaseRange> xRange(GetObjectByName_Impl(aName));
+    rtl::Reference<ScDatabaseRangeObj> xRange(GetObjectByName_Impl(aName));
     if (!xRange.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference<sheet::XDatabaseRange>(xRange));
 }
 
 uno::Sequence<OUString> SAL_CALL ScDatabaseRangesObj::getElementNames()
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 7511d9fce378..f15a8c02bbe9 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -4458,11 +4458,11 @@ sal_Int32 SAL_CALL ScTableSheetsObj::getCount()
 uno::Any SAL_CALL ScTableSheetsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XSpreadsheet> xSheet(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScTableSheetObj> xSheet(GetObjectByIndex_Impl(nIndex));
     if (!xSheet.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xSheet);
+    return uno::Any(uno::Reference<sheet::XSpreadsheet>(xSheet));
 
 //    return uno::Any();
 }
@@ -4483,11 +4483,11 @@ sal_Bool SAL_CALL ScTableSheetsObj::hasElements()
 uno::Any SAL_CALL ScTableSheetsObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XSpreadsheet> xSheet(GetObjectByName_Impl(aName));
+    rtl::Reference<ScTableSheetObj> xSheet(GetObjectByName_Impl(aName));
     if (!xSheet.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xSheet);
+    return uno::Any(uno::Reference<sheet::XSpreadsheet>(xSheet));
 }
 
 uno::Sequence<OUString> SAL_CALL ScTableSheetsObj::getElementNames()
@@ -4629,11 +4629,11 @@ sal_Int32 SAL_CALL ScTableColumnsObj::getCount()
 uno::Any SAL_CALL ScTableColumnsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XCellRange> xColumn(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScTableColumnObj> xColumn(GetObjectByIndex_Impl(nIndex));
     if (!xColumn.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xColumn);
+    return uno::Any(uno::Reference<table::XCellRange>(xColumn));
 
 }
 
@@ -4651,11 +4651,11 @@ sal_Bool SAL_CALL ScTableColumnsObj::hasElements()
 uno::Any SAL_CALL ScTableColumnsObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XCellRange> xColumn(GetObjectByName_Impl(aName));
+    rtl::Reference<ScTableColumnObj> xColumn(GetObjectByName_Impl(aName));
     if (!xColumn.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xColumn);
+    return uno::Any(uno::Reference<table::XCellRange>(xColumn));
 }
 
 uno::Sequence<OUString> SAL_CALL ScTableColumnsObj::getElementNames()
@@ -4871,11 +4871,11 @@ sal_Int32 SAL_CALL ScTableRowsObj::getCount()
 uno::Any SAL_CALL ScTableRowsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<table::XCellRange> xRow(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScTableRowObj> xRow(GetObjectByIndex_Impl(nIndex));
     if (!xRow.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xRow);
+    return uno::Any(uno::Reference<table::XCellRange>(xRow));
 }
 
 uno::Type SAL_CALL ScTableRowsObj::getElementType()
@@ -5180,11 +5180,11 @@ sal_Int32 SAL_CALL ScAnnotationsObj::getCount()
 uno::Any SAL_CALL ScAnnotationsObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XSheetAnnotation> 
xAnnotation(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScAnnotationObj> xAnnotation(GetObjectByIndex_Impl(nIndex));
     if (!xAnnotation.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xAnnotation);
+    return uno::Any(uno::Reference<sheet::XSheetAnnotation>(xAnnotation));
 }
 
 uno::Type SAL_CALL ScAnnotationsObj::getElementType()
@@ -5334,11 +5334,11 @@ sal_Int32 SAL_CALL ScScenariosObj::getCount()
 uno::Any SAL_CALL ScScenariosObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XScenario> xScen(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScTableSheetObj> xScen(GetObjectByIndex_Impl(nIndex));
     if (!xScen.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xScen);
+    return uno::Any(uno::Reference<sheet::XScenario>(xScen));
 }
 
 uno::Type SAL_CALL ScScenariosObj::getElementType()
@@ -5355,11 +5355,11 @@ sal_Bool SAL_CALL ScScenariosObj::hasElements()
 uno::Any SAL_CALL ScScenariosObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XScenario> xScen(GetObjectByName_Impl(aName));
+    rtl::Reference<ScTableSheetObj> xScen(GetObjectByName_Impl(aName));
     if (!xScen.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xScen);
+    return uno::Any(uno::Reference<sheet::XScenario>(xScen));
 }
 
 uno::Sequence<OUString> SAL_CALL ScScenariosObj::getElementNames()
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 110b9ddc2ddd..92728de2560c 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -1165,7 +1165,7 @@ uno::Reference<text::XTextRange> SAL_CALL 
ScEditFieldObj::getAnchor()
 uno::Reference<beans::XPropertySetInfo> SAL_CALL 
ScEditFieldObj::getPropertySetInfo()
 {
     SolarMutexGuard aGuard;
-    uno::Reference<beans::XPropertySetInfo> aRef = 
pPropSet->getPropertySetInfo();
+    rtl::Reference<SfxItemPropertySetInfo> aRef = 
pPropSet->getPropertySetInfo();
     return aRef;
 }
 
diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx
index 53e34a58a059..e7531b42a352 100644
--- a/sc/source/ui/unoobj/linkuno.cxx
+++ b/sc/source/ui/unoobj/linkuno.cxx
@@ -469,11 +469,11 @@ sal_Int32 SAL_CALL ScSheetLinksObj::getCount()
 uno::Any SAL_CALL ScSheetLinksObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<beans::XPropertySet> xLink(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScSheetLinkObj> xLink(GetObjectByIndex_Impl(nIndex));
     if (!xLink.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xLink);
+    return uno::Any(uno::Reference<beans::XPropertySet>(xLink));
 }
 
 uno::Type SAL_CALL ScSheetLinksObj::getElementType()
@@ -490,11 +490,11 @@ sal_Bool SAL_CALL ScSheetLinksObj::hasElements()
 uno::Any SAL_CALL ScSheetLinksObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<beans::XPropertySet> xLink(GetObjectByName_Impl(aName));
+    rtl::Reference<ScSheetLinkObj> xLink(GetObjectByName_Impl(aName));
     if (!xLink.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xLink);
+    return uno::Any(uno::Reference<beans::XPropertySet>(xLink));
 }
 
 sal_Bool SAL_CALL ScSheetLinksObj::hasByName( const OUString& aName )
@@ -967,11 +967,11 @@ sal_Int32 SAL_CALL ScAreaLinksObj::getCount()
 uno::Any SAL_CALL ScAreaLinksObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XAreaLink> xLink(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScAreaLinkObj> xLink(GetObjectByIndex_Impl(nIndex));
     if (!xLink.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xLink);
+    return uno::Any(uno::Reference<sheet::XAreaLink>(xLink));
 
 }
 
@@ -1251,11 +1251,11 @@ sal_Int32 SAL_CALL ScDDELinksObj::getCount()
 uno::Any SAL_CALL ScDDELinksObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XDDELink> xLink(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference<ScDDELinkObj> xLink(GetObjectByIndex_Impl(nIndex));
     if (!xLink.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xLink);
+    return uno::Any(uno::Reference<sheet::XDDELink>(xLink));
 }
 
 uno::Type SAL_CALL ScDDELinksObj::getElementType()
@@ -1272,11 +1272,11 @@ sal_Bool SAL_CALL ScDDELinksObj::hasElements()
 uno::Any SAL_CALL ScDDELinksObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XDDELink> xLink(GetObjectByName_Impl(aName));
+    rtl::Reference<ScDDELinkObj> xLink(GetObjectByName_Impl(aName));
     if (!xLink.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xLink);
+    return uno::Any(uno::Reference<sheet::XDDELink>(xLink));
 }
 
 uno::Sequence<OUString> SAL_CALL ScDDELinksObj::getElementNames()
diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx
index c96700f3474c..5497e0fc7569 100644
--- a/sc/source/ui/unoobj/nameuno.cxx
+++ b/sc/source/ui/unoobj/nameuno.cxx
@@ -592,11 +592,11 @@ sal_Int32 SAL_CALL ScNamedRangesObj::getCount()
 uno::Any SAL_CALL ScNamedRangesObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< sheet::XNamedRange >  
xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
+    rtl::Reference< ScNamedRangeObj >  
xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
     if ( !xRange.is() )
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference< sheet::XNamedRange >(xRange));
 }
 
 uno::Type SAL_CALL ScNamedRangesObj::getElementType()
@@ -642,11 +642,11 @@ SC_IMPL_DUMMY_PROPERTY_LISTENER( ScNamedRangesObj )
 uno::Any SAL_CALL ScNamedRangesObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< sheet::XNamedRange >  xRange(GetObjectByName_Impl(aName));
+    rtl::Reference< ScNamedRangeObj >  xRange(GetObjectByName_Impl(aName));
     if ( !xRange.is() )
         throw container::NoSuchElementException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference< sheet::XNamedRange >(xRange));
 }
 
 uno::Sequence<OUString> SAL_CALL ScNamedRangesObj::getElementNames()
@@ -1126,11 +1126,11 @@ sal_Int32 SAL_CALL ScLabelRangesObj::getCount()
 uno::Any SAL_CALL ScLabelRangesObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< sheet::XLabelRange >  
xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
+    rtl::Reference< ScLabelRangeObj >  
xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
     if ( !xRange.is() )
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xRange);
+    return uno::Any(uno::Reference< sheet::XLabelRange >(xRange));
 }
 
 uno::Type SAL_CALL ScLabelRangesObj::getElementType()
diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx
index 417fded19368..21fe7e6525cf 100644
--- a/sc/source/ui/unoobj/styleuno.cxx
+++ b/sc/source/ui/unoobj/styleuno.cxx
@@ -503,11 +503,11 @@ sal_Int32 SAL_CALL ScStyleFamiliesObj::getCount()
 uno::Any SAL_CALL ScStyleFamiliesObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< container::XNameContainer >  
xFamily(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference< ScStyleFamilyObj >  xFamily(GetObjectByIndex_Impl(nIndex));
     if (!xFamily.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xFamily);
+    return uno::Any(uno::Reference< container::XNameContainer >(xFamily));
 }
 
 uno::Type SAL_CALL ScStyleFamiliesObj::getElementType()
@@ -526,11 +526,11 @@ sal_Bool SAL_CALL ScStyleFamiliesObj::hasElements()
 uno::Any SAL_CALL ScStyleFamiliesObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< container::XNameContainer >  
xFamily(GetObjectByName_Impl(aName));
+    rtl::Reference< ScStyleFamilyObj >  xFamily(GetObjectByName_Impl(aName));
     if (!xFamily.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xFamily);
+    return uno::Any(uno::Reference< container::XNameContainer >(xFamily));
 }
 
 uno::Sequence<OUString> SAL_CALL ScStyleFamiliesObj::getElementNames()
@@ -827,11 +827,11 @@ sal_Int32 SAL_CALL ScStyleFamilyObj::getCount()
 uno::Any SAL_CALL ScStyleFamilyObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< style::XStyle >  xObj(GetObjectByIndex_Impl(nIndex));
+    rtl::Reference< ScStyleObj >  xObj(GetObjectByIndex_Impl(nIndex));
     if (!xObj.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xObj);
+    return uno::Any(uno::Reference< style::XStyle >(xObj));
 }
 
 uno::Type SAL_CALL ScStyleFamilyObj::getElementType()
@@ -850,12 +850,12 @@ sal_Bool SAL_CALL ScStyleFamilyObj::hasElements()
 uno::Any SAL_CALL ScStyleFamilyObj::getByName( const OUString& aName )
 {
     SolarMutexGuard aGuard;
-    uno::Reference< style::XStyle > xObj(
+    rtl::Reference< ScStyleObj > xObj(
         GetObjectByName_Impl( 
ScStyleNameConversion::ProgrammaticToDisplayName( aName, eFamily ) ));
     if (!xObj.is())
         throw container::NoSuchElementException();
 
-    return uno::Any(xObj);
+    return uno::Any(uno::Reference< style::XStyle >(xObj));
 }
 
 uno::Sequence<OUString> SAL_CALL ScStyleFamilyObj::getElementNames()
diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx
index 02f66358cb25..f88710e4355f 100644
--- a/sc/source/ui/unoobj/viewuno.cxx
+++ b/sc/source/ui/unoobj/viewuno.cxx
@@ -1014,11 +1014,11 @@ sal_Int32 SAL_CALL ScTabViewObj::getCount()
 uno::Any SAL_CALL ScTabViewObj::getByIndex( sal_Int32 nIndex )
 {
     SolarMutexGuard aGuard;
-    uno::Reference<sheet::XViewPane> 
xPane(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
+    rtl::Reference<ScViewPaneObj> 
xPane(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)));
     if (!xPane.is())
         throw lang::IndexOutOfBoundsException();
 
-    return uno::Any(xPane);
+    return uno::Any(uno::Reference<sheet::XViewPane>(xPane));
 }
 
 uno::Type SAL_CALL ScTabViewObj::getElementType()
diff --git a/sc/source/ui/vba/vbasheetobjects.cxx 
b/sc/source/ui/vba/vbasheetobjects.cxx
index ebd854f305ad..10eccf035b24 100644
--- a/sc/source/ui/vba/vbasheetobjects.cxx
+++ b/sc/source/ui/vba/vbasheetobjects.cxx
@@ -220,8 +220,8 @@ sal_Int32 ScVbaObjectContainer::insertShape( const 
uno::Reference< drawing::XSha
 uno::Any ScVbaObjectContainer::createCollectionObject( const uno::Any& rSource 
)
 {
     uno::Reference< drawing::XShape > xShape( rSource, uno::UNO_QUERY_THROW );
-    uno::Reference< excel::XSheetObject > xSheetObject( implCreateVbaObject( 
xShape ) );
-    return uno::Any( xSheetObject );
+    rtl::Reference< ScVbaSheetObjectBase > xSheetObject( implCreateVbaObject( 
xShape ) );
+    return uno::Any( uno::Reference< excel::XSheetObject >(xSheetObject) );
 }
 
 uno::Any ScVbaObjectContainer::getItemByStringIndex( const OUString& rIndex )

Reply via email to