sw/inc/unotextrange.hxx                |    2 +-
 sw/source/core/access/accpara.cxx      |    2 +-
 sw/source/core/crsr/crsrsh.cxx         |    2 +-
 sw/source/core/inc/unobookmark.hxx     |    5 +++--
 sw/source/core/txtnode/atrftn.cxx      |    2 +-
 sw/source/core/txtnode/txtedt.cxx      |    2 +-
 sw/source/core/unocore/unobkm.cxx      |    4 ++--
 sw/source/core/unocore/unodraw.cxx     |   10 +++++-----
 sw/source/core/unocore/unofield.cxx    |    2 +-
 sw/source/core/unocore/unoflatpara.cxx |   14 ++++++--------
 sw/source/core/unocore/unoframe.cxx    |    2 +-
 sw/source/core/unocore/unoidx.cxx      |    2 +-
 sw/source/core/unocore/unoobj2.cxx     |   15 ++++++---------
 sw/source/core/unocore/unoredline.cxx  |    4 ++--
 sw/source/core/unocore/unosect.cxx     |    2 +-
 sw/source/filter/docx/swdocxreader.cxx |    4 ++--
 sw/source/filter/rtf/swparrtf.cxx      |    7 ++++---
 sw/source/filter/xml/swxml.cxx         |    4 ++--
 sw/source/filter/xml/xmlimp.cxx        |    2 +-
 sw/source/filter/xml/xmltbli.cxx       |    2 +-
 sw/source/uibase/dochdl/swdtflvr.cxx   |    4 ++--
 sw/source/uibase/uiview/view2.cxx      |    2 +-
 sw/source/uibase/uno/unotxvw.cxx       |    8 ++++----
 23 files changed, 50 insertions(+), 53 deletions(-)

New commits:
commit 0f57a02c5aabbc09cfd6c912d211d21a748abc88
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sun Oct 30 12:36:12 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Oct 31 12:29:49 2022 +0100

    tdf#126788 return concrete type from CreateXTextRange
    
    to make it easier to optimise call sites unnecessarily creates tons of
    these
    
    Change-Id: I39bced82ae03fe33dbf0592f384332ab49f914fc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142036
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/unotextrange.hxx b/sw/inc/unotextrange.hxx
index b124b0cf282c..c3988596e8c4 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -129,7 +129,7 @@ public:
     bool GetPositions(SwPaM & rToFill,
         ::sw::TextRangeMode eMode = ::sw::TextRangeMode::RequireTextNode) 
const;
 
-    static css::uno::Reference< css::text::XTextRange > CreateXTextRange(
+    static rtl::Reference< SwXTextRange > CreateXTextRange(
             SwDoc & rDoc,
             const SwPosition& rPos, const SwPosition *const pMark);
 
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index f10840f27a68..aea0d2b3518f 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -2616,7 +2616,7 @@ sal_Bool SwAccessibleParagraph::replaceText(
         SwPosition aEndPos(pFrame->MapViewToModelPos(nEnd));
 
         // now create XTextRange as helper and set string
-        const uno::Reference<text::XTextRange> xRange(
+        const rtl::Reference<SwXTextRange> xRange(
             SwXTextRange::CreateXTextRange(
                 const_cast<SwDoc&>(pFrame->GetDoc()), aStartPos, &aEndPos));
         xRange->setString(sReplacement);
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 901e3b149644..0267990c8741 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -3744,7 +3744,7 @@ static void lcl_FillTextRange( 
uno::Reference<text::XTextRange>& rRange,
     // create SwPosition for nEndIndex
     SwPosition aEndPos( rNode, nBegin + nLen );
 
-    const uno::Reference<text::XTextRange> xRange =
+    const rtl::Reference<SwXTextRange> xRange =
         SwXTextRange::CreateXTextRange(rNode.GetDoc(), aStartPos, &aEndPos);
 
     rRange = xRange;
diff --git a/sw/source/core/inc/unobookmark.hxx 
b/sw/source/core/inc/unobookmark.hxx
index 740e11865a2d..aa3ef430387a 100644
--- a/sw/source/core/inc/unobookmark.hxx
+++ b/sw/source/core/inc/unobookmark.hxx
@@ -36,6 +36,7 @@
 #include <IDocumentMarkAccess.hxx>
 
 class SwDoc;
+class SwXTextRange;
 
 typedef ::cppu::ImplInheritanceHelper
 <   ::sfx2::MetadatableMixin
@@ -193,9 +194,9 @@ class SwXFieldmark final
     bool const m_bReplacementObject;
     bool m_isFieldmarkSeparatorAtStart = false;
 
-    css::uno::Reference<css::text::XTextRange>
+    rtl::Reference<SwXTextRange>
         GetCommand(::sw::mark::IFieldmark const& rMark);
-    css::uno::Reference<css::text::XTextRange>
+    rtl::Reference<SwXTextRange>
         GetResult(::sw::mark::IFieldmark const& rMark);
 
     SwXFieldmark(bool isReplacementObject, SwDoc* pDoc);
diff --git a/sw/source/core/txtnode/atrftn.cxx 
b/sw/source/core/txtnode/atrftn.cxx
index 7cbba1e5efbf..d558ea4911d2 100644
--- a/sw/source/core/txtnode/atrftn.cxx
+++ b/sw/source/core/txtnode/atrftn.cxx
@@ -277,7 +277,7 @@ uno::Reference<text::XTextRange> 
SwFormatFootnote::getAnchor(SwDoc& rDoc) const
     SwPaM aPam(m_pTextAttr->GetTextNode(), m_pTextAttr->GetStart());
     aPam.SetMark();
     aPam.GetMark()->AdjustContent(+1);
-    const uno::Reference<text::XTextRange> xRet =
+    const rtl::Reference<SwXTextRange> xRet =
         SwXTextRange::CreateXTextRange(rDoc, *aPam.Start(), aPam.End());
     return xRet;
 }
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index e906826e7db7..60c4685470dc 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1468,7 +1468,7 @@ SwRect SwTextFrame::SmartTagScan(SwTextNode & rNode)
 
         SwPosition start(*pNode, nBegin);
         SwPosition end  (*pNode, nEnd);
-        Reference< css::text::XTextRange > xRange = 
SwXTextRange::CreateXTextRange(pNode->GetDoc(), start, &end);
+        rtl::Reference<SwXTextRange> xRange = 
SwXTextRange::CreateXTextRange(pNode->GetDoc(), start, &end);
 
         rSmartTagMgr.RecognizeTextRange(xRange, xTextMarkup, xController);
 
diff --git a/sw/source/core/unocore/unobkm.cxx 
b/sw/source/core/unocore/unobkm.cxx
index 248d1fc820ad..2e5e1f697c0f 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -817,7 +817,7 @@ uno::Reference<text::XTextRange> SAL_CALL 
SwXFieldmark::getAnchor()
     return SwXBookmark::getAnchor();
 }
 
-uno::Reference<text::XTextRange>
+rtl::Reference<SwXTextRange>
 SwXFieldmark::GetCommand(IFieldmark const& rMark)
 {
     SwPosition const sepPos(sw::mark::FindFieldSep(rMark));
@@ -826,7 +826,7 @@ SwXFieldmark::GetCommand(IFieldmark const& rMark)
     return SwXTextRange::CreateXTextRange(*GetDoc(), start, &sepPos);
 }
 
-uno::Reference<text::XTextRange>
+rtl::Reference<SwXTextRange>
 SwXFieldmark::GetResult(IFieldmark const& rMark)
 {
     SwPosition sepPos(sw::mark::FindFieldSep(rMark));
diff --git a/sw/source/core/unocore/unodraw.cxx 
b/sw/source/core/unocore/unodraw.cxx
index 556be300bcff..fe4c2d762f84 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -1462,12 +1462,12 @@ uno::Any SwXShape::getPropertyValue(const OUString& 
rPropertyName)
                     {
                         if ( aAnchor.GetContentAnchor() )
                         {
-                            const uno::Reference< text::XTextRange > xTextRange
+                            const rtl::Reference<SwXTextRange> xTextRange
                                 = SwXTextRange::CreateXTextRange(
                                                     *pFormat->GetDoc(),
                                                     
*aAnchor.GetContentAnchor(),
                                                     nullptr );
-                            aRet <<= xTextRange;
+                            aRet <<= 
uno::Reference<text::XTextRange>(xTextRange);
                         }
                         else
                         {
@@ -2041,10 +2041,10 @@ void SwXShape::attach(const uno::Reference< 
text::XTextRange > & xTextRange)
     }
 }
 
-uno::Reference< text::XTextRange >  SwXShape::getAnchor()
+uno::Reference< text::XTextRange > SwXShape::getAnchor()
 {
     SolarMutexGuard aGuard;
-    uno::Reference< text::XTextRange >  aRef;
+    uno::Reference< text::XTextRange > aRef;
     SwFrameFormat* pFormat = GetFrameFormat();
     if(pFormat)
     {
@@ -2066,7 +2066,7 @@ uno::Reference< text::XTextRange >  SwXShape::getAnchor()
         }
     }
     else
-        aRef = m_pImpl->GetTextRange();
+        aRef = m_pImpl->GetTextRange().get();
     return aRef;
 }
 
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 2785d95b2224..df60adf9d6d8 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2083,7 +2083,7 @@ SwXTextField::getAnchor()
         }
     }
 
-    uno::Reference<text::XTextRange> xRange = SwXTextRange::CreateXTextRange(
+    rtl::Reference<SwXTextRange> xRange = SwXTextRange::CreateXTextRange(
             *m_pImpl->m_pDoc, *(pPamForTextField->GetPoint()), 
pPamForTextField->GetMark());
     return xRange;
 }
diff --git a/sw/source/core/unocore/unoflatpara.cxx 
b/sw/source/core/unocore/unoflatpara.cxx
index ea2343e8b18a..3182812cecdb 100644
--- a/sw/source/core/unocore/unoflatpara.cxx
+++ b/sw/source/core/unocore/unoflatpara.cxx
@@ -260,14 +260,13 @@ void SAL_CALL SwXFlatParagraph::changeText(::sal_Int32 
nPos, ::sal_Int32 nLen, c
 
     UnoActionContext aAction( &GetTextNode()->GetDoc() );
 
-    const uno::Reference< text::XTextRange > xRange =
+    const rtl::Reference<SwXTextRange> xRange =
         SwXTextRange::CreateXTextRange(
             GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
-    uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
-    if ( xPropSet.is() )
+    if ( xRange.is() )
     {
         for ( const auto& rAttribute : aAttributes )
-            xPropSet->setPropertyValue( rAttribute.Name, rAttribute.Value );
+            xRange->setPropertyValue( rAttribute.Name, rAttribute.Value );
     }
 
     IDocumentContentOperations& rIDCO = 
pOldTextNode->getIDocumentContentOperations();
@@ -293,14 +292,13 @@ void SAL_CALL 
SwXFlatParagraph::changeAttributes(::sal_Int32 nPos, ::sal_Int32 n
 
     UnoActionContext aAction( &GetTextNode()->GetDoc() );
 
-    const uno::Reference< text::XTextRange > xRange =
+    const rtl::Reference<SwXTextRange> xRange =
         SwXTextRange::CreateXTextRange(
             GetTextNode()->GetDoc(), *aPaM.GetPoint(), aPaM.GetMark() );
-    uno::Reference< beans::XPropertySet > xPropSet( xRange, uno::UNO_QUERY );
-    if ( xPropSet.is() )
+    if ( xRange.is() )
     {
         for ( const auto& rAttribute : aAttributes )
-            xPropSet->setPropertyValue( rAttribute.Name, rAttribute.Value );
+            xRange->setPropertyValue( rAttribute.Name, rAttribute.Value );
     }
 
     ClearTextNode(); // TODO: is this really needed?
diff --git a/sw/source/core/unocore/unoframe.cxx 
b/sw/source/core/unocore/unoframe.cxx
index d2383579275a..b8aef77bbab8 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2690,7 +2690,7 @@ void SwXFrame::dispose()
 uno::Reference< text::XTextRange >  SwXFrame::getAnchor()
 {
     SolarMutexGuard aGuard;
-    uno::Reference< text::XTextRange >  aRef;
+    rtl::Reference<SwXTextRange> aRef;
     SwFrameFormat* pFormat = GetFrameFormat();
     if(!pFormat)
         throw uno::RuntimeException();
diff --git a/sw/source/core/unocore/unoidx.cxx 
b/sw/source/core/unocore/unoidx.cxx
index d321dc06729a..b2b4f1618068 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -1348,7 +1348,7 @@ SwXDocumentIndex::getAnchor()
         throw uno::RuntimeException();
     }
 
-    uno::Reference< text::XTextRange > xRet;
+    rtl::Reference<SwXTextRange> xRet;
     SwNodeIndex const*const pIdx( pSectionFormat->GetContent().GetContentIdx() 
);
     if (pIdx && pIdx->GetNode().GetNodes().IsDocNodes())
     {
diff --git a/sw/source/core/unocore/unoobj2.cxx 
b/sw/source/core/unocore/unoobj2.cxx
index 83828ad45b94..c8af3285f9de 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1206,7 +1206,7 @@ lcl_IsStartNodeInFormat(const bool bHeader, SwStartNode 
const *const pSttNode,
 
 } // namespace sw
 
-uno::Reference< text::XTextRange >
+rtl::Reference< SwXTextRange >
 SwXTextRange::CreateXTextRange(
     SwDoc & rDoc, const SwPosition& rPos, const SwPosition *const pMark)
 {
@@ -1219,10 +1219,8 @@ SwXTextRange::CreateXTextRange(
         *pNewCursor->GetMark() = *pMark;
     }
     const bool isCell( dynamic_cast<SwXCell*>(xParentText.get()) );
-    const uno::Reference< text::XTextRange > xRet(
-        new SwXTextRange(*pNewCursor, xParentText,
-            isCell ? RANGE_IN_CELL : RANGE_IN_TEXT) );
-    return xRet;
+    return new SwXTextRange(*pNewCursor, xParentText,
+            isCell ? RANGE_IN_CELL : RANGE_IN_TEXT);
 }
 
 namespace sw {
@@ -1588,7 +1586,7 @@ struct SwXTextRangesImpl final : public SwXTextRanges
     virtual SwUnoCursor* GetCursor() override
         { return &(*m_pUnoCursor); };
     void MakeRanges();
-    std::vector< uno::Reference< text::XTextRange > > m_Ranges;
+    std::vector< rtl::Reference<SwXTextRange> > m_Ranges;
     sw::UnoCursorPointer m_pUnoCursor;
 };
 
@@ -1601,7 +1599,7 @@ void SwXTextRangesImpl::MakeRanges()
 
     for(SwPaM& rTmpCursor : GetCursor()->GetRingContainer())
     {
-        const uno::Reference< text::XTextRange > xRange(
+        const rtl::Reference<SwXTextRange> xRange(
                 SwXTextRange::CreateXTextRange(
                     rTmpCursor.GetDoc(),
                     *rTmpCursor.GetPoint(), rTmpCursor.GetMark()));
@@ -1644,8 +1642,7 @@ uno::Any SAL_CALL SwXTextRangesImpl::getByIndex(sal_Int32 
nIndex)
     SolarMutexGuard aGuard;
     if ((nIndex < 0) || (o3tl::make_unsigned(nIndex) >= m_Ranges.size()))
         throw lang::IndexOutOfBoundsException();
-    uno::Any ret;
-    ret <<= m_Ranges.at(nIndex);
+    uno::Any ret(uno::Reference<text::XTextRange>(m_Ranges.at(nIndex)));
     return ret;
 }
 
diff --git a/sw/source/core/unocore/unoredline.cxx 
b/sw/source/core/unocore/unoredline.cxx
index 6772bb1e1305..8675743da681 100644
--- a/sw/source/core/unocore/unoredline.cxx
+++ b/sw/source/core/unocore/unoredline.cxx
@@ -435,9 +435,9 @@ uno::Any SwXRedline::getPropertyValue( const OUString& 
rPropertyName )
                     pPoint = m_pRedline->GetPoint();
                 else
                     pPoint = m_pRedline->GetMark();
-                const uno::Reference<text::XTextRange> xRange =
+                const rtl::Reference<SwXTextRange> xRange =
                     SwXTextRange::CreateXTextRange(*m_pDoc, *pPoint, nullptr);
-                xRet = xRange.get();
+                xRet = uno::Reference<text::XTextRange>(xRange);
             }
             break;
             default:
diff --git a/sw/source/core/unocore/unosect.cxx 
b/sw/source/core/unocore/unosect.cxx
index e7fe7aaa604c..25aa3804a66f 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -435,7 +435,7 @@ SwXTextSection::getAnchor()
 {
     SolarMutexGuard aGuard;
 
-    uno::Reference< text::XTextRange >  xRet;
+    rtl::Reference<SwXTextRange> xRet;
     SwSectionFormat *const pSectFormat = m_pImpl->GetSectionFormat();
     if(pSectFormat)
     {
diff --git a/sw/source/filter/docx/swdocxreader.cxx 
b/sw/source/filter/docx/swdocxreader.cxx
index a813cf9eef74..028fb973c760 100644
--- a/sw/source/filter/docx/swdocxreader.cxx
+++ b/sw/source/filter/docx/swdocxreader.cxx
@@ -63,7 +63,7 @@ ErrCode SwDOCXReader::Read(SwDoc& rDoc, const OUString& /* 
rBaseURL */, SwPaM& r
     uno::Reference<document::XImporter> xImporter(xInterface, 
uno::UNO_QUERY_THROW);
     xImporter->setTargetDocument(xDstDoc);
 
-    const uno::Reference<text::XTextRange> xInsertTextRange = 
SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
+    const rtl::Reference<SwXTextRange> xInsertTextRange = 
SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
     uno::Reference<io::XStream> xStream(new 
utl::OStreamWrapper(*m_pMedium->GetInStream()));
 
     //SetLoading hack because the document properties will be re-initted
@@ -76,7 +76,7 @@ ErrCode SwDOCXReader::Read(SwDoc& rDoc, const OUString& /* 
rBaseURL */, SwPaM& r
     {
         { "InputStream", uno::Any(xStream) },
         { "InsertMode", uno::Any(true) },
-        { "TextInsertModeRange", uno::Any(xInsertTextRange) }
+        { "TextInsertModeRange", 
uno::Any(uno::Reference<text::XTextRange>(xInsertTextRange)) }
     }));
 
     ErrCode ret = ERRCODE_NONE;
diff --git a/sw/source/filter/rtf/swparrtf.cxx 
b/sw/source/filter/rtf/swparrtf.cxx
index c5eb1ae6e8ea..0f0af73b2c95 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -59,7 +59,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& 
/*rBaseURL*/, SwPaM& rPam
     // We want to work in an empty paragraph.
     // Step 1: XTextRange will be updated when content is inserted, so we know
     // the end position.
-    const uno::Reference<text::XTextRange> xInsertPosition
+    const rtl::Reference<SwXTextRange> xInsertPosition
         = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
     auto pSttNdIdx = std::make_shared<SwNodeIndex>(rDoc.GetNodes());
     const SwPosition* pPos = rPam.GetPoint();
@@ -89,7 +89,7 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& 
/*rBaseURL*/, SwPaM& rPam
     uno::Reference<lang::XComponent> xDstDoc(pDocShell->GetModel(), 
uno::UNO_QUERY_THROW);
     xImporter->setTargetDocument(xDstDoc);
 
-    const uno::Reference<text::XTextRange> xInsertTextRange
+    const rtl::Reference<SwXTextRange> xInsertTextRange
         = SwXTextRange::CreateXTextRange(rDoc, *rPam.GetPoint(), nullptr);
 
     uno::Reference<document::XFilter> xFilter(xInterface, 
uno::UNO_QUERY_THROW);
@@ -97,7 +97,8 @@ ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& 
/*rBaseURL*/, SwPaM& rPam
         { { "InputStream",
             uno::Any(uno::Reference<io::XStream>(new 
utl::OStreamWrapper(*m_pStream))) },
           { "InsertMode", uno::Any(true) },
-          { "TextInsertModeRange", uno::Any(xInsertTextRange) } }));
+          { "TextInsertModeRange",
+            uno::Any(uno::Reference<text::XTextRange>(xInsertTextRange)) } }));
     auto ret = ERRCODE_NONE;
     try
     {
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 21afc25b9152..b679f111a3b6 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -688,10 +688,10 @@ ErrCode XMLReader::Read( SwDoc &rDoc, const OUString& 
rBaseURL, SwPaM &rPaM, con
     }
     else if( m_bInsertMode )
     {
-        const uno::Reference<text::XTextRange> xInsertTextRange =
+        const rtl::Reference<SwXTextRange> xInsertTextRange =
             SwXTextRange::CreateXTextRange(rDoc, *rPaM.GetPoint(), nullptr);
         xInfoSet->setPropertyValue( "TextInsertModeRange",
-                                    Any(xInsertTextRange) );
+                                    
Any(uno::Reference<text::XTextRange>(xInsertTextRange)) );
     }
     else
     {
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 1fa30ceedfdd..024531cedd44 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -532,7 +532,7 @@ void SwXMLImport::startDocument()
         }
         if( pCursorSh )
         {
-            const uno::Reference<text::XTextRange> xInsertTextRange(
+            const rtl::Reference<SwXTextRange> xInsertTextRange(
                 SwXTextRange::CreateXTextRange(
                     *pDoc, *pCursorSh->GetCursor()->GetPoint(), nullptr ) );
             setTextInsertMode( xInsertTextRange );
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index e53be9b8ff4f..517fa2b0288a 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -2711,7 +2711,7 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
                                                             ->GetContentNode();
             SwPosition aPos( *pCNd );
 
-            const uno::Reference< text::XTextRange > xTextRange =
+            const rtl::Reference<SwXTextRange> xTextRange =
                 SwXTextRange::CreateXTextRange( *pDoc, aPos, nullptr );
             Reference < XText > xText = xTextRange->getText();
             Reference < XTextCursor > xTextCursor =
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx 
b/sw/source/uibase/dochdl/swdtflvr.cxx
index 496d0c8903ef..8c6d6bda92eb 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1343,9 +1343,9 @@ SwPasteContext::~SwPasteContext()
                 m_oPaM->GetPoint()->SetContent(m_nStartContent);
 
                 aPropertyValue.Name = "TextRange";
-                const uno::Reference<text::XTextRange> xTextRange = 
SwXTextRange::CreateXTextRange(
+                const rtl::Reference<SwXTextRange> xTextRange = 
SwXTextRange::CreateXTextRange(
                     m_oPaM->GetDoc(), *m_oPaM->GetPoint(), m_oPaM->GetMark());
-                aPropertyValue.Value <<= xTextRange;
+                aPropertyValue.Value <<= 
uno::Reference<text::XTextRange>(xTextRange);
                 break;
             }
         }
diff --git a/sw/source/uibase/uiview/view2.cxx 
b/sw/source/uibase/uiview/view2.cxx
index 2ba8c135d800..6e2db153bf9a 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -2733,7 +2733,7 @@ tools::Long SwView::InsertMedium( sal_uInt16 nSlotId, 
std::unique_ptr<SfxMedium>
                     else
                     {
                         ::sw::UndoGuard const ug(pDoc->GetIDocumentUndoRedo());
-                        uno::Reference<text::XTextRange> const xInsertPosition(
+                        rtl::Reference<SwXTextRange> const xInsertPosition(
                             SwXTextRange::CreateXTextRange(*pDoc,
                                 *m_pWrtShell->GetCursor()->GetPoint(), 
nullptr));
                         nErrno = pDocSh->ImportFrom(*pMedium, xInsertPosition)
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 112e6a934d11..65401a8410e6 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -535,7 +535,7 @@ SwXTextView::createTextRangeByPixelPosition(const 
awt::Point& rPixelPosition)
     SwWrtShell& rSh = m_pView->GetWrtShell();
     SwPosition aPosition(*rSh.GetCurrentShellCursor().GetPoint());
     rSh.GetLayout()->GetModelPositionForViewPoint(&aPosition, aLogicPoint);
-    uno::Reference<text::XTextRange> xRet
+    rtl::Reference<SwXTextRange> xRet
         = SwXTextRange::CreateXTextRange(*rSh.GetDoc(), aPosition, 
/*pMark=*/nullptr);
 
     return xRet;
@@ -1345,7 +1345,7 @@ uno::Reference< text::XText >  
SwXTextViewCursor::getText()
     return xRet;
 }
 
-uno::Reference< text::XTextRange >  SwXTextViewCursor::getStart()
+uno::Reference< text::XTextRange > SwXTextViewCursor::getStart()
 {
     SolarMutexGuard aGuard;
     uno::Reference< text::XTextRange >  xRet;
@@ -1363,10 +1363,10 @@ uno::Reference< text::XTextRange >  
SwXTextViewCursor::getStart()
     return xRet;
 }
 
-uno::Reference< text::XTextRange >  SwXTextViewCursor::getEnd()
+uno::Reference< text::XTextRange > SwXTextViewCursor::getEnd()
 {
     SolarMutexGuard aGuard;
-    uno::Reference< text::XTextRange >  xRet;
+    rtl::Reference<SwXTextRange> xRet;
     if(!m_pView)
         throw uno::RuntimeException();
 

Reply via email to