update dev300-m58
[ooovba.git] / configmgr / source / api2 / propertysetaccess.cxx
blob7a9be49a33b91725030f393f7eaec0c32d46656c
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: propertysetaccess.cxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_configmgr.hxx"
34 #include "propertysetaccess.hxx"
35 #include "propsetaccessimpl.hxx"
36 #include "apinotifierimpl.hxx"
37 #include "apinodeaccess.hxx"
38 #include "apinodeupdate.hxx"
40 namespace configmgr
42 //////////////////////////////////////////////////////////////////////////////////
43 // class BasicPropertySet
44 //////////////////////////////////////////////////////////////////////////////////
46 //////////////////////////////////////////////////////////////////////////////////
47 // getting Property Metadata
48 //////////////////////////////////////////////////////////////////////////////////
50 // XPropertySet & XMultiPropertySet
51 //////////////////////////////////////////////////////////////////////////////////
52 uno::Reference< beans::XPropertySetInfo > SAL_CALL BasicPropertySet::getPropertySetInfo( )
53 throw(uno::RuntimeException)
55 return configapi::implGetPropertySetInfo( getNode(), NULL != maybeGetUpdateAccess() );
58 // XHierarchicalPropertySet & XHierarchicalMultiPropertySet
59 //////////////////////////////////////////////////////////////////////////////////
60 uno::Reference< beans::XHierarchicalPropertySetInfo > SAL_CALL BasicPropertySet::getHierarchicalPropertySetInfo( )
61 throw(uno::RuntimeException)
63 return configapi::implGetHierarchicalPropertySetInfo( getNode() );
66 //////////////////////////////////////////////////////////////////////////////////
67 // setting values - may all throw (PropertyVeto)Exceptions on read-only property sets
68 //////////////////////////////////////////////////////////////////////////////////
70 /// get the access for updating, check that it is present
71 configapi::NodeGroupAccess& BasicPropertySet::getGroupNode()
73 configapi::NodeGroupAccess* pAccess = maybeGetUpdateAccess();
74 OSL_ENSURE(pAccess, "Write operation invoked on a read-only node access - failing with PropertyVetoException");
76 if (!pAccess)
78 throw beans::PropertyVetoException(
79 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Configuration: INTERNAL VETO - Write operation invoked on a read-only node access")),
80 static_cast< beans::XPropertySet * >(this)
83 return *pAccess;
86 // XPropertySet
87 //////////////////////////////////////////////////////////////////////////////////
88 void SAL_CALL BasicPropertySet::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
89 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
90 lang::WrappedTargetException, uno::RuntimeException)
92 configapi::implSetPropertyValue( getGroupNode(), aPropertyName, aValue );
95 // XMultiPropertySet
96 //////////////////////////////////////////////////////////////////////////////////
97 void SAL_CALL BasicPropertySet::setPropertyValues( const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
98 throw(beans::PropertyVetoException, lang::IllegalArgumentException,
99 lang::WrappedTargetException, uno::RuntimeException)
101 configapi::implSetPropertyValues( getGroupNode(), PropertyNames, Values );
104 // XHierarchicalPropertySet
105 //////////////////////////////////////////////////////////////////////////////////
106 void SAL_CALL BasicPropertySet::setHierarchicalPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
107 throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
108 lang::WrappedTargetException, uno::RuntimeException)
110 configapi::implSetHierarchicalPropertyValue( getGroupNode(), aPropertyName, aValue );
113 // XMultiHierarchicalPropertySet
114 //////////////////////////////////////////////////////////////////////////////////
115 void SAL_CALL BasicPropertySet::setHierarchicalPropertyValues( const uno::Sequence< rtl::OUString >& PropertyNames, const uno::Sequence< uno::Any >& Values )
116 throw(beans::PropertyVetoException, lang::IllegalArgumentException,
117 lang::WrappedTargetException, uno::RuntimeException)
119 configapi::implSetHierarchicalPropertyValues( getGroupNode(), PropertyNames, Values );
123 //////////////////////////////////////////////////////////////////////////////////
124 // getting values
125 //////////////////////////////////////////////////////////////////////////////////
126 // XPropertySet
127 //////////////////////////////////////////////////////////////////////////////////
128 uno::Any SAL_CALL BasicPropertySet::getPropertyValue( const rtl::OUString& aPropertyName )
129 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
131 return configapi::implGetPropertyValue( getNode(), aPropertyName );
134 // XMultiPropertySet
135 //////////////////////////////////////////////////////////////////////////////////
136 uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames )
137 throw(uno::RuntimeException)
139 return configapi::implGetPropertyValues( getNode(), aPropertyNames );
142 // XHierarchicalPropertySet
143 //////////////////////////////////////////////////////////////////////////////////
144 uno::Any SAL_CALL BasicPropertySet::getHierarchicalPropertyValue( const rtl::OUString& aPropertyName )
145 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
147 return configapi::implGetHierarchicalPropertyValue( getNode(), aPropertyName );
150 // XMultiHierarchicalPropertySet
151 //////////////////////////////////////////////////////////////////////////////////
152 uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getHierarchicalPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames )
153 throw(uno::RuntimeException)
155 return configapi::implGetHierarchicalPropertyValues( getNode(), aPropertyNames );
158 //////////////////////////////////////////////////////////////////////////////////
159 // adding/removing listeners
160 //////////////////////////////////////////////////////////////////////////////////
162 void SAL_CALL BasicPropertySet::addVetoableChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XVetoableChangeListener >& xListener )
163 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
165 configapi::implAddListener( getNode(), xListener, aPropertyName );
168 void SAL_CALL BasicPropertySet::addPropertyChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
169 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
171 configapi::implAddListener( getNode(), xListener, aPropertyName );
174 void SAL_CALL BasicPropertySet::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
175 throw(uno::RuntimeException)
177 configapi::implAddListener( getNode(), xListener, aPropertyNames );
180 //////////////////////////////////////////////////////////////////////////////////
181 void SAL_CALL BasicPropertySet::removeVetoableChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XVetoableChangeListener >& xListener )
182 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
184 configapi::implRemoveListener( getNode(), xListener, aPropertyName );
186 //---------------------------------------------------------------------------------
188 void SAL_CALL BasicPropertySet::removePropertyChangeListener( const rtl::OUString& aPropertyName, const uno::Reference< beans::XPropertyChangeListener >& xListener )
189 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
191 configapi::implRemoveListener( getNode(), xListener, aPropertyName );
193 //---------------------------------------------------------------------------------
195 void SAL_CALL BasicPropertySet::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener )
196 throw(uno::RuntimeException)
198 configapi::implRemoveListener( getNode(), xListener );
200 //---------------------------------------------------------------------------------
203 //////////////////////////////////////////////////////////////////////////////////
204 // SPECIAL: XMultiPropertySet::firePropertiesChangeEvent
205 //////////////////////////////////////////////////////////////////////////////////
206 void SAL_CALL BasicPropertySet::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames, const uno::Reference< beans::XPropertiesChangeListener >& xListener )
207 throw(uno::RuntimeException)
209 configapi::implFirePropertiesChangeEvent( getNode(),aPropertyNames , xListener );
212 //////////////////////////////////////////////////////////////////////////////////
213 // XPropertyState / XMultiPropertyStates
214 //////////////////////////////////////////////////////////////////////////////////
216 // getting property states
217 //////////////////////////////////////////////////////////////////////////////////
219 beans::PropertyState SAL_CALL BasicPropertySet::getPropertyState( const rtl::OUString& sPropertyName )
220 throw(beans::UnknownPropertyException, uno::RuntimeException)
222 return configapi::implGetPropertyState( getNode(), sPropertyName);
224 //---------------------------------------------------------------------------------
226 uno::Sequence< beans::PropertyState > SAL_CALL BasicPropertySet::getPropertyStates( const uno::Sequence< rtl::OUString >& aPropertyNames )
227 throw(beans::UnknownPropertyException, uno::RuntimeException)
229 return configapi::implGetPropertyStates( getNode(), aPropertyNames );
231 //---------------------------------------------------------------------------------
233 // setting to default state
234 //////////////////////////////////////////////////////////////////////////////////
236 void SAL_CALL BasicPropertySet::setPropertyToDefault( const rtl::OUString& sPropertyName )
237 throw(beans::UnknownPropertyException, uno::RuntimeException)
239 configapi::implSetPropertyToDefault( getGroupNode(), sPropertyName);
241 //---------------------------------------------------------------------------------
243 void SAL_CALL BasicPropertySet::setPropertiesToDefault( const uno::Sequence< rtl::OUString >& aPropertyNames )
244 throw (beans::UnknownPropertyException, uno::RuntimeException)
246 configapi::implSetPropertiesToDefault( getGroupNode(), aPropertyNames);
248 //---------------------------------------------------------------------------------
250 void SAL_CALL BasicPropertySet::setAllPropertiesToDefault( )
251 throw (uno::RuntimeException)
253 configapi::implSetAllPropertiesToDefault( getGroupNode() );
255 //---------------------------------------------------------------------------------
257 // getting defaults
258 //////////////////////////////////////////////////////////////////////////////////
260 uno::Any SAL_CALL BasicPropertySet::getPropertyDefault( const rtl::OUString& sPropertyName )
261 throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
264 return configapi::implGetPropertyDefault( getNode(), sPropertyName);
266 //---------------------------------------------------------------------------------
268 uno::Sequence< uno::Any > SAL_CALL BasicPropertySet::getPropertyDefaults( const uno::Sequence< rtl::OUString >& aPropertyNames )
269 throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
271 return configapi::implGetPropertyDefaults( getNode(), aPropertyNames);
273 //---------------------------------------------------------------------------------
275 //-----------------------------------------------------------------------------------
276 } // namespace configmgr