LibreOffice Module chart2 (master) 1
OPropertySet.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#pragma once
20
21// helper classes
24
25// interfaces and types
26#include <com/sun/star/lang/XTypeProvider.hpp>
27#include <com/sun/star/beans/XPropertyState.hpp>
28#include <com/sun/star/beans/XMultiPropertyStates.hpp>
29#include <com/sun/star/style/XStyleSupplier.hpp>
30#include "charttoolsdllapi.hxx"
31
32#include <unordered_map>
33
34namespace property
35{
36
38 protected cppu::BaseMutex,
40 // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet
42 // includes uno::XWeak (and XInterface, esp. ref-counting)
43
44 public css::lang::XTypeProvider,
45 public css::beans::XPropertyState,
46 public css::beans::XMultiPropertyStates,
47 public css::style::XStyleSupplier
48{
49public:
51 virtual ~OPropertySet();
52
53protected:
54 explicit OPropertySet( const OPropertySet & rOther );
55
56 void SetNewValuesExplicitlyEvenIfTheyEqualDefault();
57
68 virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const = 0;
69
78 virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override = 0;
79
104 virtual sal_Bool SAL_CALL convertFastPropertyValue
105 ( css::uno::Any & rConvertedValue,
106 css::uno::Any & rOldValue,
107 sal_Int32 nHandle,
108 const css::uno::Any& rValue ) override final;
109
127 virtual void SAL_CALL setFastPropertyValue_NoBroadcast
128 ( sal_Int32 nHandle,
129 const css::uno::Any& rValue ) override;
130
137 virtual void SAL_CALL getFastPropertyValue
138 ( css::uno::Any& rValue,
139 sal_Int32 nHandle ) const override;
140
144 virtual void firePropertyChangeEvent();
145
146public:
148 using ::cppu::OPropertySetHelper::getFastPropertyValue;
149
150 // Interfaces
151
152 // ____ XInterface ____
153 virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override;
154
155 // ____ XTypeProvider ____
156 virtual css::uno::Sequence< css::uno::Type > SAL_CALL
157 getTypes() override;
158 virtual css::uno::Sequence< sal_Int8 > SAL_CALL
159 getImplementationId() override;
160
161 // ____ XPropertyState ____
162 virtual css::beans::PropertyState SAL_CALL
163 getPropertyState( const OUString& PropertyName ) override final;
164 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL
165 getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override final;
166 virtual void SAL_CALL
167 setPropertyToDefault( const OUString& PropertyName ) override final;
168 virtual css::uno::Any SAL_CALL
169 getPropertyDefault( const OUString& aPropertyName ) override final;
170
171 // ____ XMultiPropertyStates ____
172 // Note: getPropertyStates() is already implemented in XPropertyState with the
173 // same signature
174 virtual void SAL_CALL
175 setAllPropertiesToDefault() override final;
176 virtual void SAL_CALL
177 setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override final;
178 virtual css::uno::Sequence< css::uno::Any > SAL_CALL
179 getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override final;
180
181 // ____ XStyleSupplier ____
182 virtual css::uno::Reference< css::style::XStyle > SAL_CALL getStyle() override final;
183 virtual void SAL_CALL setStyle( const css::uno::Reference< css::style::XStyle >& xStyle ) override final;
184
185 // ____ XMultiPropertySet ____
186 virtual void SAL_CALL setPropertyValues(
187 const css::uno::Sequence< OUString >& PropertyNames,
188 const css::uno::Sequence< css::uno::Any >& Values ) override final;
189
190 // ____ XFastPropertySet ____
191 virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override final;
192
193 // Note: it is assumed that the base class implements setPropertyValue by
194 // using setFastPropertyValue
195
196private:
199 css::beans::PropertyState
200 GetPropertyStateByHandle( sal_Int32 nHandle ) const;
201
202 css::uno::Sequence< css::beans::PropertyState >
203 GetPropertyStatesByHandle( const std::vector< sal_Int32 > & aHandles ) const;
204
205 void SetPropertyToDefault( sal_Int32 nHandle );
206 void SetPropertiesToDefault( const std::vector< sal_Int32 > & aHandles );
207 void SetAllPropertiesToDefault();
208
217 bool GetPropertyValueByHandle(
218 css::uno::Any & rValue,
219 sal_Int32 nHandle ) const;
220
221 void SetPropertyValueByHandle( sal_Int32 nHandle,
222 const css::uno::Any & rValue );
223
224 bool SetStyle( const css::uno::Reference< css::style::XStyle > & xStyle );
225
226 bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault;
227 std::unordered_map< sal_Int32, css::uno::Any > m_aProperties;
228 css::uno::Reference< css::style::XStyle > m_xStyle;
229};
230
231} // namespace property
232
233/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define OOO_DLLPUBLIC_CHARTTOOLS
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override=0
The InfoHelper table contains all property names and types of this object.
virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any &rAny) const =0
implement this method to provide default values for all properties supporting defaults.
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType, Interface1 *p1)
unsigned char sal_Bool