LibreOffice Module forms (master) 1
propertybaghelper.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#pragma once
21
22#include <com/sun/star/beans/PropertyValue.hpp>
23
26#include <memory>
27
28
29namespace frm
30{
31
32
33 //= class IPropertyBagHelperContext
34
36 {
37 public:
38 virtual ::osl::Mutex& getMutex() = 0;
39
41 css::uno::Sequence< css::beans::Property >& _out_rFixedProperties,
42 css::uno::Sequence< css::beans::Property >& _out_rAggregateProperties
43 ) const = 0;
44
45 virtual css::uno::Reference< css::beans::XMultiPropertySet >
47
48 protected:
50 };
51
53 {
54 private:
56 std::unique_ptr<::comphelper::OPropertyArrayAggregationHelper>
58 ::comphelper::PropertyBag m_aDynamicProperties;
60
61 public:
66
67 // XComponent equivalent
68 void dispose();
69
70 // OPropertySetHelper equivalent
71 inline ::comphelper::OPropertyArrayAggregationHelper& getInfoHelper() const;
72
73 // XPropertyContainer equivalent
74 void addProperty( const OUString& _rName, ::sal_Int16 _nAttributes, const css::uno::Any& _rInitialValue );
75 void removeProperty( const OUString& _rName );
76
77 // XPropertyAccess equivalent
78 css::uno::Sequence< css::beans::PropertyValue > getPropertyValues();
79 void setPropertyValues( const css::uno::Sequence< css::beans::PropertyValue >& _rProps );
80
81 // forwards to m_aDynamicProperties
82 inline void getDynamicFastPropertyValue( sal_Int32 _nHandle, css::uno::Any& _out_rValue ) const;
83 inline bool convertDynamicFastPropertyValue( sal_Int32 _nHandle, const css::uno::Any& _rNewValue, css::uno::Any& _out_rConvertedValue, css::uno::Any& _out_rCurrentValue ) const;
84 inline void setDynamicFastPropertyValue( sal_Int32 _nHandle, const css::uno::Any& _rValue );
85 inline void getDynamicPropertyDefaultByHandle( sal_Int32 _nHandle, css::uno::Any& _out_rValue ) const;
86 inline bool hasDynamicPropertyByHandle( sal_Int32 _nHandle ) const;
87
88 private:
90
95
99
105 sal_Int32 impl_findFreeHandle( const OUString& _rPropertyName );
106 };
107
108
109 inline ::comphelper::OPropertyArrayAggregationHelper& PropertyBagHelper::getInfoHelper() const
110 {
111 return impl_ts_getArrayHelper();
112 }
113
114
115 inline void PropertyBagHelper::getDynamicFastPropertyValue( sal_Int32 _nHandle, css::uno::Any& _out_rValue ) const
116 {
117 m_aDynamicProperties.getFastPropertyValue( _nHandle, _out_rValue );
118 }
119
120
121 inline bool PropertyBagHelper::convertDynamicFastPropertyValue( sal_Int32 _nHandle, const css::uno::Any& _rNewValue, css::uno::Any& _out_rConvertedValue, css::uno::Any& _out_rCurrentValue ) const
122 {
123 return m_aDynamicProperties.convertFastPropertyValue( _nHandle, _rNewValue, _out_rConvertedValue, _out_rCurrentValue );
124 }
125
126
127 inline void PropertyBagHelper::setDynamicFastPropertyValue( sal_Int32 _nHandle, const css::uno::Any& _rValue )
128 {
129 m_aDynamicProperties.setFastPropertyValue( _nHandle, _rValue );
130 }
131
132
133 inline void PropertyBagHelper::getDynamicPropertyDefaultByHandle( sal_Int32 _nHandle, css::uno::Any& _out_rValue ) const
134 {
135 m_aDynamicProperties.getPropertyDefaultByHandle( _nHandle, _out_rValue );
136 }
137
138 inline bool PropertyBagHelper::hasDynamicPropertyByHandle( sal_Int32 _nHandle ) const
139 {
140 return m_aDynamicProperties.hasPropertyByHandle( _nHandle );
141 }
142
143
144} // namespace frm
145
146
147/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ::osl::Mutex & getMutex()=0
virtual void describeFixedAndAggregateProperties(css::uno::Sequence< css::beans::Property > &_out_rFixedProperties, css::uno::Sequence< css::beans::Property > &_out_rAggregateProperties) const =0
virtual css::uno::Reference< css::beans::XMultiPropertySet > getPropertiesInterface()=0
PropertyBagHelper(IPropertyBagHelperContext &_rContext)
::comphelper::PropertyBag m_aDynamicProperties
css::uno::Sequence< css::beans::PropertyValue > getPropertyValues()
bool convertDynamicFastPropertyValue(sal_Int32 _nHandle, const css::uno::Any &_rNewValue, css::uno::Any &_out_rConvertedValue, css::uno::Any &_out_rCurrentValue) const
PropertyBagHelper & operator=(const PropertyBagHelper &)=delete
void getDynamicPropertyDefaultByHandle(sal_Int32 _nHandle, css::uno::Any &_out_rValue) const
void getDynamicFastPropertyValue(sal_Int32 _nHandle, css::uno::Any &_out_rValue) const
void removeProperty(const OUString &_rName)
sal_Int32 impl_findFreeHandle(const OUString &_rPropertyName)
finds a free property handle
void addProperty(const OUString &_rName, ::sal_Int16 _nAttributes, const css::uno::Any &_rInitialValue)
void setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &_rProps)
bool hasDynamicPropertyByHandle(sal_Int32 _nHandle) const
PropertyBagHelper(const PropertyBagHelper &)=delete
::comphelper::OPropertyArrayAggregationHelper & impl_ts_getArrayHelper() const
returns the IPropertyArrayHelper instance used by |this|
void impl_nts_checkDisposed_throw() const
inline ::comphelper::OPropertyArrayAggregationHelper & getInfoHelper() const
IPropertyBagHelperContext & m_rContext
std::unique_ptr<::comphelper::OPropertyArrayAggregationHelper > m_pPropertyArrayHelper
void impl_nts_invalidatePropertySetInfo()
invalidates our property set info, so subsequent calls to impl_ts_getArrayHelper and thus getInfoHelp...
void setDynamicFastPropertyValue(sal_Int32 _nHandle, const css::uno::Any &_rValue)
ListBox is a bit confusing / different from other form components, so here are a few notes:
Definition: BaseListBox.hxx:25
#define SAL_NO_VTABLE