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#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>
32
33#include <climits>
34
36class ScAutoFormatObj;
37
38#define SC_AFMTOBJ_INVALID USHRT_MAX
39
40class ScAutoFormatsObj final : public ::cppu::WeakImplHelper<
41 css::container::XNameContainer,
42 css::container::XEnumerationAccess,
43 css::container::XIndexAccess,
44 css::lang::XServiceInfo >
45{
46private:
49
50public:
52 virtual ~ScAutoFormatsObj() override;
53
54 // XNameContainer
55 virtual void SAL_CALL insertByName( const OUString& aName,
56 const css::uno::Any& aElement ) override;
57 virtual void SAL_CALL removeByName( const OUString& Name ) override;
58
59 // XNameReplace
60 virtual void SAL_CALL replaceByName( const OUString& aName,
61 const css::uno::Any& aElement ) override;
62
63 // XNameAccess
64 virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override;
65 virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override;
66 virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override;
67
68 // XElementAccess
69 virtual css::uno::Type SAL_CALL getElementType() override;
70 virtual sal_Bool SAL_CALL hasElements() override;
71
72 // XEnumerationAccess
73 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
74 createEnumeration() override;
75
76 // XIndexAccess
77 virtual sal_Int32 SAL_CALL getCount() override;
78 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
79
80 // XServiceInfo
81 virtual OUString SAL_CALL getImplementationName() override;
82 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
83 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
84};
85
86class ScAutoFormatObj final : public ::cppu::WeakImplHelper<
87 css::container::XIndexAccess,
88 css::container::XEnumerationAccess,
89 css::container::XNamed,
90 css::beans::XPropertySet,
91 css::lang::XServiceInfo >
92{
93private:
95 sal_uInt16 nFormatIndex;
96
98
99public:
100 ScAutoFormatObj(sal_uInt16 nIndex);
101 virtual ~ScAutoFormatObj() override;
102
103 // called via getImplementation:
104 bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; }
105 void InitFormat( sal_uInt16 nNewIndex );
106
107 // XIndexAccess
108 virtual sal_Int32 SAL_CALL getCount() override;
109 virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) override;
110
111 // XElementAccess
112 virtual css::uno::Type SAL_CALL getElementType() override;
113 virtual sal_Bool SAL_CALL hasElements() override;
114
115 // XEnumerationAccess
116 virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL
117 createEnumeration() override;
118
119 // XNamed
120 virtual OUString SAL_CALL getName() override;
121 virtual void SAL_CALL setName( const OUString& aName ) override;
122
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;
142
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;
147};
148
149class ScAutoFormatFieldObj final : public ::cppu::WeakImplHelper<
150 css::beans::XPropertySet,
151 css::lang::XServiceInfo >
152{
153private:
155 sal_uInt16 nFormatIndex;
156 sal_uInt16 nFieldIndex;
157
158public:
159 ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField);
160 virtual ~ScAutoFormatFieldObj() override;
161
162 // XPropertySet
163 virtual css::uno::Reference< css::beans::XPropertySetInfo >
164 SAL_CALL getPropertySetInfo() override;
165 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
166 const css::uno::Any& aValue ) override;
167 virtual css::uno::Any SAL_CALL getPropertyValue(
168 const OUString& PropertyName ) override;
169 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
170 const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
171 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName,
172 const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
173 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName,
174 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
175 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName,
176 const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
177
178 // XServiceInfo
179 virtual OUString SAL_CALL getImplementationName() override;
180 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
181 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
182};
183
184/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
#define SC_AFMTOBJ_INVALID
Definition: afmtuno.hxx:38
sal_uInt16 nFieldIndex
Definition: afmtuno.hxx:156
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
sal_uInt16 nFormatIndex
Definition: afmtuno.hxx:155
ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField)
Definition: afmtuno.cxx:536
virtual ~ScAutoFormatFieldObj() override
Definition: afmtuno.cxx:543
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: afmtuno.cxx:657
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: afmtuno.cxx:556
SfxItemPropertySet aPropSet
Definition: afmtuno.hxx:154
virtual void SAL_CALL removeVetoableChangeListener(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:549
rtl::Reference< ScAutoFormatFieldObj > GetObjectByIndex_Impl(sal_uInt16 nIndex)
Definition: afmtuno.cxx:358
ScAutoFormatObj(sal_uInt16 nIndex)
Definition: afmtuno.cxx:329
virtual ~ScAutoFormatObj() override
Definition: afmtuno.cxx:335
virtual sal_Int32 SAL_CALL getCount() override
Definition: afmtuno.cxx:376
virtual OUString SAL_CALL getName() override
Definition: afmtuno.cxx:410
bool IsInserted() const
Definition: afmtuno.hxx:104
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: afmtuno.cxx:368
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setName(const OUString &aName) override
Definition: afmtuno.cxx:420
virtual void SAL_CALL addVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual sal_Bool SAL_CALL hasElements() override
Definition: afmtuno.cxx:402
virtual css::uno::Type SAL_CALL getElementType() override
Definition: afmtuno.cxx:397
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: afmtuno.cxx:467
void InitFormat(sal_uInt16 nNewIndex)
Definition: afmtuno.cxx:350
virtual void SAL_CALL removeVetoableChangeListener(const OUString &PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &aListener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: afmtuno.cxx:498
SfxItemPropertySet aPropSet
Definition: afmtuno.hxx:94
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: afmtuno.cxx:385
sal_uInt16 nFormatIndex
Definition: afmtuno.hxx:95
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: afmtuno.cxx:460
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: afmtuno.cxx:261
static rtl::Reference< ScAutoFormatObj > GetObjectByIndex_Impl(sal_uInt16 nIndex)
Definition: afmtuno.cxx:166
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: afmtuno.cxx:275
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
Definition: afmtuno.cxx:306
virtual css::uno::Type SAL_CALL getElementType() override
Definition: afmtuno.cxx:284
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasElements() override
Definition: afmtuno.cxx:289
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: afmtuno.cxx:234
virtual sal_Int32 SAL_CALL getCount() override
Definition: afmtuno.cxx:269
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
Definition: afmtuno.cxx:321
virtual ~ScAutoFormatsObj() override
Definition: afmtuno.cxx:152
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
Definition: afmtuno.cxx:297
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
Definition: afmtuno.cxx:185
virtual void SAL_CALL removeByName(const OUString &Name) override
Definition: afmtuno.cxx:242
static rtl::Reference< ScAutoFormatObj > GetObjectByName_Impl(std::u16string_view aName)
Definition: afmtuno.cxx:174
virtual OUString SAL_CALL getImplementationName() override
sal_Int32 nIndex
OUString aName
OUString Name
unsigned char sal_Bool