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>
30#include <com/sun/star/lang/XUnoTunnel.hpp>
33
34#include <climits>
35
37class ScAutoFormatObj;
38
39#define SC_AFMTOBJ_INVALID USHRT_MAX
40
41class ScAutoFormatsObj final : public ::cppu::WeakImplHelper<
42 css::container::XNameContainer,
43 css::container::XEnumerationAccess,
44 css::container::XIndexAccess,
45 css::lang::XServiceInfo >
46{
47private:
50
51public:
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
87class ScAutoFormatObj final : 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{
95private:
97 sal_uInt16 nFormatIndex;
98
100
101public:
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
154class ScAutoFormatFieldObj final : public ::cppu::WeakImplHelper<
155 css::beans::XPropertySet,
156 css::lang::XServiceInfo >
157{
158private:
160 sal_uInt16 nFormatIndex;
161 sal_uInt16 nFieldIndex;
162
163public:
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/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct _ADOIndex Index
#define SC_AFMTOBJ_INVALID
Definition: afmtuno.hxx:39
sal_uInt16 nFieldIndex
Definition: afmtuno.hxx:161
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
sal_uInt16 nFormatIndex
Definition: afmtuno.hxx:160
ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField)
Definition: afmtuno.cxx:540
virtual ~ScAutoFormatFieldObj() override
Definition: afmtuno.cxx:547
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
Definition: afmtuno.cxx:661
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:560
SfxItemPropertySet aPropSet
Definition: afmtuno.hxx:159
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:553
rtl::Reference< ScAutoFormatFieldObj > GetObjectByIndex_Impl(sal_uInt16 nIndex)
Definition: afmtuno.cxx:362
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:380
virtual OUString SAL_CALL getName() override
Definition: afmtuno.cxx:414
bool IsInserted() const
Definition: afmtuno.hxx:106
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:372
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL setName(const OUString &aName) override
Definition: afmtuno.cxx:424
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:406
virtual css::uno::Type SAL_CALL getElementType() override
Definition: afmtuno.cxx:401
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: afmtuno.cxx:471
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:502
SfxItemPropertySet aPropSet
Definition: afmtuno.hxx:96
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: afmtuno.cxx:389
sal_uInt16 nFormatIndex
Definition: afmtuno.hxx:97
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: afmtuno.cxx:464
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
#define UNO3_GETIMPLEMENTATION_DECL(classname)
OUString Name
unsigned char sal_Bool