1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_CHAINABLEPROPERTYSET_HXX
21 #define INCLUDED_COMPHELPER_CHAINABLEPROPERTYSET_HXX
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/beans/XPropertyState.hpp>
25 #include <com/sun/star/beans/XMultiPropertySet.hpp>
26 #include <comphelper/PropertyInfoHash.hxx>
27 #include <comphelper/comphelperdllapi.h>
28 #include <comphelper/solarmutex.hxx>
32 class ChainablePropertySetInfo
;
36 * A ChainablePropertySet has the following features:
38 * 1. It implements both the PropertySet and MultiPropertySet interfaces.
39 * 2. It can be 'included' in a MasterPropertySet to seamlessly appear as if
40 * if it's properties were in the master.
42 * To be used as a base class for PropertySets, the subclass must implement
43 * the 6 protected pure virtual functions. If a mutex is passed to the
44 * constructor, this is locked before any call to _getSingleValue or
45 * _setSingleValue and released after all processing has completed
46 * (including _postSetValues or _postGetValues )
48 * Any MasterPropertySet implementations that can include an
49 * implementation of a given ChainablePropertySet must be
50 * declared as a 'friend' in the implementation of the ChainablePropertySet.
56 class COMPHELPER_DLLPUBLIC ChainablePropertySet
: public ::com::sun::star::beans::XPropertySet
,
57 public ::com::sun::star::beans::XPropertyState
,
58 public ::com::sun::star::beans::XMultiPropertySet
60 friend class MasterPropertySet
;
62 ChainablePropertySetInfo
*mpInfo
;
64 ::com::sun::star::uno::Reference
< com::sun::star::beans::XPropertySetInfo
> mxInfo
;
66 virtual void _preSetValues ()
67 throw (css::beans::UnknownPropertyException
,
68 css::beans::PropertyVetoException
,
69 css::lang::IllegalArgumentException
,
70 css::lang::WrappedTargetException
,
71 css::uno::RuntimeException
) = 0;
72 virtual void _setSingleValue(const comphelper::PropertyInfo
& rInfo
, const ::com::sun::star::uno::Any
&rValue
)
73 throw (css::beans::UnknownPropertyException
,
74 css::beans::PropertyVetoException
,
75 css::lang::IllegalArgumentException
,
76 css::lang::WrappedTargetException
,
77 css::uno::RuntimeException
,
79 virtual void _postSetValues ()
80 throw (css::beans::UnknownPropertyException
,
81 css::beans::PropertyVetoException
,
82 css::lang::IllegalArgumentException
,
83 css::lang::WrappedTargetException
,
84 css::uno::RuntimeException
) = 0;
86 virtual void _preGetValues ()
87 throw (css::beans::UnknownPropertyException
,
88 css::beans::PropertyVetoException
,
89 css::lang::IllegalArgumentException
,
90 css::lang::WrappedTargetException
,
91 css::uno::RuntimeException
) = 0;
92 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, ::com::sun::star::uno::Any
& rValue
)
93 throw (css::beans::UnknownPropertyException
,
94 css::lang::WrappedTargetException
,
95 css::uno::RuntimeException
) = 0;
96 virtual void _postGetValues ()
97 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
99 static void _preGetPropertyState ()
100 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
101 static void _getPropertyState( const comphelper::PropertyInfo
& rInfo
, ::com::sun::star::beans::PropertyState
& rState
)
102 throw(::com::sun::star::beans::UnknownPropertyException
);
103 static void _postGetPropertyState ()
104 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
106 static void _setPropertyToDefault( const comphelper::PropertyInfo
& rEntry
)
107 throw(::com::sun::star::beans::UnknownPropertyException
);
108 static ::com::sun::star::uno::Any
_getPropertyDefault( const comphelper::PropertyInfo
& rEntry
)
109 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
);
112 ChainablePropertySet( comphelper::ChainablePropertySetInfo
* pInfo
, SolarMutex
* pMutex
= NULL
)
114 virtual ~ChainablePropertySet()
118 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( )
119 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
120 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
121 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
122 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
123 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
124 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
125 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
126 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
127 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
128 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
129 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
130 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
131 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
134 virtual void SAL_CALL
setPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
, const ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
>& aValues
)
135 throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
)
137 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
138 virtual void SAL_CALL
addPropertiesChangeListener( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
139 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
140 virtual void SAL_CALL
removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
141 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
142 virtual void SAL_CALL
firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
143 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
146 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
)
147 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
148 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
getPropertyStates( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyName
)
149 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
150 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
)
151 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
152 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
)
153 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */