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_SVL_ITEMPROP_HXX
20 #define INCLUDED_SVL_ITEMPROP_HXX
22 #include <com/sun/star/beans/XPropertySetInfo.hpp>
23 #include <com/sun/star/beans/PropertyState.hpp>
24 #include <com/sun/star/lang/IllegalArgumentException.hpp>
25 #include <cppuhelper/implbase1.hxx>
26 #include <svl/itemset.hxx>
27 #include <svl/svldllapi.h>
30 struct SfxItemPropertyMapEntry
34 com::sun::star::uno::Type aType
;
40 struct SfxItemPropertySimpleEntry
43 com::sun::star::uno::Type aType
;
47 SfxItemPropertySimpleEntry()
54 SfxItemPropertySimpleEntry(sal_uInt16 _nWID
, com::sun::star::uno::Type
const & _rType
,
55 long _nFlags
, sal_uInt8 _nMemberId
)
59 , nMemberId( _nMemberId
)
63 SfxItemPropertySimpleEntry( const SfxItemPropertyMapEntry
* pMapEntry
)
64 : nWID( pMapEntry
->nWID
)
65 , aType( pMapEntry
->aType
)
66 , nFlags( pMapEntry
->nFlags
)
67 , nMemberId( pMapEntry
->nMemberId
)
72 struct SfxItemPropertyNamedEntry
: public SfxItemPropertySimpleEntry
75 SfxItemPropertyNamedEntry( const OUString
& rName
, const SfxItemPropertySimpleEntry
& rSimpleEntry
)
76 : SfxItemPropertySimpleEntry( rSimpleEntry
)
82 typedef std::vector
< SfxItemPropertyNamedEntry
> PropertyEntryVector_t
;
83 class SfxItemPropertyMap_Impl
;
84 class SVL_DLLPUBLIC SfxItemPropertyMap
86 SfxItemPropertyMap_Impl
* m_pImpl
;
88 SfxItemPropertyMap( const SfxItemPropertyMapEntry
* pEntries
);
89 SfxItemPropertyMap( const SfxItemPropertyMap
& rSource
);
90 ~SfxItemPropertyMap();
92 const SfxItemPropertySimpleEntry
* getByName( const OUString
&rName
) const;
93 com::sun::star::uno::Sequence
< com::sun::star::beans::Property
> getProperties() const;
94 com::sun::star::beans::Property
getPropertyByName( const OUString
& rName
) const
95 throw( ::com::sun::star::beans::UnknownPropertyException
);
96 bool hasPropertyByName( const OUString
& rName
) const;
98 void mergeProperties( const ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
>& rPropSeq
);
99 PropertyEntryVector_t
getPropertyEntries() const;
100 sal_uInt32
getSize() const;
104 class SVL_DLLPUBLIC SfxItemPropertySet
106 SfxItemPropertyMap m_aMap
;
107 mutable com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySetInfo
> m_xInfo
;
110 SfxItemPropertySet( const SfxItemPropertyMapEntry
*pMap
) :
112 virtual ~SfxItemPropertySet();
114 void getPropertyValue( const SfxItemPropertySimpleEntry
& rEntry
,
115 const SfxItemSet
& rSet
,
116 com::sun::star::uno::Any
& rAny
) const
117 throw(::com::sun::star::uno::RuntimeException
);
118 void getPropertyValue( const OUString
&rName
,
119 const SfxItemSet
& rSet
,
120 com::sun::star::uno::Any
& rAny
) const
121 throw(::com::sun::star::uno::RuntimeException
,
122 ::com::sun::star::beans::UnknownPropertyException
);
123 com::sun::star::uno::Any
124 getPropertyValue( const OUString
&rName
,
125 const SfxItemSet
& rSet
) const
126 throw(::com::sun::star::uno::RuntimeException
,
127 ::com::sun::star::beans::UnknownPropertyException
);
128 void setPropertyValue( const SfxItemPropertySimpleEntry
& rEntry
,
129 const com::sun::star::uno::Any
& aVal
,
130 SfxItemSet
& rSet
) const
131 throw(::com::sun::star::uno::RuntimeException
,
132 com::sun::star::lang::IllegalArgumentException
);
133 void setPropertyValue( const OUString
& rPropertyName
,
134 const com::sun::star::uno::Any
& aVal
,
135 SfxItemSet
& rSet
) const
136 throw(::com::sun::star::uno::RuntimeException
,
137 com::sun::star::lang::IllegalArgumentException
,
138 ::com::sun::star::beans::UnknownPropertyException
);
140 com::sun::star::beans::PropertyState
141 getPropertyState(const OUString
& rName
, const SfxItemSet
& rSet
)const
142 throw(com::sun::star::beans::UnknownPropertyException
);
143 com::sun::star::beans::PropertyState
144 getPropertyState(const SfxItemPropertySimpleEntry
& rEntry
, const SfxItemSet
& rSet
) const
147 com::sun::star::uno::Reference
<com::sun::star::beans::XPropertySetInfo
>
148 getPropertySetInfo() const;
149 const SfxItemPropertyMap
& getPropertyMap() const {return m_aMap
;}
152 struct SfxItemPropertySetInfo_Impl
;
153 class SVL_DLLPUBLIC SfxItemPropertySetInfo
: public
154 cppu::WeakImplHelper1
<com::sun::star::beans::XPropertySetInfo
>
156 SfxItemPropertySetInfo_Impl
* m_pImpl
;
159 SfxItemPropertySetInfo(const SfxItemPropertyMap
&rMap
);
160 SfxItemPropertySetInfo(const SfxItemPropertyMapEntry
*pEntries
);
161 virtual ~SfxItemPropertySetInfo();
163 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
165 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
167 virtual ::com::sun::star::beans::Property SAL_CALL
168 getPropertyByName( const OUString
& aName
)
169 throw(::com::sun::star::beans::UnknownPropertyException
,
170 ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
172 virtual sal_Bool SAL_CALL
173 hasPropertyByName( const OUString
& Name
)
174 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
178 class SVL_DLLPUBLIC SfxExtItemPropertySetInfo
: public cppu::WeakImplHelper1
<com::sun::star::beans::XPropertySetInfo
>
180 SfxItemPropertyMap aExtMap
;
182 SfxExtItemPropertySetInfo(
183 const SfxItemPropertyMapEntry
*pMap
,
184 const com::sun::star::uno::Sequence
<com::sun::star::beans::Property
>& rPropSeq
);
185 virtual ~SfxExtItemPropertySetInfo();
187 virtual ::com::sun::star::uno::Sequence
< ::com::sun::star::beans::Property
> SAL_CALL
189 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
191 virtual ::com::sun::star::beans::Property SAL_CALL
192 getPropertyByName( const OUString
& aName
)
193 throw(::com::sun::star::beans::UnknownPropertyException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
195 virtual sal_Bool SAL_CALL
196 hasPropertyByName( const OUString
& Name
)
197 throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */