sw/inc/unocoll.hxx                       |    3 ++-
 sw/source/core/docnode/section.cxx       |    2 +-
 sw/source/core/unocore/unocoll.cxx       |    4 ++--
 sw/source/core/unocore/unocrsrhelper.cxx |    5 +++--
 sw/source/core/unocore/unoredline.cxx    |    4 +++-
 sw/source/core/unocore/unotbl.cxx        |    8 +++++---
 6 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 02f8e04778596e4395c01271540298a044eee17a
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Fri Dec 29 18:07:26 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Fri Dec 29 19:36:57 2023 +0100

    use more concrete UNO types in sw
    
    Change-Id: Ie8dafd99a95ccbae724e7c37b49da01763a4ed42
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161408
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx
index 48e1196f520e..751a4033f20e 100644
--- a/sw/inc/unocoll.hxx
+++ b/sw/inc/unocoll.hxx
@@ -39,6 +39,7 @@ class SwFormatFootnote;
 class SwSectionFormat;
 struct SvEventDescription;
 class SwXFootnote;
+class SwXTextSection;
 
 const SvEventDescription* sw_GetSupportedMacroItems();
 
@@ -393,7 +394,7 @@ public:
     virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) 
override;
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() 
override;
 
-    static css::uno::Reference< css::text::XTextSection> GetObject( 
SwSectionFormat& rFormat );
+    static rtl::Reference<SwXTextSection> GetObject( SwSectionFormat& rFormat 
);
 };
 
 class SwXBookmarks final : public SwCollectionBaseClass,
diff --git a/sw/source/core/docnode/section.cxx 
b/sw/source/core/docnode/section.cxx
index 12d9e281c2f0..000d4fc15527 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -973,7 +973,7 @@ bool SwSectionFormat::IsInContent() const
 uno::Reference< rdf::XMetadatable >
 SwSectionFormat::MakeUnoObject()
 {
-    uno::Reference<rdf::XMetadatable> xMeta;
+    rtl::Reference<SwXTextSection> xMeta;
     SwSection *const pSection( GetSection() );
     if (pSection)
     {
diff --git a/sw/source/core/unocore/unocoll.cxx 
b/sw/source/core/unocore/unocoll.cxx
index 9f7677899c9e..a03d6e2535ed 100644
--- a/sw/source/core/unocore/unocoll.cxx
+++ b/sw/source/core/unocore/unocoll.cxx
@@ -1375,7 +1375,7 @@ uno::Any SwXTextSections::getByIndex(sal_Int32 nIndex)
         if( !rSectFormats[i]->IsInNodesArr())
             nIndex2++;
         else if (nIndex2 == i)
-            return Any(GetObject(*rSectFormats[i]));
+            return Any(css::uno::Reference< 
css::text::XTextSection>(GetObject(*rSectFormats[i])));
     }
     throw IndexOutOfBoundsException();
 }
@@ -1475,7 +1475,7 @@ sal_Bool SwXTextSections::hasElements()
     return nCount > 0;
 }
 
-uno::Reference< XTextSection >  SwXTextSections::GetObject( SwSectionFormat& 
rFormat )
+rtl::Reference< SwXTextSection >  SwXTextSections::GetObject( SwSectionFormat& 
rFormat )
 {
     return SwXTextSection::CreateXTextSection(&rFormat);
 }
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx 
b/sw/source/core/unocore/unocrsrhelper.cxx
index 70a724814cc6..ec4b772c675d 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -45,6 +45,7 @@
 #include <unoidx.hxx>
 #include <unofield.hxx>
 #include <unotbl.hxx>
+#include <unosection.hxx>
 #include <unosett.hxx>
 #include <unoframe.hxx>
 #include <unocrsr.hxx>
@@ -636,8 +637,8 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& 
rEntry
             {
                 if( pAny )
                 {
-                    uno::Reference< XTextSection >  xSect = 
SwXTextSections::GetObject( *pSect->GetFormat() );
-                    *pAny <<= xSect;
+                    rtl::Reference< SwXTextSection > xSect = 
SwXTextSections::GetObject( *pSect->GetFormat() );
+                    *pAny <<= uno::Reference< XTextSection >(xSect);
                 }
             }
             else
diff --git a/sw/source/core/unocore/unoredline.cxx 
b/sw/source/core/unocore/unoredline.cxx
index fe16324e4238..2ac7eebf5695 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -29,6 +29,7 @@
 #include <redline.hxx>
 #include <section.hxx>
 #include <unoprnms.hxx>
+#include <unosection.hxx>
 #include <unotextrange.hxx>
 #include <unotextcursor.hxx>
 #include <unoparagraph.hxx>
@@ -411,7 +412,8 @@ uno::Any SwXRedline::getPropertyValue( const OUString& 
rPropertyName )
             {
                 SwSectionNode* pSectNode = pNode->GetSectionNode();
                 OSL_ENSURE(pSectNode, "No section node!");
-                xRet = SwXTextSections::GetObject( 
*pSectNode->GetSection().GetFormat() );
+                rtl::Reference< SwXTextSection > xSect = 
SwXTextSections::GetObject( *pSectNode->GetSection().GetFormat() );
+                xRet = uno::Reference< text::XTextSection >(xSect);
             }
             break;
             case SwNodeType::Table :
diff --git a/sw/source/core/unocore/unotbl.cxx 
b/sw/source/core/unocore/unotbl.cxx
index c2f92df7f1cf..eb683b0b1c69 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -36,6 +36,7 @@
 #include <unomid.h>
 #include <unomap.hxx>
 #include <unotbl.hxx>
+#include <unosection.hxx>
 #include <section.hxx>
 #include <unocrsr.hxx>
 #include <hints.hxx>
@@ -1015,7 +1016,8 @@ uno::Any SwXCell::getPropertyValue(const OUString& 
rPropertyName)
             if(!pSectionNode)
                 return uno::Any();
             SwSection& rSect = pSectionNode->GetSection();
-            return uno::Any(SwXTextSections::GetObject(*rSect.GetFormat()));
+            rtl::Reference< SwXTextSection > xSect = 
SwXTextSections::GetObject(*rSect.GetFormat());
+            return uno::Any(uno::Reference< text::XTextSection >(xSect));
         }
         break;
         case FN_UNO_CELL_NAME:
@@ -2885,9 +2887,9 @@ uno::Any SwXTextTable::getPropertyValue(const OUString& 
rPropertyName)
                     if(pSectionNode)
                     {
                         SwSection& rSect = pSectionNode->GetSection();
-                        uno::Reference< text::XTextSection >  xSect =
+                        rtl::Reference< SwXTextSection > xSect =
                                         SwXTextSections::GetObject( 
*rSect.GetFormat() );
-                        aRet <<= xSect;
+                        aRet <<= uno::Reference< text::XTextSection >(xSect);
                     }
                 }
                 break;

Reply via email to