From 1f8d457073f371592e57945ced6922ceab6036ce Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 30 Oct 2022 12:48:39 +0200 Subject: 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 --- 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(-) (limited to 'sw') 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 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 #include #include +#include #include #include #include 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 #include +#include #include #include @@ -2711,9 +2712,10 @@ const SwStartNode *SwXMLTableContext::InsertTableSection( ->GetContentNode(); SwPosition aPos( *pCNd ); - const rtl::Reference 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 xTextRange = new SwXTextRange(*pNewCursor, xText, + SwXTextRange::RANGE_IN_CELL); Reference < XTextCursor > xTextCursor = xText->createTextCursorByRange( xTextRange ); GetImport().GetTextImport()->SetCursor( xTextCursor ); -- cgit