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 .
19 #ifndef INCLUDED_BASIC_SOURCE_INC_PROPACC_HXX
20 #define INCLUDED_BASIC_SOURCE_INC_PROPACC_HXX
22 #include <com/sun/star/beans/PropertyValue.hpp>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/beans/XPropertySetInfo.hpp>
25 #include <com/sun/star/beans/XPropertyAccess.hpp>
26 #include <com/sun/star/beans/XPropertyContainer.hpp>
27 #include <cppuhelper/implbase1.hxx>
28 #include <cppuhelper/implbase2.hxx>
29 #include <boost/ptr_container/ptr_vector.hpp>
31 typedef ::boost::ptr_vector
< ::com::sun::star::beans::PropertyValue
>
32 SbPropertyValueArr_Impl
;
34 typedef ::cppu::WeakImplHelper2
< ::com::sun::star::beans::XPropertySet
,
35 ::com::sun::star::beans::XPropertyAccess
> SbPropertyValuesHelper
;
40 class SbPropertyValues
: public SbPropertyValuesHelper
42 SbPropertyValueArr_Impl m_aPropVals
;
43 ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> m_xInfo
;
46 size_t GetIndex_Impl( const OUString
&rPropName
) const;
50 virtual ~SbPropertyValues();
53 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySetInfo
> SAL_CALL
54 getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
55 virtual void SAL_CALL
setPropertyValue(
56 const OUString
& aPropertyName
,
57 const ::com::sun::star::uno::Any
& aValue
)
58 throw (::com::sun::star::beans::UnknownPropertyException
,
59 ::com::sun::star::beans::PropertyVetoException
,
60 ::com::sun::star::lang::IllegalArgumentException
,
61 ::com::sun::star::lang::WrappedTargetException
,
62 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
63 virtual ::com::sun::star::uno::Any SAL_CALL
getPropertyValue( const OUString
& PropertyName
)
64 throw( ::com::sun::star::beans::UnknownPropertyException
,
65 ::com::sun::star::lang::WrappedTargetException
,
66 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
67 virtual void SAL_CALL
addPropertyChangeListener(
68 const OUString
& aPropertyName
,
69 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& )
70 throw (std::exception
) SAL_OVERRIDE
;
71 virtual void SAL_CALL
removePropertyChangeListener(
72 const OUString
& aPropertyName
,
73 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertyChangeListener
>& )
74 throw (std::exception
) SAL_OVERRIDE
;
75 virtual void SAL_CALL
addVetoableChangeListener(
76 const OUString
& aPropertyName
,
77 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& )
78 throw (std::exception
) SAL_OVERRIDE
;
79 virtual void SAL_CALL
removeVetoableChangeListener(
80 const OUString
& aPropertyName
,
81 const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XVetoableChangeListener
>& )
82 throw (std::exception
) SAL_OVERRIDE
;
85 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
> SAL_CALL
getPropertyValues() throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
86 virtual void SAL_CALL
setPropertyValues(const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::PropertyValue
>& PropertyValues_
) 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
, std::exception
) SAL_OVERRIDE
;
91 typedef ::cppu::WeakImplHelper1
< ::com::sun::star::beans::XPropertySetInfo
> SbPropertySetInfoHelper
;
93 // AB 20.3.2000 Help Class for XPropertySetInfo implementation
94 class PropertySetInfoImpl
96 friend class SbPropertySetInfo
;
98 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> _aProps
;
100 sal_Int32
GetIndex_Impl( const OUString
&rPropName
) const;
103 PropertySetInfoImpl();
104 PropertySetInfoImpl( ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& rProps
);
107 ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
getProperties() throw () { return _aProps
;}
108 ::com::sun::star::beans::Property SAL_CALL
getPropertyByName(const OUString
& Name
)
109 throw( ::com::sun::star::uno::RuntimeException
);
110 bool SAL_CALL
hasPropertyByName(const OUString
& Name
)
111 throw ( ::com::sun::star::uno::RuntimeException
);
114 class SbPropertySetInfo
: public SbPropertySetInfoHelper
116 PropertySetInfoImpl aImpl
;
119 SbPropertySetInfo( const SbPropertyValueArr_Impl
&rPropVals
);
120 virtual ~SbPropertySetInfo();
123 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
getProperties()
124 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
125 virtual ::com::sun::star::beans::Property SAL_CALL
getPropertyByName(const OUString
& Name
)
126 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
127 virtual sal_Bool SAL_CALL
hasPropertyByName(const OUString
& Name
)
128 throw( ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
136 void RTL_Impl_CreatePropertySet( StarBASIC
* pBasic
, SbxArray
& rPar
, bool bWrite
);
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */