use more concrete SwXText class

Change-Id: I94e9642eee47b58b54ff28edab01f41929fc72ff
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199089
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
(cherry picked from commit d616561e0d2c32b4fd08a5db25a4aa6d93da9374)
Reviewed-on: https://gerrit.collaboraoffice.com/c/core/+/364
Reviewed-by: Noel Grandin <noel.grandin@collabora.com>
Tested-by: Jenkins CPCI <releng@collaboraoffice.com>
diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx
index de3803b..5ee5bdc 100644
--- a/sw/inc/unoframe.hxx
+++ b/sw/inc/unoframe.hxx
@@ -79,7 +79,7 @@
     sal_Int64                       m_nDrawAspect;
     sal_Int64                       m_nVisibleAreaWidth;
     sal_Int64                       m_nVisibleAreaHeight;
-    css::uno::Reference<css::text::XText> m_xParentText;
+    css::uno::Reference<SwXText> m_xParentText;
     css::uno::Reference< css::beans::XPropertySet > mxStyleData;
     css::uno::Reference< css::container::XNameAccess >  mxStyleFamily;
 
diff --git a/sw/inc/unotbl.hxx b/sw/inc/unotbl.hxx
index d39cbe5..4e3dd90 100644
--- a/sw/inc/unotbl.hxx
+++ b/sw/inc/unotbl.hxx
@@ -75,7 +75,7 @@
 
     // table position where pBox was found last
     size_t m_nFndPos;
-    css::uno::Reference<css::text::XText> m_xParentText;
+    css::uno::Reference<SwXText> m_xParentText;
     static size_t const NOTFOUND = SAL_MAX_SIZE;
 
     virtual const SwStartNode *GetStartNode() const override;
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 713d576..6d569c3 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2236,7 +2236,7 @@
                     m_xParentText = sw::CreateParentXText(pFormat->GetDoc(), *rFormatAnchor.GetContentAnchor());
                 }
             }
-            aAny <<= m_xParentText;
+            aAny <<= uno::Reference<text::XText>(m_xParentText);
         }
         else
         {
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 73a9aed..d69ad2f 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -1275,7 +1275,7 @@
     SwDoc & rDoc, const SwPosition& rPos, const SwPosition *const pMark,
     RangePosition const eRange)
 {
-    const uno::Reference<text::XText> xParentText(
+    const uno::Reference<SwXText> xParentText(
             ::sw::CreateParentXText(rDoc, rPos));
     const auto pNewCursor(rDoc.CreateUnoCursor(rPos));
     if(pMark)
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 45c3877..e140141e 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1067,7 +1067,7 @@
                 m_xParentText = sw::CreateParentXText(rDoc, aPos);
             }
 
-            return uno::Any(m_xParentText);
+            return uno::Any(uno::Reference<text::XText>(m_xParentText));
         }
         break;
         default:
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 498ecdb8..54e1875 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -934,7 +934,7 @@
     Reference< XInterface >  xRet;
     if(nResult)
     {
-        const uno::Reference< text::XText >  xParent =
+        const uno::Reference< SwXText >  xParent =
             ::sw::CreateParentXText(GetDocOrThrow(),
                     *pResultCursor->GetPoint());
         xRet = *new SwXTextCursor(xParent, *pResultCursor);
@@ -956,7 +956,7 @@
     Reference< XInterface >  xRet;
     if(nResult)
     {
-        const uno::Reference< text::XText >  xParent =
+        const uno::Reference< SwXText >  xParent =
             ::sw::CreateParentXText(GetDocOrThrow(),
                     *pResultCursor->GetPoint());
 
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 2f5dfb7..f4108a2 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -1289,7 +1289,6 @@
 uno::Reference< text::XText >  SwXTextViewCursor::getText()
 {
     SolarMutexGuard aGuard;
-    uno::Reference< text::XText >  xRet;
     if(!m_pView)
         throw uno::RuntimeException();
 
@@ -1299,7 +1298,7 @@
     SwWrtShell& rSh = m_pView->GetWrtShell();
     SwPaM* pShellCursor = rSh.GetCursor();
     SwDoc* pDoc = m_pView->GetDocShell()->GetDoc();
-    xRet = ::sw::CreateParentXText(*pDoc, *pShellCursor->Start());
+    uno::Reference< SwXText > xRet = ::sw::CreateParentXText(*pDoc, *pShellCursor->Start());
 
     return xRet;
 }