LibreOffice Module extensions (master) 1
propertycomposer.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 "pcrcommon.hxx"
23#include "composeduiupdate.hxx"
24#include "formbrowsertools.hxx"
25
26#include <com/sun/star/inspection/XPropertyHandler.hpp>
27#include <com/sun/star/lang/DisposedException.hpp>
30
31#include <memory>
32#include <vector>
33#include <set>
34
35
36namespace pcr
37{
38
39
40 //= PropertyComposer
41
42 typedef ::cppu::WeakComponentImplHelper < css::inspection::XPropertyHandler
43 , css::beans::XPropertyChangeListener
51 {
52 public:
53 typedef std::vector< css::uno::Reference< css::inspection::XPropertyHandler > >
55
56 private:
58 std::unique_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer;
62
63 public:
70 explicit PropertyComposer( std::vector< css::uno::Reference< css::inspection::XPropertyHandler > >&& _rSlaveHandlers );
71
72 public:
73 // XPropertyHandler overridables
74 virtual void SAL_CALL inspect( const css::uno::Reference< css::uno::XInterface >& _rxIntrospectee ) override;
75 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override;
76 virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override;
77 virtual css::uno::Any SAL_CALL convertToPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rControlValue ) override;
78 virtual css::uno::Any SAL_CALL convertToControlValue( const OUString& _rPropertyName, const css::uno::Any& _rPropertyValue, const css::uno::Type& _rControlValueType ) override;
79 virtual css::beans::PropertyState
80 SAL_CALL getPropertyState( const OUString& _rPropertyName ) override;
81 virtual void SAL_CALL addPropertyChangeListener( const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener ) override;
82 virtual void SAL_CALL removePropertyChangeListener( const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener ) override;
83 virtual css::uno::Sequence< css::beans::Property >
84 SAL_CALL getSupportedProperties() override;
85 virtual css::uno::Sequence< OUString >
86 SAL_CALL getSupersededProperties( ) override;
87 virtual css::uno::Sequence< OUString >
88 SAL_CALL getActuatingProperties( ) override;
89 virtual css::inspection::LineDescriptor
90 SAL_CALL describePropertyLine( const OUString& _rPropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory ) override;
91 virtual sal_Bool SAL_CALL isComposable( const OUString& _rPropertyName ) override;
92 virtual css::inspection::InteractiveSelectionResult
93 SAL_CALL onInteractivePropertySelection( const OUString& _rPropertyName, sal_Bool _bPrimary, css::uno::Any& _rData, const css::uno::Reference< css::inspection::XObjectInspectorUI >& _rxInspectorUI ) override;
94 virtual void SAL_CALL actuatingPropertyChanged( const OUString& _rActuatingPropertyName, const css::uno::Any& _rNewValue, const css::uno::Any& _rOldValue, const css::uno::Reference< css::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) override;
95 virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) override;
96
97 // XComponent
99 virtual void SAL_CALL disposing() override;
100
101 // XPropertyChangeListener
102 virtual void SAL_CALL propertyChange( const css::beans::PropertyChangeEvent& evt ) override;
103
104 // XEventListener
105 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
106
107 // IPropertyExistenceCheck
108 virtual bool hasPropertyByName( const OUString& _rName ) override;
109
110 private:
113 void impl_ensureUIRequestComposer( const css::uno::Reference< css::inspection::XObjectInspectorUI >& _rxInspectorUI );
114
117 bool impl_isSupportedProperty_nothrow( const OUString& _rPropertyName )
118 {
119 css::beans::Property aDummy; aDummy.Name = _rPropertyName;
120 return m_aSupportedProperties.find( aDummy ) != m_aSupportedProperties.end();
121 }
122
123 private:
124 class MethodGuard;
125 friend class MethodGuard;
126 class MethodGuard : public ::osl::MutexGuard
127 {
128 public:
129 explicit MethodGuard( PropertyComposer& _rInstance )
130 : ::osl::MutexGuard( _rInstance.m_aMutex )
131 {
132 if ( _rInstance.m_aSlaveHandlers.empty() )
133 throw css::lang::DisposedException( OUString(), _rInstance );
134 }
135 };
136 };
137
138
139} // namespace pcr
140
141
142/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
mutable::osl::Mutex m_aMutex
callback for a ComposedPropertyUIUpdate checking a given property for existence
MethodGuard(PropertyComposer &_rInstance)
implements an <type>XPropertyHandler</type> which composes its information from a set of other proper...
std::unique_ptr< ComposedPropertyUIUpdate > m_pUIRequestComposer
virtual void SAL_CALL inspect(const css::uno::Reference< css::uno::XInterface > &_rxIntrospectee) override
virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString &_rPropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory) override
virtual sal_Bool SAL_CALL isComposable(const OUString &_rPropertyName) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override
virtual void SAL_CALL propertyChange(const css::beans::PropertyChangeEvent &evt) override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &_rPropertyName) override
std::vector< css::uno::Reference< css::inspection::XPropertyHandler > > HandlerArray
virtual css::uno::Any SAL_CALL convertToPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rControlValue) override
virtual void SAL_CALL setPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rValue) override
virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override
bool impl_isSupportedProperty_nothrow(const OUString &_rPropertyName)
checks whether a given property exists in <member>m_aSupportedProperties</member>
PropertyBag m_aSupportedProperties
virtual void SAL_CALL actuatingPropertyChanged(const OUString &_rActuatingPropertyName, const css::uno::Any &_rNewValue, const css::uno::Any &_rOldValue, const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI, sal_Bool _bFirstTimeInit) override
virtual void SAL_CALL addPropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener) override
void impl_ensureUIRequestComposer(const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI)
ensures that m_pUIRequestComposer exists
PropertyChangeListeners m_aPropertyListeners
virtual void SAL_CALL removePropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener) override
virtual bool hasPropertyByName(const OUString &_rName) override
virtual css::inspection::InteractiveSelectionResult SAL_CALL onInteractivePropertySelection(const OUString &_rPropertyName, sal_Bool _bPrimary, css::uno::Any &_rData, const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI) override
virtual void SAL_CALL disposing() override
virtual sal_Bool SAL_CALL suspend(sal_Bool _bSuspend) override
virtual css::uno::Any SAL_CALL convertToControlValue(const OUString &_rPropertyName, const css::uno::Any &_rPropertyValue, const css::uno::Type &_rControlValueType) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &_rPropertyName) override
PropertyComposer(std::vector< css::uno::Reference< css::inspection::XPropertyHandler > > &&_rSlaveHandlers)
constructs an <type>XPropertyHandler</type> which composes its information from a set of other proper...
virtual css::uno::Sequence< css::beans::Property > SAL_CALL getSupportedProperties() override
a property handler for any virtual string properties
Definition: browserline.cxx:39
std::set< css::beans::Property, PropertyLessByName > PropertyBag
::cppu::WeakComponentImplHelper< css::inspection::XPropertyHandler, css::beans::XPropertyChangeListener > PropertyComposer_Base
#define DECLARE_XCOMPONENT()
Definition: pcrcommon.hxx:100
unsigned char sal_Bool