solenv/clang-format/excludelist | 2 +- sw/inc/unobookmark.hxx | 4 ++-- sw/inc/unocoll.hxx | 2 ++ sw/inc/unosett.hxx | 2 +- sw/inc/unotxdoc.hxx | 2 ++ sw/source/core/inc/unoport.hxx | 2 +- sw/source/core/unocore/unocoll.cxx | 9 ++++++--- sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx | 12 +++++------- sw/source/uibase/uno/unotxdoc.cxx | 10 ++++++++++ sw/source/writerfilter/dmapper/DomainMapper.cxx | 3 ++- 10 files changed, 32 insertions(+), 16 deletions(-)
New commits: commit 43d46a62ab3badbb4a97c5488acbbb9bb3af0c63 Author: Noel Grandin <[email protected]> AuthorDate: Mon Dec 1 10:42:37 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Dec 1 17:04:55 2025 +0100 use more concrete UNO in UpdateTree Change-Id: I3e5b5a5ee86c214e107f19e323ead1154cb96457 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194859 Tested-by: Jenkins Reviewed-by: Noel Grandin <[email protected]> diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 38b28af52641..8081c827fc75 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -11859,6 +11859,7 @@ sw/inc/txtrfmrk.hxx sw/inc/txttxmrk.hxx sw/inc/undobj.hxx sw/inc/unobaseclass.hxx +sw/inc/unobookmark.hxx sw/inc/unochart.hxx sw/inc/unocoll.hxx sw/inc/unocrsr.hxx @@ -12261,7 +12262,6 @@ sw/source/core/inc/txtfly.hxx sw/source/core/inc/txtfrm.hxx sw/source/core/inc/txttypes.hxx sw/source/core/inc/undoflystrattr.hxx -sw/source/core/inc/unobookmark.hxx sw/source/core/inc/unofield.hxx sw/source/core/inc/unoflatpara.hxx sw/source/core/inc/unofldmid.h diff --git a/sw/source/core/inc/unobookmark.hxx b/sw/inc/unobookmark.hxx similarity index 99% rename from sw/source/core/inc/unobookmark.hxx rename to sw/inc/unobookmark.hxx index df39881562a8..041ca826ff09 100644 --- a/sw/source/core/inc/unobookmark.hxx +++ b/sw/inc/unobookmark.hxx @@ -31,8 +31,8 @@ #include <svl/listener.hxx> #include <sfx2/Metadatable.hxx> -#include <unobaseclass.hxx> -#include <IDocumentMarkAccess.hxx> +#include "unobaseclass.hxx" +#include "IDocumentMarkAccess.hxx" class SwDoc; class SwXTextRange; diff --git a/sw/inc/unocoll.hxx b/sw/inc/unocoll.hxx index 40ed1e61e776..c620f9e77fc4 100644 --- a/sw/inc/unocoll.hxx +++ b/sw/inc/unocoll.hxx @@ -41,6 +41,7 @@ struct SvEventDescription; class SwXFootnote; class SwXTextSection; class SwXTextTable; +class SwXBookmark; const SvEventDescription* sw_GetSupportedMacroItems(); @@ -427,6 +428,7 @@ class SwXBookmarks final : public SwCollectionBaseClass, virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + rtl::Reference<SwXBookmark> getBookmarkByIndex(sal_Int32 nIndex); }; class SwXNumberingRulesCollection final : public cppu::WeakImplHelper diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 38a6a71266a3..7e1d793694ae 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -556,6 +556,7 @@ public: rtl::Reference<SwXTextSections> getSwTextSections(); rtl::Reference<SwXChapterNumbering> getSwChapterNumberingRules(); rtl::Reference< SwXLineNumberingProperties > getSwLineNumberingProperties(); + rtl::Reference< SwXBookmarks > getSwBookmarks(); }; class SwXLinkTargetSupplier final : public cppu::WeakImplHelper diff --git a/sw/source/core/inc/unoport.hxx b/sw/source/core/inc/unoport.hxx index dd642c85e681..abec415e99e8 100644 --- a/sw/source/core/inc/unoport.hxx +++ b/sw/source/core/inc/unoport.hxx @@ -43,7 +43,7 @@ #include "unometa.hxx" #include "unocontentcontrol.hxx" #include "unolinebreak.hxx" -#include "unobookmark.hxx" +#include <unobookmark.hxx> namespace com::sun::star::beans { struct PropertyValue; } namespace com::sun::star::text { class XTextField; } diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 4789297bc8ce..cb2a04c8de0b 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -1535,6 +1535,11 @@ sal_Int32 SwXBookmarks::getCount() } uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex) +{ + return uno::Any(uno::Reference< text::XTextContent >(getBookmarkByIndex(nIndex))); +} + +rtl::Reference<SwXBookmark> SwXBookmarks::getBookmarkByIndex(sal_Int32 nIndex) { SolarMutexGuard aGuard; auto& rDoc = GetDoc(); @@ -1551,9 +1556,7 @@ uno::Any SwXBookmarks::getByIndex(sal_Int32 nIndex) { if (count == nIndex) { - const rtl::Reference< SwXBookmark > xRef = - SwXBookmark::CreateXBookmark(rDoc, *ppMark); - return uno::Any(uno::Reference< text::XTextContent >(xRef)); + return SwXBookmark::CreateXBookmark(rDoc, *ppMark); } ++count; // only count real bookmarks } diff --git a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx index 23747a064fd9..0a56541db974 100644 --- a/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx +++ b/sw/source/uibase/sidebar/WriterInspectorTextPanel.cxx @@ -49,6 +49,7 @@ #include <strings.hrc> #include <rdfhelper.hxx> #include <unotxdoc.hxx> +#include <unobookmark.hxx> namespace sw::sidebar { @@ -661,18 +662,15 @@ static void UpdateTree(SwDocShell& rDocSh, const SwEditShell& rEditSh, aParaNode.children.end()); // Parent style should be first then children // Collect bookmarks at character position - uno::Reference<container::XIndexAccess> xBookmarks(pSwTextDocument->getBookmarks(), - uno::UNO_QUERY); + rtl::Reference<SwXBookmarks> xBookmarks(pSwTextDocument->getSwBookmarks()); for (sal_Int32 i = 0; i < xBookmarks->getCount(); ++i) { svx::sidebar::TreeNode aCurNode; - uno::Reference<text::XTextContent> bookmark; - xBookmarks->getByIndex(i) >>= bookmark; - uno::Reference<container::XNamed> xBookmark(bookmark, uno::UNO_QUERY); + rtl::Reference<SwXBookmark> xBookmark = xBookmarks->getBookmarkByIndex(i); try { - uno::Reference<text::XTextRange> bookmarkRange = bookmark->getAnchor(); + uno::Reference<text::XTextRange> bookmarkRange = xBookmark->getAnchor(); uno::Reference<text::XTextRangeCompare> xTextRangeCompare(xRange->getText(), uno::UNO_QUERY); if (xTextRangeCompare.is() @@ -682,7 +680,7 @@ static void UpdateTree(SwDocShell& rDocSh, const SwEditShell& rEditSh, aCurNode.sNodeName = xBookmark->getName(); aCurNode.NodeType = svx::sidebar::TreeNode::ComplexProperty; - MetadataToTreeNode(xBookmark, aCurNode); + MetadataToTreeNode(cppu::getXWeak(xBookmark.get()), aCurNode); // show bookmark only if it has RDF metadata if (aCurNode.children.size() > 0) aBookmarksNode.children.push_back(std::move(aCurNode)); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 29ad750f6bfd..fec3025831e5 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1233,6 +1233,11 @@ Reference< XNameAccess > SwXTextDocument::getEmbeddedObjects() } Reference< XNameAccess > SwXTextDocument::getBookmarks() +{ + return getSwBookmarks(); +} + +rtl::Reference< SwXBookmarks > SwXTextDocument::getSwBookmarks() { SolarMutexGuard aGuard; ThrowIfInvalid(); commit ee0b78be5bdaf012228117254824aa7bd0ae99a9 Author: Noel Grandin <[email protected]> AuthorDate: Mon Dec 1 10:30:30 2025 +0200 Commit: Noel Grandin <[email protected]> CommitDate: Mon Dec 1 17:04:46 2025 +0100 use more concrete UNO in DomainMapper Change-Id: Ide73298c57df6c465d2fa64f883f112f621fe621 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194858 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Jenkins diff --git a/sw/inc/unosett.hxx b/sw/inc/unosett.hxx index daf20f125611..26b0d1aacd18 100644 --- a/sw/inc/unosett.hxx +++ b/sw/inc/unosett.hxx @@ -115,7 +115,7 @@ public: //XPropertySet virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; - virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + SW_DLLPUBLIC virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 53c9814f6ff1..38a6a71266a3 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -555,6 +555,7 @@ public: rtl::Reference<SwXTextFrames> getSwTextFrames(); rtl::Reference<SwXTextSections> getSwTextSections(); rtl::Reference<SwXChapterNumbering> getSwChapterNumberingRules(); + rtl::Reference< SwXLineNumberingProperties > getSwLineNumberingProperties(); }; class SwXLinkTargetSupplier final : public cppu::WeakImplHelper diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index cc9a3d1b22b3..29ad750f6bfd 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -590,6 +590,11 @@ void SwXTextDocument::removeEventListener(const Reference< lang::XEventListener } Reference< XPropertySet > SwXTextDocument::getLineNumberingProperties() +{ + return getSwLineNumberingProperties(); +} + +rtl::Reference< SwXLineNumberingProperties > SwXTextDocument::getSwLineNumberingProperties() { SolarMutexGuard aGuard; ThrowIfInvalid(); diff --git a/sw/source/writerfilter/dmapper/DomainMapper.cxx b/sw/source/writerfilter/dmapper/DomainMapper.cxx index 75068e656cfe..c9598ebad25f 100644 --- a/sw/source/writerfilter/dmapper/DomainMapper.cxx +++ b/sw/source/writerfilter/dmapper/DomainMapper.cxx @@ -95,6 +95,7 @@ #include <tools/UnitConversion.hxx> #include <unotxdoc.hxx> #include <unostyle.hxx> +#include <unosett.hxx> #include <SwXTextDefaults.hxx> using namespace ::com::sun::star; @@ -2764,7 +2765,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, const PropertyMapPtr& rContext ) //apply settings at XLineNumberingProperties try { - uno::Reference< beans::XPropertySet > xLineNumberingPropSet = m_pImpl->GetTextDocument()->getLineNumberingProperties(); + rtl::Reference< SwXLineNumberingProperties > xLineNumberingPropSet = m_pImpl->GetTextDocument()->getSwLineNumberingProperties(); if( aSettings.nInterval == 0 ) xLineNumberingPropSet->setPropertyValue(getPropertyName( PROP_IS_ON ), uno::Any(false) ); else
