LibreOffice Module comphelper (master) 1
propertybag.hxx
Go to the documentation of this file.
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
20#ifndef INCLUDED_COMPHELPER_PROPERTYBAG_HXX
21#define INCLUDED_COMPHELPER_PROPERTYBAG_HXX
22
23#include <config_options.h>
24#include <com/sun/star/uno/Any.h>
27
28#include <map>
29
30
31namespace comphelper
32{
33
34
35 //= PropertyBag
36
42 class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) PropertyBag final : protected OPropertyContainerHelper
43 {
44 std::map< sal_Int32, css::uno::Any > aDefaults;
45 bool m_bAllowEmptyPropertyName;
46 public:
48 virtual ~PropertyBag();
49
55 void setAllowEmptyPropertyName(bool i_isAllowed);
56
79 void addProperty(
80 const OUString& _rName,
81 sal_Int32 _nHandle,
82 sal_Int32 _nAttributes,
83 const css::uno::Any& _rInitialValue
84 );
85
107 void addVoidProperty(
108 const OUString& _rName,
109 const css::uno::Type& _rType,
110 sal_Int32 _nHandle,
111 sal_Int32 _nAttributes
112 );
113
124 void removeProperty(
125 const OUString& _rName
126 );
127
132 void describeProperties(
133 css::uno::Sequence< css::beans::Property >& _out_rProps
134 ) const
135 {
137 }
138
147 void getFastPropertyValue(
148 sal_Int32 _nHandle,
149 css::uno::Any& _out_rValue
150 ) const;
151
169 bool convertFastPropertyValue(
170 sal_Int32 _nHandle,
171 const css::uno::Any& _rNewValue,
172 css::uno::Any& _out_rConvertedValue,
173 css::uno::Any& _out_rCurrentValue
174 ) const;
175
180 void setFastPropertyValue(
181 sal_Int32 _nHandle,
182 const css::uno::Any& _rValue
183 );
184
197 void getPropertyDefaultByHandle(
198 sal_Int32 _nHandle,
199 css::uno::Any& _out_rValue
200 ) const;
201
204 bool hasPropertyByName( const OUString& _rName ) const
205 {
206 return isRegisteredProperty( _rName );
207 }
208
211 bool hasPropertyByHandle( sal_Int32 _nHandle ) const
212 {
213 return isRegisteredProperty( _nHandle );
214 }
215 protected:
218 };
219
220
221} // namespace comphelper
222
223
224#endif // INCLUDED_COMPHELPER_PROPERTYBAG_HXX
225
226/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void getFastPropertyValue(css::uno::Any &rValue, sal_Int32 nHandle) const
bool convertFastPropertyValue(css::uno::Any &rConvertedValue, css::uno::Any &rOldValue, sal_Int32 nHandle, const css::uno::Any &rValue)
void describeProperties(css::uno::Sequence< css::beans::Property > &_rProps) const
appends the descriptions of all properties which were registered 'til that moment to the given sequen...
std::set< css::beans::Property, PropertyLessByName > PropertyBag