LibreOffice Module chart2 (master) 1
WrappedPropertySet.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#include "WrappedProperty.hxx"
22#include "charttoolsdllapi.hxx"
23#include <com/sun/star/beans/XMultiPropertySet.hpp>
24#include <com/sun/star/beans/XMultiPropertyStates.hpp>
25#include <com/sun/star/beans/XPropertySet.hpp>
26#include <com/sun/star/beans/XPropertyState.hpp>
28
29#include <memory>
30#include <mutex>
31#include <vector>
32
33namespace cppu { class IPropertyArrayHelper; }
34namespace cppu { class OPropertyArrayHelper; }
35
36namespace chart
37{
38
40 public ::cppu::WeakImplHelper
41 < css::beans::XPropertySet
42 , css::beans::XMultiPropertySet
43 , css::beans::XPropertyState
44 , css::beans::XMultiPropertyStates
45 >
46{
47public:
49 virtual ~WrappedPropertySet() override;
50
51 void clearWrappedPropertySet();
52
53public:
54 //XPropertySet
55 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
56
57 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
58 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
59
60 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
61 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
62 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
63 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
64
65 //XMultiPropertySet
66 //getPropertySetInfo() already declared in XPropertySet
67 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
68 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
69 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
70 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
71 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
72
73 //XPropertyState
74 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
75 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
76 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
77 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
78
79 //XMultiPropertyStates
80 //getPropertyStates() already declared in XPropertyState
81 virtual void SAL_CALL setAllPropertiesToDefault( ) override;
82 virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override;
83 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
84
85protected: //methods
88 virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence()=0;
94 virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties()=0;
95
96 virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() = 0;
97 SAL_DLLPRIVATE css::uno::Reference< css::beans::XPropertyState > getInnerPropertyState();
98
99 ::cppu::IPropertyArrayHelper& getInfoHelper();
100 SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap();
101
102 const WrappedProperty* getWrappedProperty( const OUString& rOuterName );
103 const WrappedProperty* getWrappedProperty( sal_Int32 nHandle );
104
105 std::mutex m_aMutex;
106
107private:
108 css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo
109
110 std::unique_ptr<::cppu::OPropertyArrayHelper> m_pPropertyArrayHelper;//holds all possible outer properties
111
112 std::unique_ptr<tWrappedPropertyMap> m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties)
113
114 //Container for the XPropertyChangedListener. The listeners are inserted by handle.
115 //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer;
116
117 //Container for the XPropertyVetoableListener. The listeners are inserted by handle.
118 //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer;
119};
120
121} //namespace chart
122
123/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define OOO_DLLPUBLIC_CHARTTOOLS
virtual const css::uno::Sequence< css::beans::Property > & getPropertySequence()=0
give all the properties that should be visible to the outer side
virtual std::vector< std::unique_ptr< WrappedProperty > > createWrappedProperties()=0
give a list of all properties that need a special treatment; properties that are not in this list wil...
std::unique_ptr< tWrappedPropertyMap > m_pWrappedPropertyMap
std::unique_ptr<::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper
css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet()=0
void setPropertyValue(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Set a property to a certain value in the given map.
std::map< sal_Int32, std::unique_ptr< const WrappedProperty > > tWrappedPropertyMap
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)