Don't search for old (<= 2.0) .NET SDK anymore
[LibreOffice.git] / include / comphelper / MasterPropertySet.hxx
blob4fe94ac902672e7cfa5aa7990d5a84f640e94ddf
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 .
20 #ifndef INCLUDED_COMPHELPER_MASTERPROPERTYSET_HXX
21 #define INCLUDED_COMPHELPER_MASTERPROPERTYSET_HXX
22 #include <com/sun/star/beans/XPropertySet.hpp>
23 #include <com/sun/star/beans/XPropertyState.hpp>
24 #include <com/sun/star/beans/XMultiPropertySet.hpp>
25 #include <comphelper/PropertyInfoHash.hxx>
26 #include <comphelper/comphelperdllapi.h>
27 #include <comphelper/solarmutex.hxx>
28 #include <rtl/ref.hxx>
29 #include <map>
31 namespace comphelper
33 class MasterPropertySetInfo;
34 class ChainablePropertySet;
35 struct SlaveData
37 rtl::Reference < ChainablePropertySet > mxSlave;
38 bool mbInit;
40 SlaveData ( ChainablePropertySet *pSlave);
41 bool IsInit () const { return mbInit;}
42 void SetInit ( bool bInit) { mbInit = bInit; }
47 * A MasterPropertySet implements all of the features of a ChainablePropertySet
48 * (it is not inherited from ChainablePropertySet to prevent MasterPropertySets
49 * being chained to each other), but also allows properties implemented in
50 * other ChainablePropertySets to be included as 'native' properties in a
51 * given MasterPropertySet implementation. These are registered using the
52 * 'registerSlave' method, and require that the implementation of the
53 * ChainablePropertySet and the implementation of the ChainablePropertySetInfo
54 * both declare the implementation of the MasterPropertySet as a friend.
56 namespace comphelper
58 class COMPHELPER_DLLPUBLIC MasterPropertySet : public css::beans::XPropertySet,
59 public css::beans::XPropertyState,
60 public css::beans::XMultiPropertySet
62 protected:
63 SolarMutex* mpMutex;
64 sal_uInt8 mnLastId;
65 std::map< sal_uInt8, comphelper::SlaveData* > maSlaveMap;
66 rtl::Reference< MasterPropertySetInfo > mxInfo;
68 /// @throws css::beans::UnknownPropertyException
69 /// @throws css::beans::PropertyVetoException
70 /// @throws css::lang::IllegalArgumentException
71 /// @throws css::lang::WrappedTargetException
72 virtual void _preSetValues () = 0;
73 /// @throws css::beans::UnknownPropertyException
74 /// @throws css::beans::PropertyVetoException
75 /// @throws css::lang::IllegalArgumentException
76 /// @throws css::lang::WrappedTargetException
77 /// @throws css::uno::RuntimeException
78 virtual void _setSingleValue( const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue ) = 0;
79 /// @throws css::beans::UnknownPropertyException
80 /// @throws css::beans::PropertyVetoException
81 /// @throws css::lang::IllegalArgumentException
82 /// @throws css::lang::WrappedTargetException
83 virtual void _postSetValues () = 0;
85 /// @throws css::beans::UnknownPropertyException
86 /// @throws css::beans::PropertyVetoException
87 /// @throws css::lang::IllegalArgumentException
88 /// @throws css::lang::WrappedTargetException
89 virtual void _preGetValues () = 0;
90 /// @throws css::beans::UnknownPropertyException
91 /// @throws css::lang::WrappedTargetException
92 /// @throws css::uno::RuntimeException
93 virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) = 0;
94 /// @throws css::beans::UnknownPropertyException
95 /// @throws css::beans::PropertyVetoException
96 /// @throws css::lang::IllegalArgumentException
97 /// @throws css::lang::WrappedTargetException
98 virtual void _postGetValues () = 0;
100 public:
101 MasterPropertySet( comphelper::MasterPropertySetInfo* pInfo, SolarMutex* pMutex )
102 throw();
103 virtual ~MasterPropertySet()
104 throw();
105 void registerSlave ( ChainablePropertySet *pNewSet )
106 throw();
108 // XPropertySet
109 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
110 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
111 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
112 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
113 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
114 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
115 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
117 // XMultiPropertySet
118 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
119 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
120 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
121 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
122 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
124 // XPropertyState
125 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
126 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
127 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
128 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
131 #endif
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */