Get the style color and number just once
[LibreOffice.git] / chart2 / source / inc / WrappedPropertySet.hxx
blobdabc6e33c5c4a880aa83e3c550ea462c4f65642c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #pragma once
21 #include <config_options.h>
22 #include "WrappedProperty.hxx"
23 #include "charttoolsdllapi.hxx"
24 #include <com/sun/star/beans/XMultiPropertySet.hpp>
25 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
26 #include <com/sun/star/beans/XPropertySet.hpp>
27 #include <com/sun/star/beans/XPropertyState.hpp>
28 #include <cppuhelper/implbase.hxx>
30 #include <memory>
31 #include <mutex>
32 #include <vector>
34 namespace cppu { class IPropertyArrayHelper; }
35 namespace cppu { class OPropertyArrayHelper; }
37 namespace chart
40 class UNLESS_MERGELIBS(OOO_DLLPUBLIC_CHARTTOOLS) WrappedPropertySet :
41 public ::cppu::WeakImplHelper
42 < css::beans::XPropertySet
43 , css::beans::XMultiPropertySet
44 , css::beans::XPropertyState
45 , css::beans::XMultiPropertyStates
48 public:
49 WrappedPropertySet();
50 virtual ~WrappedPropertySet() override;
52 void clearWrappedPropertySet();
54 public:
55 //XPropertySet
56 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
58 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
59 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
61 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
62 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
63 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
64 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
66 //XMultiPropertySet
67 //getPropertySetInfo() already declared in XPropertySet
68 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
69 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
70 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
71 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
72 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
74 //XPropertyState
75 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
76 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
77 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
78 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
80 //XMultiPropertyStates
81 //getPropertyStates() already declared in XPropertyState
82 virtual void SAL_CALL setAllPropertiesToDefault( ) override;
83 virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override;
84 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
86 protected: //methods
87 /** give all the properties that should be visible to the outer side
89 virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence()=0;
90 /** give a list of all properties that need a special treatment;
91 properties that are not in this list will be wrapped identical.
92 The base class 'WrappedPropertySet' will take ownership on the contained pointer.
93 It is not allowed to have duplicate entries in this list.
95 virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties()=0;
97 virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() = 0;
98 SAL_DLLPRIVATE css::uno::Reference< css::beans::XPropertyState > getInnerPropertyState();
100 ::cppu::IPropertyArrayHelper& getInfoHelper();
101 SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap();
103 const WrappedProperty* getWrappedProperty( const OUString& rOuterName );
104 const WrappedProperty* getWrappedProperty( sal_Int32 nHandle );
106 std::mutex m_aMutex;
108 private:
109 css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo
111 std::unique_ptr<::cppu::OPropertyArrayHelper> m_pPropertyArrayHelper;//holds all possible outer properties
113 std::unique_ptr<tWrappedPropertyMap> m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties)
115 //Container for the XPropertyChangedListener. The listeners are inserted by handle.
116 //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer;
118 //Container for the XPropertyVetoableListener. The listeners are inserted by handle.
119 //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer;
122 } //namespace chart
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */