Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_BASIC_SOURCE_INC_PROPACC_HXX
20 : #define INCLUDED_BASIC_SOURCE_INC_PROPACC_HXX
21 :
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>
30 :
31 : typedef ::boost::ptr_vector< ::com::sun::star::beans::PropertyValue >
32 : SbPropertyValueArr_Impl;
33 :
34 : typedef ::cppu::WeakImplHelper2< ::com::sun::star::beans::XPropertySet,
35 : ::com::sun::star::beans::XPropertyAccess > SbPropertyValuesHelper;
36 :
37 :
38 :
39 :
40 : class SbPropertyValues: public SbPropertyValuesHelper
41 : {
42 : SbPropertyValueArr_Impl m_aPropVals;
43 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > m_xInfo;
44 :
45 : private:
46 : size_t GetIndex_Impl( const OUString &rPropName ) const;
47 :
48 : public:
49 : SbPropertyValues();
50 : virtual ~SbPropertyValues();
51 :
52 : // XPropertySet
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;
83 :
84 : // XPropertyAccess
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;
87 : };
88 :
89 :
90 :
91 : typedef ::cppu::WeakImplHelper1< ::com::sun::star::beans::XPropertySetInfo > SbPropertySetInfoHelper;
92 :
93 : // AB 20.3.2000 Help Class for XPropertySetInfo implementation
94 0 : class PropertySetInfoImpl
95 : {
96 : friend class SbPropertySetInfo;
97 :
98 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > _aProps;
99 :
100 : sal_Int32 GetIndex_Impl( const OUString &rPropName ) const;
101 :
102 : public:
103 : PropertySetInfoImpl();
104 : PropertySetInfoImpl( ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& rProps );
105 :
106 : // XPropertySetInfo
107 0 : ::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 );
112 : };
113 :
114 : class SbPropertySetInfo: public SbPropertySetInfoHelper
115 : {
116 : PropertySetInfoImpl aImpl;
117 :
118 : public:
119 : SbPropertySetInfo( const SbPropertyValueArr_Impl &rPropVals );
120 : virtual ~SbPropertySetInfo();
121 :
122 : // XPropertySetInfo
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;
129 : };
130 :
131 :
132 :
133 : class StarBASIC;
134 : class SbxArray;
135 :
136 : void RTL_Impl_CreatePropertySet( StarBASIC* pBasic, SbxArray& rPar, bool bWrite );
137 :
138 : #endif
139 :
140 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|