Coverage Report

Created: 2026-04-09 11:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sw/inc/unosett.hxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
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/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
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 .
18
 */
19
#ifndef INCLUDED_SW_INC_UNOSETT_HXX
20
#define INCLUDED_SW_INC_UNOSETT_HXX
21
22
#include <sal/config.h>
23
24
#include <string_view>
25
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"
34
#include "names.hxx"
35
36
class SwDoc;
37
class SwDocShell;
38
class SwNumRule;
39
class SwNumFormat;
40
class SfxItemPropertySet;
41
namespace com::sun::star::beans { struct PropertyValue; }
42
43
class SwXFootnoteProperties final : public cppu::WeakImplHelper
44
<
45
    css::beans::XPropertySet,
46
    css::lang::XServiceInfo
47
>
48
{
49
    SwDoc*                      m_pDoc;
50
    const SfxItemPropertySet*   m_pPropertySet;
51
52
    virtual ~SwXFootnoteProperties() override;
53
public:
54
    SwXFootnoteProperties(SwDoc* pDoc);
55
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;
64
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;
69
70
1.33k
    void            Invalidate() {m_pDoc = nullptr;}
71
};
72
73
class SwXEndnoteProperties final : public cppu::WeakImplHelper
74
<
75
    css::beans::XPropertySet,
76
    css::lang::XServiceInfo
77
>
78
{
79
    SwDoc*                      m_pDoc;
80
    const SfxItemPropertySet*   m_pPropertySet;
81
82
    virtual ~SwXEndnoteProperties() override;
83
public:
84
    SwXEndnoteProperties(SwDoc* pDoc);
85
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;
94
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;
99
100
1.36k
    void            Invalidate() {m_pDoc = nullptr;}
101
};
102
103
class SAL_DLLPUBLIC_RTTI SwXLineNumberingProperties final : public cppu::WeakImplHelper
104
<
105
    css::beans::XPropertySet,
106
    css::lang::XServiceInfo
107
>
108
{
109
    SwDoc*                      m_pDoc;
110
    const SfxItemPropertySet*   m_pPropertySet;
111
112
    virtual ~SwXLineNumberingProperties() override;
113
public:
114
    SwXLineNumberingProperties(SwDoc* pDoc);
115
116
    //XPropertySet
117
    virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) override;
118
    SW_DLLPUBLIC 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;
124
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;
129
130
1.22k
    void            Invalidate() {m_pDoc = nullptr;}
131
};
132
133
class SAL_DLLPUBLIC_RTTI SwXNumberingRules : public cppu::WeakImplHelper
134
<
135
    css::container::XIndexReplace,
136
    css::beans::XPropertySet,
137
    css::container::XNamed,
138
    css::lang::XServiceInfo
139
>
140
{
141
private:
142
    class Impl;
143
    ::sw::UnoImplPtr<Impl> m_pImpl;
144
145
    UIName                      m_sNewCharStyleNames[MAXLEVEL];
146
    UIName                      m_sNewBulletFontNames[MAXLEVEL];
147
    UIName                      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;
156
157
public:
158
    SwXNumberingRules(const SwNumRule& rRule, SwDoc* doc = nullptr); // NumRule for paragraphs, numbering styles
159
    SwXNumberingRules(SwDoc& rDoc); //create a new instance
160
161
    //XIndexReplace
162
    virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const css::uno::Any& Element ) override;
163
164
    //XIndexAccess
165
    virtual sal_Int32 SAL_CALL getCount(  ) override;
166
    virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override;
167
168
    //XElementAccess
169
    virtual css::uno::Type SAL_CALL getElementType(  ) override;
170
    virtual sal_Bool SAL_CALL hasElements(  ) override;
171
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;
180
181
    //XNamed
182
    virtual OUString SAL_CALL getName() override;
183
    virtual void SAL_CALL setName(const OUString& Name_) override;
184
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;
189
190
    SW_DLLPUBLIC css::uno::Sequence<css::beans::PropertyValue> getRuleByIndex(sal_Int32 nIndex);
191
192
    css::uno::Sequence< css::beans::PropertyValue>
193
            GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 nIndex)const;
194
    /// @throws css::uno::RuntimeException
195
    /// @throws css::lang::IllegalArgumentException
196
    void    SetNumberingRuleByIndex(SwNumRule& rNumRule,
197
                const css::uno::Sequence< css::beans::PropertyValue>& rProperties, sal_Int32 nIndex);
198
199
25.9k
    const UIName*           GetNewCharStyleNames() const {return m_sNewCharStyleNames;}
200
25.9k
    const UIName*           GetBulletFontNames() const {return m_sNewBulletFontNames;}
201
37.8k
    const SwNumRule*        GetNumRule() const {return m_pNumRule;}
202
203
    static bool             isInvalidStyle(const UIName& rName);
204
23.9k
    void    Invalidate()    {m_pDocShell = nullptr;}
205
58.5k
    const UIName&   GetCreatedNumRuleName() const {return m_sCreatedNumRuleName;}
206
207
    SW_DLLPUBLIC css::uno::Any getPropertyByIndex(sal_Int32 nIndex, const OUString& rPropName);
208
209
    static css::uno::Sequence<css::beans::PropertyValue> GetPropertiesForNumFormat(
210
            const SwNumFormat& rFormat, UIName const& rCharFormatName,
211
            ProgName const* pHeadingStyleName, OUString const & referer);
212
    static void SetPropertiesToNumFormat(
213
            SwNumFormat & aFormat,
214
            UIName & rCharStyleName,
215
            UIName *const pBulletFontName,
216
            UIName *const pHeadingStyleName,
217
            OUString *const pParagraphStyleName,
218
            SwDoc *const pDoc,
219
            SwDocShell *const pDocShell,
220
            css::uno::Sequence<css::beans::PropertyValue> const& rProperties);
221
222
private:
223
    css::uno::Any GetNumberingRuleByIndex(const SwNumRule& rNumRule, sal_Int32 nIndex, const OUString& rPropName) const;
224
    static css::uno::Any GetPropertyForNumFormat(
225
            const SwNumFormat& rFormat, UIName const& rCharFormatName,
226
            ProgName const* pHeadingStyleName, OUString const & referer, OUString const & rPropName);
227
};
228
229
class SwXChapterNumbering final : public SwXNumberingRules
230
{
231
232
    virtual ~SwXChapterNumbering() override;
233
public:
234
    SwXChapterNumbering(SwDocShell& rDocSh);
235
236
    using SwXNumberingRules::Invalidate;
237
238
    //XServiceInfo
239
    virtual OUString SAL_CALL getImplementationName() override;
240
    virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
241
    virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
242
243
};
244
245
#endif
246
247
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */