Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / inc / afmtuno.hxx
blob6919e180bf91fc1c9c5d3263bfff0b70e1f6f347
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 .
20 #ifndef INCLUDED_SC_INC_AFMTUNO_HXX
21 #define INCLUDED_SC_INC_AFMTUNO_HXX
23 #include <svl/lstner.hxx>
24 #include <svl/itemprop.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/container/XContainer.hpp>
27 #include <com/sun/star/container/XIndexContainer.hpp>
28 #include <com/sun/star/container/XNameReplace.hpp>
29 #include <com/sun/star/container/XContainerListener.hpp>
30 #include <com/sun/star/container/XSet.hpp>
31 #include <com/sun/star/container/ContainerEvent.hpp>
32 #include <com/sun/star/container/XIndexReplace.hpp>
33 #include <com/sun/star/container/XNameContainer.hpp>
34 #include <com/sun/star/container/XNamed.hpp>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/lang/XUnoTunnel.hpp>
37 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
38 #include <cppuhelper/implbase.hxx>
40 class ScAutoFormatFieldObj;
41 class ScAutoFormatObj;
43 #define SC_AFMTOBJ_INVALID USHRT_MAX
45 class ScAutoFormatsObj : public ::cppu::WeakImplHelper<
46 css::container::XNameContainer,
47 css::container::XEnumerationAccess,
48 css::container::XIndexAccess,
49 css::lang::XServiceInfo >
51 private:
52 static ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
53 static ScAutoFormatObj* GetObjectByName_Impl(const OUString& aName);
55 public:
56 ScAutoFormatsObj();
57 virtual ~ScAutoFormatsObj();
59 // XNameContainer
60 virtual void SAL_CALL insertByName( const OUString& aName,
61 const css::uno::Any& aElement )
62 throw(css::lang::IllegalArgumentException,
63 css::container::ElementExistException,
64 css::lang::WrappedTargetException,
65 css::uno::RuntimeException,
66 std::exception) override;
67 virtual void SAL_CALL removeByName( const OUString& Name )
68 throw(css::container::NoSuchElementException,
69 css::lang::WrappedTargetException,
70 css::uno::RuntimeException, std::exception) override;
72 // XNameReplace
73 virtual void SAL_CALL replaceByName( const OUString& aName,
74 const css::uno::Any& aElement )
75 throw(css::lang::IllegalArgumentException,
76 css::container::NoSuchElementException,
77 css::lang::WrappedTargetException,
78 css::uno::RuntimeException, std::exception) override;
80 // XNameAccess
81 virtual css::uno::Any SAL_CALL getByName( const OUString& aName )
82 throw(css::container::NoSuchElementException,
83 css::lang::WrappedTargetException,
84 css::uno::RuntimeException, std::exception) override;
85 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames()
86 throw(css::uno::RuntimeException, std::exception) override;
87 virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
88 throw(css::uno::RuntimeException, std::exception) override;
90 // XElementAccess
91 virtual css::uno::Type SAL_CALL getElementType()
92 throw(css::uno::RuntimeException, std::exception) override;
93 virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException, std::exception) override;
95 // XEnumerationAccess
96 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
97 createEnumeration() throw(css::uno::RuntimeException, std::exception) override;
99 // XIndexAccess
100 virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException, std::exception) override;
101 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
102 throw(css::lang::IndexOutOfBoundsException,
103 css::lang::WrappedTargetException,
104 css::uno::RuntimeException, std::exception) override;
106 // XServiceInfo
107 virtual OUString SAL_CALL getImplementationName()
108 throw(css::uno::RuntimeException, std::exception) override;
109 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
110 throw(css::uno::RuntimeException, std::exception) override;
111 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
112 throw(css::uno::RuntimeException, std::exception) override;
115 class ScAutoFormatObj : public ::cppu::WeakImplHelper<
116 css::container::XIndexAccess,
117 css::container::XEnumerationAccess,
118 css::container::XNamed,
119 css::beans::XPropertySet,
120 css::lang::XUnoTunnel,
121 css::lang::XServiceInfo >,
122 public SfxListener
124 private:
125 SfxItemPropertySet aPropSet;
126 sal_uInt16 nFormatIndex;
128 ScAutoFormatFieldObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
130 public:
131 ScAutoFormatObj(sal_uInt16 nIndex);
132 virtual ~ScAutoFormatObj();
134 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
136 // per getImplementation gerufen:
137 bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; }
138 void InitFormat( sal_uInt16 nNewIndex );
140 // XIndexAccess
141 virtual sal_Int32 SAL_CALL getCount() throw(css::uno::RuntimeException, std::exception) override;
142 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index )
143 throw(css::lang::IndexOutOfBoundsException,
144 css::lang::WrappedTargetException,
145 css::uno::RuntimeException, std::exception) override;
147 // XElementAccess
148 virtual css::uno::Type SAL_CALL getElementType()
149 throw(css::uno::RuntimeException, std::exception) override;
150 virtual sal_Bool SAL_CALL hasElements() throw(css::uno::RuntimeException, std::exception) override;
152 // XEnumerationAccess
153 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
154 createEnumeration() throw(css::uno::RuntimeException, std::exception) override;
156 // XNamed
157 virtual OUString SAL_CALL getName() throw(css::uno::RuntimeException, std::exception) override;
158 virtual void SAL_CALL setName( const OUString& aName )
159 throw (css::uno::RuntimeException,
160 std::exception) override;
162 // XPropertySet
163 virtual css::uno::Reference< css::beans::XPropertySetInfo >
164 SAL_CALL getPropertySetInfo()
165 throw(css::uno::RuntimeException, std::exception) override;
166 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
167 const css::uno::Any& aValue )
168 throw(css::beans::UnknownPropertyException,
169 css::beans::PropertyVetoException,
170 css::lang::IllegalArgumentException,
171 css::lang::WrappedTargetException,
172 css::uno::RuntimeException, std::exception) override;
173 virtual css::uno::Any SAL_CALL getPropertyValue(
174 const OUString& PropertyName )
175 throw(css::beans::UnknownPropertyException,
176 css::lang::WrappedTargetException,
177 css::uno::RuntimeException, std::exception) override;
178 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
179 const css::uno::Reference<
180 css::beans::XPropertyChangeListener >& xListener )
181 throw(css::beans::UnknownPropertyException,
182 css::lang::WrappedTargetException,
183 css::uno::RuntimeException, std::exception) override;
184 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
185 const css::uno::Reference<
186 css::beans::XPropertyChangeListener >& aListener )
187 throw(css::beans::UnknownPropertyException,
188 css::lang::WrappedTargetException,
189 css::uno::RuntimeException, std::exception) override;
190 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
191 const css::uno::Reference<
192 css::beans::XVetoableChangeListener >& aListener )
193 throw(css::beans::UnknownPropertyException,
194 css::lang::WrappedTargetException,
195 css::uno::RuntimeException, std::exception) override;
196 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
197 const css::uno::Reference<
198 css::beans::XVetoableChangeListener >& aListener )
199 throw(css::beans::UnknownPropertyException,
200 css::lang::WrappedTargetException,
201 css::uno::RuntimeException, std::exception) override;
203 // XServiceInfo
204 virtual OUString SAL_CALL getImplementationName()
205 throw(css::uno::RuntimeException, std::exception) override;
206 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
207 throw(css::uno::RuntimeException, std::exception) override;
208 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
209 throw(css::uno::RuntimeException, std::exception) override;
211 // XUnoTunnel
212 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
213 sal_Int8 >& aIdentifier )
214 throw(css::uno::RuntimeException, std::exception) override;
216 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
217 static ScAutoFormatObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
220 class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper<
221 css::beans::XPropertySet,
222 css::lang::XServiceInfo >,
223 public SfxListener
225 private:
226 SfxItemPropertySet aPropSet;
227 sal_uInt16 nFormatIndex;
228 sal_uInt16 nFieldIndex;
230 public:
231 ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
232 virtual ~ScAutoFormatFieldObj();
234 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
236 // XPropertySet
237 virtual css::uno::Reference< css::beans::XPropertySetInfo >
238 SAL_CALL getPropertySetInfo()
239 throw(css::uno::RuntimeException, std::exception) override;
240 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
241 const css::uno::Any& aValue )
242 throw(css::beans::UnknownPropertyException,
243 css::beans::PropertyVetoException,
244 css::lang::IllegalArgumentException,
245 css::lang::WrappedTargetException,
246 css::uno::RuntimeException, std::exception) override;
247 virtual css::uno::Any SAL_CALL getPropertyValue(
248 const OUString& PropertyName )
249 throw(css::beans::UnknownPropertyException,
250 css::lang::WrappedTargetException,
251 css::uno::RuntimeException, std::exception) override;
252 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
253 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener )
254 throw(css::beans::UnknownPropertyException,
255 css::lang::WrappedTargetException,
256 css::uno::RuntimeException, std::exception) override;
257 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
258 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener )
259 throw(css::beans::UnknownPropertyException,
260 css::lang::WrappedTargetException,
261 css::uno::RuntimeException, std::exception) override;
262 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
263 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener )
264 throw(css::beans::UnknownPropertyException,
265 css::lang::WrappedTargetException,
266 css::uno::RuntimeException, std::exception) override;
267 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
268 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener )
269 throw(css::beans::UnknownPropertyException,
270 css::lang::WrappedTargetException,
271 css::uno::RuntimeException, std::exception) override;
273 // XServiceInfo
274 virtual OUString SAL_CALL getImplementationName()
275 throw(css::uno::RuntimeException, std::exception) override;
276 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
277 throw(css::uno::RuntimeException, std::exception) override;
278 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames()
279 throw(css::uno::RuntimeException, std::exception) override;
282 #endif
284 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */