Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / chart2 / source / inc / WrappedPropertySet.hxx
blob09c768fc75f010789e561e256f175477bbb6ffac
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 #ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX
20 #define INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX
22 #include "WrappedProperty.hxx"
23 #include "MutexContainer.hxx"
24 #include "charttoolsdllapi.hxx"
25 #include <com/sun/star/beans/XMultiPropertySet.hpp>
26 #include <com/sun/star/beans/XMultiPropertyStates.hpp>
27 #include <com/sun/star/beans/XPropertySet.hpp>
28 #include <com/sun/star/beans/XPropertyState.hpp>
29 #include <cppuhelper/implbase.hxx>
31 #include <memory>
32 #include <vector>
34 namespace cppu { class IPropertyArrayHelper; }
35 namespace cppu { class OPropertyArrayHelper; }
37 namespace chart
40 class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet :
41 public MutexContainer
42 , public ::cppu::WeakImplHelper
43 < css::beans::XPropertySet
44 , css::beans::XMultiPropertySet
45 , css::beans::XPropertyState
46 , css::beans::XMultiPropertyStates
49 public:
50 WrappedPropertySet();
51 virtual ~WrappedPropertySet() override;
53 void clearWrappedPropertySet();
55 public:
56 //XPropertySet
57 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
59 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
60 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
62 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
63 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
64 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
65 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
67 //XMultiPropertySet
68 //getPropertySetInfo() already declared in XPropertySet
69 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
70 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
71 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
72 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
73 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
75 //XPropertyState
76 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
77 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
78 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
79 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
81 //XMultiPropertyStates
82 //getPropertyStates() already declared in XPropertyState
83 virtual void SAL_CALL setAllPropertiesToDefault( ) override;
84 virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override;
85 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override;
87 protected: //methods
88 /** give all the properties that should be visible to the outer side
90 virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence()=0;
91 /** give a list of all properties that need a special treatment;
92 properties that are not in this list will be wrapped identical.
93 The base class 'WrappedPropertySet' will take ownership on the contained pointer.
94 It is not allowed to have duplicate entries in this list.
96 virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties()=0;
98 virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() = 0;
99 SAL_DLLPRIVATE css::uno::Reference< css::beans::XPropertyState > getInnerPropertyState();
101 ::cppu::IPropertyArrayHelper& getInfoHelper();
102 SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap();
104 const WrappedProperty* getWrappedProperty( const OUString& rOuterName );
105 const WrappedProperty* getWrappedProperty( sal_Int32 nHandle );
107 protected: //member
108 css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo
110 std::unique_ptr<::cppu::OPropertyArrayHelper> m_pPropertyArrayHelper;//holds all possible outer properties
112 std::unique_ptr<tWrappedPropertyMap> m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties)
114 //Container for the XPropertyChangedListener. The listeners are inserted by handle.
115 //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer;
117 //Container for the XPropertyVetoableListener. The listeners are inserted by handle.
118 //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer;
121 } //namespace chart
123 // INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX
124 #endif
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */