LibreOffice Module comphelper (master) 1
ChainablePropertySet.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_CHAINABLEPROPERTYSET_HXX
21#define INCLUDED_COMPHELPER_CHAINABLEPROPERTYSET_HXX
22
23#include <com/sun/star/beans/XPropertySet.hpp>
24#include <com/sun/star/beans/XPropertyState.hpp>
25#include <com/sun/star/beans/XMultiPropertySet.hpp>
26#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <rtl/ref.hxx>
30
31namespace comphelper { class SolarMutex; }
32namespace comphelper { struct PropertyInfo; }
33
34namespace comphelper
35{
36 class ChainablePropertySetInfo;
37}
38
39/*
40 * A ChainablePropertySet has the following features:
41 *
42 * 1. It implements both the PropertySet and MultiPropertySet interfaces.
43 * 2. It can be 'included' in a MasterPropertySet to seamlessly appear as if
44 * if it's properties were in the master.
45 *
46 * To be used as a base class for PropertySets, the subclass must implement
47 * the 6 protected pure virtual functions. If a mutex is passed to the
48 * constructor, this is locked before any call to _getSingleValue or
49 * _setSingleValue and released after all processing has completed
50 * (including _postSetValues or _postGetValues )
51 *
52 * Any MasterPropertySet implementations that can include an
53 * implementation of a given ChainablePropertySet must be
54 * declared as a 'friend' in the implementation of the ChainablePropertySet.
55 *
56 */
57
58namespace comphelper
59{
60 typedef cppu::WeakImplHelper
61 <
62 css::beans::XPropertySet,
63 css::beans::XMultiPropertySet,
64 css::lang::XServiceInfo
65 >
68 public css::beans::XPropertyState
69 {
70 friend class MasterPropertySet;
71 protected:
74
80 virtual void _preSetValues () = 0;
86 virtual void _setSingleValue(const comphelper::PropertyInfo & rInfo, const css::uno::Any &rValue) = 0;
92 virtual void _postSetValues () = 0;
93
99 virtual void _preGetValues () = 0;
103 virtual void _getSingleValue( const comphelper::PropertyInfo & rInfo, css::uno::Any & rValue ) = 0;
108 virtual void _postGetValues () = 0;
109
110 public:
112 noexcept;
113 virtual ~ChainablePropertySet()
114 noexcept override;
115
116 css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override
117 { return ChainablePropertySetBase::queryInterface( aType ); }
118 void SAL_CALL acquire( ) noexcept override
119 { ChainablePropertySetBase::acquire( ); }
120 void SAL_CALL release( ) noexcept override
121 { ChainablePropertySetBase::release( ); }
122
123 // XPropertySet
124 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
125 virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
126 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override;
127 virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override;
128 virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override;
129 virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
130 virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override;
131
132 // XMultiPropertySet
133 virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override;
134 virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override;
135 virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
136 virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
137 virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override;
138
139 // XPropertyState
140 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override;
141 virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override;
142 virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override;
143 virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override;
144 };
145}
146#endif
147
148/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SAL_CALL acquire() noexcept override
virtual void _getSingleValue(const comphelper::PropertyInfo &rInfo, css::uno::Any &rValue)=0
void SAL_CALL release() noexcept override
rtl::Reference< ChainablePropertySetInfo > mxInfo
virtual void _setSingleValue(const comphelper::PropertyInfo &rInfo, const css::uno::Any &rValue)=0
SolarMutex, needed for VCL's Application::GetSolarMutex().
Definition: solarmutex.hxx:46
#define COMPHELPER_DLLPUBLIC
cppu::WeakImplHelper< css::beans::XPropertySet, css::beans::XMultiPropertySet, css::lang::XServiceInfo > ChainablePropertySetBase
Type
VBAHELPER_DLLPUBLIC bool setPropertyValue(css::uno::Sequence< css::beans::PropertyValue > &aProp, const OUString &aName, const css::uno::Any &aValue)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)