1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX
29*cdf0e10cSrcweir #define EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include "propertyhandler.hxx"
32*cdf0e10cSrcweir #include "sqlcommanddesign.hxx"
33*cdf0e10cSrcweir #include "pcrcommon.hxx"
34*cdf0e10cSrcweir #include <comphelper/uno3.hxx>
35*cdf0e10cSrcweir #include <comphelper/proparrhlp.hxx>
36*cdf0e10cSrcweir #include <comphelper/propertycontainer.hxx>
37*cdf0e10cSrcweir /** === begin UNO includes === **/
38*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
39*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertyState.hpp>
40*cdf0e10cSrcweir #include <com/sun/star/sdbc/XRowSet.hpp>
41*cdf0e10cSrcweir #include <com/sun/star/awt/XControlContainer.hpp>
42*cdf0e10cSrcweir #include <com/sun/star/form/XForm.hpp>
43*cdf0e10cSrcweir /** === end UNO includes === **/
44*cdf0e10cSrcweir #include <tools/fldunit.hxx>
45*cdf0e10cSrcweir #include <vcl/waitobj.hxx>
46*cdf0e10cSrcweir #include <connectivity/dbtools.hxx>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir #include <set>
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir //........................................................................
51*cdf0e10cSrcweir namespace pcr
52*cdf0e10cSrcweir {
53*cdf0e10cSrcweir //........................................................................
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir 	//====================================================================
56*cdf0e10cSrcweir 	//= ComponentClassification
57*cdf0e10cSrcweir 	//====================================================================
58*cdf0e10cSrcweir     enum ComponentClassification
59*cdf0e10cSrcweir     {
60*cdf0e10cSrcweir         eFormControl,
61*cdf0e10cSrcweir         eDialogControl,
62*cdf0e10cSrcweir         eUnknown
63*cdf0e10cSrcweir     };
64*cdf0e10cSrcweir 
65*cdf0e10cSrcweir 	//====================================================================
66*cdf0e10cSrcweir 	//= FormComponentPropertyHandler
67*cdf0e10cSrcweir 	//====================================================================
68*cdf0e10cSrcweir     class FormComponentPropertyHandler;
69*cdf0e10cSrcweir     typedef HandlerComponentBase< FormComponentPropertyHandler > FormComponentPropertyHandler_Base;
70*cdf0e10cSrcweir     typedef ::comphelper::OPropertyArrayUsageHelper<FormComponentPropertyHandler> FormComponentPropertyHandler_PROP;
71*cdf0e10cSrcweir     /** default ->XPropertyHandler for all form components.
72*cdf0e10cSrcweir     */
73*cdf0e10cSrcweir     class FormComponentPropertyHandler :    public FormComponentPropertyHandler_Base,
74*cdf0e10cSrcweir                                             public ::comphelper::OPropertyContainer,
75*cdf0e10cSrcweir                                             public FormComponentPropertyHandler_PROP
76*cdf0e10cSrcweir 	{
77*cdf0e10cSrcweir     private:
78*cdf0e10cSrcweir         /// access to property states
79*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >             m_xPropertyState;
80*cdf0e10cSrcweir         /// the parent of our component
81*cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > 				    m_xObjectParent;
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir         /// the database connection. Owned by us if and only if we created it ourself.
84*cdf0e10cSrcweir         mutable ::dbtools::SharedConnection                                                     m_xRowSetConnection;
85*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >                     m_xRowSet;
86*cdf0e10cSrcweir         /** helper component encapsulating the handling for the QueryDesign component for
87*cdf0e10cSrcweir             interactively designing an SQL command
88*cdf0e10cSrcweir         */
89*cdf0e10cSrcweir         ::rtl::Reference< SQLCommandDesigner >                                                  m_xCommandDesigner;
90*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >    m_xBrowserUI;
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir         /// the string indicating a "default" (VOID) value in list-like controls
93*cdf0e10cSrcweir         ::rtl::OUString                 m_sDefaultValueString;
94*cdf0e10cSrcweir         /// all properties to whose control's we added ->m_sDefaultValueString
95*cdf0e10cSrcweir         ::std::set< ::rtl::OUString >   m_aPropertiesWithDefListEntry;
96*cdf0e10cSrcweir         /// type of our component
97*cdf0e10cSrcweir         ComponentClassification         m_eComponentClass;
98*cdf0e10cSrcweir         /// is our component a (database) sub form?
99*cdf0e10cSrcweir         bool                            m_bComponentIsSubForm : 1;
100*cdf0e10cSrcweir         /// our component has a "ListSource" property
101*cdf0e10cSrcweir         bool                            m_bHaveListSource : 1;
102*cdf0e10cSrcweir         /// our component has a "Command" property
103*cdf0e10cSrcweir         bool                            m_bHaveCommand : 1;
104*cdf0e10cSrcweir 		/// the class id of the component - if appliable
105*cdf0e10cSrcweir 		sal_Int16				        m_nClassId;
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir     public:
108*cdf0e10cSrcweir         FormComponentPropertyHandler(
109*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& _rxContext
110*cdf0e10cSrcweir         );
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir         DECLARE_XINTERFACE( )
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir         // XPropertySet
115*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) throw(::com::sun::star::uno::RuntimeException);
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir         static ::rtl::OUString SAL_CALL getImplementationName_static(  ) throw (::com::sun::star::uno::RuntimeException);
118*cdf0e10cSrcweir         static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_static(  ) throw (::com::sun::star::uno::RuntimeException);
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     protected:
121*cdf0e10cSrcweir         ~FormComponentPropertyHandler();
122*cdf0e10cSrcweir 
123*cdf0e10cSrcweir     protected:
124*cdf0e10cSrcweir         virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
125*cdf0e10cSrcweir 		virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper();
126*cdf0e10cSrcweir         // XPropertyHandler overridables
127*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any                          SAL_CALL getPropertyValue( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
128*cdf0e10cSrcweir         virtual void                                                SAL_CALL setPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
129*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any                          SAL_CALL convertToPropertyValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rControlValue ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
130*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Any                          SAL_CALL convertToControlValue( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Any& _rPropertyValue, const ::com::sun::star::uno::Type& _rControlValueType ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
131*cdf0e10cSrcweir         virtual ::com::sun::star::beans::PropertyState              SAL_CALL getPropertyState( const ::rtl::OUString& _rPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
132*cdf0e10cSrcweir         virtual void                                                SAL_CALL addPropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
133*cdf0e10cSrcweir         virtual void                                                SAL_CALL removePropertyChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& _rxListener ) throw (::com::sun::star::uno::RuntimeException);
134*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >  SAL_CALL getSupersededProperties() throw (::com::sun::star::uno::RuntimeException);
135*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >  SAL_CALL getActuatingProperties() throw (::com::sun::star::uno::RuntimeException);
136*cdf0e10cSrcweir         virtual ::com::sun::star::inspection::LineDescriptor        SAL_CALL describePropertyLine( const ::rtl::OUString& _rPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
137*cdf0e10cSrcweir         virtual ::com::sun::star::inspection::InteractiveSelectionResult
138*cdf0e10cSrcweir                                                                     SAL_CALL onInteractivePropertySelection( const ::rtl::OUString& _rPropertyName, sal_Bool _bPrimary, ::com::sun::star::uno::Any& _rData, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
139*cdf0e10cSrcweir         virtual void                                                SAL_CALL actuatingPropertyChanged( const ::rtl::OUString& _rActuatingPropertyName, const ::com::sun::star::uno::Any& _rNewValue, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI, sal_Bool _bFirstTimeInit ) throw (::com::sun::star::lang::NullPointerException, ::com::sun::star::uno::RuntimeException);
140*cdf0e10cSrcweir         virtual sal_Bool                                            SAL_CALL suspend( sal_Bool _bSuspend ) throw (::com::sun::star::uno::RuntimeException);
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir         // XComponent
143*cdf0e10cSrcweir         virtual void                                                SAL_CALL disposing();
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir         // PropertyHandler
146*cdf0e10cSrcweir         virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >
147*cdf0e10cSrcweir                                             SAL_CALL doDescribeSupportedProperties() const;
148*cdf0e10cSrcweir         virtual void onNewComponent();
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir     private:
151*cdf0e10cSrcweir         /** initializes some (cached) meta data about the component
152*cdf0e10cSrcweir             @throws RuntimeException
153*cdf0e10cSrcweir                 if a serious error occurs, for instance if the component does not provide an XPropertySetInfo instance
154*cdf0e10cSrcweir         */
155*cdf0e10cSrcweir         void    impl_initComponentMetaData_throw();
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir         /** classifies our component, in case it's a control model, by ClassId
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir             Note that UNO dialog controls are also classified, though they don't have the ClassId property
160*cdf0e10cSrcweir         */
161*cdf0e10cSrcweir         void    impl_classifyControlModel_throw();
162*cdf0e10cSrcweir 
163*cdf0e10cSrcweir         /** const-version of ->getPropertyValue
164*cdf0e10cSrcweir         */
165*cdf0e10cSrcweir         ::com::sun::star::uno::Any impl_getPropertyValue_throw( const ::rtl::OUString& _rPropertyName ) const;
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir         // some property values are faked, and not used in the way they're provided by our component
168*cdf0e10cSrcweir         void impl_normalizePropertyValue_nothrow( ::com::sun::star::uno::Any& _rValue, PropertyId _nPropId ) const;
169*cdf0e10cSrcweir 
170*cdf0e10cSrcweir         /** determines whether we should exclude a given property from our "supported properties"
171*cdf0e10cSrcweir         */
172*cdf0e10cSrcweir         bool impl_shouldExcludeProperty_nothrow( const ::com::sun::star::beans::Property& _rProperty ) const;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir         /** initializes the list of field names, if we're handling a control which supports the
175*cdf0e10cSrcweir             DataField property
176*cdf0e10cSrcweir         */
177*cdf0e10cSrcweir         void impl_initFieldList_nothrow( ::std::vector< ::rtl::OUString >& rFieldNames ) const;
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir         /** obtaines the RowSet to which our component belongs
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir             If the component is a RowSet itself, it's returned directly. Else, the parent
182*cdf0e10cSrcweir             is examined for the XRowSet interface. If the parent is no XRowSet, then
183*cdf0e10cSrcweir             a check is made whether our component is a grid control column, and if so,
184*cdf0e10cSrcweir             the parent of the grid control is examied for the XRowSet interace.
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir             Normally, at least one of those methods should succeed.
187*cdf0e10cSrcweir         */
188*cdf0e10cSrcweir 	    ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > impl_getRowSet_throw( ) const;
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir         /** nothrow-version of ->impl_getRowSet_throw
191*cdf0e10cSrcweir         */
192*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet > impl_getRowSet_nothrow( ) const;
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir         /** connects the row set belonging to our introspected data aware form component,
195*cdf0e10cSrcweir             and remembers the connection in ->m_xRowSetConnection.
196*cdf0e10cSrcweir 
197*cdf0e10cSrcweir             If the row set already is connected, ->m_xRowSetConnection will be set, too, but
198*cdf0e10cSrcweir             not take the ownership of the connection.
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir             If ->m_xRowSetConnection is already set, nothing happens, so if you want to
201*cdf0e10cSrcweir             force creation of a connection, you need to clear ->m_xRowSetConnection.
202*cdf0e10cSrcweir         */
203*cdf0e10cSrcweir 	    bool impl_ensureRowsetConnection_nothrow() const;
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir         /** clears ->m_xRowSetConnection
206*cdf0e10cSrcweir         */
207*cdf0e10cSrcweir         void impl_clearRowsetConnection_nothrow();
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir         /** fills an ->LineDescriptor with information to represent a cursor source
210*cdf0e10cSrcweir             of our form - that is, a table, a query, or an SQL statement.
211*cdf0e10cSrcweir 
212*cdf0e10cSrcweir             As an example, if our form has currently a CommandType of TABLE, then the
213*cdf0e10cSrcweir             value list in the LineDescriptor will contain a list of all tables
214*cdf0e10cSrcweir             of the data source which the form is bound to.
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir             @seealso impl_fillTableNames_throw
217*cdf0e10cSrcweir             @seealso impl_fillQueryNames_throw
218*cdf0e10cSrcweir         */
219*cdf0e10cSrcweir         void impl_describeCursorSource_nothrow(
220*cdf0e10cSrcweir                 ::com::sun::star::inspection::LineDescriptor& _out_rProperty,
221*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory
222*cdf0e10cSrcweir             ) const;
223*cdf0e10cSrcweir 
224*cdf0e10cSrcweir         /** describes the UI for selecting a table name
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir             @precond
227*cdf0e10cSrcweir                 m_xRowSetConnection is not <NULL/>
228*cdf0e10cSrcweir         */
229*cdf0e10cSrcweir 	    void impl_fillTableNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const;
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir         /** describes the UI for selecting a query name
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir             @precond
234*cdf0e10cSrcweir                 m_xRowSetConnection is not <NULL/>
235*cdf0e10cSrcweir         */
236*cdf0e10cSrcweir 	    void impl_fillQueryNames_throw( ::std::vector< ::rtl::OUString >& _out_rNames ) const;
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir         /** describes the UI for selecting a query name
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir             @precond
241*cdf0e10cSrcweir                 m_xRowSetConnection is not <NULL/>
242*cdf0e10cSrcweir         */
243*cdf0e10cSrcweir         void impl_fillQueryNames_throw( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xQueryNames
244*cdf0e10cSrcweir                     ,::std::vector< ::rtl::OUString >& _out_rNames
245*cdf0e10cSrcweir                     ,const ::rtl::OUString& _sName = ::rtl::OUString() ) const;
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir         /** describes the UI for selecting a ListSource (for list-like form controls)
248*cdf0e10cSrcweir             @precond
249*cdf0e10cSrcweir                 ->m_xRowSetConnection is not <NULL/>
250*cdf0e10cSrcweir             @precond
251*cdf0e10cSrcweir                 ->m_xComponent is not <NULL/>
252*cdf0e10cSrcweir         */
253*cdf0e10cSrcweir         void impl_describeListSourceUI_throw(
254*cdf0e10cSrcweir                 ::com::sun::star::inspection::LineDescriptor& _out_rDescriptor,
255*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControlFactory >& _rxControlFactory
256*cdf0e10cSrcweir             ) const;
257*cdf0e10cSrcweir 
258*cdf0e10cSrcweir         /** displays a datbase-related error to the user
259*cdf0e10cSrcweir         */
260*cdf0e10cSrcweir         void impl_displaySQLError_nothrow( const ::dbtools::SQLExceptionInfo& _rErrorDescriptor ) const;
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir         /** let's the user chose a selection of entries from a string list, and stores this
263*cdf0e10cSrcweir             selection in the given property
264*cdf0e10cSrcweir             @return
265*cdf0e10cSrcweir                 <TRUE/> if and only if the user successfully changed the property
266*cdf0e10cSrcweir         */
267*cdf0e10cSrcweir         bool impl_dialogListSelection_nothrow( const ::rtl::OUString& _rProperty, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
268*cdf0e10cSrcweir 
269*cdf0e10cSrcweir         /** executes a dialog for chosing a filter or sort criterion for a database form
270*cdf0e10cSrcweir             @param _bFilter
271*cdf0e10cSrcweir                 <TRUE/> if the Filter property should be used, <FALSE/> if it's the Order
272*cdf0e10cSrcweir                 property
273*cdf0e10cSrcweir             @param _out_rSelectedClause
274*cdf0e10cSrcweir                 the filter or order clause as chosen by the user
275*cdf0e10cSrcweir             @precond
276*cdf0e10cSrcweir                 we're really inspecting a database form (well, a RowSet at least)
277*cdf0e10cSrcweir             @return
278*cdf0e10cSrcweir                 <TRUE/> if and only if the user successfully chose a clause
279*cdf0e10cSrcweir         */
280*cdf0e10cSrcweir         bool impl_dialogFilterOrSort_nothrow( bool _bFilter, ::rtl::OUString& _out_rSelectedClause, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir         /** executes a dialog which allows the user to chose the columns linking
283*cdf0e10cSrcweir             a sub to a master form, and sets the respective MasterFields / SlaveFields
284*cdf0e10cSrcweir             properties at the form.
285*cdf0e10cSrcweir             @precond
286*cdf0e10cSrcweir                 we're inspecting (sub) database form
287*cdf0e10cSrcweir             @return
288*cdf0e10cSrcweir                 <TRUE/> if and only if the user successfully eneter master and slave fields
289*cdf0e10cSrcweir         */
290*cdf0e10cSrcweir         bool impl_dialogLinkedFormFields_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir         /** executes a dialog which allows the user to modify the FormatKey
293*cdf0e10cSrcweir             property of our component, by chosing a (number) format.
294*cdf0e10cSrcweir             @precond
295*cdf0e10cSrcweir                 Our component actually has a FormatKey property.
296*cdf0e10cSrcweir             @param _out_rNewValue
297*cdf0e10cSrcweir                 the new property value, if the user chose a new formatting
298*cdf0e10cSrcweir             @return
299*cdf0e10cSrcweir                 <TRUE/> if and only if a new formatting has been chosen by the user.
300*cdf0e10cSrcweir                 In this case, ->_out_rNewValue is filled with the new property value
301*cdf0e10cSrcweir         */
302*cdf0e10cSrcweir 		bool impl_dialogFormatting_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
303*cdf0e10cSrcweir 
304*cdf0e10cSrcweir         /** executes a dialog which allows to the user to change the ImageURL property
305*cdf0e10cSrcweir             of our component by browsing for an image file.
306*cdf0e10cSrcweir             @precond
307*cdf0e10cSrcweir                 our component actually has a ImageURL property
308*cdf0e10cSrcweir             @param _out_rNewValue
309*cdf0e10cSrcweir                 the new property value, if the user chose a new image url
310*cdf0e10cSrcweir             @return
311*cdf0e10cSrcweir                 <TRUE/> if and only if a new image URL has been chosen by the user.
312*cdf0e10cSrcweir                 In this case, ->_out_rNewValue is filled with the new property value
313*cdf0e10cSrcweir         */
314*cdf0e10cSrcweir         bool impl_browseForImage_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
315*cdf0e10cSrcweir 
316*cdf0e10cSrcweir         /** executes a dialog which allows the user to change the TargetURL property of
317*cdf0e10cSrcweir             our component
318*cdf0e10cSrcweir             @precond
319*cdf0e10cSrcweir                 our component actually has a TargetURL property
320*cdf0e10cSrcweir             @param _out_rNewValue
321*cdf0e10cSrcweir                 the new property value, if the user chose a new TargetURL
322*cdf0e10cSrcweir             @return
323*cdf0e10cSrcweir                 <TRUE/> if and only if a new TargetURL has been chosen by the user.
324*cdf0e10cSrcweir                 In this case, ->_out_rNewValue is filled with the new property value
325*cdf0e10cSrcweir         */
326*cdf0e10cSrcweir         bool impl_browseForTargetURL_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir         /** executes a dialog which allows the user to change the font, plus related properties,
329*cdf0e10cSrcweir             of our component
330*cdf0e10cSrcweir             @precond
331*cdf0e10cSrcweir                 our component actually has a Font property
332*cdf0e10cSrcweir             @param _out_rNewValue
333*cdf0e10cSrcweir                 a value desribing the new font, as <code>Sequence&lt; NamedValue &gt;</code>
334*cdf0e10cSrcweir             @return
335*cdf0e10cSrcweir                 <TRUE/> if and only if the user successfully changed the font of our component
336*cdf0e10cSrcweir         */
337*cdf0e10cSrcweir 		bool impl_executeFontDialog_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir         /** allows the user browsing for a database document
340*cdf0e10cSrcweir             @precond
341*cdf0e10cSrcweir                 our component actually has a DataSource property
342*cdf0e10cSrcweir             @param _out_rNewValue
343*cdf0e10cSrcweir                 the new property value, if the user chose a new DataSource
344*cdf0e10cSrcweir             @return
345*cdf0e10cSrcweir                 <TRUE/> if and only if a new DataSource has been chosen by the user.
346*cdf0e10cSrcweir                 In this case, ->_out_rNewValue is filled with the new property value
347*cdf0e10cSrcweir         */
348*cdf0e10cSrcweir         bool impl_browseForDatabaseDocument_throw( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir         /** raises a dialog which allows the user to choose a color
351*cdf0e10cSrcweir             @param  _nColorPropertyId
352*cdf0e10cSrcweir                 the ID of the color property
353*cdf0e10cSrcweir             @param  _out_rNewValue
354*cdf0e10cSrcweir                 the chosen color value
355*cdf0e10cSrcweir             @return
356*cdf0e10cSrcweir                 <TRUE/> if and only if a color was chosen by the user
357*cdf0e10cSrcweir         */
358*cdf0e10cSrcweir         bool impl_dialogColorChooser_throw( sal_Int32 _nColorPropertyId, ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
359*cdf0e10cSrcweir 
360*cdf0e10cSrcweir         /** raises a dialog which allows the user to choose a label control for our component
361*cdf0e10cSrcweir             @param  _out_rNewValue
362*cdf0e10cSrcweir                 the chosen label control, if any
363*cdf0e10cSrcweir             @return
364*cdf0e10cSrcweir                 <TRUE/> if and only if a label control was chosen by the user
365*cdf0e10cSrcweir         */
366*cdf0e10cSrcweir         bool impl_dialogChooseLabelControl_nothrow( ::com::sun::star::uno::Any& _out_rNewValue, ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
367*cdf0e10cSrcweir 
368*cdf0e10cSrcweir         /** raises a dialog which lets the user chose the tab order of controls of a form
369*cdf0e10cSrcweir             @precond
370*cdf0e10cSrcweir                 we have a view control container in which our controls live
371*cdf0e10cSrcweir             @return
372*cdf0e10cSrcweir                 <TRUE/> if and only if the user successfully changed the tab order
373*cdf0e10cSrcweir             @seealso impl_getContextControlContainer_nothrow
374*cdf0e10cSrcweir         */
375*cdf0e10cSrcweir         bool impl_dialogChangeTabOrder_nothrow( ::osl::ClearableMutexGuard& _rClearBeforeDialog ) const;
376*cdf0e10cSrcweir 
377*cdf0e10cSrcweir         /** retrieves the context for controls, whose model(s) we're inspecting
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir             If we're inspecting a control model, this is usually part of a set of controls
380*cdf0e10cSrcweir             and control models, where the controls live in a certain context (a ->XControlContainer).
381*cdf0e10cSrcweir             If we know this context, we can enable additional special functionality.
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir             The ->XComponentContext in which we were created is examined for a value
384*cdf0e10cSrcweir             named "ControlContext", and this value is returned.
385*cdf0e10cSrcweir         */
386*cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
387*cdf0e10cSrcweir             impl_getContextControlContainer_nothrow() const;
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir         /** opens a query design window for interactively designing the SQL command of a
390*cdf0e10cSrcweir             database form
391*cdf0e10cSrcweir             @param _rxUIUpdate
392*cdf0e10cSrcweir                 access to the property browser UI
393*cdf0e10cSrcweir             @param _nDesignForProperty
394*cdf0e10cSrcweir                 the ID for the property for which the designer is opened
395*cdf0e10cSrcweir             @return
396*cdf0e10cSrcweir                 <TRUE/> if the window was successfully opened, or was previously open,
397*cdf0e10cSrcweir                 <FALSE/> otherwise
398*cdf0e10cSrcweir         */
399*cdf0e10cSrcweir         bool impl_doDesignSQLCommand_nothrow(
400*cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI,
401*cdf0e10cSrcweir             PropertyId _nDesignForProperty
402*cdf0e10cSrcweir         );
403*cdf0e10cSrcweir 
404*cdf0e10cSrcweir         /** updates a property (UI) whose state depends on more than one other property
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir             ->actuatingPropertyChanged is called for certain properties in whose changes
407*cdf0e10cSrcweir             we expressed interes (->getActuatingProperty). Now such a property change can
408*cdf0e10cSrcweir             result in simple UI updates, for instance another property being enabled or disabled.
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir             However, it can also result in a more complex change: The current (UI) state might
411*cdf0e10cSrcweir             depend on the value of more than one other property. Those dependent properties (their
412*cdf0e10cSrcweir             UI, more precisly) are updated in this method.
413*cdf0e10cSrcweir 
414*cdf0e10cSrcweir             @param _nPropid
415*cdf0e10cSrcweir                 the ->PropertyId of the dependent property whose UI state is to be updated
416*cdf0e10cSrcweir 
417*cdf0e10cSrcweir             @param _rxInspectorUI
418*cdf0e10cSrcweir                 provides access to the property browser UI. Must not be <NULL/>.
419*cdf0e10cSrcweir         */
420*cdf0e10cSrcweir         void impl_updateDependentProperty_nothrow( PropertyId _nPropId, const ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XObjectInspectorUI >& _rxInspectorUI ) const;
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir         /** determines whether the given form has a valid data source signature.
423*cdf0e10cSrcweir 
424*cdf0e10cSrcweir             Valid here means that the DataSource property denotes an existing data source, and the
425*cdf0e10cSrcweir             Command property is not empty. No check is made whether the value of the Command property
426*cdf0e10cSrcweir             denotes an existent object, since this would be way too expensive.
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir             @param _xFormProperties
429*cdf0e10cSrcweir                 the form to check. Must not be <NULL/>.
430*cdf0e10cSrcweir             @param _bAllowEmptyDataSourceName
431*cdf0e10cSrcweir                 determine whether an empty data source name is allowed (<TRUE/>), and should not
432*cdf0e10cSrcweir                 lead to rejection
433*cdf0e10cSrcweir         */
434*cdf0e10cSrcweir         static bool impl_hasValidDataSourceSignature_nothrow(
435*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _xFormProperties,
436*cdf0e10cSrcweir                 bool _bAllowEmptyDataSourceName );
437*cdf0e10cSrcweir 
438*cdf0e10cSrcweir         /** returns the URL of our context document
439*cdf0e10cSrcweir             @return
440*cdf0e10cSrcweir         */
441*cdf0e10cSrcweir         ::rtl::OUString impl_getDocumentURL_nothrow() const;
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir     private:
444*cdf0e10cSrcweir         DECL_LINK( OnDesignerClosed, void* );
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir     private:
447*cdf0e10cSrcweir         FormComponentPropertyHandler();                                                 // never implemented
448*cdf0e10cSrcweir         FormComponentPropertyHandler( const FormComponentPropertyHandler& );            // never implemented
449*cdf0e10cSrcweir         FormComponentPropertyHandler& operator=( const FormComponentPropertyHandler& ); // never implemented
450*cdf0e10cSrcweir 
451*cdf0e10cSrcweir     private:
452*cdf0e10cSrcweir         using ::comphelper::OPropertyContainer::addPropertyChangeListener;
453*cdf0e10cSrcweir         using ::comphelper::OPropertyContainer::removePropertyChangeListener;
454*cdf0e10cSrcweir 	};
455*cdf0e10cSrcweir 
456*cdf0e10cSrcweir 	//====================================================================
457*cdf0e10cSrcweir 	//= WaitCursor
458*cdf0e10cSrcweir 	//====================================================================
459*cdf0e10cSrcweir     /** wrapper around a ->WaitObject which can cope with a NULL window
460*cdf0e10cSrcweir     */
461*cdf0e10cSrcweir     class WaitCursor
462*cdf0e10cSrcweir     {
463*cdf0e10cSrcweir     private:
464*cdf0e10cSrcweir         ::std::auto_ptr< WaitObject >       m_aWaitObject;
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir     public:
467*cdf0e10cSrcweir         WaitCursor( Window* _pWindow )
468*cdf0e10cSrcweir         {
469*cdf0e10cSrcweir             if ( _pWindow )
470*cdf0e10cSrcweir                 m_aWaitObject.reset( new WaitObject( _pWindow ) );
471*cdf0e10cSrcweir         }
472*cdf0e10cSrcweir     };
473*cdf0e10cSrcweir 
474*cdf0e10cSrcweir //........................................................................
475*cdf0e10cSrcweir } // namespace pcr
476*cdf0e10cSrcweir //........................................................................
477*cdf0e10cSrcweir 
478*cdf0e10cSrcweir #endif // EXTENSIONS_SOURCE_PROPCTRLR_FORMCOMPONENTHANDLER_HXX
479*cdf0e10cSrcweir 
480