1*6d739b60SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*6d739b60SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*6d739b60SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*6d739b60SAndrew Rist * distributed with this work for additional information
6*6d739b60SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*6d739b60SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*6d739b60SAndrew Rist * "License"); you may not use this file except in compliance
9*6d739b60SAndrew Rist * with the License. You may obtain a copy of the License at
10cdf0e10cSrcweir *
11*6d739b60SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir *
13*6d739b60SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*6d739b60SAndrew Rist * software distributed under the License is distributed on an
15*6d739b60SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*6d739b60SAndrew Rist * KIND, either express or implied. See the License for the
17*6d739b60SAndrew Rist * specific language governing permissions and limitations
18*6d739b60SAndrew Rist * under the License.
19cdf0e10cSrcweir *
20*6d739b60SAndrew Rist *************************************************************/
21*6d739b60SAndrew Rist
22*6d739b60SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_framework.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir //_________________________________________________________________________________________________________________
28cdf0e10cSrcweir // my own includes
29cdf0e10cSrcweir
30cdf0e10cSrcweir #include <classes/propertysethelper.hxx>
31cdf0e10cSrcweir #include <threadhelp/transactionguard.hxx>
32cdf0e10cSrcweir #include <threadhelp/readguard.hxx>
33cdf0e10cSrcweir #include <threadhelp/writeguard.hxx>
34cdf0e10cSrcweir
35cdf0e10cSrcweir //_________________________________________________________________________________________________________________
36cdf0e10cSrcweir // interface includes
37cdf0e10cSrcweir
38cdf0e10cSrcweir //_________________________________________________________________________________________________________________
39cdf0e10cSrcweir // other includes
40cdf0e10cSrcweir
41cdf0e10cSrcweir //_________________________________________________________________________________________________________________
42cdf0e10cSrcweir // namespace
43cdf0e10cSrcweir
44cdf0e10cSrcweir namespace framework{
45cdf0e10cSrcweir
46cdf0e10cSrcweir //_________________________________________________________________________________________________________________
47cdf0e10cSrcweir // non exported definitions
48cdf0e10cSrcweir
49cdf0e10cSrcweir //-----------------------------------------------------------------------------
PropertySetHelper(const css::uno::Reference<css::lang::XMultiServiceFactory> & xSMGR,LockHelper * pExternalLock,TransactionManager * pExternalTransactionManager,sal_Bool bReleaseLockOnCall)50cdf0e10cSrcweir PropertySetHelper::PropertySetHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ,
51cdf0e10cSrcweir LockHelper* pExternalLock ,
52cdf0e10cSrcweir TransactionManager* pExternalTransactionManager ,
53cdf0e10cSrcweir sal_Bool bReleaseLockOnCall )
54cdf0e10cSrcweir : m_xSMGR (xSMGR )
55cdf0e10cSrcweir , m_lSimpleChangeListener(pExternalLock->getShareableOslMutex())
56cdf0e10cSrcweir , m_lVetoChangeListener (pExternalLock->getShareableOslMutex())
57cdf0e10cSrcweir , m_bReleaseLockOnCall (bReleaseLockOnCall )
58cdf0e10cSrcweir , m_rLock (*pExternalLock )
59cdf0e10cSrcweir , m_rTransactionManager (*pExternalTransactionManager )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir }
62cdf0e10cSrcweir
63cdf0e10cSrcweir //-----------------------------------------------------------------------------
~PropertySetHelper()64cdf0e10cSrcweir PropertySetHelper::~PropertySetHelper()
65cdf0e10cSrcweir {
66cdf0e10cSrcweir }
67cdf0e10cSrcweir
68cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_setPropertyChangeBroadcaster(const css::uno::Reference<css::uno::XInterface> & xBroadcaster)69cdf0e10cSrcweir void PropertySetHelper::impl_setPropertyChangeBroadcaster(const css::uno::Reference< css::uno::XInterface >& xBroadcaster)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
72cdf0e10cSrcweir
73cdf0e10cSrcweir // SAFE ->
74cdf0e10cSrcweir WriteGuard aWriteLock(m_rLock);
75cdf0e10cSrcweir m_xBroadcaster = xBroadcaster;
76cdf0e10cSrcweir aWriteLock.unlock();
77cdf0e10cSrcweir // <- SAFE
78cdf0e10cSrcweir }
79cdf0e10cSrcweir
80cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_addPropertyInfo(const css::beans::Property & aProperty)81cdf0e10cSrcweir void SAL_CALL PropertySetHelper::impl_addPropertyInfo(const css::beans::Property& aProperty)
82cdf0e10cSrcweir throw(css::beans::PropertyExistException,
83cdf0e10cSrcweir css::uno::Exception )
84cdf0e10cSrcweir {
85cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
86cdf0e10cSrcweir
87cdf0e10cSrcweir // SAFE ->
88cdf0e10cSrcweir WriteGuard aWriteLock(m_rLock);
89cdf0e10cSrcweir
90cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(aProperty.Name);
91cdf0e10cSrcweir if (pIt != m_lProps.end())
92cdf0e10cSrcweir throw css::beans::PropertyExistException();
93cdf0e10cSrcweir
94cdf0e10cSrcweir m_lProps[aProperty.Name] = aProperty;
95cdf0e10cSrcweir // <- SAFE
96cdf0e10cSrcweir }
97cdf0e10cSrcweir
98cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_removePropertyInfo(const::rtl::OUString & sProperty)99cdf0e10cSrcweir void SAL_CALL PropertySetHelper::impl_removePropertyInfo(const ::rtl::OUString& sProperty)
100cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
101cdf0e10cSrcweir css::uno::Exception )
102cdf0e10cSrcweir {
103cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
104cdf0e10cSrcweir
105cdf0e10cSrcweir // SAFE ->
106cdf0e10cSrcweir WriteGuard aWriteLock(m_rLock);
107cdf0e10cSrcweir
108cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::iterator pIt = m_lProps.find(sProperty);
109cdf0e10cSrcweir if (pIt == m_lProps.end())
110cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
111cdf0e10cSrcweir
112cdf0e10cSrcweir m_lProps.erase(pIt);
113cdf0e10cSrcweir // <- SAFE
114cdf0e10cSrcweir }
115cdf0e10cSrcweir
116cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_enablePropertySet()117cdf0e10cSrcweir void SAL_CALL PropertySetHelper::impl_enablePropertySet()
118cdf0e10cSrcweir {
119cdf0e10cSrcweir }
120cdf0e10cSrcweir
121cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_disablePropertySet()122cdf0e10cSrcweir void SAL_CALL PropertySetHelper::impl_disablePropertySet()
123cdf0e10cSrcweir {
124cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
125cdf0e10cSrcweir
126cdf0e10cSrcweir // SAFE ->
127cdf0e10cSrcweir WriteGuard aWriteLock(m_rLock);
128cdf0e10cSrcweir
129cdf0e10cSrcweir css::uno::Reference< css::uno::XInterface > xThis(static_cast< css::beans::XPropertySet* >(this), css::uno::UNO_QUERY);
130cdf0e10cSrcweir css::lang::EventObject aEvent(xThis);
131cdf0e10cSrcweir
132cdf0e10cSrcweir m_lSimpleChangeListener.disposeAndClear(aEvent);
133cdf0e10cSrcweir m_lVetoChangeListener.disposeAndClear(aEvent);
134cdf0e10cSrcweir m_lProps.free();
135cdf0e10cSrcweir
136cdf0e10cSrcweir aWriteLock.unlock();
137cdf0e10cSrcweir // <- SAFE
138cdf0e10cSrcweir }
139cdf0e10cSrcweir
140cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_existsVeto(const css::beans::PropertyChangeEvent & aEvent)141cdf0e10cSrcweir sal_Bool PropertySetHelper::impl_existsVeto(const css::beans::PropertyChangeEvent& aEvent)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir /* Dont use the lock here!
144cdf0e10cSrcweir The used helper is threadsafe and it lives for the whole lifetime of
145cdf0e10cSrcweir our own object.
146cdf0e10cSrcweir */
147cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pVetoListener = m_lVetoChangeListener.getContainer(aEvent.PropertyName);
148cdf0e10cSrcweir if (! pVetoListener)
149cdf0e10cSrcweir return sal_False;
150cdf0e10cSrcweir
151cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper pListener(*pVetoListener);
152cdf0e10cSrcweir while (pListener.hasMoreElements())
153cdf0e10cSrcweir {
154cdf0e10cSrcweir try
155cdf0e10cSrcweir {
156cdf0e10cSrcweir css::uno::Reference< css::beans::XVetoableChangeListener > xListener(
157cdf0e10cSrcweir ((css::beans::XVetoableChangeListener*)pListener.next()),
158cdf0e10cSrcweir css::uno::UNO_QUERY_THROW);
159cdf0e10cSrcweir xListener->vetoableChange(aEvent);
160cdf0e10cSrcweir }
161cdf0e10cSrcweir catch(const css::uno::RuntimeException&)
162cdf0e10cSrcweir { pListener.remove(); }
163cdf0e10cSrcweir catch(const css::beans::PropertyVetoException&)
164cdf0e10cSrcweir { return sal_True; }
165cdf0e10cSrcweir }
166cdf0e10cSrcweir
167cdf0e10cSrcweir return sal_False;
168cdf0e10cSrcweir }
169cdf0e10cSrcweir
170cdf0e10cSrcweir //-----------------------------------------------------------------------------
impl_notifyChangeListener(const css::beans::PropertyChangeEvent & aEvent)171cdf0e10cSrcweir void PropertySetHelper::impl_notifyChangeListener(const css::beans::PropertyChangeEvent& aEvent)
172cdf0e10cSrcweir {
173cdf0e10cSrcweir /* Dont use the lock here!
174cdf0e10cSrcweir The used helper is threadsafe and it lives for the whole lifetime of
175cdf0e10cSrcweir our own object.
176cdf0e10cSrcweir */
177cdf0e10cSrcweir ::cppu::OInterfaceContainerHelper* pSimpleListener = m_lSimpleChangeListener.getContainer(aEvent.PropertyName);
178cdf0e10cSrcweir if (! pSimpleListener)
179cdf0e10cSrcweir return;
180cdf0e10cSrcweir
181cdf0e10cSrcweir ::cppu::OInterfaceIteratorHelper pListener(*pSimpleListener);
182cdf0e10cSrcweir while (pListener.hasMoreElements())
183cdf0e10cSrcweir {
184cdf0e10cSrcweir try
185cdf0e10cSrcweir {
186cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertyChangeListener > xListener(
187cdf0e10cSrcweir ((css::beans::XVetoableChangeListener*)pListener.next()),
188cdf0e10cSrcweir css::uno::UNO_QUERY_THROW);
189cdf0e10cSrcweir xListener->propertyChange(aEvent);
190cdf0e10cSrcweir }
191cdf0e10cSrcweir catch(const css::uno::RuntimeException&)
192cdf0e10cSrcweir { pListener.remove(); }
193cdf0e10cSrcweir }
194cdf0e10cSrcweir }
195cdf0e10cSrcweir
196cdf0e10cSrcweir //-----------------------------------------------------------------------------
getPropertySetInfo()197cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL PropertySetHelper::getPropertySetInfo()
198cdf0e10cSrcweir throw(css::uno::RuntimeException)
199cdf0e10cSrcweir {
200cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
201cdf0e10cSrcweir
202cdf0e10cSrcweir css::uno::Reference< css::beans::XPropertySetInfo > xInfo(static_cast< css::beans::XPropertySetInfo* >(this), css::uno::UNO_QUERY_THROW);
203cdf0e10cSrcweir return xInfo;
204cdf0e10cSrcweir }
205cdf0e10cSrcweir
206cdf0e10cSrcweir //-----------------------------------------------------------------------------
setPropertyValue(const::rtl::OUString & sProperty,const css::uno::Any & aValue)207cdf0e10cSrcweir void SAL_CALL PropertySetHelper::setPropertyValue(const ::rtl::OUString& sProperty,
208cdf0e10cSrcweir const css::uno::Any& aValue )
209cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
210cdf0e10cSrcweir css::beans::PropertyVetoException ,
211cdf0e10cSrcweir css::lang::IllegalArgumentException ,
212cdf0e10cSrcweir css::lang::WrappedTargetException ,
213cdf0e10cSrcweir css::uno::RuntimeException )
214cdf0e10cSrcweir {
215cdf0e10cSrcweir // TODO look for e.g. readonly props and reject setProp() call!
216cdf0e10cSrcweir
217cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
218cdf0e10cSrcweir
219cdf0e10cSrcweir // SAFE ->
220cdf0e10cSrcweir WriteGuard aWriteLock(m_rLock);
221cdf0e10cSrcweir
222cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
223cdf0e10cSrcweir if (pIt == m_lProps.end())
224cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
225cdf0e10cSrcweir
226cdf0e10cSrcweir css::beans::Property aPropInfo = pIt->second;
227cdf0e10cSrcweir
228cdf0e10cSrcweir sal_Bool bLocked = sal_True;
229cdf0e10cSrcweir if (m_bReleaseLockOnCall)
230cdf0e10cSrcweir {
231cdf0e10cSrcweir aWriteLock.unlock();
232cdf0e10cSrcweir bLocked = sal_False;
233cdf0e10cSrcweir // <- SAFE
234cdf0e10cSrcweir }
235cdf0e10cSrcweir
236cdf0e10cSrcweir css::uno::Any aCurrentValue = impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
237cdf0e10cSrcweir
238cdf0e10cSrcweir if (! bLocked)
239cdf0e10cSrcweir {
240cdf0e10cSrcweir // SAFE ->
241cdf0e10cSrcweir aWriteLock.lock();
242cdf0e10cSrcweir bLocked = sal_True;
243cdf0e10cSrcweir }
244cdf0e10cSrcweir
245cdf0e10cSrcweir sal_Bool bWillBeChanged = (aCurrentValue != aValue);
246cdf0e10cSrcweir if (! bWillBeChanged)
247cdf0e10cSrcweir return;
248cdf0e10cSrcweir
249cdf0e10cSrcweir css::beans::PropertyChangeEvent aEvent;
250cdf0e10cSrcweir aEvent.PropertyName = aPropInfo.Name;
251cdf0e10cSrcweir aEvent.Further = sal_False;
252cdf0e10cSrcweir aEvent.PropertyHandle = aPropInfo.Handle;
253cdf0e10cSrcweir aEvent.OldValue = aCurrentValue;
254cdf0e10cSrcweir aEvent.NewValue = aValue;
255cdf0e10cSrcweir aEvent.Source = css::uno::Reference< css::uno::XInterface >(m_xBroadcaster.get(), css::uno::UNO_QUERY);
256cdf0e10cSrcweir
257cdf0e10cSrcweir if (m_bReleaseLockOnCall)
258cdf0e10cSrcweir {
259cdf0e10cSrcweir aWriteLock.unlock();
260cdf0e10cSrcweir bLocked = sal_False;
261cdf0e10cSrcweir // <- SAFE
262cdf0e10cSrcweir }
263cdf0e10cSrcweir
264cdf0e10cSrcweir if (impl_existsVeto(aEvent))
265cdf0e10cSrcweir throw css::beans::PropertyVetoException();
266cdf0e10cSrcweir
267cdf0e10cSrcweir impl_setPropertyValue(aPropInfo.Name, aPropInfo.Handle, aValue);
268cdf0e10cSrcweir
269cdf0e10cSrcweir impl_notifyChangeListener(aEvent);
270cdf0e10cSrcweir }
271cdf0e10cSrcweir
272cdf0e10cSrcweir //-----------------------------------------------------------------------------
getPropertyValue(const::rtl::OUString & sProperty)273cdf0e10cSrcweir css::uno::Any SAL_CALL PropertySetHelper::getPropertyValue(const ::rtl::OUString& sProperty)
274cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
275cdf0e10cSrcweir css::lang::WrappedTargetException ,
276cdf0e10cSrcweir css::uno::RuntimeException )
277cdf0e10cSrcweir {
278cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
279cdf0e10cSrcweir
280cdf0e10cSrcweir // SAFE ->
281cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
282cdf0e10cSrcweir
283cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
284cdf0e10cSrcweir if (pIt == m_lProps.end())
285cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
286cdf0e10cSrcweir
287cdf0e10cSrcweir css::beans::Property aPropInfo = pIt->second;
288cdf0e10cSrcweir
289cdf0e10cSrcweir sal_Bool bLocked = sal_True;
290cdf0e10cSrcweir if (m_bReleaseLockOnCall)
291cdf0e10cSrcweir {
292cdf0e10cSrcweir aReadLock.unlock();
293cdf0e10cSrcweir bLocked = sal_False;
294cdf0e10cSrcweir // <- SAFE
295cdf0e10cSrcweir }
296cdf0e10cSrcweir
297cdf0e10cSrcweir return impl_getPropertyValue(aPropInfo.Name, aPropInfo.Handle);
298cdf0e10cSrcweir }
299cdf0e10cSrcweir
300cdf0e10cSrcweir //-----------------------------------------------------------------------------
addPropertyChangeListener(const::rtl::OUString & sProperty,const css::uno::Reference<css::beans::XPropertyChangeListener> & xListener)301cdf0e10cSrcweir void SAL_CALL PropertySetHelper::addPropertyChangeListener(const ::rtl::OUString& sProperty,
302cdf0e10cSrcweir const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener)
303cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
304cdf0e10cSrcweir css::lang::WrappedTargetException ,
305cdf0e10cSrcweir css::uno::RuntimeException )
306cdf0e10cSrcweir {
307cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
308cdf0e10cSrcweir
309cdf0e10cSrcweir // SAFE ->
310cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
311cdf0e10cSrcweir
312cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
313cdf0e10cSrcweir if (pIt == m_lProps.end())
314cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
315cdf0e10cSrcweir
316cdf0e10cSrcweir aReadLock.unlock();
317cdf0e10cSrcweir // <- SAFE
318cdf0e10cSrcweir
319cdf0e10cSrcweir m_lSimpleChangeListener.addInterface(sProperty, xListener);
320cdf0e10cSrcweir }
321cdf0e10cSrcweir
322cdf0e10cSrcweir //-----------------------------------------------------------------------------
removePropertyChangeListener(const::rtl::OUString & sProperty,const css::uno::Reference<css::beans::XPropertyChangeListener> & xListener)323cdf0e10cSrcweir void SAL_CALL PropertySetHelper::removePropertyChangeListener(const ::rtl::OUString& sProperty,
324cdf0e10cSrcweir const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener)
325cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
326cdf0e10cSrcweir css::lang::WrappedTargetException ,
327cdf0e10cSrcweir css::uno::RuntimeException )
328cdf0e10cSrcweir {
329cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
330cdf0e10cSrcweir
331cdf0e10cSrcweir // SAFE ->
332cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
333cdf0e10cSrcweir
334cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
335cdf0e10cSrcweir if (pIt == m_lProps.end())
336cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
337cdf0e10cSrcweir
338cdf0e10cSrcweir aReadLock.unlock();
339cdf0e10cSrcweir // <- SAFE
340cdf0e10cSrcweir
341cdf0e10cSrcweir m_lSimpleChangeListener.removeInterface(sProperty, xListener);
342cdf0e10cSrcweir }
343cdf0e10cSrcweir
344cdf0e10cSrcweir //-----------------------------------------------------------------------------
addVetoableChangeListener(const::rtl::OUString & sProperty,const css::uno::Reference<css::beans::XVetoableChangeListener> & xListener)345cdf0e10cSrcweir void SAL_CALL PropertySetHelper::addVetoableChangeListener(const ::rtl::OUString& sProperty,
346cdf0e10cSrcweir const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener)
347cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
348cdf0e10cSrcweir css::lang::WrappedTargetException ,
349cdf0e10cSrcweir css::uno::RuntimeException )
350cdf0e10cSrcweir {
351cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
352cdf0e10cSrcweir
353cdf0e10cSrcweir // SAFE ->
354cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
355cdf0e10cSrcweir
356cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
357cdf0e10cSrcweir if (pIt == m_lProps.end())
358cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
359cdf0e10cSrcweir
360cdf0e10cSrcweir aReadLock.unlock();
361cdf0e10cSrcweir // <- SAFE
362cdf0e10cSrcweir
363cdf0e10cSrcweir m_lVetoChangeListener.addInterface(sProperty, xListener);
364cdf0e10cSrcweir }
365cdf0e10cSrcweir
366cdf0e10cSrcweir //-----------------------------------------------------------------------------
removeVetoableChangeListener(const::rtl::OUString & sProperty,const css::uno::Reference<css::beans::XVetoableChangeListener> & xListener)367cdf0e10cSrcweir void SAL_CALL PropertySetHelper::removeVetoableChangeListener(const ::rtl::OUString& sProperty,
368cdf0e10cSrcweir const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener)
369cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
370cdf0e10cSrcweir css::lang::WrappedTargetException ,
371cdf0e10cSrcweir css::uno::RuntimeException )
372cdf0e10cSrcweir {
373cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_SOFTEXCEPTIONS);
374cdf0e10cSrcweir
375cdf0e10cSrcweir // SAFE ->
376cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
377cdf0e10cSrcweir
378cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sProperty);
379cdf0e10cSrcweir if (pIt == m_lProps.end())
380cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
381cdf0e10cSrcweir
382cdf0e10cSrcweir aReadLock.unlock();
383cdf0e10cSrcweir // <- SAFE
384cdf0e10cSrcweir
385cdf0e10cSrcweir m_lVetoChangeListener.removeInterface(sProperty, xListener);
386cdf0e10cSrcweir }
387cdf0e10cSrcweir
388cdf0e10cSrcweir //-----------------------------------------------------------------------------
getProperties()389cdf0e10cSrcweir css::uno::Sequence< css::beans::Property > SAL_CALL PropertySetHelper::getProperties()
390cdf0e10cSrcweir throw(css::uno::RuntimeException)
391cdf0e10cSrcweir {
392cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
393cdf0e10cSrcweir
394cdf0e10cSrcweir // SAFE ->
395cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
396cdf0e10cSrcweir
397cdf0e10cSrcweir sal_Int32 c = (sal_Int32)m_lProps.size();
398cdf0e10cSrcweir css::uno::Sequence< css::beans::Property > lProps(c);
399cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt ;
400cdf0e10cSrcweir
401cdf0e10cSrcweir for ( pIt = m_lProps.begin();
402cdf0e10cSrcweir pIt != m_lProps.end() ;
403cdf0e10cSrcweir ++pIt )
404cdf0e10cSrcweir {
405cdf0e10cSrcweir lProps[--c] = pIt->second;
406cdf0e10cSrcweir }
407cdf0e10cSrcweir
408cdf0e10cSrcweir return lProps;
409cdf0e10cSrcweir // <- SAFE
410cdf0e10cSrcweir }
411cdf0e10cSrcweir
412cdf0e10cSrcweir //-----------------------------------------------------------------------------
getPropertyByName(const::rtl::OUString & sName)413cdf0e10cSrcweir css::beans::Property SAL_CALL PropertySetHelper::getPropertyByName(const ::rtl::OUString& sName)
414cdf0e10cSrcweir throw(css::beans::UnknownPropertyException,
415cdf0e10cSrcweir css::uno::RuntimeException )
416cdf0e10cSrcweir {
417cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
418cdf0e10cSrcweir
419cdf0e10cSrcweir // SAFE ->
420cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
421cdf0e10cSrcweir
422cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::const_iterator pIt = m_lProps.find(sName);
423cdf0e10cSrcweir if (pIt == m_lProps.end())
424cdf0e10cSrcweir throw css::beans::UnknownPropertyException();
425cdf0e10cSrcweir
426cdf0e10cSrcweir return pIt->second;
427cdf0e10cSrcweir // <- SAFE
428cdf0e10cSrcweir }
429cdf0e10cSrcweir
430cdf0e10cSrcweir //-----------------------------------------------------------------------------
hasPropertyByName(const::rtl::OUString & sName)431cdf0e10cSrcweir sal_Bool SAL_CALL PropertySetHelper::hasPropertyByName(const ::rtl::OUString& sName)
432cdf0e10cSrcweir throw(css::uno::RuntimeException)
433cdf0e10cSrcweir {
434cdf0e10cSrcweir TransactionGuard aTransaction(m_rTransactionManager, E_HARDEXCEPTIONS);
435cdf0e10cSrcweir
436cdf0e10cSrcweir // SAFE ->
437cdf0e10cSrcweir ReadGuard aReadLock(m_rLock);
438cdf0e10cSrcweir
439cdf0e10cSrcweir PropertySetHelper::TPropInfoHash::iterator pIt = m_lProps.find(sName);
440cdf0e10cSrcweir sal_Bool bExist = (pIt != m_lProps.end());
441cdf0e10cSrcweir
442cdf0e10cSrcweir return bExist;
443cdf0e10cSrcweir // <- SAFE
444cdf0e10cSrcweir }
445cdf0e10cSrcweir
446cdf0e10cSrcweir } // namespace framework
447