a11y: Simplify OCommonAccessibleComponent::getAccessibleIndexInParent
[LibreOffice.git] / sw / inc / unosett.hxx
blobf280e78c5a6d8aa7946073bb43dd7915cad007c2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_INC_UNOSETT_HXX
20 #define INCLUDED_SW_INC_UNOSETT_HXX
22 #include <sal/config.h>
24 #include <string_view>
26 #include "swtypes.hxx"
27 #include <com/sun/star/text/XTextColumns.hpp>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include <com/sun/star/container/XIndexReplace.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/container/XNamed.hpp>
32 #include <cppuhelper/implbase.hxx>
33 #include "unobaseclass.hxx"
35 class SwDoc;
36 class SwFormatCol;
37 class SwDocShell;
38 class SwNumRule;
39 class SwNumFormat;
40 class SfxItemPropertySet;
41 namespace com::sun::star::beans { struct PropertyValue; }
43 class SwXFootnoteProperties final : public cppu::WeakImplHelper
45 css::beans::XPropertySet,
46 css::lang::XServiceInfo
49 SwDoc* m_pDoc;
50 const SfxItemPropertySet* m_pPropertySet;
52 virtual ~SwXFootnoteProperties() override;
53 public:
54 SwXFootnoteProperties(SwDoc* pDoc);
56 //XPropertySet
57 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
58 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
59 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
60 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
61 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
62 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
63 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
65 //XServiceInfo
66 virtual OUString SAL_CALL getImplementationName() override;
67 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
68 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
70 void Invalidate() {m_pDoc = nullptr;}
73 class SwXEndnoteProperties final : public cppu::WeakImplHelper
75 css::beans::XPropertySet,
76 css::lang::XServiceInfo
79 SwDoc* m_pDoc;
80 const SfxItemPropertySet* m_pPropertySet;
82 virtual ~SwXEndnoteProperties() override;
83 public:
84 SwXEndnoteProperties(SwDoc* pDoc);
86 //XPropertySet
87 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
88 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
89 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
90 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
91 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
92 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
93 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
95 //XServiceInfo
96 virtual OUString SAL_CALL getImplementationName() override;
97 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
98 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
100 void Invalidate() {m_pDoc = nullptr;}
103 class SwXLineNumberingProperties final : public cppu::WeakImplHelper
105 css::beans::XPropertySet,
106 css::lang::XServiceInfo
109 SwDoc* m_pDoc;
110 const SfxItemPropertySet* m_pPropertySet;
112 virtual ~SwXLineNumberingProperties() override;
113 public:
114 SwXLineNumberingProperties(SwDoc* pDoc);
116 //XPropertySet
117 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
118 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
119 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
120 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
121 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
122 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
123 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
125 //XServiceInfo
126 virtual OUString SAL_CALL getImplementationName() override;
127 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
128 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
130 void Invalidate() {m_pDoc = nullptr;}
133 class SAL_DLLPUBLIC_RTTI SwXNumberingRules : public cppu::WeakImplHelper
135 css::container::XIndexReplace,
136 css::beans::XPropertySet,
137 css::container::XNamed,
138 css::lang::XServiceInfo
141 private:
142 class Impl;
143 ::sw::UnoImplPtr<Impl> m_pImpl;
145 OUString m_sNewCharStyleNames[MAXLEVEL];
146 OUString m_sNewBulletFontNames[MAXLEVEL];
147 OUString m_sCreatedNumRuleName; //connects to a numbering in SwDoc
148 SwDoc* m_pDoc; // Only if *not* used as chapter numbering.
149 SwDocShell* m_pDocShell; // Only if used as chapter numbering.
150 SwNumRule* m_pNumRule;
151 const SfxItemPropertySet* m_pPropertySet;
152 bool m_bOwnNumRuleCreated;
153 protected:
154 SwXNumberingRules(SwDocShell& rDocSh); // chapter numbering
155 virtual ~SwXNumberingRules() override;
157 public:
158 SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc = nullptr); // NumRule for paragraphs, numbering styles
159 SwXNumberingRules(SwDoc& rDoc); //create a new instance
161 //XIndexReplace
162 virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
164 //XIndexAccess
165 virtual sal_Int32 SAL_CALL getCount( ) override;
166 virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
168 //XElementAccess
169 virtual css::uno::Type SAL_CALL getElementType( ) override;
170 virtual sal_Bool SAL_CALL hasElements( ) override;
172 //XPropertySet
173 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
174 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
175 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
176 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
177 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
178 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
179 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
181 //XNamed
182 virtual OUString SAL_CALL getName() override;
183 virtual void SAL_CALL setName(const OUString& Name_) override;
185 //XServiceInfo
186 virtual OUString SAL_CALL getImplementationName() override;
187 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
188 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
190 css::uno::Sequence< css::beans::PropertyValue>
191 GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 nIndex)const;
192 /// @throws css::uno::RuntimeException
193 /// @throws css::lang::IllegalArgumentException
194 void SetNumberingRuleByIndex(SwNumRule& rNumRule,
195 const css::uno::Sequence< css::beans::PropertyValue>& rProperties, sal_Int32 nIndex);
197 const OUString* GetNewCharStyleNames() const {return m_sNewCharStyleNames;}
198 const OUString* GetBulletFontNames() const {return m_sNewBulletFontNames;}
199 const SwNumRule* GetNumRule() const {return m_pNumRule;}
201 static bool isInvalidStyle(std::u16string_view rName);
202 void Invalidate() {m_pDocShell = nullptr;}
203 const OUString& GetCreatedNumRuleName() const {return m_sCreatedNumRuleName;}
205 SW_DLLPUBLIC css::uno::Any getPropertyByIndex(sal_Int32 nIndex, const OUString& rPropName);
207 static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat(
208 const SwNumFormat& rFormat, OUString const& rCharFormatName,
209 OUString const* pHeadingStyleName, OUString const & referer);
210 static void SetPropertiesToNumFormat(
211 SwNumFormat & aFormat,
212 OUString & rCharStyleName,
213 OUString *const pBulletFontName,
214 OUString *const pHeadingStyleName,
215 OUString *const pParagraphStyleName,
216 SwDoc *const pDoc,
217 SwDocShell *const pDocShell,
218 css::uno::Sequence<css::beans::PropertyValue> const& rProperties);
220 private:
221 css::uno::Any GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 nIndex, const OUString& rPropName) const;
222 static css::uno::Any GetPropertyForNumFormat(
223 const SwNumFormat& rFormat, OUString const& rCharFormatName,
224 OUString const* pHeadingStyleName, OUString const & referer, OUString const & rPropName);
227 class SwXChapterNumbering final : public SwXNumberingRules
230 virtual ~SwXChapterNumbering() override;
231 public:
232 SwXChapterNumbering(SwDocShell& rDocSh);
234 using SwXNumberingRules::Invalidate;
236 //XServiceInfo
237 virtual OUString SAL_CALL getImplementationName() override;
238 virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
239 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
243 #endif
245 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */