1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/implbase2.hxx>
33 #include <cppuhelper/implbase4.hxx>
34 #include "unobaseclass.hxx"
41 class SfxItemPropertySet
;
42 namespace com::sun::star::beans
{ struct PropertyValue
; }
44 class SwXFootnoteProperties final
: public cppu::WeakAggImplHelper2
46 css::beans::XPropertySet
,
47 css::lang::XServiceInfo
51 const SfxItemPropertySet
* m_pPropertySet
;
53 virtual ~SwXFootnoteProperties() override
;
55 SwXFootnoteProperties(SwDoc
* pDoc
);
58 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
59 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
60 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
61 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
62 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
63 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
64 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
67 virtual OUString SAL_CALL
getImplementationName() override
;
68 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
69 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
71 void Invalidate() {m_pDoc
= nullptr;}
74 class SwXEndnoteProperties final
: public cppu::WeakAggImplHelper2
76 css::beans::XPropertySet
,
77 css::lang::XServiceInfo
81 const SfxItemPropertySet
* m_pPropertySet
;
83 virtual ~SwXEndnoteProperties() override
;
85 SwXEndnoteProperties(SwDoc
* pDoc
);
88 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
89 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
90 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
91 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
92 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
93 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
94 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
97 virtual OUString SAL_CALL
getImplementationName() override
;
98 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
99 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
101 void Invalidate() {m_pDoc
= nullptr;}
104 class SwXLineNumberingProperties final
: public cppu::WeakAggImplHelper2
106 css::beans::XPropertySet
,
107 css::lang::XServiceInfo
111 const SfxItemPropertySet
* m_pPropertySet
;
113 virtual ~SwXLineNumberingProperties() override
;
115 SwXLineNumberingProperties(SwDoc
* pDoc
);
118 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
119 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
120 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
121 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
122 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
123 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
124 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
127 virtual OUString SAL_CALL
getImplementationName() override
;
128 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
129 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
131 void Invalidate() {m_pDoc
= nullptr;}
134 class SwXNumberingRules
: public cppu::WeakAggImplHelper4
136 css::container::XIndexReplace
,
137 css::beans::XPropertySet
,
138 css::container::XNamed
,
139 css::lang::XServiceInfo
144 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
146 OUString m_sNewCharStyleNames
[MAXLEVEL
];
147 OUString m_sNewBulletFontNames
[MAXLEVEL
];
148 OUString m_sCreatedNumRuleName
; //connects to a numbering in SwDoc
149 SwDoc
* m_pDoc
; // Only if *not* used as chapter numbering.
150 SwDocShell
* m_pDocShell
; // Only if used as chapter numbering.
151 SwNumRule
* m_pNumRule
;
152 const SfxItemPropertySet
* m_pPropertySet
;
153 bool m_bOwnNumRuleCreated
;
155 SwXNumberingRules(SwDocShell
& rDocSh
); // chapter numbering
156 virtual ~SwXNumberingRules() override
;
159 SwXNumberingRules(const SwNumRule
& rRule
, SwDoc
* doc
= nullptr); // NumRule for paragraphs, numbering styles
160 SwXNumberingRules(SwDoc
& rDoc
); //create a new instance
163 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
166 virtual sal_Int32 SAL_CALL
getCount( ) override
;
167 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
170 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
171 virtual sal_Bool SAL_CALL
hasElements( ) override
;
174 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
175 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
176 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
177 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
178 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
179 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
180 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
183 virtual OUString SAL_CALL
getName() override
;
184 virtual void SAL_CALL
setName(const OUString
& Name_
) override
;
187 virtual OUString SAL_CALL
getImplementationName() override
;
188 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
189 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
191 css::uno::Sequence
< css::beans::PropertyValue
>
192 GetNumberingRuleByIndex(const SwNumRule
& rNumRule
, sal_Int32 nIndex
)const;
193 /// @throws css::uno::RuntimeException
194 /// @throws css::lang::IllegalArgumentException
195 void SetNumberingRuleByIndex(SwNumRule
& rNumRule
,
196 const css::uno::Sequence
< css::beans::PropertyValue
>& rProperties
, sal_Int32 nIndex
);
198 const OUString
* GetNewCharStyleNames() const {return m_sNewCharStyleNames
;}
199 const OUString
* GetBulletFontNames() const {return m_sNewBulletFontNames
;}
200 const SwNumRule
* GetNumRule() const {return m_pNumRule
;}
202 static bool isInvalidStyle(std::u16string_view rName
);
203 void Invalidate() {m_pDocShell
= nullptr;}
204 const OUString
& GetCreatedNumRuleName() const {return m_sCreatedNumRuleName
;}
206 static css::uno::Sequence
<css::beans::PropertyValue
> GetPropertiesForNumFormat(
207 const SwNumFormat
& rFormat
, OUString
const& rCharFormatName
,
208 OUString
const* pHeadingStyleName
, OUString
const & referer
);
209 static void SetPropertiesToNumFormat(
210 SwNumFormat
& aFormat
,
211 OUString
& rCharStyleName
,
212 OUString
*const pBulletFontName
,
213 OUString
*const pHeadingStyleName
,
214 OUString
*const pParagraphStyleName
,
216 SwDocShell
*const pDocShell
,
217 css::uno::Sequence
<css::beans::PropertyValue
> const& rProperties
);
221 class SwXChapterNumbering final
: public SwXNumberingRules
224 virtual ~SwXChapterNumbering() override
;
226 SwXChapterNumbering(SwDocShell
& rDocSh
);
228 using SwXNumberingRules::Invalidate
;
231 virtual OUString SAL_CALL
getImplementationName() override
;
232 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
233 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
239 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */