diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2024-08-03 19:15:34 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-08-04 08:43:07 +0200 |
commit | f13e5718f53c3e460a6aacdb8f429d18ac011fa3 (patch) | |
tree | 406ab2b7c8760b0ab191ebe4ad4c0c2ea4a3687a /sw/inc | |
parent | 4cad11120687b5dcb6812e88a03712686ff78333 (diff) |
use more concrete UNO type in writerfilter
Change-Id: Idf3fd445994e0b42cffc173ed68475398d74cdd2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171447
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/unostyle.hxx | 65 | ||||
-rw-r--r-- | sw/inc/unotxdoc.hxx | 1 |
2 files changed, 65 insertions, 1 deletions
diff --git a/sw/inc/unostyle.hxx b/sw/inc/unostyle.hxx index 77c2cc8856c0..b6f4d9abd96b 100644 --- a/sw/inc/unostyle.hxx +++ b/sw/inc/unostyle.hxx @@ -48,6 +48,8 @@ class SwXStyle; class SwXTextCellStyle; class SwXPageStyle; class SwXFrameStyle; +class StyleFamilyEntry; +class SwXStyleFamily; class SwXStyleFamilies final : public cppu::WeakImplHelper < @@ -60,7 +62,7 @@ class SwXStyleFamilies final : public cppu::WeakImplHelper { SwDocShell* m_pDocShell; - std::map<SfxStyleFamily, css::uno::Reference<css::container::XNameContainer>> m_vFamilies; + std::map<SfxStyleFamily, rtl::Reference<SwXStyleFamily>> m_vFamilies; virtual ~SwXStyleFamilies() override; public: @@ -88,6 +90,12 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + SW_DLLPUBLIC rtl::Reference<SwXStyleFamily> GetPageStyles(); + SW_DLLPUBLIC rtl::Reference<SwXStyleFamily> GetCharacterStyles(); + SW_DLLPUBLIC rtl::Reference<SwXStyleFamily> GetParagraphStyles(); + rtl::Reference<SwXStyleFamily> GetStylesByName(const OUString& rName); + rtl::Reference<SwXStyleFamily> GetStylesByIndex(sal_Int32 nIndex); + static css::uno::Reference<css::style::XStyle> CreateStyle(SfxStyleFamily eFamily, SwDoc& rDoc); static rtl::Reference<SwXStyle> CreateStyleCharOrParaOrPseudo(SfxStyleFamily eFamily, SwDoc& rDoc); static rtl::Reference<SwXPageStyle> CreateStylePage(SwDoc& rDoc); @@ -390,4 +398,59 @@ class SwXTextCellStyle final : public cppu::WeakImplHelper static rtl::Reference<SwXTextCellStyle> CreateXTextCellStyle(SwDocShell* pDocShell, const OUString& sName); }; +class SW_DLLPUBLIC SwXStyleFamily final : public cppu::WeakImplHelper +< + css::container::XNameContainer, + css::lang::XServiceInfo, + css::container::XIndexAccess, + css::beans::XPropertySet +> +, public SfxListener +{ + const StyleFamilyEntry& m_rEntry; + SfxStyleSheetBasePool* m_pBasePool; + SwDocShell* m_pDocShell; + + SwXStyle* FindStyle(std::u16string_view rStyleName) const; + sal_Int32 GetCountOrName(OUString* pString, sal_Int32 nIndex = SAL_MAX_INT32); + static const StyleFamilyEntry& InitEntry(SfxStyleFamily eFamily); +public: + SwXStyleFamily(SwDocShell* pDocShell, const SfxStyleFamily eFamily); + + //XIndexAccess + virtual sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override; + + //XElementAccess + virtual css::uno::Type SAL_CALL getElementType( ) override; + virtual sal_Bool SAL_CALL hasElements( ) override; + + //XNameAccess + virtual css::uno::Any SAL_CALL getByName(const OUString& Name) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; + virtual sal_Bool SAL_CALL hasByName(const OUString& Name) override; + + //XNameContainer + virtual void SAL_CALL insertByName(const OUString& Name, const css::uno::Any& Element) override; + virtual void SAL_CALL replaceByName(const OUString& Name, const css::uno::Any& Element) override; + virtual void SAL_CALL removeByName(const OUString& Name) override; + + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + virtual void SAL_CALL setPropertyValue( const OUString&, const css::uno::Any&) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString&, const css::uno::Reference<css::beans::XPropertyChangeListener>&) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString&, const css::uno::Reference<css::beans::XPropertyChangeListener>&) override; + virtual void SAL_CALL addVetoableChangeListener(const OUString&, const css::uno::Reference<css::beans::XVetoableChangeListener>&) override; + virtual void SAL_CALL removeVetoableChangeListener(const OUString&, const css::uno::Reference<css::beans::XVetoableChangeListener>&) override; + + //SfxListener + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; + + //XServiceInfo + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx index 38d67effb9ff..b3a308f37761 100644 --- a/sw/inc/unotxdoc.hxx +++ b/sw/inc/unotxdoc.hxx @@ -538,6 +538,7 @@ public: rtl::Reference<SwXFootnote> createEndnote(); rtl::Reference<SwXTextEmbeddedObject> createTextEmbeddedObject(); rtl::Reference<SvXMLEmbeddedObjectHelper> createEmbeddedObjectResolver(); + rtl::Reference< SwXStyleFamilies > getSwStyleFamilies(); }; class SwXLinkTargetSupplier final : public cppu::WeakImplHelper |