LibreOffice Module sc (master)  1
afmtuno.hxx
Go to the documentation of this file.
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 #ifndef INCLUDED_SC_INC_AFMTUNO_HXX
21 #define INCLUDED_SC_INC_AFMTUNO_HXX
22 
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 <com/sun/star/lang/XUnoTunnel.hpp>
32 #include <cppuhelper/implbase.hxx>
33 
34 #include <climits>
35 
37 class ScAutoFormatObj;
38 
39 #define SC_AFMTOBJ_INVALID USHRT_MAX
40 
41 class ScAutoFormatsObj final : public ::cppu::WeakImplHelper<
42  css::container::XNameContainer,
43  css::container::XEnumerationAccess,
44  css::container::XIndexAccess,
45  css::lang::XServiceInfo >
46 {
47 private:
48  static ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
49  static ScAutoFormatObj* GetObjectByName_Impl(std::u16string_view aName);
50 
51 public:
53  virtual ~ScAutoFormatsObj() override;
54 
55  // XNameContainer
56  virtual void SAL_CALL insertByName( const OUString& aName,
57  const css::uno::Any& aElement ) override;
58  virtual void SAL_CALL removeByName( const OUString& Name ) override;
59 
60  // XNameReplace
61  virtual void SAL_CALL replaceByName( const OUString& aName,
62  const css::uno::Any& aElement ) override;
63 
64  // XNameAccess
65  virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
66  virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
67  virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
68 
69  // XElementAccess
70  virtual css::uno::Type SAL_CALL getElementType() override;
71  virtual sal_Bool SAL_CALL hasElements() override;
72 
73  // XEnumerationAccess
74  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
75  createEnumeration() override;
76 
77  // XIndexAccess
78  virtual sal_Int32 SAL_CALL getCount() override;
79  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
80 
81  // XServiceInfo
82  virtual OUString SAL_CALL getImplementationName() override;
83  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
84  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
85 };
86 
87 class ScAutoFormatObj : public ::cppu::WeakImplHelper<
88  css::container::XIndexAccess,
89  css::container::XEnumerationAccess,
90  css::container::XNamed,
91  css::beans::XPropertySet,
92  css::lang::XUnoTunnel,
93  css::lang::XServiceInfo >
94 {
95 private:
97  sal_uInt16 nFormatIndex;
98 
99  ScAutoFormatFieldObj* GetObjectByIndex_Impl(sal_uInt16 nIndex);
100 
101 public:
102  ScAutoFormatObj(sal_uInt16 nIndex);
103  virtual ~ScAutoFormatObj() override;
104 
105  // called via getImplementation:
106  bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; }
107  void InitFormat( sal_uInt16 nNewIndex );
108 
109  // XIndexAccess
110  virtual sal_Int32 SAL_CALL getCount() override;
111  virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
112 
113  // XElementAccess
114  virtual css::uno::Type SAL_CALL getElementType() override;
115  virtual sal_Bool SAL_CALL hasElements() override;
116 
117  // XEnumerationAccess
118  virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
119  createEnumeration() override;
120 
121  // XNamed
122  virtual OUString SAL_CALL getName() override;
123  virtual void SAL_CALL setName( const OUString& aName ) override;
124 
125  // XPropertySet
126  virtual css::uno::Reference< css::beans::XPropertySetInfo >
127  SAL_CALL getPropertySetInfo() override;
128  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
129  const css::uno::Any& aValue ) override;
130  virtual css::uno::Any SAL_CALL getPropertyValue(
131  const OUString& PropertyName ) override;
132  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
133  const css::uno::Reference<
134  css::beans::XPropertyChangeListener >& xListener ) override;
135  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
136  const css::uno::Reference<
137  css::beans::XPropertyChangeListener >& aListener ) override;
138  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
139  const css::uno::Reference<
140  css::beans::XVetoableChangeListener >& aListener ) override;
141  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
142  const css::uno::Reference<
143  css::beans::XVetoableChangeListener >& aListener ) override;
144 
145  // XServiceInfo
146  virtual OUString SAL_CALL getImplementationName() override;
147  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
148  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
149 
150  // XUnoTunnel
152 };
153 
154 class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper<
155  css::beans::XPropertySet,
156  css::lang::XServiceInfo >
157 {
158 private:
160  sal_uInt16 nFormatIndex;
161  sal_uInt16 nFieldIndex;
162 
163 public:
164  ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
165  virtual ~ScAutoFormatFieldObj() override;
166 
167  // XPropertySet
168  virtual css::uno::Reference< css::beans::XPropertySetInfo >
169  SAL_CALL getPropertySetInfo() override;
170  virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
171  const css::uno::Any& aValue ) override;
172  virtual css::uno::Any SAL_CALL getPropertyValue(
173  const OUString& PropertyName ) override;
174  virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
175  const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
176  virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
177  const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
178  virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
179  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
180  virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
181  const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
182 
183  // XServiceInfo
184  virtual OUString SAL_CALL getImplementationName() override;
185  virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
186  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
187 };
188 
189 #endif
190 
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_Int32 nIndex
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: afmtuno.cxx:277
ScAutoFormatObj(sal_uInt16 nIndex)
Definition: afmtuno.cxx:332
virtual sal_Bool SAL_CALL hasElements() override
Definition: afmtuno.cxx:410
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: afmtuno.cxx:506
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString Name
virtual sal_Int32 SAL_CALL getCount() override
Definition: afmtuno.cxx:383
static ScAutoFormatObj * GetObjectByName_Impl(std::u16string_view aName)
Definition: afmtuno.cxx:176
#define UNO3_GETIMPLEMENTATION_DECL(classname)
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: afmtuno.cxx:665
virtual OUString SAL_CALL getImplementationName() override
sal_uInt16 nFormatIndex
Definition: afmtuno.hxx:160
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: afmtuno.cxx:557
sal_uInt16 nFieldIndex
Definition: afmtuno.hxx:161
static ScAutoFormatObj * GetObjectByIndex_Impl(sal_uInt16 nIndex)
Definition: afmtuno.cxx:168
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: afmtuno.cxx:309
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: afmtuno.cxx:564
SfxItemPropertySet aPropSet
Definition: afmtuno.hxx:96
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: afmtuno.cxx:468
ScAutoFormatFieldObj * GetObjectByIndex_Impl(sal_uInt16 nIndex)
Definition: afmtuno.cxx:365
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: afmtuno.cxx:475
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual ~ScAutoFormatsObj() override
Definition: afmtuno.cxx:154
unsigned char sal_Bool
bool IsInserted() const
Definition: afmtuno.hxx:106
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual ~ScAutoFormatObj() override
Definition: afmtuno.cxx:338
virtual ~ScAutoFormatFieldObj() override
Definition: afmtuno.cxx:551
virtual sal_Int32 SAL_CALL getCount() override
Definition: afmtuno.cxx:271
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: afmtuno.cxx:244
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Type SAL_CALL getElementType() override
Definition: afmtuno.cxx:286
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL setName(const OUString &aName) override
Definition: afmtuno.cxx:428
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
void InitFormat(sal_uInt16 nNewIndex)
Definition: afmtuno.cxx:353
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: afmtuno.cxx:392
#define SC_AFMTOBJ_INVALID
Definition: afmtuno.hxx:39
ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField)
Definition: afmtuno.cxx:544
SfxItemPropertySet aPropSet
Definition: afmtuno.hxx:159
OUString aName
virtual css::uno::Type SAL_CALL getElementType() override
Definition: afmtuno.cxx:404
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
sal_uInt16 nFormatIndex
Definition: afmtuno.hxx:97
virtual OUString SAL_CALL getName() override
Definition: afmtuno.cxx:418
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: afmtuno.cxx:324
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: afmtuno.cxx:236
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: afmtuno.cxx:187
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: afmtuno.cxx:300
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: afmtuno.cxx:375
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL hasElements() override
Definition: afmtuno.cxx:292
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: afmtuno.cxx:263
struct _ADOIndex Index