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