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(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
68 virtual void _setSingleValue( const comphelper::PropertyInfo
& rInfo
, const ::com::sun::star::uno::Any
&rValue
)
69 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
70 virtual void _postSetValues ()
71 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
73 virtual void _preGetValues ()
74 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
75 virtual void _getSingleValue( const comphelper::PropertyInfo
& rInfo
, ::com::sun::star::uno::Any
& rValue
)
76 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
77 virtual void _postGetValues ()
78 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
) = 0;
80 virtual void _preGetPropertyState ()
81 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
82 virtual void _getPropertyState( const comphelper::PropertyInfo
& rInfo
, ::com::sun::star::beans::PropertyState
& rState
)
83 throw(::com::sun::star::beans::UnknownPropertyException
);
84 virtual void _postGetPropertyState ()
85 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
);
87 virtual void _setPropertyToDefault( const comphelper::PropertyInfo
& rEntry
)
88 throw(::com::sun::star::beans::UnknownPropertyException
);
89 virtual ::com::sun::star::uno::Any
_getPropertyDefault( const comphelper::PropertyInfo
& rEntry
)
90 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
);
93 ChainablePropertySet( comphelper::ChainablePropertySetInfo
* pInfo
, SolarMutex
* pMutex
= NULL
)
95 virtual ~ChainablePropertySet()
99 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
getPropertySetInfo( )
100 throw(::com::sun::star::uno::RuntimeException
);
101 virtual void SAL_CALL
setPropertyValue( const OUString
& aPropertyName
, const ::com::sun::star::uno::Any
& aValue
)
102 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
);
103 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
104 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
105 virtual void SAL_CALL
addPropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& xListener
)
106 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
107 virtual void SAL_CALL
removePropertyChangeListener( const OUString
& aPropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& aListener
)
108 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
109 virtual void SAL_CALL
addVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
110 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
111 virtual void SAL_CALL
removeVetoableChangeListener( const OUString
& PropertyName
, const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& aListener
)
112 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
115 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
)
116 throw(::com::sun::star::beans::PropertyVetoException
, ::com::sun::star::lang::IllegalArgumentException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
117 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> SAL_CALL
getPropertyValues( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyNames
)
118 throw(::com::sun::star::uno::RuntimeException
);
119 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
)
120 throw(::com::sun::star::uno::RuntimeException
);
121 virtual void SAL_CALL
removePropertiesChangeListener( const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertiesChangeListener
>& xListener
)
122 throw(::com::sun::star::uno::RuntimeException
);
123 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
)
124 throw(::com::sun::star::uno::RuntimeException
);
127 virtual ::com::sun::star::beans::PropertyState SAL_CALL
getPropertyState( const OUString
& PropertyName
)
128 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
129 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyState
> SAL_CALL
getPropertyStates( const ::com::sun::star::uno::Sequence
< OUString
>& aPropertyName
)
130 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
131 virtual void SAL_CALL
setPropertyToDefault( const OUString
& PropertyName
)
132 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
);
133 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyDefault( const OUString
& aPropertyName
)
134 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::lang::WrappedTargetException
, ::com::sun::star::uno::RuntimeException
);
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */