Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / afmtuno.hxx
blob09172e84fa63d34f663da5c5bea13a0b633449f0
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/itemprop.hxx>
24 #include <com/sun/star/lang/XServiceInfo.hpp>
25 #include <com/sun/star/container/XNameReplace.hpp>
26 #include <com/sun/star/container/XSet.hpp>
27 #include <com/sun/star/container/XIndexReplace.hpp>
28 #include <com/sun/star/container/XNameContainer.hpp>
29 #include <com/sun/star/container/XNamed.hpp>
30 #include <com/sun/star/beans/XPropertySet.hpp>
31 #include <com/sun/star/lang/XUnoTunnel.hpp>
32 #include <cppuhelper/implbase.hxx>
34 class ScAutoFormatFieldObj;
35 class ScAutoFormatObj;
37 #define SC_AFMTOBJ_INVALID USHRT_MAX
39 class ScAutoFormatsObj : public ::cppu::WeakImplHelper<
40 css::container::XNameContainer,
41 css::container::XEnumerationAccess,
42 css::container::XIndexAccess,
43 css::lang::XServiceInfo >
45 private:
46 static ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
47 static ScAutoFormatObj* GetObjectByName_Impl(const OUString& aName);
49 public:
50 ScAutoFormatsObj();
51 virtual ~ScAutoFormatsObj() override;
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;
58 // XNameReplace
59 virtual void SAL_CALL replaceByName( const OUString& aName,
60 const css::uno::Any& aElement ) override;
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;
67 // XElementAccess
68 virtual css::uno::Type SAL_CALL getElementType() override;
69 virtual sal_Bool SAL_CALL hasElements() override;
71 // XEnumerationAccess
72 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
73 createEnumeration() override;
75 // XIndexAccess
76 virtual sal_Int32 SAL_CALL getCount() override;
77 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
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;
85 class ScAutoFormatObj : public ::cppu::WeakImplHelper<
86 css::container::XIndexAccess,
87 css::container::XEnumerationAccess,
88 css::container::XNamed,
89 css::beans::XPropertySet,
90 css::lang::XUnoTunnel,
91 css::lang::XServiceInfo >
93 private:
94 SfxItemPropertySet aPropSet;
95 sal_uInt16 nFormatIndex;
97 ScAutoFormatFieldObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
99 public:
100 ScAutoFormatObj(sal_uInt16 nIndex);
101 virtual ~ScAutoFormatObj() override;
103 // per getImplementation gerufen:
104 bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; }
105 void InitFormat( sal_uInt16 nNewIndex );
107 // XIndexAccess
108 virtual sal_Int32 SAL_CALL getCount() override;
109 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
111 // XElementAccess
112 virtual css::uno::Type SAL_CALL getElementType() override;
113 virtual sal_Bool SAL_CALL hasElements() override;
115 // XEnumerationAccess
116 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
117 createEnumeration() override;
119 // XNamed
120 virtual OUString SAL_CALL getName() override;
121 virtual void SAL_CALL setName( const OUString& aName ) override;
123 // XPropertySet
124 virtual css::uno::Reference< css::beans::XPropertySetInfo >
125 SAL_CALL getPropertySetInfo() override;
126 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
127 const css::uno::Any& aValue ) override;
128 virtual css::uno::Any SAL_CALL getPropertyValue(
129 const OUString& PropertyName ) override;
130 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
131 const css::uno::Reference<
132 css::beans::XPropertyChangeListener >& xListener ) override;
133 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
134 const css::uno::Reference<
135 css::beans::XPropertyChangeListener >& aListener ) override;
136 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
137 const css::uno::Reference<
138 css::beans::XVetoableChangeListener >& aListener ) override;
139 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
140 const css::uno::Reference<
141 css::beans::XVetoableChangeListener >& aListener ) override;
143 // XServiceInfo
144 virtual OUString SAL_CALL getImplementationName() override;
145 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
146 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
148 // XUnoTunnel
149 virtual sal_Int64 SAL_CALL getSomething( const css::uno::Sequence<
150 sal_Int8 >& aIdentifier ) override;
152 static const css::uno::Sequence<sal_Int8>& getUnoTunnelId();
153 static ScAutoFormatObj* getImplementation(const css::uno::Reference<css::uno::XInterface>& rObj);
156 class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper<
157 css::beans::XPropertySet,
158 css::lang::XServiceInfo >
160 private:
161 SfxItemPropertySet aPropSet;
162 sal_uInt16 nFormatIndex;
163 sal_uInt16 nFieldIndex;
165 public:
166 ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
167 virtual ~ScAutoFormatFieldObj() override;
169 // XPropertySet
170 virtual css::uno::Reference< css::beans::XPropertySetInfo >
171 SAL_CALL getPropertySetInfo() override;
172 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
173 const css::uno::Any& aValue ) override;
174 virtual css::uno::Any SAL_CALL getPropertyValue(
175 const OUString& PropertyName ) override;
176 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
177 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
178 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
179 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
180 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
181 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
182 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
183 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
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;
191 #endif
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */