sw/inc/unoframe.hxx | 10 ++ sw/inc/unotbl.hxx | 2 sw/inc/unotext.hxx | 14 +++ sw/source/core/unocore/unoframe.cxx | 12 ++- sw/source/core/unocore/unoobj2.cxx | 2 sw/source/core/unocore/unotbl.cxx | 2 sw/source/core/unocore/unotext.cxx | 25 +++++- sw/source/uibase/uno/unotxdoc.cxx | 4 - sw/source/uibase/uno/unotxvw.cxx | 3 sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx | 46 ++++-------- sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 38 ++++----- sw/source/writerfilter/dmapper/TableManager.cxx | 18 ++-- 12 files changed, 107 insertions(+), 69 deletions(-)
New commits: commit 66900d375990dcb94aec75e166738464f39f1701 Author: Noel Grandin <[email protected]> AuthorDate: Tue Feb 10 18:29:50 2026 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Feb 11 07:15:45 2026 +0100 XTextAppendAndConvert is only implemented by SwXText so all users of that in writerfilter can use the concrete class Change-Id: Idd2e994ada5294a8be1bfa007a0925d68a40b1b8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199090 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index f6aab1f38065..5342ef3dea4f 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -47,6 +47,7 @@ class SwFormat; class SwUnoInternalPaM; class SfxItemPropertySet; class SwXOLEListener; +struct SwXParagraphEnumeration; namespace com::sun::star::frame { class XModel; } class BaseFrameProperties_Impl; @@ -150,6 +151,8 @@ public: void attachToRange(css::uno::Reference<css::text::XTextRange> const& xTextRange, SwPaM const* pCopySource = nullptr); + SW_DLLPUBLIC rtl::Reference< SwXTextRange > getSwAnchor(); + const SwFrameFormat* GetFrameFormat() const { return m_pFrameFormat; } SwFrameFormat* GetFrameFormat() @@ -215,7 +218,7 @@ public: //XTextContent virtual void SAL_CALL attach( const css::uno::Reference< css::text::XTextRange >& xTextRange ) override; - virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override; + virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor( ) override final; //XComponent virtual void SAL_CALL dispose( ) override; @@ -233,6 +236,9 @@ public: //XPropertySet virtual SW_DLLPUBLIC css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; using SwXFrame::setPropertyValue; + + SW_DLLPUBLIC rtl::Reference< SwXParagraphEnumeration > createSwEnumeration(); + private: rtl::Reference< SwXTextCursor > createXTextCursorByRangeImpl(SwFrameFormat& rFormat, SwUnoInternalPaM& rPam); }; diff --git a/sw/inc/unotext.hxx b/sw/inc/unotext.hxx index 83823e9bb5c1..37ba6696987d 100644 --- a/sw/inc/unotext.hxx +++ b/sw/inc/unotext.hxx @@ -40,6 +40,7 @@ class SwXTextCursor; class SwXParagraph; class SwXTextRange; class SwXTextTable; +class SwXTextFrame; class SAL_DLLPUBLIC_RTTI SAL_LOPLUGIN_ANNOTATE("crosscast") SwXText : public css::lang::XTypeProvider @@ -161,7 +162,7 @@ public: virtual css::uno::Reference< css::text::XTextRange > SAL_CALL finishParagraphInsert( const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, - const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override; + const css::uno::Reference< css::text::XTextRange >& xInsertPosition) override final; // XTextPortionAppend virtual css::uno::Reference< css::text::XTextRange > SAL_CALL @@ -191,7 +192,7 @@ public: convertToTextFrame( const css::uno::Reference< css::text::XTextRange >& xStart, const css::uno::Reference< css::text::XTextRange >& xEnd, - const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override; + const css::uno::Sequence< css::beans::PropertyValue >& xFrameProperties) override final; virtual css::uno::Reference< css::text::XTextTable > SAL_CALL convertToTable( @@ -240,6 +241,10 @@ public: virtual void SAL_CALL removeTextContentAfter( const css::uno::Reference< css::text::XTextContent>& xPredecessor) override; + SW_DLLPUBLIC rtl::Reference< SwXParagraph > + finishSwParagraphInsert( + const css::uno::Sequence< css::beans::PropertyValue >& rCharacterAndParagraphProperties, + const css::uno::Reference< css::text::XTextRange >& xInsertPosition); SW_DLLPUBLIC rtl::Reference< SwXTextTable > convertToSwTable( css::uno::Sequence< @@ -260,6 +265,11 @@ public: css::uno::Sequence< css::beans::PropertyValue > const& rTableProperties); + SW_DLLPUBLIC rtl::Reference< SwXTextFrame > + convertToSwTextFrame( + const css::uno::Reference< css::text::XTextRange >& xStart, + const css::uno::Reference< css::text::XTextRange >& xEnd, + const std::vector< css::beans::PropertyValue >& xFrameProperties); private: rtl::Reference< SwXTextCursor > getEndImpl(SolarMutexGuard& rGuard); diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 9eb9df37217f..969788c871a0 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2637,6 +2637,11 @@ void SwXFrame::dispose() } uno::Reference< text::XTextRange > SwXFrame::getAnchor() +{ + return getSwAnchor(); +} + +rtl::Reference< SwXTextRange > SwXFrame::getSwAnchor() { SolarMutexGuard aGuard; rtl::Reference<SwXTextRange> aRef; @@ -3278,6 +3283,11 @@ rtl::Reference< SwXTextCursor > SwXTextFrame::createXTextCursorByRangeImpl( } uno::Reference< container::XEnumeration > SwXTextFrame::createEnumeration() +{ + return createSwEnumeration(); +} + +rtl::Reference< SwXParagraphEnumeration > SwXTextFrame::createSwEnumeration() { SolarMutexGuard aGuard; SwFrameFormat* pFormat = GetFrameFormat(); diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index 94c4531c0128..7cd43df6f746 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1148,6 +1148,16 @@ SwXText::finishParagraphInsert( return finishOrAppendParagraph(rProperties, xInsertPosition); } +rtl::Reference< SwXParagraph > +SwXText::finishSwParagraphInsert( + const uno::Sequence< beans::PropertyValue > & rProperties, + const uno::Reference< text::XTextRange >& xInsertPosition) +{ + SolarMutexGuard g; + + return finishOrAppendParagraph(rProperties, xInsertPosition); +} + rtl::Reference<SwXParagraph> SwXText::finishOrAppendParagraph( const uno::Sequence< beans::PropertyValue > & rProperties, @@ -1469,6 +1479,17 @@ SwXText::convertToTextFrame( const uno::Reference< text::XTextRange >& xStart, const uno::Reference< text::XTextRange >& xEnd, const uno::Sequence< beans::PropertyValue >& rFrameProperties) +{ + return static_cast<SwXFrame*>(convertToSwTextFrame(xStart, xEnd, comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(rFrameProperties)).get()); +} + +// move previously appended paragraphs into a text frames +// to support import filters +rtl::Reference< SwXTextFrame > +SwXText::convertToSwTextFrame( + const uno::Reference< text::XTextRange >& xStart, + const uno::Reference< text::XTextRange >& xEnd, + const std::vector< beans::PropertyValue >& rFrameProperties) { SolarMutexGuard aGuard; @@ -1492,7 +1513,6 @@ SwXText::convertToTextFrame( break; } } - uno::Reference< text::XTextContent > xRet; std::optional<SwUnoInternalPaM> pTempStartPam(*GetDoc()); std::optional<SwUnoInternalPaM> pEndPam(*GetDoc()); if (!::sw::XTextRangeToSwPaM(*pTempStartPam, xStart, eMode) @@ -1748,7 +1768,6 @@ SwXText::convertToTextFrame( sMessage = rRuntime.Message; bRuntimeException = true; } - xRet = static_cast<SwXFrame*>(xNewFrame.get()); if (bParaBeforeInserted || bParaAfterInserted) { const rtl::Reference<SwXTextCursor> xFrameTextCursor = @@ -1787,7 +1806,7 @@ SwXText::convertToTextFrame( throw uno::RuntimeException(sMessage); } } - return xRet; + return xNewFrame; } namespace { diff --git a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx index 6438c16ed185..a450c079ea66 100644 --- a/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapperTableHandler.cxx @@ -58,6 +58,7 @@ #include <officecfg/Office/Writer.hxx> #include <unotbl.hxx> #include <unoparagraph.hxx> +#include <unotextrange.hxx> #ifdef DBG_UTIL #include "PropertyMapHelper.hxx" @@ -1732,12 +1733,12 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) sal_Int32 nTableWidthType = text::SizeType::FIX; m_aTableProperties->getValue(TablePropertyMap::TABLE_WIDTH_TYPE, nTableWidthType); // m_xText points to the body text, get the current xText from m_rDMapper_Impl, in case e.g. we would be in a header. - uno::Reference<text::XTextAppendAndConvert> xTextAppendAndConvert; + rtl::Reference<SwXText> xTextAppendAndConvert; if (m_rDMapper_Impl.GetCurrentXText()) { - xTextAppendAndConvert.set(m_rDMapper_Impl.GetTopTextAppend(), uno::UNO_QUERY); + xTextAppendAndConvert = dynamic_cast<SwXText*>(m_rDMapper_Impl.GetTopTextAppend().get()); } - uno::Reference<beans::XPropertySet> xFrameAnchor; + rtl::Reference<SwXTextRange> xFrameAnchor; // Writer layout has problems with redlines on floating table rows in footnotes, avoid // them. @@ -1751,13 +1752,14 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) std::vector<OUString> redTable; BeforeConvertToTextFrame(rFramedRedlines, redPos, redLen, redCell, redTable); - uno::Reference<text::XTextContent> xContent = xTextAppendAndConvert->convertToTextFrame(xStart, xEnd, comphelper::containerToSequence(aFrameProperties)); - xFrameAnchor.set(xContent->getAnchor(), uno::UNO_QUERY); + rtl::Reference<SwXTextFrame> xContent = xTextAppendAndConvert->convertToSwTextFrame(xStart, xEnd, aFrameProperties); + if (xContent) + xFrameAnchor = xContent->getSwAnchor(); bool bConvertToFloatingInFootnote = false; - if (xContent.is() && xContent->getAnchor().is()) + if (xFrameAnchor) { - uno::Reference<lang::XServiceInfo> xText(xContent->getAnchor()->getText(), uno::UNO_QUERY); + uno::Reference<lang::XServiceInfo> xText(xFrameAnchor->getText(), uno::UNO_QUERY); if (xText.is()) { bConvertToFloatingInFootnote = xText->supportsService(u"com.sun.star.text.Footnote"_ustr); @@ -1767,34 +1769,24 @@ void DomainMapperTableHandler::endTable(unsigned int nestedTableLevel) // paragraph of the anchoring point of the floating table needs zero top and bottom // margins, if the table was a not floating table in the footnote, otherwise // docDefault margins could result bigger vertical spaces around the table - if ( bConvertToFloatingInFootnote && xContent.is() ) + if ( bConvertToFloatingInFootnote && xFrameAnchor ) { - uno::Reference<beans::XPropertySet> xParagraph( - xContent->getAnchor(), uno::UNO_QUERY); - if ( xParagraph.is() ) - { - xParagraph->setPropertyValue(u"ParaTopMargin"_ustr, - uno::Any(static_cast<sal_Int32>(0))); - xParagraph->setPropertyValue(u"ParaBottomMargin"_ustr, - uno::Any(static_cast<sal_Int32>(0))); - } + xFrameAnchor->setPropertyValue(u"ParaTopMargin"_ustr, + uno::Any(static_cast<sal_Int32>(0))); + xFrameAnchor->setPropertyValue(u"ParaBottomMargin"_ustr, + uno::Any(static_cast<sal_Int32>(0))); } - if (xContent.is()) + if (xFrameAnchor) { // By the time the frame is created, the anchor's paragraph marker character // properties are already imported. Check if we need to disable "vanish", that // would lead to a hidden floating table in Writer, but it does not in Word. - uno::Reference<beans::XPropertySet> xParagraph(xContent->getAnchor(), - uno::UNO_QUERY); - if (xParagraph.is()) + bool bCharHidden{}; + xFrameAnchor->getPropertyValue(u"CharHidden"_ustr) >>= bCharHidden; + if (bCharHidden) { - bool bCharHidden{}; - xParagraph->getPropertyValue(u"CharHidden"_ustr) >>= bCharHidden; - if (bCharHidden) - { - xParagraph->setPropertyValue(u"CharHidden"_ustr, uno::Any(false)); - } + xFrameAnchor->setPropertyValue(u"CharHidden"_ustr, uno::Any(false)); } } diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index bd46598898c1..ffc2703608fb 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -156,6 +156,7 @@ #include <unotextbodyhf.hxx> #include <unosett.hxx> #include <unodraw.hxx> +#include <unoparagraph.hxx> using namespace ::com::sun::star; using namespace oox; @@ -2873,22 +2874,20 @@ void DomainMapper_Impl::finishParagraph( const PropertyMapPtr& pPropertyMap, con fillEmptyFrameProperties(aFrameProperties, false); - uno::Reference<text::XTextAppendAndConvert> xBodyText(xRangeStart->getText(), uno::UNO_QUERY); + rtl::Reference<SwXText> xBodyText = dynamic_cast<SwXText*>(xRangeStart->getText().get()); - uno::Reference<text::XTextContent> xFrame = xBodyText->convertToTextFrame(xRangeStart, xRangeEnd, comphelper::containerToSequence(aFrameProperties)); - uno::Reference<beans::XPropertySet> xFrameProps(xFrame, uno::UNO_QUERY); + rtl::Reference<SwXTextFrame> xFrame = xBodyText->convertToSwTextFrame(xRangeStart, xRangeEnd, aFrameProperties); // set frame style now to avoid losing text content (convertToTextFrame() doesn't work // with frame styles anchored "as character") - xFrameProps->setPropertyValue(u"FrameStyleName"_ustr, uno::Any(u"Inline Heading"_ustr)); + xFrame->setPropertyValue(u"FrameStyleName"_ustr, uno::Any(u"Inline Heading"_ustr)); // set anchoring because setting frame style doesn't modify the anchoring to // its default "anchored as character" setting - xFrameProps->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE), uno::Any(text::TextContentAnchorType_AS_CHARACTER)); + xFrame->setPropertyValue(getPropertyName(PROP_ANCHOR_TYPE), uno::Any(text::TextContentAnchorType_AS_CHARACTER)); // tdf#164903 empty top and bottom margins to emulate the behaviour of style separators - uno::Reference<container::XEnumerationAccess> xParaEnumAccess(xFrame, uno::UNO_QUERY); - if ( xParaEnumAccess.is() && !pParaContext->isSet(PROP_PARA_TOP_MARGIN) ) + if ( !pParaContext->isSet(PROP_PARA_TOP_MARGIN) ) { - uno::Reference<container::XEnumeration> xParaEnum = xParaEnumAccess->createEnumeration(); + rtl::Reference<SwXParagraphEnumeration> xParaEnum = xFrame->createSwEnumeration(); if ( xParaEnum.is() ) { uno::Reference<beans::XPropertySet> xParaProps(xParaEnum->nextElement(), uno::UNO_QUERY); @@ -3636,7 +3635,7 @@ void DomainMapper_Impl::appendTextContent( SAL_WARN_IF(m_aTextAppendStack.empty(), "writerfilter.dmapper", "no text append stack"); if (m_aTextAppendStack.empty()) return; - uno::Reference< text::XTextAppendAndConvert > xTextAppendAndConvert( m_aTextAppendStack.top().xTextAppend, uno::UNO_QUERY ); + rtl::Reference< SwXText > xTextAppendAndConvert = dynamic_cast<SwXText*>( m_aTextAppendStack.top().xTextAppend.get() ); OSL_ENSURE( xTextAppendAndConvert.is(), "trying to append a text content without XTextAppendAndConvert" ); if (!xTextAppendAndConvert.is() || !hasTableManager() || getTableManager().isIgnore()) return; @@ -4040,8 +4039,8 @@ void DomainMapper_Impl::ConvertHeaderFooterToTextFrame(bool bDynamicHeightTop, b { aFrameProperties.push_back(comphelper::makePropertyValue(getPropertyName(PROP_VERT_ORIENT), text::VertOrientation::BOTTOM)); } - uno::Reference<text::XTextAppendAndConvert> xBodyText(xRangeStart->getText(), uno::UNO_QUERY); - xBodyText->convertToTextFrame(xTextAppend, xRangeEnd, comphelper::containerToSequence(aFrameProperties)); + rtl::Reference<SwXText> xBodyText = dynamic_cast<SwXText*>(xRangeStart->getText().get()); + xBodyText->convertToSwTextFrame(xTextAppend, xRangeEnd, aFrameProperties); } m_aHeaderFooterTextAppendStack.pop(); } @@ -6169,9 +6168,11 @@ void DomainMapper_Impl::PushTextBoxContent() { rtl::Reference<SwXTextFrame> xTBoxFrame(m_xTextDocument->createTextFrame()); xTBoxFrame->setName("textbox" + OUString::number(m_xPendingTextBoxFrames.size() + 1)); - uno::Reference<text::XTextAppendAndConvert>(m_aTextAppendStack.top().xTextAppend, - uno::UNO_QUERY_THROW) - ->appendTextContent(static_cast<SwXFrame*>(xTBoxFrame.get()), beans::PropertyValues()); + rtl::Reference<SwXText> xText = dynamic_cast<SwXText*>(m_aTextAppendStack.top().xTextAppend.get()); + assert(xText); + if (!xText) + return; + xText->appendTextContent(static_cast<SwXFrame*>(xTBoxFrame.get()), beans::PropertyValues()); m_xPendingTextBoxFrames.push(xTBoxFrame); m_aTextAppendStack.push(TextAppendContext(xTBoxFrame, {})); @@ -9869,18 +9870,17 @@ void DomainMapper_Impl::ExecuteFrameConversion() std::vector<sal_Int32> redPos, redLen; try { - uno::Reference< text::XTextAppendAndConvert > xTextAppendAndConvert( GetTopTextAppend(), uno::UNO_QUERY_THROW ); + rtl::Reference< SwXText > xTextAppendAndConvert = dynamic_cast<SwXText*>( GetTopTextAppend().get() ); // convert redline ranges to cursor movement and character length sal_Int32 redIdx; lcl_CopyRedlines(GetTopTextAppend(), m_aStoredRedlines[StoredRedlines::FRAME], redPos, redLen, redIdx); - const uno::Reference< text::XTextContent > xTextContent = xTextAppendAndConvert->convertToTextFrame( + const rtl::Reference< SwXTextFrame > xTextContent = xTextAppendAndConvert->convertToSwTextFrame( m_xFrameStartRange, m_xFrameEndRange, - comphelper::containerToSequence(m_aFrameProperties) ); + m_aFrameProperties ); - uno::Reference< text::XText > xDest( xTextContent, uno::UNO_QUERY_THROW ); - lcl_PasteRedlines(xDest, m_aStoredRedlines[StoredRedlines::FRAME], redPos, redLen, redIdx); + lcl_PasteRedlines(xTextContent, m_aStoredRedlines[StoredRedlines::FRAME], redPos, redLen, redIdx); } catch( const uno::Exception&) { diff --git a/sw/source/writerfilter/dmapper/TableManager.cxx b/sw/source/writerfilter/dmapper/TableManager.cxx index 8d3dc62b4d16..903cf9151e36 100644 --- a/sw/source/writerfilter/dmapper/TableManager.cxx +++ b/sw/source/writerfilter/dmapper/TableManager.cxx @@ -29,6 +29,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/diagnose_ex.hxx> #include <com/sun/star/text/TableColumnSeparator.hpp> +#include <unoparagraph.hxx> using namespace com::sun::star; @@ -406,8 +407,8 @@ void TableManager::HandleSmallerRows() // if (bIsDiffRowWidth) { - uno::Reference<text::XTextAppendAndConvert> xTextAppendAndConvert( - mpTableDataHandler->getDomainMapperImpl().GetTopTextAppend(), uno::UNO_QUERY); + rtl::Reference<SwXText> xTextAppendAndConvert = dynamic_cast<SwXText*>( + mpTableDataHandler->getDomainMapperImpl().GetTopTextAppend().get()); for (unsigned int nRow = 0; nRow < nRows; ++nRow) { @@ -420,17 +421,18 @@ void TableManager::HandleSmallerRows() = pRowData->getCellEnd(pRowData->getCellCount() - 1); std::vector<beans::PropertyValue> aProperties; //TODO: is there a simpler way to create a new paragraph behind the current cell and get that range back? - uno::Reference<text::XTextRange> xNewCellTextRange - = xTextAppendAndConvert->finishParagraphInsert( + rtl::Reference<SwXParagraph> xNewCellTextRange + = xTextAppendAndConvert->finishSwParagraphInsert( comphelper::containerToSequence(aProperties), xTextRange); - uno::Reference<text::XTextCursor> xNewCellTextCursor - = xTextAppendAndConvert->createTextCursorByRange(xNewCellTextRange); + rtl::Reference<SwXTextCursor> xNewCellTextCursor + = xTextAppendAndConvert->createXTextCursorByRange(xNewCellTextRange); xNewCellTextCursor->collapseToEnd(); xNewCellTextCursor->goRight(1, false); TablePropertyMapPtr pCellPropMap(new TablePropertyMap); - pRowData->addCell(xNewCellTextCursor, pCellPropMap); - pRowData->endCell(xNewCellTextCursor); + pRowData->addCell(static_cast<text::XSentenceCursor*>(xNewCellTextCursor.get()), + pCellPropMap); + pRowData->endCell(static_cast<text::XSentenceCursor*>(xNewCellTextCursor.get())); pRowData->getProperties()->setValue(TablePropertyMap::TABLE_WIDTH, nMaxRowWidth); // tdf#166953 the TableColumnSeparators property needs another // separator for the extra cell added to it commit d616561e0d2c32b4fd08a5db25a4aa6d93da9374 Author: Noel Grandin <[email protected]> AuthorDate: Tue Feb 10 18:48:39 2026 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Wed Feb 11 07:15:34 2026 +0100 use more concrete SwXText class Change-Id: I94e9642eee47b58b54ff28edab01f41929fc72ff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/199089 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 0bdfc8c265e7..f6aab1f38065 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -79,7 +79,7 @@ private: 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 94ecd2f80be2..3c24441c4fd5 100644 --- a/sw/inc/unotbl.hxx +++ b/sw/inc/unotbl.hxx @@ -75,7 +75,7 @@ class SW_DLLPUBLIC SwXCell final : public SwXCellBaseClass, // 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 869d844232f0..9eb9df37217f 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2236,7 +2236,7 @@ uno::Any SwXFrame::getPropertyValue(const OUString& rPropertyName) 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 70534192f5ec..13b4c5224d6b 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1275,7 +1275,7 @@ SwXTextRange::CreateXTextRange( 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 74071584654d..a48f53fbbc44 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1067,7 +1067,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName) 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 9a4dff318e53..121430651da7 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -920,7 +920,7 @@ Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSear 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); @@ -942,7 +942,7 @@ Reference< XInterface > SwXTextDocument::findNext(const Reference< XInterface > 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 a7cdf44e8d75..f0f43bd0fc46 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1287,7 +1287,6 @@ sal_Bool SwXTextViewCursor::screenUp() uno::Reference< text::XText > SwXTextViewCursor::getText() { SolarMutexGuard aGuard; - uno::Reference< text::XText > xRet; if(!m_pView) throw uno::RuntimeException(); @@ -1297,7 +1296,7 @@ uno::Reference< text::XText > SwXTextViewCursor::getText() 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; }
