1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: propertysethelper.cxx,v $
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 "propertysethelper.hxx"
35 #include <com/sun/star/lang/XTypeProvider.hpp>
37 #include <cppuhelper/typeprovider.hxx>
39 //..........................................................................
42 //..........................................................................
43 namespace uno
= com::sun::star::uno
;
44 namespace lang
= com::sun::star::lang
;
45 namespace beans
= com::sun::star::beans
;
46 //..........................................................................
47 PropertySetHelper::PropertySetHelper()
50 , cppu::OPropertySetHelper( BroadcasterBase::getBroadcastHelper() )
55 //..........................................................................
56 PropertySetHelper::~PropertySetHelper()
61 //..........................................................................
63 uno::Any SAL_CALL
PropertySetHelper::queryInterface( uno::Type
const & rType
) throw (uno::RuntimeException
)
65 uno::Any aResult
= cppu::OPropertySetHelper::queryInterface(rType
);
66 if (!aResult
.hasValue())
67 aResult
= OWeakObject::queryInterface(rType
);
71 void SAL_CALL
PropertySetHelper::acquire() throw ()
73 OWeakObject::acquire();
76 void SAL_CALL
PropertySetHelper::release() throw ()
81 OWeakObject::release();
84 //..........................................................................
86 uno::Sequence
< uno::Type
> SAL_CALL
PropertySetHelper::getTypes() throw (uno::RuntimeException
)
88 // could be static instance
89 cppu::OTypeCollection
aTypes(
90 ::getCppuType( static_cast< uno::Reference
< beans::XPropertySet
> const * >(0) ),
91 ::getCppuType( static_cast< uno::Reference
< beans::XMultiPropertySet
> const * >(0) ),
92 ::getCppuType( static_cast< uno::Reference
< beans::XFastPropertySet
> const * >(0) ),
93 ::getCppuType( static_cast< uno::Reference
< lang::XTypeProvider
> const * >(0) ) );
95 return aTypes
.getTypes();
98 //..........................................................................
99 // cppu::OPropertySetHelper
100 uno::Reference
< beans::XPropertySetInfo
> SAL_CALL
PropertySetHelper::getPropertySetInfo( )
101 throw (uno::RuntimeException
)
103 return createPropertySetInfo(getInfoHelper());
106 //..........................................................................
107 cppu::IPropertyArrayHelper
& SAL_CALL
PropertySetHelper::getInfoHelper()
109 osl::MutexGuard
aGuard( getBroadcastMutex() );
111 m_pHelper
= newInfoHelper();
113 OSL_ENSURE(m_pHelper
,"Derived class did not create new PropertyInfoHelper");
115 throw uno::RuntimeException(rtl::OUString::createFromAscii("No PropertyArrayHelper available"),*this);
120 //..........................................................................
121 sal_Bool SAL_CALL
PropertySetHelper::convertFastPropertyValue(
122 uno::Any
& rConvertedValue
, uno::Any
& rOldValue
, sal_Int32 nHandle
, const uno::Any
& rValue
)
123 throw (lang::IllegalArgumentException
)
125 this->getFastPropertyValue(rOldValue
, nHandle
);
126 rConvertedValue
= rValue
;
127 return rValue
.isExtractableTo( rOldValue
.getValueType() );
129 //..........................................................................
130 } // namespace apihelper
131 } // namespace configmgr
132 //..........................................................................