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_SD_SOURCE_UI_INC_TOOLS_PROPERTYSET_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_TOOLS_PROPERTYSET_HXX
23 #include <cppuhelper/basemutex.hxx>
24 #include <cppuhelper/compbase1.hxx>
25 #include <com/sun/star/beans/XPropertySet.hpp>
26 #include <boost/scoped_ptr.hpp>
29 namespace sd
{ namespace tools
{
32 typedef ::cppu::WeakComponentImplHelper1
<
33 css::beans::XPropertySet
34 > PropertySetInterfaceBase
;
37 /** A very simple implementation of the XPropertySet interface. It does not
38 support constrained properties and thus does not support vetoable
39 listeners. It does not support the optional property set info.
41 In order to use it you have to derive from this class and implement the
42 GetPropertyValue() and SetPropertyValue() methods.
45 : protected ::cppu::BaseMutex
,
46 public PropertySetInterfaceBase
49 explicit PropertySet();
50 virtual ~PropertySet();
52 virtual void SAL_CALL
disposing() SAL_OVERRIDE
;
56 virtual css::uno::Reference
<css::beans::XPropertySetInfo
>
57 SAL_CALL
getPropertySetInfo()
58 throw(css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
60 virtual void SAL_CALL
setPropertyValue (
61 const OUString
& rsPropertyName
,
62 const css::uno::Any
& rsPropertyValue
)
63 throw(css::beans::UnknownPropertyException
,
64 css::beans::PropertyVetoException
,
65 css::lang::IllegalArgumentException
,
66 css::lang::WrappedTargetException
,
67 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
69 virtual css::uno::Any SAL_CALL
getPropertyValue (const OUString
& rsPropertyName
)
70 throw(css::beans::UnknownPropertyException
,
71 css::lang::WrappedTargetException
,
72 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
74 virtual void SAL_CALL
addPropertyChangeListener (
75 const OUString
& rsPropertyName
,
76 const css::uno::Reference
<css::beans::XPropertyChangeListener
>& rxListener
)
77 throw(css::beans::UnknownPropertyException
,
78 css::lang::WrappedTargetException
,
79 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 virtual void SAL_CALL
removePropertyChangeListener (
82 const OUString
& rsPropertyName
,
83 const css::uno::Reference
<css::beans::XPropertyChangeListener
>& rxListener
)
84 throw(css::beans::UnknownPropertyException
,
85 css::lang::WrappedTargetException
,
86 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 virtual void SAL_CALL
addVetoableChangeListener (
89 const OUString
& rsPropertyName
,
90 const css::uno::Reference
<css::beans::XVetoableChangeListener
>& rxListener
)
91 throw(css::beans::UnknownPropertyException
,
92 css::lang::WrappedTargetException
,
93 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
95 virtual void SAL_CALL
removeVetoableChangeListener (
96 const OUString
& rsPropertyName
,
97 const css::uno::Reference
<css::beans::XVetoableChangeListener
>& rxListener
)
98 throw(css::beans::UnknownPropertyException
,
99 css::lang::WrappedTargetException
,
100 css::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
103 /** Return the requested property value.
104 @throw com::sun::star::beans::UnknownPropertyException when the
105 property is not supported.
107 virtual css::uno::Any
GetPropertyValue (const OUString
& rsPropertyName
) = 0;
108 /** Set the given property value.
109 @return the old value.
110 @throw com::sun::star::beans::UnknownPropertyException when the
111 property is not supported.
113 virtual css::uno::Any
SetPropertyValue (
114 const OUString
& rsPropertyName
,
115 const css::uno::Any
& rValue
) = 0;
118 typedef ::std::multimap
<OUString
,
119 css::uno::Reference
<css::beans::XPropertyChangeListener
> > ChangeListenerContainer
;
120 ::boost::scoped_ptr
<ChangeListenerContainer
> mpChangeListeners
;
122 /** Call all listeners that are registered for the given property name.
123 Call this method with an empty property name to call listeners that
124 are registered for all properties.
127 const OUString
& rsPropertyName
,
128 const css::beans::PropertyChangeEvent
& rEvent
);
130 /** This method throws a DisposedException when the object has already been
133 void ThrowIfDisposed()
134 throw (css::lang::DisposedException
);
137 } } // end of namespace ::sd::tools
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */