/src/libreoffice/sc/inc/afmtuno.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 | | |
20 | | #pragma once |
21 | | |
22 | | #include <rtl/ref.hxx> |
23 | | #include <svl/itemprop.hxx> |
24 | | #include <com/sun/star/lang/XServiceInfo.hpp> |
25 | | #include <com/sun/star/container/XIndexAccess.hpp> |
26 | | #include <com/sun/star/container/XEnumerationAccess.hpp> |
27 | | #include <com/sun/star/container/XNameContainer.hpp> |
28 | | #include <com/sun/star/container/XNamed.hpp> |
29 | | #include <com/sun/star/beans/XPropertySet.hpp> |
30 | | #include <cppuhelper/implbase.hxx> |
31 | | |
32 | | #include <climits> |
33 | | |
34 | | class ScAutoFormatFieldObj; |
35 | | class ScAutoFormatObj; |
36 | | |
37 | 0 | #define SC_AFMTOBJ_INVALID USHRT_MAX |
38 | | |
39 | | class ScAutoFormatsObj final : public ::cppu::WeakImplHelper< |
40 | | css::container::XNameContainer, |
41 | | css::container::XEnumerationAccess, |
42 | | css::container::XIndexAccess, |
43 | | css::lang::XServiceInfo > |
44 | | { |
45 | | private: |
46 | | static rtl::Reference<ScAutoFormatObj> GetObjectByIndex_Impl(sal_uInt16 nIndex); |
47 | | static rtl::Reference<ScAutoFormatObj> GetObjectByName_Impl(std::u16string_view aName); |
48 | | |
49 | | public: |
50 | | ScAutoFormatsObj(); |
51 | | virtual ~ScAutoFormatsObj() override; |
52 | | |
53 | | // XNameContainer |
54 | | virtual void SAL_CALL insertByName( const OUString& aName, |
55 | | const css::uno::Any& aElement ) override; |
56 | | virtual void SAL_CALL removeByName( const OUString& Name ) override; |
57 | | |
58 | | // XNameReplace |
59 | | virtual void SAL_CALL replaceByName( const OUString& aName, |
60 | | const css::uno::Any& aElement ) override; |
61 | | |
62 | | // XNameAccess |
63 | | virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; |
64 | | virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override; |
65 | | virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; |
66 | | |
67 | | // XElementAccess |
68 | | virtual css::uno::Type SAL_CALL getElementType() override; |
69 | | virtual sal_Bool SAL_CALL hasElements() override; |
70 | | |
71 | | // XEnumerationAccess |
72 | | virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL |
73 | | createEnumeration() override; |
74 | | |
75 | | // XIndexAccess |
76 | | virtual sal_Int32 SAL_CALL getCount() override; |
77 | | virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; |
78 | | |
79 | | // XServiceInfo |
80 | | virtual OUString SAL_CALL getImplementationName() override; |
81 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
82 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
83 | | }; |
84 | | |
85 | | class ScAutoFormatObj final : public ::cppu::WeakImplHelper< |
86 | | css::container::XIndexAccess, |
87 | | css::container::XEnumerationAccess, |
88 | | css::container::XNamed, |
89 | | css::beans::XPropertySet, |
90 | | css::lang::XServiceInfo > |
91 | | { |
92 | | private: |
93 | | SfxItemPropertySet aPropSet; |
94 | | sal_uInt16 nFormatIndex; |
95 | | |
96 | | rtl::Reference<ScAutoFormatFieldObj> GetObjectByIndex_Impl(sal_uInt16 nIndex); |
97 | | |
98 | | public: |
99 | | ScAutoFormatObj(sal_uInt16 nIndex); |
100 | | virtual ~ScAutoFormatObj() override; |
101 | | |
102 | | // called via getImplementation: |
103 | 0 | bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; } |
104 | | void InitFormat( sal_uInt16 nNewIndex ); |
105 | | |
106 | | // XIndexAccess |
107 | | virtual sal_Int32 SAL_CALL getCount() override; |
108 | | virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override; |
109 | | |
110 | | // XElementAccess |
111 | | virtual css::uno::Type SAL_CALL getElementType() override; |
112 | | virtual sal_Bool SAL_CALL hasElements() override; |
113 | | |
114 | | // XEnumerationAccess |
115 | | virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL |
116 | | createEnumeration() override; |
117 | | |
118 | | // XNamed |
119 | | virtual OUString SAL_CALL getName() override; |
120 | | virtual void SAL_CALL setName( const OUString& aName ) override; |
121 | | |
122 | | // XPropertySet |
123 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > |
124 | | SAL_CALL getPropertySetInfo() override; |
125 | | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, |
126 | | const css::uno::Any& aValue ) override; |
127 | | virtual css::uno::Any SAL_CALL getPropertyValue( |
128 | | const OUString& PropertyName ) override; |
129 | | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, |
130 | | const css::uno::Reference< |
131 | | css::beans::XPropertyChangeListener >& xListener ) override; |
132 | | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, |
133 | | const css::uno::Reference< |
134 | | css::beans::XPropertyChangeListener >& aListener ) override; |
135 | | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, |
136 | | const css::uno::Reference< |
137 | | css::beans::XVetoableChangeListener >& aListener ) override; |
138 | | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, |
139 | | const css::uno::Reference< |
140 | | css::beans::XVetoableChangeListener >& aListener ) override; |
141 | | |
142 | | // XServiceInfo |
143 | | virtual OUString SAL_CALL getImplementationName() override; |
144 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
145 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
146 | | }; |
147 | | |
148 | | class ScAutoFormatFieldObj final : public ::cppu::WeakImplHelper< |
149 | | css::beans::XPropertySet, |
150 | | css::lang::XServiceInfo > |
151 | | { |
152 | | private: |
153 | | SfxItemPropertySet aPropSet; |
154 | | sal_uInt16 nFormatIndex; |
155 | | sal_uInt16 nFieldIndex; |
156 | | |
157 | | public: |
158 | | ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField); |
159 | | virtual ~ScAutoFormatFieldObj() override; |
160 | | |
161 | | // XPropertySet |
162 | | virtual css::uno::Reference< css::beans::XPropertySetInfo > |
163 | | SAL_CALL getPropertySetInfo() override; |
164 | | virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, |
165 | | const css::uno::Any& aValue ) override; |
166 | | virtual css::uno::Any SAL_CALL getPropertyValue( |
167 | | const OUString& PropertyName ) override; |
168 | | virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, |
169 | | const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; |
170 | | virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, |
171 | | const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; |
172 | | virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, |
173 | | const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
174 | | virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, |
175 | | const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; |
176 | | |
177 | | // XServiceInfo |
178 | | virtual OUString SAL_CALL getImplementationName() override; |
179 | | virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
180 | | virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
181 | | }; |
182 | | |
183 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |