sw/source/core/access/AccessibilityIssue.cxx | 12 ++---- sw/source/core/access/acccell.cxx | 8 +--- sw/source/core/access/acccontext.cxx | 3 - sw/source/core/access/accmap.cxx | 2 - sw/source/core/access/accpara.cxx | 4 +- sw/source/core/crsr/bookmark.cxx | 2 - sw/source/core/doc/docnew.cxx | 5 +- sw/source/core/doc/rdfhelper.cxx | 18 ++++----- sw/source/core/edit/edfcol.cxx | 37 ++++++++----------- sw/source/core/fields/docufld.cxx | 3 - sw/source/core/layout/atrfrm.cxx | 4 +- sw/source/core/text/porlay.cxx | 8 +--- sw/source/core/txtnode/ndtxt.cxx | 2 - sw/source/core/unocore/unobkm.cxx | 4 +- sw/source/core/unocore/unocoll.cxx | 28 ++++++-------- sw/source/core/unocore/unocrsrhelper.cxx | 36 +++++++++--------- sw/source/core/unocore/unofield.cxx | 10 ++--- sw/source/core/unocore/unoidx.cxx | 22 +++++------ sw/source/core/unocore/unoobj.cxx | 2 - sw/source/core/unocore/unoparagraph.cxx | 2 - sw/source/core/unocore/unoportenum.cxx | 12 +++--- sw/source/core/unocore/unosect.cxx | 10 ++--- sw/source/core/unocore/unostyle.cxx | 4 +- sw/source/ui/vba/vbacontentcontrol.cxx | 2 - sw/source/ui/vba/vbaheaderfooterhelper.cxx | 7 +-- sw/source/ui/vba/vbasections.cxx | 5 +- sw/source/ui/vba/vbaselection.cxx | 2 - sw/source/ui/vba/vbatables.cxx | 3 - sw/source/uibase/dbui/dbmgr.cxx | 2 - sw/source/uibase/uno/unotxdoc.cxx | 7 +-- sw/source/uibase/uno/unotxvw.cxx | 4 +- sw/source/writerfilter/dmapper/DomainMapper.cxx | 2 - sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx | 2 - 33 files changed, 124 insertions(+), 150 deletions(-)
New commits: commit 347a437dc6d854d9ab92503cc18b1e8bf803d358 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 20 12:43:49 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Thu Feb 20 15:51:38 2025 +0100 use more concrete UNO types in some local vars found by a clang plugin I created. Change-Id: I109cf2ebd48e39a626c975da2199bf25edc3bb27 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181933 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/sw/source/core/access/AccessibilityIssue.cxx b/sw/source/core/access/AccessibilityIssue.cxx index 2aabb968bb0a..c561995b37b1 100644 --- a/sw/source/core/access/AccessibilityIssue.cxx +++ b/sw/source/core/access/AccessibilityIssue.cxx @@ -343,16 +343,12 @@ void AccessibilityIssue::quickFixIssue() const SwContentNode* pContentNode = m_pNode->GetContentNode(); SwPosition aStart(*pContentNode, m_nStart); SwPosition aEnd(*pContentNode, m_nEnd); - uno::Reference<text::XTextRange> xRun + rtl::Reference<SwXTextRange> xRun = SwXTextRange::CreateXTextRange(*m_pDoc, aStart, &aEnd); - if (xRun.is()) + if (xRun.is() + && xRun->getPropertySetInfo()->hasPropertyByName(u"HyperLinkName"_ustr)) { - uno::Reference<beans::XPropertySet> xProperties(xRun, uno::UNO_QUERY); - if (xProperties->getPropertySetInfo()->hasPropertyByName(u"HyperLinkName"_ustr)) - { - xProperties->setPropertyValue(u"HyperLinkName"_ustr, - uno::Any(aNameDialog->GetName())); - } + xRun->setPropertyValue(u"HyperLinkName"_ustr, uno::Any(aNameDialog->GetName())); } pWrtShell->SetModified(); } diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index 2ce7b0302ea7..2f8d16e28710 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -107,13 +107,11 @@ SwAccessibleCell::SwAccessibleCell(std::shared_ptr<SwAccessibleMap> const& pInit m_bIsSelected = IsSelected(); - css::uno::Reference<css::accessibility::XAccessible> xTableReference( + rtl::Reference<SwAccessibleContext> xTableReference( getAccessibleParentImpl()); - css::uno::Reference<css::accessibility::XAccessibleContext> xContextTable( - xTableReference, css::uno::UNO_QUERY); SAL_WARN_IF( - (!xContextTable.is() - || xContextTable->getAccessibleRole() != AccessibleRole::TABLE), + (!xTableReference.is() + || xTableReference->getAccessibleRole() != AccessibleRole::TABLE), "sw.a11y", "bad accessible context"); m_pAccTable = static_cast<SwAccessibleTable *>(xTableReference.get()); } diff --git a/sw/source/core/access/acccontext.cxx b/sw/source/core/access/acccontext.cxx index d7430e31dbaa..2d48a12f4067 100644 --- a/sw/source/core/access/acccontext.cxx +++ b/sw/source/core/access/acccontext.cxx @@ -1025,8 +1025,7 @@ void SwAccessibleContext::DisposeShape( const SdrObject *pObj, AccessibleEventObject aEvent; aEvent.EventId = AccessibleEventId::CHILD; - uno::Reference< XAccessible > xAcc( xAccImpl ); - aEvent.OldValue <<= xAcc; + aEvent.OldValue <<= uno::Reference< XAccessible >( xAccImpl ); aEvent.IndexHint = -1; FireAccessibleEvent( aEvent ); diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index d84028ced857..4fb40faee662 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1761,7 +1761,7 @@ uno::Reference<XAccessible> SwAccessibleMap::GetDocumentPreview( mpPreview.reset( new SwAccPreviewData() ); mpPreview->Update( *this, _rPreviewPages, _rScale, _pSelectedPageFrame, _rPreviewWinSize ); - uno::Reference<XAccessible> xAcc = GetDocumentView_( true ); + rtl::Reference<SwAccessibleContext> xAcc = GetDocumentView_( true ); return xAcc; } diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 36c7fff36ac4..87bff9aaad8b 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -3396,7 +3396,7 @@ sal_Int16 SAL_CALL SwAccessibleParagraph::getAccessibleRole() //Get the real heading level, Heading1 ~ Heading10 sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel() { - uno::Reference< css::beans::XPropertySet > xPortion = CreateUnoPortion( 0, 0 ); + rtl::Reference< SwXTextPortion > xPortion = CreateUnoPortion( 0, 0 ); uno::Any styleAny = xPortion->getPropertyValue( u"ParaStyleName"_ustr ); OUString sValue; if (styleAny >>= sValue) @@ -3417,7 +3417,7 @@ sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel() bool SwAccessibleParagraph::IsBlockQuote() { - uno::Reference<css::beans::XPropertySet> xPortion = CreateUnoPortion(0, 0); + rtl::Reference<SwXTextPortion> xPortion = CreateUnoPortion(0, 0); uno::Any aStyleAny = xPortion->getPropertyValue(u"ParaStyleName"_ustr); OUString sValue; if (aStyleAny >>= sValue) diff --git a/sw/source/core/crsr/bookmark.cxx b/sw/source/core/crsr/bookmark.cxx index b25bdbe50e6b..47f855334635 100644 --- a/sw/source/core/crsr/bookmark.cxx +++ b/sw/source/core/crsr/bookmark.cxx @@ -517,7 +517,7 @@ namespace sw::mark uno::Reference< rdf::XMetadatable > Bookmark::MakeUnoObject() { SwDoc& rDoc( GetMarkPos().GetDoc() ); - const uno::Reference< rdf::XMetadatable> xMeta( + const rtl::Reference< SwXBookmark> xMeta( SwXBookmark::CreateXBookmark(rDoc, this) ); return xMeta; } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index f3b9e768557a..bbf2448b018b 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -167,10 +167,9 @@ bool SwDoc::StartGrammarChecking( bool bSkipStart ) if ( xGCIterator.is() ) { rtl::Reference< SwXTextDocument > xDoc = pDocShell->GetBaseModel(); - uno::Reference< text::XFlatParagraphIteratorProvider > xFPIP( xDoc ); // start automatic background checking if not active already - if ( xFPIP.is() && !xGCIterator->isProofreading( cppu::getXWeak(xDoc.get()) ) ) + if ( xDoc.is() && !xGCIterator->isProofreading( cppu::getXWeak(xDoc.get()) ) ) { bStarted = true; if ( !bSkipStart ) @@ -180,7 +179,7 @@ bool SwDoc::StartGrammarChecking( bool bSkipStart ) // again until the user modifies the document pLayout->SetNeedGrammarCheck(false); } - xGCIterator->startProofreading( cppu::getXWeak(xDoc.get()), xFPIP ); + xGCIterator->startProofreading( cppu::getXWeak(xDoc.get()), uno::Reference< text::XFlatParagraphIteratorProvider >(xDoc) ); } } } diff --git a/sw/source/core/doc/rdfhelper.cxx b/sw/source/core/doc/rdfhelper.cxx index aad999761445..ac83748ae877 100644 --- a/sw/source/core/doc/rdfhelper.cxx +++ b/sw/source/core/doc/rdfhelper.cxx @@ -168,20 +168,20 @@ void SwRDFHelper::clearStatements(const rtl::Reference<SwXTextDocument>& xModel, std::map<OUString, OUString> SwRDFHelper::getTextNodeStatements(const OUString& rType, SwTextNode& rTextNode) { - uno::Reference<rdf::XResource> xTextNode(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); + rtl::Reference<SwXParagraph> xTextNode(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); SwDocShell* pShell = rTextNode.GetDoc().GetDocShell(); if (!pShell) return std::map<OUString, OUString>(); - return getStatements(pShell->GetBaseModel(), rType, xTextNode); + return getStatements(pShell->GetBaseModel(), rType, uno::Reference<rdf::XResource>(xTextNode)); } void SwRDFHelper::addTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue) { - uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); + rtl::Reference<SwXParagraph> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); SwDocShell* pShell = rTextNode.GetDoc().GetDocShell(); if (!pShell) return; - addStatement(pShell->GetBaseModel(), rType, rPath, xSubject, rKey, rValue); + addStatement(pShell->GetBaseModel(), rType, rPath, uno::Reference<rdf::XResource>(xSubject), rKey, rValue); } void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTextNode, const OUString& rKey, const OUString& rValue) @@ -198,10 +198,10 @@ void SwRDFHelper::removeTextNodeStatement(const OUString& rType, SwTextNode& rTe const uno::Reference<rdf::XURI>& xGraphName = aGraphNames[0]; uno::Reference<rdf::XNamedGraph> xGraph = xModel->getRDFRepository()->getGraph(xGraphName); - uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); + rtl::Reference<SwXParagraph> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey); uno::Reference<rdf::XLiteral> xValue = rdf::Literal::create(xComponentContext, rValue); - xGraph->removeStatements(xSubject, xKey, xValue); + xGraph->removeStatements(uno::Reference<rdf::XResource>(xSubject), xKey, xValue); } void SwRDFHelper::updateTextNodeStatement(const OUString& rType, const OUString& rPath, SwTextNode& rTextNode, const OUString& rKey, const OUString& rOldValue, const OUString& rNewValue) @@ -225,19 +225,19 @@ void SwRDFHelper::updateTextNodeStatement(const OUString& rType, const OUString& } uno::Reference<rdf::XNamedGraph> xGraph = xModel->getRDFRepository()->getGraph(xGraphName); - uno::Reference<rdf::XResource> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); + rtl::Reference<SwXParagraph> xSubject(SwXParagraph::CreateXParagraph(rTextNode.GetDoc(), &rTextNode, nullptr)); uno::Reference<rdf::XURI> xKey = rdf::URI::create(xComponentContext, rKey); if (aGraphNames.hasElements()) { // Remove the old value. uno::Reference<rdf::XLiteral> xOldValue = rdf::Literal::create(xComponentContext, rOldValue); - xGraph->removeStatements(xSubject, xKey, xOldValue); + xGraph->removeStatements(uno::Reference<rdf::XResource>(xSubject), xKey, xOldValue); } // Now add it with new value. uno::Reference<rdf::XLiteral> xNewValue = rdf::Literal::create(xComponentContext, rNewValue); - xGraph->addStatement(xSubject, xKey, xNewValue); + xGraph->addStatement(uno::Reference<rdf::XResource>(xSubject), xKey, xNewValue); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 2a0271655893..257632379a30 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -453,8 +453,7 @@ uno::Reference<text::XTextField> lcl_InsertParagraphSignature(const rtl::Referen const OUString& signature, const OUString& usage) { - uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel); - auto xField = uno::Reference<text::XTextField>(xMultiServiceFactory->createInstance(MetadataFieldServiceName), uno::UNO_QUERY); + auto xField = uno::Reference<text::XTextField>(xModel->createInstance(MetadataFieldServiceName), uno::UNO_QUERY); // Add the signature at the end. xField->attach(xParagraph->getAnchor()->getEnd()); @@ -708,7 +707,7 @@ SwTextFormatColl& SwEditShell::GetTextFormatColl(sal_uInt16 nFormatColl) const return *((*(GetDoc()->GetTextFormatColls()))[nFormatColl]); } -static void insertFieldToDocument(uno::Reference<lang::XMultiServiceFactory> const & rxMultiServiceFactory, +static void insertFieldToDocument(rtl::Reference<SwXTextDocument> const & rxMultiServiceFactory, uno::Reference<text::XText> const & rxText, uno::Reference<text::XParagraphCursor> const & rxParagraphCursor, OUString const & rsKey) { @@ -795,8 +794,6 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes uno::Reference<container::XNameAccess> xStyleFamilies = xModel->getStyleFamilies(); uno::Reference<container::XNameAccess> xStyleFamily(xStyleFamilies->getByName(u"PageStyles"_ustr), uno::UNO_QUERY); - uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel); - uno::Reference<document::XDocumentProperties> xDocumentProperties = pObjSh->getDocProperties(); const OUString sPolicy = SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType()); @@ -888,16 +885,16 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes OUString sKey = aCreator.makeNumberedTextKey(); svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName); - insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); - insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); + insertFieldToDocument(xModel, xHeaderText, xHeaderParagraphCursor, sKey); + insertFieldToDocument(xModel, xFooterText, xFooterParagraphCursor, sKey); } break; case svx::ClassificationType::CATEGORY: { OUString sKey = aCreator.makeCategoryNameKey(); - insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); - insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); + insertFieldToDocument(xModel, xHeaderText, xHeaderParagraphCursor, sKey); + insertFieldToDocument(xModel, xFooterText, xFooterParagraphCursor, sKey); } break; @@ -905,8 +902,8 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes { OUString sKey = aCreator.makeNumberedMarkingKey(); svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName); - insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); - insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); + insertFieldToDocument(xModel, xHeaderText, xHeaderParagraphCursor, sKey); + insertFieldToDocument(xModel, xFooterText, xFooterParagraphCursor, sKey); } break; @@ -914,8 +911,8 @@ void SwEditShell::ApplyAdvancedClassification(std::vector<svx::ClassificationRes { OUString sKey = aCreator.makeNumberedIntellectualPropertyPartKey(); svx::classification::addOrInsertDocumentProperty(xPropertyContainer, sKey, rResult.msName); - insertFieldToDocument(xMultiServiceFactory, xHeaderText, xHeaderParagraphCursor, sKey); - insertFieldToDocument(xMultiServiceFactory, xFooterText, xFooterParagraphCursor, sKey); + insertFieldToDocument(xModel, xHeaderText, xHeaderParagraphCursor, sKey); + insertFieldToDocument(xModel, xFooterText, xFooterParagraphCursor, sKey); } break; @@ -1112,7 +1109,6 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli for (const OUString& rPageStyleName : aStyles) { uno::Reference<beans::XPropertySet> xPageStyle(xStyleFamily->getByName(rPageStyleName), uno::UNO_QUERY); - uno::Reference<lang::XMultiServiceFactory> xMultiServiceFactory(xModel); if (bHeaderIsNeeded || bWatermarkIsNeeded || bHadWatermark) { @@ -1131,7 +1127,7 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli if (!lcl_hasField(xHeaderText, DocInfoServiceName, Concat2View(SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCHEADER()))) { // Append a field to the end of the header text. - uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance(DocInfoServiceName), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xField(xModel->createInstance(DocInfoServiceName), uno::UNO_QUERY); xField->setPropertyValue(UNO_NAME_NAME, uno::Any(SfxClassificationHelper::PROP_PREFIX_INTELLECTUALPROPERTY() + SfxClassificationHelper::PROP_DOCHEADER())); uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY); xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, /*bAbsorb=*/false); @@ -1158,7 +1154,7 @@ void SwEditShell::SetClassification(const OUString& rName, SfxClassificationPoli if (!lcl_hasField(xFooterText, DocInfoServiceName, sFooter)) { // Append a field to the end of the footer text. - uno::Reference<beans::XPropertySet> xField(xMultiServiceFactory->createInstance(DocInfoServiceName), uno::UNO_QUERY); + uno::Reference<beans::XPropertySet> xField(xModel->createInstance(DocInfoServiceName), uno::UNO_QUERY); xField->setPropertyValue(UNO_NAME_NAME, uno::Any(sFooter)); uno::Reference<text::XTextContent> xTextContent(xField, uno::UNO_QUERY); xFooterText->insertTextContent(xFooterText->getEnd(), xTextContent, /*bAbsorb=*/false); @@ -1959,8 +1955,7 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures() try { - const css::uno::Reference<css::rdf::XResource> xSubject(xParagraph); - std::map<OUString, OUString> aParagraphStatements = SwRDFHelper::getStatements(xModel, aGraphNames, xSubject); + std::map<OUString, OUString> aParagraphStatements = SwRDFHelper::getStatements(xModel, aGraphNames, xParagraph); auto it = aParagraphStatements.find(ParagraphClassificationFieldNamesRDFName); const OUString sFieldNames = (it != aParagraphStatements.end()) ? it->second : OUString(); @@ -1990,13 +1985,13 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures() } else if (aKeyCreator.isCategoryNameKey(sName)) { - const std::pair<OUString, OUString> pairAbbr = lcl_getRDF(xModel, xSubject, ParagraphClassificationAbbrRDFName); + const std::pair<OUString, OUString> pairAbbr = lcl_getRDF(xModel, uno::Reference<rdf::XResource>(xParagraph), ParagraphClassificationAbbrRDFName); const OUString sAbbreviatedName = (!pairAbbr.second.isEmpty() ? pairAbbr.second : sValue); aResults.emplace_back(svx::ClassificationType::CATEGORY, sValue, sAbbreviatedName, sBlank); } else if (aKeyCreator.isCategoryIdentifierKey(sName)) { - const std::pair<OUString, OUString> pairAbbr = lcl_getRDF(xModel, xSubject, ParagraphClassificationAbbrRDFName); + const std::pair<OUString, OUString> pairAbbr = lcl_getRDF(xModel, uno::Reference<rdf::XResource>(xParagraph), ParagraphClassificationAbbrRDFName); const OUString sAbbreviatedName = (!pairAbbr.second.isEmpty() ? pairAbbr.second : sValue); aResults.emplace_back(svx::ClassificationType::CATEGORY, sBlank, sAbbreviatedName, sValue); } @@ -2013,7 +2008,7 @@ void SwEditShell::RestoreMetadataFieldsAndValidateParagraphSignatures() } // Update classification based on results. - lcl_ApplyParagraphClassification(GetDoc(), xModel, xParagraph, xSubject, std::move(aResults)); + lcl_ApplyParagraphClassification(GetDoc(), xModel, xParagraph, xParagraph, std::move(aResults)); // Get Signatures std::map<OUString, SignatureDescr> aSignatures; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index e2c36d967962..fc9141f67f03 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -1919,8 +1919,7 @@ bool SwPostItField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const else m_xTextObject->SetString( m_sText ); - uno::Reference < text::XText > xText( m_xTextObject ); - rAny <<= xText; + rAny <<= uno::Reference < text::XText >( m_xTextObject ); break; } case FIELD_PROP_DATE: diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 6b438735c810..034a18fda12b 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -1803,9 +1803,9 @@ bool SwFormatAnchor::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const SwFrameFormat* pFormat = m_oContentAnchor->GetNode().GetFlyFormat(); if(pFormat) { - uno::Reference<text::XTextFrame> const xRet( + rtl::Reference<SwXTextFrame> const xRet( SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat)); - rVal <<= xRet; + rVal <<= uno::Reference<text::XTextFrame>(xRet); } } } diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 40b45ae691f5..2cce4dd4a44b 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -877,7 +877,6 @@ static Color getBookmarkColor(const SwTextNode& rNode, const sw::mark::Bookmark* SwDoc& rDoc = const_cast<SwDoc&>(rNode.GetDoc()); const rtl::Reference< SwXBookmark > xRef = SwXBookmark::CreateXBookmark(rDoc, const_cast<sw::mark::MarkBase*>(static_cast<const sw::mark::MarkBase*>(pBookmark))); - const css::uno::Reference<css::rdf::XResource> xSubject(xRef); if (const SwDocShell* pShell = rDoc.GetDocShell()) { rtl::Reference<SwXTextDocument> xModel = pShell->GetBaseModel(); @@ -891,7 +890,7 @@ static Color getBookmarkColor(const SwTextNode& rNode, const sw::mark::Bookmark* const uno::Reference<rdf::XRepository> xRepository = xModel->getRDFRepository(); const uno::Reference<container::XEnumeration> xEnum( - xRepository->getStatements(xSubject, xODF_SHADING, nullptr), uno::UNO_SET_THROW); + xRepository->getStatements(css::uno::Reference<css::rdf::XResource>(xRef), xODF_SHADING, nullptr), uno::UNO_SET_THROW); rdf::Statement stmt; if ( xEnum->hasMoreElements() && (xEnum->nextElement() >>= stmt) ) @@ -919,7 +918,6 @@ static OUString getBookmarkType(const SwTextNode& rNode, const sw::mark::Bookmar SwDoc& rDoc = const_cast<SwDoc&>(rNode.GetDoc()); const rtl::Reference< SwXBookmark > xRef = SwXBookmark::CreateXBookmark(rDoc, const_cast<sw::mark::MarkBase*>(static_cast<const sw::mark::MarkBase*>(pBookmark))); - const css::uno::Reference<css::rdf::XResource> xSubject(xRef); if (const SwDocShell* pShell = rDoc.GetDocShell()) { rtl::Reference<SwXTextDocument> xModel = pShell->GetBaseModel(); @@ -930,12 +928,12 @@ static OUString getBookmarkType(const SwTextNode& rNode, const sw::mark::Bookmar static uno::Reference< rdf::XURI > xODF_PREFIX( rdf::URI::createKnown(xContext, rdf::URIs::RDF_TYPE), uno::UNO_SET_THROW); - uno::Reference<rdf::XDocumentMetadataAccess> xDocumentMetadataAccess( + rtl::Reference<SwXTextDocument> xDocumentMetadataAccess( pShell->GetBaseModel()); const uno::Reference<rdf::XRepository> xRepository = xDocumentMetadataAccess->getRDFRepository(); const uno::Reference<container::XEnumeration> xEnum( - xRepository->getStatements(xSubject, xODF_PREFIX, nullptr), uno::UNO_SET_THROW); + xRepository->getStatements(css::uno::Reference<css::rdf::XResource>(xRef), xODF_PREFIX, nullptr), uno::UNO_SET_THROW); rdf::Statement stmt; if ( xEnum->hasMoreElements() && (xEnum->nextElement() >>= stmt) ) diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 686a5ff15849..f62ef446fc15 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -5758,7 +5758,7 @@ void SwTextNode::SwClientNotify( const SwModify& rModify, const SfxHint& rHint ) uno::Reference< rdf::XMetadatable > SwTextNode::MakeUnoObject() { - const uno::Reference<rdf::XMetadatable> xMeta( + const rtl::Reference<SwXParagraph> xMeta( SwXParagraph::CreateXParagraph(GetDoc(), this, nullptr)); return xMeta; } diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index f37f2f13b2d5..6b9dea87fcd9 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -847,7 +847,7 @@ SwXFieldmark::getPresentation(sal_Bool const bShowCommand) } else { // also for ODF_FORMDATE, which shouldn't be a fieldmark... - uno::Reference<text::XTextRange> const xCommand(GetCommand(*pMark)); + rtl::Reference<SwXTextRange> const xCommand(GetCommand(*pMark)); return xCommand->getString(); } } @@ -861,7 +861,7 @@ SwXFieldmark::getPresentation(sal_Bool const bShowCommand) else { assert(!m_bReplacementObject); - uno::Reference<text::XTextRange> const xResult(GetResult(*pMark)); + rtl::Reference<SwXTextRange> const xResult(GetResult(*pMark)); return xResult->getString(); } } diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 041e6cc3d4df..342d2913f74a 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -869,10 +869,8 @@ sal_Int32 SwXTextTables::getCount() uno::Any SAL_CALL SwXTextTables::getByIndex(sal_Int32 nInputIndex) { - uno::Reference<XTextTable> xTable = getTextTableByIndex(nInputIndex); - uno::Any aRet; - aRet <<= xTable; - return aRet; + rtl::Reference<SwXTextTable> xTable = getTextTableByIndex(nInputIndex); + return uno::Any(uno::Reference<XTextTable>(xTable)); } rtl::Reference<SwXTextTable> SwXTextTables::getTextTableByIndex(sal_Int32 nInputIndex) @@ -1000,9 +998,9 @@ namespace { static uno::Any wrapFrame(SwFrameFormat & rFrameFormat) { - uno::Reference<text::XTextFrame> const xRet( + rtl::Reference<SwXTextFrame> const xRet( SwXTextFrame::CreateXTextFrame(*rFrameFormat.GetDoc(), &rFrameFormat)); - return uno::Any(xRet); + return uno::Any(uno::Reference<text::XTextFrame>(xRet)); } static bool filter(const SwNode* const pNode) { return !pNode->IsNoTextNode(); }; }; @@ -1012,9 +1010,9 @@ namespace { static uno::Any wrapFrame(SwFrameFormat & rFrameFormat) { - uno::Reference<text::XTextContent> const xRet( + rtl::Reference<SwXTextGraphicObject> const xRet( SwXTextGraphicObject::CreateXTextGraphicObject(*rFrameFormat.GetDoc(), &rFrameFormat)); - return uno::Any(xRet); + return uno::Any(uno::Reference<text::XTextContent>(xRet)); } static bool filter(const SwNode* const pNode) { return pNode->IsGrfNode(); }; }; @@ -1024,9 +1022,9 @@ namespace { static uno::Any wrapFrame(SwFrameFormat & rFrameFormat) { - uno::Reference<text::XTextContent> const xRet( + rtl::Reference<SwXTextEmbeddedObject> const xRet( SwXTextEmbeddedObject::CreateXTextEmbeddedObject(*rFrameFormat.GetDoc(), &rFrameFormat)); - return uno::Any(xRet); + return uno::Any(uno::Reference<text::XTextContent>(xRet)); } static bool filter(const SwNode* const pNode) { return pNode->IsOLENode(); }; }; @@ -1550,11 +1548,9 @@ uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex) { if (count == nIndex) { - uno::Any aRet; - const uno::Reference< text::XTextContent > xRef = + const rtl::Reference< SwXBookmark > xRef = SwXBookmark::CreateXBookmark(rDoc, *ppMark); - aRet <<= xRef; - return aRet; + return uno::Any(uno::Reference< text::XTextContent >(xRef)); } ++count; // only count real bookmarks } @@ -1573,9 +1569,9 @@ uno::Any SwXBookmarks::getByName(const OUString& rName) throw NoSuchElementException(); uno::Any aRet; - const uno::Reference< text::XTextContent > xRef = + const rtl::Reference< SwXBookmark > xRef = SwXBookmark::CreateXBookmark(rDoc, *ppBkmk); - aRet <<= xRef; + aRet <<= uno::Reference< text::XTextContent >(xRef); return aRet; } diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 55cd70f2d92f..0f5dff74d1c0 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -530,10 +530,10 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry { // hmm... can only return 1 here SwTOXMark & rMark = static_cast<SwTOXMark &>((*marks.begin())->GetAttr()); - const uno::Reference< text::XDocumentIndexMark > xRef = + const rtl::Reference< SwXDocumentIndexMark > xRef = SwXDocumentIndexMark::CreateXDocumentIndexMark( rPam.GetDoc(), &rMark); - (*pAny) <<= xRef; + (*pAny) <<= uno::Reference< text::XDocumentIndexMark >(xRef); } } else @@ -549,10 +549,10 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry { if( pAny ) { - const uno::Reference< text::XDocumentIndex > xRef = + const rtl::Reference< SwXDocumentIndex > xRef = SwXDocumentIndex::CreateXDocumentIndex(rPam.GetDoc(), static_cast<SwTOXBaseSection *>(pBase)); - (*pAny) <<= xRef; + (*pAny) <<= uno::Reference< text::XDocumentIndex >(xRef); } } else @@ -571,10 +571,10 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry { if( pAny ) { - uno::Reference<text::XTextField> const xField( + rtl::Reference<SwXTextField> const xField( SwXTextField::CreateXTextField(&rPam.GetDoc(), &pTextAttr->GetFormatField())); - *pAny <<= xField; + *pAny <<= uno::Reference<text::XTextField>(xField); } } else @@ -595,14 +595,14 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable(); if(FN_UNO_TEXT_TABLE == rEntry.nWID) { - uno::Reference< XTextTable > xTable = SwXTextTables::GetObject(*pTableFormat); - *pAny <<= xTable; + rtl::Reference< SwXTextTable > xTable = SwXTextTables::GetObject(*pTableFormat); + *pAny <<= uno::Reference< XTextTable >(xTable); } else { SwTableBox* pBox = pSttNode->GetTableBox(); - uno::Reference< XCell > xCell = SwXCell::CreateXCell(pTableFormat, pBox); - *pAny <<= xCell; + rtl::Reference< SwXCell > xCell = SwXCell::CreateXCell(pTableFormat, pBox); + *pAny <<= uno::Reference< XCell >(xCell); } } } @@ -621,9 +621,9 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry // Create a wrapper only for text frames, not for graphic or OLE nodes. if (pAny && !rPam.GetPointNode().IsNoTextNode()) { - uno::Reference<XTextFrame> const xFrame( + rtl::Reference<SwXTextFrame> const xFrame( SwXTextFrame::CreateXTextFrame(*pFormat->GetDoc(), pFormat)); - (*pAny) <<= xFrame; + (*pAny) <<= uno::Reference<XTextFrame>(xFrame); } } else @@ -652,8 +652,8 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry { if (pAny) { - uno::Reference<text::XTextContent> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode, nullptr); - *pAny <<= xParagraph; + rtl::Reference<SwXParagraph> xParagraph = SwXParagraph::CreateXParagraph(pTextNode->GetDoc(), pTextNode, nullptr); + *pAny <<= uno::Reference<text::XTextContent>(xParagraph); } } else @@ -685,10 +685,10 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry { if( pAny ) { - const uno::Reference< text::XFootnote > xFootnote = + const rtl::Reference< SwXFootnote > xFootnote = SwXFootnote::CreateXFootnote(rPam.GetDoc(), &const_cast<SwFormatFootnote&>(rFootnote)); - *pAny <<= xFootnote; + *pAny <<= uno::Reference< text::XFootnote >(xFootnote); } } else @@ -711,10 +711,10 @@ bool getCursorPropertyValue(const SfxItemPropertyMapEntry& rEntry if( pAny ) { // hmm... can only return 1 here const SwFormatRefMark& rRef = (*marks.begin())->GetRefMark(); - uno::Reference<XTextContent> const xRef = + rtl::Reference<SwXReferenceMark> const xRef = SwXReferenceMark::CreateXReferenceMark(rPam.GetDoc(), const_cast<SwFormatRefMark*>(&rRef)); - *pAny <<= xRef; + *pAny <<= uno::Reference<XTextContent>(xRef); } } else diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 047da46c30d3..da961728d8cc 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -552,7 +552,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL SwXFieldMaster::getPropertySetInfo() { SolarMutexGuard aGuard; - uno::Reference< beans::XPropertySetInfo > aRef = + rtl::Reference< SfxItemPropertySetInfo > aRef = aSwMapProvider.GetPropertySet( lcl_GetPropMapIdForFieldType(m_pImpl->m_nResTypeId))->getPropertySetInfo(); return aRef; @@ -1317,7 +1317,7 @@ SwXTextField::getTextFieldMaster() SwFieldType* pType = m_pImpl->GetFieldType(); if (!pType && !m_pImpl->m_pDoc) // tdf#152619 return nullptr; - uno::Reference<beans::XPropertySet> const xRet( + rtl::Reference<SwXFieldMaster> const xRet( SwXFieldMaster::CreateXFieldMaster(m_pImpl->m_pDoc, pType)); return xRet; } @@ -2141,7 +2141,7 @@ SwXTextField::getPropertySetInfo() } const SfxItemPropertySet* pPropSet = aSwMapProvider.GetPropertySet( lcl_GetPropertyMapOfService(m_pImpl->m_nServiceId)); - const uno::Reference<beans::XPropertySetInfo> xInfo = pPropSet->getPropertySetInfo(); + const rtl::Reference<SfxItemPropertySetInfo> xInfo = pPropSet->getPropertySetInfo(); // extend PropertySetInfo! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); aRef = new SfxExtItemPropertySetInfo( @@ -2423,8 +2423,8 @@ uno::Any SAL_CALL SwXTextField::getPropertyValue(const OUString& rPropertyName) = new SwTextAPIObject( std::make_unique<SwTextAPIEditSource>(m_pImpl->m_pDoc) ); } - uno::Reference<text::XText> xText(m_pImpl->m_xTextObject); - aRet <<= xText; + rtl::Reference<SwTextAPIObject> xText(m_pImpl->m_xTextObject); + aRet <<= uno::Reference<text::XText>(xText); break; } case FIELD_PROP_PAR1: diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index aa4f2d171c93..fe901fd6e62c 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -505,7 +505,7 @@ SwXDocumentIndex::getPropertySetInfo() { SolarMutexGuard g; - const uno::Reference< beans::XPropertySetInfo > xRef = + const rtl::Reference< SfxItemPropertySetInfo > xRef = m_pImpl->m_rPropSet.getPropertySetInfo(); return xRef; } @@ -905,9 +905,9 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) case WID_IDX_HEADER_SECTION : if(WID_IDX_CONTENT_SECTION == pEntry->nWID) { - const uno::Reference <text::XTextSection> xContentSect = + const rtl::Reference<SwXTextSection> xContentSect = SwXTextSection::CreateXTextSection( pSectionFormat ); - aRet <<= xContentSect; + aRet <<= uno::Reference <text::XTextSection>(xContentSect); } else if (pSectionFormat) { @@ -918,10 +918,10 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) { if(pSect->GetType() == SectionType::ToxHeader) { - const uno::Reference <text::XTextSection> xHeader = + const rtl::Reference<SwXTextSection> xHeader = SwXTextSection::CreateXTextSection( pSect->GetFormat() ); - aRet <<= xHeader; + aRet <<= uno::Reference <text::XTextSection>(xHeader); break; } } @@ -2028,7 +2028,7 @@ SwXDocumentIndexMark::getPropertySetInfo() } if(!xInfos[nPos].is()) { - const uno::Reference< beans::XPropertySetInfo > xInfo = + const rtl::Reference< SfxItemPropertySetInfo > xInfo = m_pImpl->m_rPropSet.getPropertySetInfo(); // extend PropertySetInfo! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); @@ -2369,11 +2369,11 @@ SwXDocumentIndexes::getByIndex(sal_Int32 nIndex) pSect->GetFormat()->GetSectionNode() && nIdx++ == nIndex ) { - const uno::Reference< text::XDocumentIndex > xTmp = + const rtl::Reference< SwXDocumentIndex > xTmp = SwXDocumentIndex::CreateXDocumentIndex( rDoc, static_cast<SwTOXBaseSection *>(pSect)); uno::Any aRet; - aRet <<= xTmp; + aRet <<= uno::Reference< text::XDocumentIndex >(xTmp); return aRet; } } @@ -2396,12 +2396,10 @@ SwXDocumentIndexes::getByName(const OUString& rName) (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName() == rName)) { - const uno::Reference< text::XDocumentIndex > xTmp = + const rtl::Reference< SwXDocumentIndex > xTmp = SwXDocumentIndex::CreateXDocumentIndex( rDoc, static_cast<SwTOXBaseSection *>(pSect)); - uno::Any aRet; - aRet <<= xTmp; - return aRet; + return uno::Any(uno::Reference< text::XDocumentIndex >(xTmp)); } } throw container::NoSuchElementException(); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 5047a2ddab86..99bc9fd8e7bf 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -2235,7 +2235,7 @@ SwXTextCursor::getPropertySetInfo() { UNO_NAME_IS_SKIP_PROTECTED_TEXT, FN_SKIP_PROTECTED_TEXT, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, { UNO_NAME_NO_FORMAT_ATTR, 0, cppu::UnoType<bool>::get(), PROPERTY_NONE, 0}, }; - const uno::Reference< beans::XPropertySetInfo > xInfo = + const rtl::Reference< SfxItemPropertySetInfo > xInfo = m_rPropSet.getPropertySetInfo(); // extend PropertySetInfo! const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties(); diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 9924a169785c..9696897e95e9 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -1352,7 +1352,7 @@ SwXParagraph::createContentEnumeration(const OUString& rServiceName) SwTextNode & rTextNode(GetTextNodeOrThrow()); SwPaM aPam( rTextNode ); - uno::Reference< container::XEnumeration > xRet = + rtl::Reference< SwXParaFrameEnumeration > xRet = SwXParaFrameEnumeration::Create(aPam, PARAFRAME_PORTION_PARAGRAPH); return xRet; } diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 7e84c1948768..13a50fde52f1 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -873,10 +873,10 @@ lcl_ExportHints( break; pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_FIELD); - Reference<XTextField> const xField = + rtl::Reference<SwXTextField> const xField = SwXTextField::CreateXTextField(&rDoc, &pAttr->GetFormatField()); - pPortion->SetTextField(xField); + pPortion->SetTextField(Reference<XTextField>(xField)); } break; @@ -898,10 +898,10 @@ lcl_ExportHints( else { pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_ANNOTATION ); - Reference<XTextField> xField = + rtl::Reference<SwXTextField> xField = SwXTextField::CreateXTextField(&rDoc, &pAttr->GetFormatField()); - pPortion->SetTextField(xField); + pPortion->SetTextField(Reference<XTextField>(xField)); } } break; @@ -915,10 +915,10 @@ lcl_ExportHints( if( *pUnoCursor->GetMark() == *pUnoCursor->GetPoint() ) break; pPortion = new SwXTextPortion( pUnoCursor, xParent, PORTION_FIELD); - Reference<XTextField> xField = + rtl::Reference<SwXTextField> xField = SwXTextField::CreateXTextField(&rDoc, &pAttr->GetFormatField()); - pPortion->SetTextField(xField); + pPortion->SetTextField(Reference<XTextField>(xField)); } break; diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 678efda2a7f6..0d0fc26765ce 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -236,9 +236,9 @@ SwXTextSection::getParentSection() SwSectionFormat & rSectionFormat( m_pImpl->GetSectionFormatOrThrow() ); SwSectionFormat *const pParentFormat = rSectionFormat.GetParent(); - const uno::Reference< text::XTextSection > xRet = - pParentFormat ? CreateXTextSection(pParentFormat) : nullptr; - return xRet; + if (!pParentFormat) + return nullptr; + return CreateXTextSection(pParentFormat); } uno::Sequence< uno::Reference< text::XTextSection > > SAL_CALL @@ -1099,10 +1099,10 @@ SwXTextSection::Impl::GetPropertyValues_Impl( if (pTOXBaseSect) { // convert section to TOXBase and get SwXDocumentIndex - const uno::Reference<text::XDocumentIndex> xIndex = + const rtl::Reference<SwXDocumentIndex> xIndex = SwXDocumentIndex::CreateXDocumentIndex( *pTOXBaseSect->GetFormat()->GetDoc(), pTOXBaseSect); - pRet[nProperty] <<= xIndex; + pRet[nProperty] <<= uno::Reference<text::XDocumentIndex>(xIndex); } // else: no enclosing index found -> empty return value } diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 1870c0b80d4a..d95e9eb200af 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -3369,9 +3369,9 @@ uno::Sequence<uno::Any> SwXPageStyle::GetPropertyValues_Impl(const uno::Sequence } else pFrameFormat = &pDesc->GetMaster(); - const uno::Reference<text::XText> xRet = lcl_makeHeaderFooter(nRes, nRes == RES_HEADER, pFrameFormat); + const rtl::Reference<SwXHeadFootText> xRet = lcl_makeHeaderFooter(nRes, nRes == RES_HEADER, pFrameFormat); if (xRet.is()) - aRetRange[nProp] <<= xRet; + aRetRange[nProp] <<= uno::Reference<text::XText>(xRet); } break; case FN_PARAM_FTN_INFO: diff --git a/sw/source/ui/vba/vbacontentcontrol.cxx b/sw/source/ui/vba/vbacontentcontrol.cxx index a127d80636d6..90c313422b49 100644 --- a/sw/source/ui/vba/vbacontentcontrol.cxx +++ b/sw/source/ui/vba/vbacontentcontrol.cxx @@ -556,7 +556,7 @@ uno::Reference<word::XRange> SwVbaContentControl::getRange() SwPosition aStart(*pTextNode, m_pCC->GetTextAttr()->GetStart() + 1); // Don't select the CH_TXTATR_BREAKWORD itself at the end. SwPosition aEnd(*pTextNode, *m_pCC->GetTextAttr()->End() - 1); - uno::Reference<text::XTextRange> xText( + rtl::Reference<SwXTextRange> xText( SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), aStart, &aEnd)); if (xText.is()) xRet = new SwVbaRange(mxParent, mxContext, mxTextDocument, xText->getStart(), diff --git a/sw/source/ui/vba/vbaheaderfooterhelper.cxx b/sw/source/ui/vba/vbaheaderfooterhelper.cxx index 0507d6b848ac..c5f2da855a40 100644 --- a/sw/source/ui/vba/vbaheaderfooterhelper.cxx +++ b/sw/source/ui/vba/vbaheaderfooterhelper.cxx @@ -116,10 +116,9 @@ bool HeaderFooterHelper::isFooter( const rtl::Reference< SwXTextDocument >& xMod return false; OUString aPropText = u"FooterText"_ustr; - uno::Reference< style::XStyle > xPageStyle = word::getCurrentPageStyle( xModel ); - uno::Reference< beans::XPropertySet > xPageProps( xPageStyle, uno::UNO_QUERY_THROW ); + rtl::Reference< SwXBaseStyle > xPageStyle = word::getCurrentPageStyle( xModel ); bool isShared = true; - xPageProps->getPropertyValue( u"FooterIsShared"_ustr ) >>= isShared; + xPageStyle->getPropertyValue( u"FooterIsShared"_ustr ) >>= isShared; if( !isShared ) { uno::Reference< text::XPageCursor > xPageCursor( word::getXTextViewCursor( xModel ), uno::UNO_QUERY_THROW ); @@ -129,7 +128,7 @@ bool HeaderFooterHelper::isFooter( const rtl::Reference< SwXTextDocument >& xMod aPropText = "FooterTextRight"; } - uno::Reference< text::XText > xFooterText( xPageProps->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); + uno::Reference< text::XText > xFooterText( xPageStyle->getPropertyValue( aPropText ), uno::UNO_QUERY_THROW ); uno::Reference< text::XTextRangeCompare > xTRC( xFooterText, uno::UNO_QUERY_THROW ); uno::Reference< text::XTextRange > xTR1( xCurrentText, uno::UNO_QUERY_THROW ); uno::Reference< text::XTextRange > xTR2( xFooterText, uno::UNO_QUERY_THROW ); diff --git a/sw/source/ui/vba/vbasections.cxx b/sw/source/ui/vba/vbasections.cxx index 75fd915aae08..62d4ee5076f5 100644 --- a/sw/source/ui/vba/vbasections.cxx +++ b/sw/source/ui/vba/vbasections.cxx @@ -99,9 +99,8 @@ public: { // Hacky implementation of Range.Sections, only support 1 section uno::Reference< beans::XPropertySet > xRangeProps( xTextRange, uno::UNO_QUERY_THROW ); - uno::Reference< style::XStyle > xStyle = word::getCurrentPageStyle( mxModel, xRangeProps ); - uno::Reference< beans::XPropertySet > xPageProps( xStyle, uno::UNO_QUERY_THROW ); - mxSections.push_back( xPageProps ); + rtl::Reference< SwXBaseStyle > xStyle = word::getCurrentPageStyle( mxModel, xRangeProps ); + mxSections.push_back( uno::Reference< beans::XPropertySet >(xStyle) ); } // XIndexAccess diff --git a/sw/source/ui/vba/vbaselection.cxx b/sw/source/ui/vba/vbaselection.cxx index db96bed0a99e..81c254487a56 100644 --- a/sw/source/ui/vba/vbaselection.cxx +++ b/sw/source/ui/vba/vbaselection.cxx @@ -815,7 +815,7 @@ SwVbaSelection::Tables( const uno::Any& aIndex ) SwFrameFormat* pFormat = pTTCursor->GetFrameFormat(); if ( pFormat ) { - uno::Reference< text::XTextTable > xTable = SwXTextTables::GetObject(*pFormat); + rtl::Reference< SwXTextTable > xTable = SwXTextTables::GetObject(*pFormat); uno::Reference< word::XTable > xVBATable = new SwVbaTable( mxParent, mxContext, mxModel, xTable ); aRet <<= xVBATable; } diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx index b49cb7dd0571..2dfa3f5099d1 100644 --- a/sw/source/ui/vba/vbatables.cxx +++ b/sw/source/ui/vba/vbatables.cxx @@ -89,8 +89,7 @@ public: { if ( Index < 0 || Index >= getCount() ) throw lang::IndexOutOfBoundsException(); - uno::Reference< text::XTextTable > xTable( mxTables[ Index ] ); - return uno::Any( xTable ); + return uno::Any( uno::Reference< text::XTextTable >( mxTables[ Index ] ) ); } // XElementAccess virtual uno::Type SAL_CALL getElementType( ) override { return cppu::UnoType<text::XTextTable>::get(); } diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index 022104934d8c..6ca34e8bca19 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -1500,7 +1500,7 @@ bool SwDBManager::MergeMailFiles(SwWrtShell* pSourceShell, } else { - uno::Reference< mail::XMailMessage > xMessage = lcl_CreateMailFromDoc( + rtl::Reference< SwMailMessage > xMessage = lcl_CreateMailFromDoc( rMergeDescriptor, sFileURL, sColumnData, sMailBodyMimeType, sMailEncoding, pStoreToFilter->GetMimeType() ); if( xMessage.is() ) diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index a2e08a20c85a..964a7983ee9d 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -882,8 +882,8 @@ Reference< XIndexAccess > auto pResultCursor(FindAny(xDesc, xCursor, true, nResult, xTmp)); if(!pResultCursor) throw RuntimeException(u"No result cursor"_ustr); - Reference< XIndexAccess > xRet = SwXTextRanges::Create( nResult ? &(*pResultCursor) : nullptr ); - return xRet; + rtl::Reference< SwXTextRanges > xRet = SwXTextRanges::Create( nResult ? &(*pResultCursor) : nullptr ); + return Reference< XIndexAccess >(xRet); } Reference< XInterface > SwXTextDocument::findFirst(const Reference< util::XSearchDescriptor > & xDesc) @@ -2220,8 +2220,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) case WID_DOC_FORBIDDEN_CHARS: { GetPropertyHelper(); - Reference<XForbiddenCharacters> xRet = mxPropertyHelper; - aAny <<= xRet; + aAny <<= Reference<XForbiddenCharacters>(mxPropertyHelper); } break; case WID_DOC_TWO_DIGIT_YEAR: diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 373be4bab8ab..1d4470d06990 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -283,8 +283,8 @@ uno::Any SwXTextView::getSelection() case ShellMode::TableListText: case ShellMode::Text : { - uno::Reference< container::XIndexAccess > xPos = SwXTextRanges::Create(rSh.GetCursor()); - aRef.set(xPos, uno::UNO_QUERY); + rtl::Reference< SwXTextRanges > xPos = SwXTextRanges::Create(rSh.GetCursor()); + aRef.set(uno::Reference< container::XIndexAccess >(xPos), uno::UNO_QUERY); } break; case ShellMode::Frame : diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index c8ee000c01e2..2e7bae42cbe1 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -2705,7 +2705,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) else if ( pSectionContext ) { FieldContextPtr pContext = m_pImpl->GetTopFieldContext(); - uno::Reference< beans::XPropertySet > xTOC = pContext->GetTOC(); + rtl::Reference< SwXSection > xTOC = pContext->GetTOC(); if( xTOC.is() ) { uno::Reference<text::XTextColumns> xTextColumns; diff --git a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx index 3ac573f160d8..aff98b7790f0 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper_Impl.cxx @@ -570,7 +570,7 @@ rtl::Reference<SwXDocumentSettings> const & DomainMapper_Impl::GetDocumentSettin void DomainMapper_Impl::SetDocumentSettingsProperty( const OUString& rPropName, const uno::Any& rValue ) { - uno::Reference< beans::XPropertySet > xSettings = GetDocumentSettings(); + rtl::Reference< SwXDocumentSettings > xSettings = GetDocumentSettings(); if( xSettings.is() ) { try