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>
26 
27 #include <memory>
28 
29 
30 namespace comphelper
31 {
32 
33 
34  struct PropertyBag_Impl;
35 
36  //= PropertyBag
37 
43  class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) PropertyBag final : protected OPropertyContainerHelper
44  {
45  private:
46  ::std::unique_ptr< PropertyBag_Impl > m_pImpl;
47 
48  public:
49  PropertyBag();
50  virtual ~PropertyBag();
51 
57  void setAllowEmptyPropertyName(bool i_isAllowed);
58 
81  void addProperty(
82  const OUString& _rName,
83  sal_Int32 _nHandle,
84  sal_Int32 _nAttributes,
85  const css::uno::Any& _rInitialValue
86  );
87 
109  void addVoidProperty(
110  const OUString& _rName,
111  const css::uno::Type& _rType,
112  sal_Int32 _nHandle,
113  sal_Int32 _nAttributes
114  );
115 
126  void removeProperty(
127  const OUString& _rName
128  );
129 
134  void describeProperties(
135  css::uno::Sequence< css::beans::Property >& _out_rProps
136  ) const
137  {
139  }
140 
149  void getFastPropertyValue(
150  sal_Int32 _nHandle,
151  css::uno::Any& _out_rValue
152  ) const;
153 
171  bool convertFastPropertyValue(
172  sal_Int32 _nHandle,
173  const css::uno::Any& _rNewValue,
174  css::uno::Any& _out_rConvertedValue,
175  css::uno::Any& _out_rCurrentValue
176  ) const;
177 
182  void setFastPropertyValue(
183  sal_Int32 _nHandle,
184  const css::uno::Any& _rValue
185  );
186 
199  void getPropertyDefaultByHandle(
200  sal_Int32 _nHandle,
201  css::uno::Any& _out_rValue
202  ) const;
203 
206  bool hasPropertyByName( const OUString& _rName ) const
207  {
208  return isRegisteredProperty( _rName );
209  }
210 
213  bool hasPropertyByHandle( sal_Int32 _nHandle ) const
214  {
215  return isRegisteredProperty( _nHandle );
216  }
217  protected:
220  };
221 
222 
223 } // namespace comphelper
224 
225 
226 #endif // INCLUDED_COMPHELPER_PROPERTYBAG_HXX
227 
228 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::set< css::beans::Property, PropertyLessByName > PropertyBag
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...
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)
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl