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 "swtypes.hxx"
23 #include <com/sun/star/text/XTextColumns.hpp>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/lang/XUnoTunnel.hpp>
26 #include <com/sun/star/container/XIndexReplace.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/container/XNamed.hpp>
29 #include <com/sun/star/style/VerticalAlignment.hpp>
30 #include <cppuhelper/implbase2.hxx>
31 #include <cppuhelper/implbase4.hxx>
32 #include <cppuhelper/implbase5.hxx>
33 #include <tools/color.hxx>
34 #include "unobaseclass.hxx"
41 class SfxItemPropertySet
;
42 namespace com
{ namespace sun
{ namespace star
{ namespace 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::WeakAggImplHelper5
136 css::container::XIndexReplace
,
137 css::lang::XUnoTunnel
,
138 css::beans::XPropertySet
,
139 css::container::XNamed
,
140 css::lang::XServiceInfo
145 ::sw::UnoImplPtr
<Impl
> m_pImpl
;
147 OUString m_sNewCharStyleNames
[MAXLEVEL
];
148 OUString m_sNewBulletFontNames
[MAXLEVEL
];
149 OUString m_sCreatedNumRuleName
; //connects to a numbering in SwDoc
150 SwDoc
* m_pDoc
; // Only if *not* used as chapter numbering.
151 SwDocShell
* m_pDocShell
; // Only if used as chapter numbering.
152 SwNumRule
* m_pNumRule
;
153 const SfxItemPropertySet
* m_pPropertySet
;
154 bool const m_bOwnNumRuleCreated
;
156 SwXNumberingRules(SwDocShell
& rDocSh
); // chapter numbering
157 virtual ~SwXNumberingRules() override
;
160 SwXNumberingRules(const SwNumRule
& rRule
, SwDoc
* doc
= nullptr); // NumRule for paragraphs, numbering styles
161 SwXNumberingRules(SwDoc
& rDoc
); //create a new instance
163 static const css::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
165 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
168 virtual void SAL_CALL
replaceByIndex( sal_Int32 Index
, const css::uno::Any
& Element
) override
;
171 virtual sal_Int32 SAL_CALL
getCount( ) override
;
172 virtual css::uno::Any SAL_CALL
getByIndex(sal_Int32 nIndex
) override
;
175 virtual css::uno::Type SAL_CALL
getElementType( ) override
;
176 virtual sal_Bool SAL_CALL
hasElements( ) override
;
179 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
180 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
181 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
182 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
183 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
184 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
185 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
188 virtual OUString SAL_CALL
getName() override
;
189 virtual void SAL_CALL
setName(const OUString
& Name_
) override
;
192 virtual OUString SAL_CALL
getImplementationName() override
;
193 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
194 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
196 css::uno::Sequence
< css::beans::PropertyValue
>
197 GetNumberingRuleByIndex(const SwNumRule
& rNumRule
, sal_Int32 nIndex
)const;
198 /// @throws css::uno::RuntimeException
199 /// @throws css::lang::IllegalArgumentException
200 void SetNumberingRuleByIndex(SwNumRule
& rNumRule
,
201 const css::uno::Sequence
< css::beans::PropertyValue
>& rProperties
, sal_Int32 nIndex
);
203 const OUString
* GetNewCharStyleNames() const {return m_sNewCharStyleNames
;}
204 const OUString
* GetBulletFontNames() const {return m_sNewBulletFontNames
;}
205 const SwNumRule
* GetNumRule() const {return m_pNumRule
;}
207 static bool isInvalidStyle(const OUString
&rName
);
208 void Invalidate() {m_pDocShell
= nullptr;}
209 const OUString
& GetCreatedNumRuleName() const {return m_sCreatedNumRuleName
;}
211 static css::uno::Sequence
<css::beans::PropertyValue
> GetPropertiesForNumFormat(
212 const SwNumFormat
& rFormat
, OUString
const& rCharFormatName
,
213 OUString
const* pHeadingStyleName
, OUString
const & referer
);
214 static void SetPropertiesToNumFormat(
215 SwNumFormat
& aFormat
,
216 OUString
& rCharStyleName
,
217 OUString
*const pBulletFontName
,
218 OUString
*const pHeadingStyleName
,
219 OUString
*const pParagraphStyleName
,
221 SwDocShell
*const pDocShell
,
222 css::uno::Sequence
<css::beans::PropertyValue
> const& rProperties
);
226 class SwXChapterNumbering final
: public SwXNumberingRules
229 virtual ~SwXChapterNumbering() override
;
231 SwXChapterNumbering(SwDocShell
& rDocSh
);
233 using SwXNumberingRules::Invalidate
;
236 virtual OUString SAL_CALL
getImplementationName() override
;
237 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
238 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
242 class SwXTextColumns final
: public cppu::WeakAggImplHelper4
245 css::lang::XUnoTunnel
,
246 css::beans::XPropertySet
,
247 css::text::XTextColumns
,
248 css::lang::XServiceInfo
251 sal_Int32 m_nReference
;
252 css::uno::Sequence
< css::text::TextColumn
> m_aTextColumns
;
253 bool m_bIsAutomaticWidth
;
254 sal_Int32 m_nAutoDistance
;
256 const SfxItemPropertySet
* m_pPropSet
;
259 sal_Int32 m_nSepLineWidth
;
260 Color m_nSepLineColor
;
261 sal_Int8 m_nSepLineHeightRelative
;
262 css::style::VerticalAlignment m_nSepLineVertAlign
;
264 sal_Int8 m_nSepLineStyle
;
267 virtual ~SwXTextColumns() override
;
270 SwXTextColumns(const SwFormatCol
& rFormatCol
);
272 static const css::uno::Sequence
< sal_Int8
> & getUnoTunnelId();
275 virtual sal_Int64 SAL_CALL
getSomething( const css::uno::Sequence
< sal_Int8
>& aIdentifier
) override
;
278 virtual sal_Int32 SAL_CALL
getReferenceValue( ) override
;
279 virtual sal_Int16 SAL_CALL
getColumnCount( ) override
;
280 virtual void SAL_CALL
setColumnCount( sal_Int16 nColumns
) override
;
281 virtual css::uno::Sequence
< css::text::TextColumn
> SAL_CALL
getColumns( ) override
;
282 virtual void SAL_CALL
setColumns( const css::uno::Sequence
< css::text::TextColumn
>& Columns
) override
;
285 virtual css::uno::Reference
< css::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( ) override
;
286 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const css::uno::Any
& aValue
) override
;
287 virtual css::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
) override
;
288 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& xListener
) override
;
289 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const css::uno::Reference
< css::beans::XPropertyChangeListener
>& aListener
) override
;
290 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
291 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const css::uno::Reference
< css::beans::XVetoableChangeListener
>& aListener
) override
;
294 virtual OUString SAL_CALL
getImplementationName() override
;
295 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) override
;
296 virtual css::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() override
;
298 sal_Int32
GetSepLineWidth() const {return m_nSepLineWidth
;}
299 Color
GetSepLineColor() const {return m_nSepLineColor
;}
300 sal_Int8
GetSepLineHeightRelative() const {return m_nSepLineHeightRelative
;}
301 css::style::VerticalAlignment
GetSepLineVertAlign() const {return m_nSepLineVertAlign
;}
302 bool GetSepLineIsOn() const {return m_bSepLineIsOn
;}
303 sal_Int8
GetSepLineStyle() const {return m_nSepLineStyle
;}
305 bool IsAutomaticWidth() const {return m_bIsAutomaticWidth
;}
309 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */