sw/inc/unotextrange.hxx           |   16 ++++++++--------
 sw/source/core/unocore/unoobj.cxx |    1 +
 sw/source/filter/xml/xmltbli.cxx  |    8 +++++---
 3 files changed, 14 insertions(+), 11 deletions(-)

New commits:
commit 1f8d457073f371592e57945ced6922ceab6036ce
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Sun Oct 30 12:48:39 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Oct 31 15:52:47 2022 +0100

    tdf#126788 inline CreateXTextRange into this call site
    
    Change-Id: Iba3c0a35ebd9e1c6e639cde79225c3ab896bc97f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142037
    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 c3988596e8c4..76e2621fd933 100644
--- a/sw/inc/unotextrange.hxx
+++ b/sw/inc/unotextrange.hxx
@@ -97,14 +97,6 @@ private:
     class Impl;
     ::sw::UnoImplPtr<Impl> m_pImpl;
 
-    enum RangePosition
-    {
-        RANGE_IN_TEXT,  // "ordinary" css::text::TextRange
-        RANGE_IN_CELL,  // position created with a cell that has no uno object
-        RANGE_IS_TABLE, // anchor of a table
-        RANGE_IS_SECTION, // anchor of a section
-    };
-
     void    SetPositions(SwPaM const& rPam);
     //TODO: new exception type for protected content
     /// @throws css::uno::RuntimeException
@@ -116,6 +108,14 @@ private:
 
 public:
 
+    enum RangePosition
+    {
+        RANGE_IN_TEXT,  // "ordinary" css::text::TextRange
+        RANGE_IN_CELL,  // position created with a cell that has no uno object
+        RANGE_IS_TABLE, // anchor of a table
+        RANGE_IS_SECTION, // anchor of a section
+    };
+
     SwXTextRange(SwPaM const & rPam,
             const css::uno::Reference< css::text::XText > & xParent,
             const enum RangePosition eRange = RANGE_IN_TEXT);
diff --git a/sw/source/core/unocore/unoobj.cxx 
b/sw/source/core/unocore/unoobj.cxx
index 3933bef5d31d..615914cdf9b5 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -41,6 +41,7 @@
 #include <paratr.hxx>
 #include <pam.hxx>
 #include <shellio.hxx>
+#include <unotbl.hxx>
 #include <fmtruby.hxx>
 #include <docsh.hxx>
 #include <docstyle.hxx>
diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx
index 517fa2b0288a..0ebda388c152 100644
--- a/sw/source/filter/xml/xmltbli.cxx
+++ b/sw/source/filter/xml/xmltbli.cxx
@@ -63,6 +63,7 @@
 #include "xmltbli.hxx"
 #include <vcl/svapp.hxx>
 #include <ndtxt.hxx>
+#include <unotextcursor.hxx>
 #include <SwStyleNameMapper.hxx>
 
 #include <algorithm>
@@ -2711,9 +2712,10 @@ const SwStartNode *SwXMLTableContext::InsertTableSection(
                                                             ->GetContentNode();
             SwPosition aPos( *pCNd );
 
-            const rtl::Reference<SwXTextRange> xTextRange =
-                SwXTextRange::CreateXTextRange( *pDoc, aPos, nullptr );
-            Reference < XText > xText = xTextRange->getText();
+            Reference < XText > xText = ::sw::CreateParentXText(*pDoc, aPos);
+            const auto pNewCursor(pDoc->CreateUnoCursor(aPos));
+            rtl::Reference<SwXTextRange> xTextRange = new 
SwXTextRange(*pNewCursor, xText,
+                    SwXTextRange::RANGE_IN_CELL);
             Reference < XTextCursor > xTextCursor =
                 xText->createTextCursorByRange( xTextRange );
             GetImport().GetTextImport()->SetCursor( xTextCursor );

Reply via email to