LibreOffice Module extensions (master) 1
formcomponenthandler.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 <memory>
23#include "propertyhandler.hxx"
24#include "sqlcommanddesign.hxx"
25#include <comphelper/uno3.hxx>
28#include <com/sun/star/beans/XPropertyState.hpp>
29#include <com/sun/star/sdbc/XRowSet.hpp>
30#include <com/sun/star/awt/XControlContainer.hpp>
32
33#include <set>
34
35
36namespace pcr
37{
38
39
40 //= ComponentClassification
41
43 {
47 };
48
49
50 //= FormComponentPropertyHandler
51
52 class FormComponentPropertyHandler;
53 typedef ::comphelper::OPropertyArrayUsageHelper<FormComponentPropertyHandler> FormComponentPropertyHandler_PROP;
59 {
60 private:
62 css::uno::Reference< css::beans::XPropertyState > m_xPropertyState;
64 css::uno::Reference< css::uno::XInterface > m_xObjectParent;
65
67 mutable ::dbtools::SharedConnection m_xRowSetConnection;
68 css::uno::Reference< css::sdbc::XRowSet > m_xRowSet;
73 css::uno::Reference< css::inspection::XObjectInspectorUI > m_xBrowserUI;
74
78 std::set< OUString > m_aPropertiesWithDefListEntry;
88 sal_Int16 m_nClassId;
89
90 public:
92 const css::uno::Reference< css::uno::XComponentContext >& _rxContext
93 );
94
96
97 // XPropertySet
98 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
99
100 protected:
101 virtual ~FormComponentPropertyHandler() override;
102
103 protected:
104 // XServiceInfo
105 virtual OUString SAL_CALL getImplementationName() override;
106 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
107
108 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
109 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override;
110 // XPropertyHandler overridables
111 virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& _rPropertyName ) override;
112 virtual void SAL_CALL setPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rValue ) override;
113 virtual css::uno::Any SAL_CALL convertToPropertyValue( const OUString& _rPropertyName, const css::uno::Any& _rControlValue ) override;
114 virtual css::uno::Any SAL_CALL convertToControlValue( const OUString& _rPropertyName, const css::uno::Any& _rPropertyValue, const css::uno::Type& _rControlValueType ) override;
115 virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& _rPropertyName ) override;
116 virtual void SAL_CALL addPropertyChangeListener( const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener ) override;
117 virtual void SAL_CALL removePropertyChangeListener( const css::uno::Reference< css::beans::XPropertyChangeListener >& _rxListener ) override;
118 virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override;
119 virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override;
120 virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine( const OUString& _rPropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory ) override;
121 virtual css::inspection::InteractiveSelectionResult
122 SAL_CALL onInteractivePropertySelection( const OUString& _rPropertyName, sal_Bool _bPrimary, css::uno::Any& _rData, const css::uno::Reference< css::inspection::XObjectInspectorUI >& _rxInspectorUI ) override;
123 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;
124 virtual sal_Bool SAL_CALL suspend( sal_Bool _bSuspend ) override;
125
126 // XComponent
127 virtual void SAL_CALL disposing() override;
128
129 // PropertyHandler
130 virtual css::uno::Sequence< css::beans::Property >
131 doDescribeSupportedProperties() const override;
132 virtual void onNewComponent() override;
133
134 private:
140
141 bool isReportModel() const;
142
145 css::uno::Any impl_getPropertyValue_throw( const OUString& _rPropertyName ) const;
146
147 // some property values are faked, and not used in the way they're provided by our component
148 void impl_normalizePropertyValue_nothrow( css::uno::Any& _rValue, PropertyId _nPropId ) const;
149
152 bool impl_shouldExcludeProperty_nothrow( const css::beans::Property& _rProperty ) const;
153
157 void impl_initFieldList_nothrow( std::vector< OUString >& rFieldNames ) const;
158
168 css::uno::Reference< css::sdbc::XRowSet > impl_getRowSet_throw( ) const;
169
172 css::uno::Reference< css::sdbc::XRowSet > impl_getRowSet_nothrow( ) const;
173
184
196 css::inspection::LineDescriptor& _out_rProperty,
197 const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory
198 ) const;
199
205 void impl_fillTableNames_throw( std::vector< OUString >& _out_rNames ) const;
206
212 void impl_fillQueryNames_throw( std::vector< OUString >& _out_rNames ) const;
213
219 void impl_fillQueryNames_throw( const css::uno::Reference< css::container::XNameAccess >& _xQueryNames
220 ,std::vector< OUString >& _out_rNames
221 ,std::u16string_view _sName = std::u16string_view() ) const;
222
230 css::inspection::LineDescriptor& _out_rDescriptor,
231 const css::uno::Reference< css::inspection::XPropertyControlFactory >& _rxControlFactory
232 ) const;
233
236 void impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const;
237
243 bool impl_dialogListSelection_nothrow( const OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
244
256 bool impl_dialogFilterOrSort_nothrow( bool _bFilter, OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
257
266 bool impl_dialogLinkedFormFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
267
278 bool impl_dialogFormatting_nothrow( css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
279
290 bool impl_browseForImage_nothrow( css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
291
302 bool impl_browseForTargetURL_nothrow( css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
303
313 bool impl_executeFontDialog_nothrow( css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
314
324 bool impl_browseForDatabaseDocument_throw( css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
325
334 bool impl_dialogColorChooser_throw( sal_Int32 _nColorPropertyId, css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
335
342 bool impl_dialogChooseLabelControl_nothrow( css::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
343
351 bool impl_dialogChangeTabOrder_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
352
362 css::uno::Reference< css::awt::XControlContainer >
364
376 const css::uno::Reference< css::inspection::XObjectInspectorUI >& _rxInspectorUI,
377 PropertyId _nDesignForProperty
378 );
379
396 void impl_updateDependentProperty_nothrow( PropertyId _nPropId, const css::uno::Reference< css::inspection::XObjectInspectorUI >& _rxInspectorUI ) const;
397
411 const css::uno::Reference< css::beans::XPropertySet >& _xFormProperties,
412 bool _bAllowEmptyDataSourceName );
413
417 OUString impl_getDocumentURL_nothrow() const;
418
419 private:
420 DECL_LINK( OnDesignerClosed, SQLCommandDesigner&, void );
421
422 private:
425
426 private:
429 };
430
431
432} // namespace pcr
433
434
435/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OPropertyContainer(::cppu::OBroadcastHelper &_rBHelper)
default ->XPropertyHandler for all form components.
bool impl_browseForDatabaseDocument_throw(css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
allows the user browsing for a database document @precond our component actually has a DataSource pro...
bool impl_dialogListSelection_nothrow(const OUString &_rProperty, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
let's the user chose a selection of entries from a string list, and stores this selection in the give...
bool impl_doDesignSQLCommand_nothrow(const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI, PropertyId _nDesignForProperty)
opens a query design window for interactively designing the SQL command of a database form
bool impl_dialogFilterOrSort_nothrow(bool _bFilter, OUString &_out_rSelectedClause, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
executes a dialog for choosing a filter or sort criterion for a database form
virtual css::uno::Any SAL_CALL convertToControlValue(const OUString &_rPropertyName, const css::uno::Any &_rPropertyValue, const css::uno::Type &_rControlValueType) override
virtual sal_Bool SAL_CALL suspend(sal_Bool _bSuspend) override
css::uno::Reference< css::sdbc::XRowSet > impl_getRowSet_nothrow() const
nothrow-version of ->impl_getRowSet_throw
FormComponentPropertyHandler(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
bool m_bHaveListSource
our component has a "ListSource" property
virtual void SAL_CALL addPropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener) override
bool impl_browseForTargetURL_nothrow(css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
executes a dialog which allows the user to change the TargetURL property of our component @precond ou...
virtual css::uno::Sequence< OUString > SAL_CALL getActuatingProperties() override
css::uno::Reference< css::uno::XInterface > m_xObjectParent
the parent of our component
OUString impl_getDocumentURL_nothrow() const
returns the URL of our context document
void impl_updateDependentProperty_nothrow(PropertyId _nPropId, const css::uno::Reference< css::inspection::XObjectInspectorUI > &_rxInspectorUI) const
updates a property (UI) whose state depends on more than one other property
void impl_initFieldList_nothrow(std::vector< OUString > &rFieldNames) const
initializes the list of field names, if we're handling a control which supports the DataField propert...
virtual OUString SAL_CALL getImplementationName() override
OUString m_sDefaultValueString
the string indicating a "default" (VOID) value in list-like controls
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &_rPropertyName) override
::rtl::Reference< SQLCommandDesigner > m_xCommandDesigner
helper component encapsulating the handling for the QueryDesign component for interactively designing...
bool impl_shouldExcludeProperty_nothrow(const css::beans::Property &_rProperty) const
determines whether we should exclude a given property from our "supported properties"
void impl_classifyControlModel_throw()
classifies our component, in case it's a control model, by ClassId
virtual css::uno::Sequence< css::beans::Property > doDescribeSupportedProperties() const override
bool impl_dialogLinkedFormFields_nothrow(::osl::ClearableMutexGuard &_rClearBeforeDialog) const
executes a dialog which allows the user to choose the columns linking a sub to a master form,...
void impl_fillTableNames_throw(std::vector< OUString > &_out_rNames) const
describes the UI for selecting a table name
mutable::dbtools::SharedConnection m_xRowSetConnection
the database connection. Owned by us if and only if we created it ourself.
void impl_describeListSourceUI_throw(css::inspection::LineDescriptor &_out_rDescriptor, const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory) const
describes the UI for selecting a ListSource (for list-like form controls) @precond ->m_xRowSetConnect...
virtual ::cppu::IPropertyArrayHelper * createArrayHelper() const override
virtual css::uno::Sequence< OUString > SAL_CALL getSupersededProperties() override
bool impl_browseForImage_nothrow(css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
executes a dialog which allows to the user to change the ImageURL property of our component by browsi...
DECL_LINK(OnDesignerClosed, SQLCommandDesigner &, void)
bool impl_ensureRowsetConnection_nothrow() const
connects the row set belonging to our introspected data aware form component, and remembers the conne...
sal_Int16 m_nClassId
the class id of the component - if applicable
bool impl_dialogColorChooser_throw(sal_Int32 _nColorPropertyId, css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
raises a dialog which allows the user to choose a color
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
bool impl_dialogChooseLabelControl_nothrow(css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
raises a dialog which allows the user to choose a label control for our component
void impl_describeCursorSource_nothrow(css::inspection::LineDescriptor &_out_rProperty, const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory) const
fills an ->LineDescriptor with information to represent a cursor source of our form - that is,...
ComponentClassification m_eComponentClass
type of our component
virtual void SAL_CALL removePropertyChangeListener(const css::uno::Reference< css::beans::XPropertyChangeListener > &_rxListener) override
virtual css::uno::Any SAL_CALL convertToPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rControlValue) override
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
virtual void SAL_CALL setPropertyValue(const OUString &_rPropertyName, const css::uno::Any &_rValue) override
css::uno::Reference< css::sdbc::XRowSet > impl_getRowSet_throw() const
obtains the RowSet to which our component belongs
virtual void onNewComponent() override
called when XPropertyHandler::inspect has been called, and we thus have a new component to inspect
bool m_bHaveCommand
our component has a "Command" property
virtual css::inspection::LineDescriptor SAL_CALL describePropertyLine(const OUString &_rPropertyName, const css::uno::Reference< css::inspection::XPropertyControlFactory > &_rxControlFactory) override
css::uno::Reference< css::sdbc::XRowSet > m_xRowSet
css::uno::Any impl_getPropertyValue_throw(const OUString &_rPropertyName) const
const-version of ->getPropertyValue
css::uno::Reference< css::inspection::XObjectInspectorUI > m_xBrowserUI
void impl_normalizePropertyValue_nothrow(css::uno::Any &_rValue, PropertyId _nPropId) const
bool impl_dialogChangeTabOrder_nothrow(::osl::ClearableMutexGuard &_rClearBeforeDialog) const
raises a dialog which lets the user chose the tab order of controls of a form @precond we have a view...
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 css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
static bool impl_hasValidDataSourceSignature_nothrow(const css::uno::Reference< css::beans::XPropertySet > &_xFormProperties, bool _bAllowEmptyDataSourceName)
determines whether the given form has a valid data source signature.
css::uno::Reference< css::awt::XControlContainer > impl_getContextControlContainer_nothrow() const
retrieves the context for controls, whose model(s) we're inspecting
bool impl_executeFontDialog_nothrow(css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
executes a dialog which allows the user to change the font, plus related properties,...
void impl_displaySQLError_nothrow(const ::dbtools::SQLExceptionInfo &_rErrorDescriptor) const
displays a database-related error to the user
bool m_bComponentIsSubForm
is our component a (database) sub form?
std::set< OUString > m_aPropertiesWithDefListEntry
all properties to whose control's we added ->m_sDefaultValueString
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &_rPropertyName) override
bool impl_dialogFormatting_nothrow(css::uno::Any &_out_rNewValue, ::osl::ClearableMutexGuard &_rClearBeforeDialog) const
executes a dialog which allows the user to modify the FormatKey property of our component,...
void impl_fillQueryNames_throw(std::vector< OUString > &_out_rNames) const
describes the UI for selecting a query name
css::uno::Reference< css::beans::XPropertyState > m_xPropertyState
access to property states
virtual ::cppu::IPropertyArrayHelper &SAL_CALL getInfoHelper() override
PropertyHandler implementation which additionally supports XServiceInfo.
encapsulates the code for calling and managing a query design frame, used for interactively designing...
Type
a property handler for any virtual string properties
Definition: browserline.cxx:39
sal_Int32 PropertyId
::comphelper::OPropertyArrayUsageHelper< FormComponentPropertyHandler > FormComponentPropertyHandler_PROP
unsigned char sal_Bool
#define DECLARE_XINTERFACE()