Line data Source code
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 : #ifndef INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
20 : #define INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
21 :
22 : #include <com/sun/star/container/XNameContainer.hpp>
23 : #include <com/sun/star/sdbc/XResultSet.hpp>
24 : #include <com/sun/star/sdb/XSQLQueryComposer.hpp>
25 : #include <com/sun/star/frame/XStatusListener.hpp>
26 : #include <com/sun/star/container/ContainerEvent.hpp>
27 : #include <com/sun/star/container/XContainerListener.hpp>
28 : #include <com/sun/star/awt/XControl.hpp>
29 : #include <com/sun/star/awt/XControlContainer.hpp>
30 : #include <com/sun/star/util/XModifyListener.hpp>
31 : #include <com/sun/star/form/XForm.hpp>
32 : #include <com/sun/star/form/runtime/XFormController.hpp>
33 : #include <com/sun/star/form/XFormComponent.hpp>
34 : #include <com/sun/star/form/NavigationBarMode.hpp>
35 : #include <com/sun/star/frame/XFrame.hpp>
36 : #include <com/sun/star/view/XSelectionChangeListener.hpp>
37 : #include <com/sun/star/beans/XPropertySet.hpp>
38 : #include <com/sun/star/beans/XFastPropertySet.hpp>
39 : #include <com/sun/star/beans/XPropertyChangeListener.hpp>
40 : #include <com/sun/star/beans/PropertyChangeEvent.hpp>
41 : #include <com/sun/star/form/runtime/FeatureState.hpp>
42 : #include <vcl/timer.hxx>
43 : #include <sfx2/app.hxx>
44 : #include <svx/svdmark.hxx>
45 : #include <svx/fmsearch.hxx>
46 : #include <svx/svxids.hrc>
47 : #include <svl/lstner.hxx>
48 :
49 : #include <sfx2/mnuitem.hxx>
50 : #include "svx/fmtools.hxx"
51 : #include "svx/fmsrccfg.hxx"
52 : #include <osl/mutex.hxx>
53 : #include <cppuhelper/component.hxx>
54 : #include <comphelper/container.hxx>
55 : #include <cppuhelper/compbase4.hxx>
56 : #include <cppuhelper/compbase6.hxx>
57 : #include <unotools/configitem.hxx>
58 : #include "formcontrolling.hxx"
59 : #include "fmdocumentclassification.hxx"
60 :
61 : #include <queue>
62 : #include <set>
63 : #include <vector>
64 : #include <boost/ptr_container/ptr_vector.hpp>
65 :
66 : typedef std::vector<SdrObject*> SdrObjArray;
67 : typedef std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > > FmFormArray;
68 :
69 : // catch database exceptions if they occur
70 : #define DO_SAFE(statement) try { statement; } catch( const Exception& ) { OSL_FAIL("unhandled exception (I tried to move a cursor (or something like that).)"); }
71 :
72 : #define GA_DISABLE_SYNC 1
73 : #define GA_FORCE_SYNC 2
74 : #define GA_ENABLE_SYNC 3
75 : #define GA_SYNC_MASK 3
76 : #define GA_DISABLE_ROCTRLR 4
77 : #define GA_ENABLE_ROCTRLR 8
78 :
79 :
80 : // flags for controlling the behaviour when calling loadForms
81 : #define FORMS_LOAD 0x0000 // default: simply load
82 : #define FORMS_SYNC 0x0000 // default: do in synchronous
83 :
84 : #define FORMS_UNLOAD 0x0001 // unload
85 : #define FORMS_ASYNC 0x0002 // do this async
86 :
87 :
88 : // a class iterating through all fields of a form which are bound to a field
89 : // sub forms are ignored, grid columns (where the grid is a direct child of the form) are included
90 0 : class FmXBoundFormFieldIterator : public ::comphelper::IndexAccessIterator
91 : {
92 : public:
93 0 : FmXBoundFormFieldIterator(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rStartingPoint) : ::comphelper::IndexAccessIterator(_rStartingPoint) { }
94 :
95 : protected:
96 : virtual bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rElement) SAL_OVERRIDE;
97 : virtual bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rContainer) const SAL_OVERRIDE;
98 : };
99 :
100 : class FmFormPage;
101 :
102 : struct FmLoadAction
103 : {
104 : FmFormPage* pPage;
105 : ImplSVEvent * nEventId;
106 : sal_uInt16 nFlags;
107 :
108 : FmLoadAction( ) : pPage( NULL ), nEventId( 0 ), nFlags( 0 ) { }
109 187 : FmLoadAction( FmFormPage* _pPage, sal_uInt16 _nFlags, ImplSVEvent * _nEventId )
110 187 : :pPage( _pPage ), nEventId( _nEventId ), nFlags( _nFlags )
111 : {
112 187 : }
113 : };
114 :
115 :
116 : class SfxViewFrame;
117 : typedef ::cppu::WeakComponentImplHelper4< ::com::sun::star::beans::XPropertyChangeListener
118 : , ::com::sun::star::container::XContainerListener
119 : , ::com::sun::star::view::XSelectionChangeListener
120 : , ::com::sun::star::form::XFormControllerListener
121 : > FmXFormShell_BD_BASE;
122 :
123 :
124 3228 : class FmXFormShell_Base_Disambiguation : public FmXFormShell_BD_BASE
125 : {
126 : using ::com::sun::star::beans::XPropertyChangeListener::disposing;
127 : protected:
128 : FmXFormShell_Base_Disambiguation( ::osl::Mutex& _rMutex );
129 : virtual void SAL_CALL disposing() SAL_OVERRIDE;
130 : };
131 :
132 :
133 : namespace svx
134 : {
135 : class FmTextControlShell;
136 : }
137 :
138 :
139 : typedef FmXFormShell_Base_Disambiguation FmXFormShell_BASE;
140 : typedef ::utl::ConfigItem FmXFormShell_CFGBASE;
141 :
142 : struct SdrViewEvent;
143 : class FmFormShell;
144 : class FmFormView;
145 : class FmFormObj;
146 : class SVX_DLLPUBLIC FmXFormShell : public FmXFormShell_BASE
147 : ,public FmXFormShell_CFGBASE
148 : ,public svx::IControllerFeatureInvalidation
149 : {
150 : friend class FmFormView;
151 : friend class FmXFormView;
152 :
153 : class SuspendPropertyTracking;
154 : friend class SuspendPropertyTracking;
155 :
156 : // timer for delayed mark
157 : Timer m_aMarkTimer;
158 : SdrObjArray m_arrSearchedControls;
159 : // We enable a permanent cursor for the grid we found a searched text, it's disabled in the next "found" event.
160 : FmFormArray m_aSearchForms;
161 :
162 : struct SAL_DLLPRIVATE InvalidSlotInfo {
163 : sal_uInt16 id;
164 : sal_uInt8 flags;
165 0 : inline InvalidSlotInfo(sal_uInt16 slotId, sal_uInt8 flgs) : id(slotId), flags(flgs) {};
166 : };
167 : std::vector<InvalidSlotInfo> m_arrInvalidSlots;
168 : // we explicitly switch off the propbrw before leaving the design mode
169 : // this flag tells us if we have to switch it on again when reentering
170 :
171 : ::osl::Mutex m_aAsyncSafety;
172 : // secure the access to our thread related members
173 : ::osl::Mutex m_aInvalidationSafety;
174 : // secure the access to all our slot invalidation related members
175 :
176 : ::com::sun::star::form::NavigationBarMode m_eNavigate; // Art der Navigation
177 :
178 : // da ich beim Suchen fuer die Behandlung des "gefunden" ein SdrObject markieren will, besorge ich mir vor dem
179 : // Hochreissen des Suchen-Dialoges alle relevanten Objekte
180 : // (das Array ist damit auch nur waehrend des Suchvorganges gueltig)
181 : std::vector<long> m_arrRelativeGridColumn;
182 :
183 : ::osl::Mutex m_aMutex;
184 : ImplSVEvent * m_nInvalidationEvent;
185 : ImplSVEvent * m_nActivationEvent;
186 : ::std::queue< FmLoadAction >
187 : m_aLoadingPages;
188 :
189 : FmFormShell* m_pShell;
190 : svx::FmTextControlShell* m_pTextShell;
191 :
192 : svx::ControllerFeatures m_aActiveControllerFeatures;
193 : svx::ControllerFeatures m_aNavControllerFeatures;
194 :
195 : // aktuelle Form, Controller
196 : // nur im alive mode verfuegbar
197 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xActiveController;
198 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xNavigationController;
199 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xActiveForm;
200 :
201 : // Aktueller container einer Page
202 : // nur im designmode verfuegbar
203 : ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess> m_xForms;
204 :
205 : // the currently selected objects, as to be displayed in the property browser
206 : InterfaceBag m_aCurrentSelection;
207 : /// the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
208 : ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > m_xCurrentForm;
209 : /// the last selection/marking of controls only. Necessary to implement the "Control properties" slot
210 : InterfaceBag m_aLastKnownMarkedControls;
211 :
212 :
213 : // und das ist ebenfalls fuer's 'gefunden' : Beim Finden in GridControls brauche ich die Spalte, bekomme aber
214 : // nur die Nummer des Feldes, die entspricht der Nummer der Spalte + <offset>, wobei der Offset von der Position
215 : // des GridControls im Formular abhaengt. Also hier eine Umrechnung.
216 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel> m_xLastGridFound;
217 : // the frame we live in
218 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame> m_xAttachedFrame;
219 : // Administration of external form views (see the SID_FM_VIEW_AS_GRID-slot)
220 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > m_xExternalViewController; // the controller for the external form view
221 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > m_xExtViewTriggerController; // the nav controller at the time the external display was triggered
222 : ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet > m_xExternalDisplayedForm; // the form which the external view is based on
223 :
224 : mutable ::svxform::DocumentType
225 : m_eDocumentType; /// the type of document we're living in
226 : sal_Int16 m_nLockSlotInvalidation;
227 : bool m_bHadPropertyBrowserInDesignMode : 1;
228 :
229 : bool m_bTrackProperties : 1;
230 : // soll ich (bzw. der Owner diese Impl-Klasse) mich um die Aktualisierung des ::com::sun::star::beans::Property-Browsers kuemmern ?
231 :
232 : bool m_bUseWizards : 1;
233 :
234 : bool m_bDatabaseBar : 1; // Gibt es eine Datenbankleiste
235 : bool m_bInActivate : 1; // Wird ein Controller aktiviert
236 : bool m_bSetFocus : 1; // Darf der Focus umgesetzt werden
237 : bool m_bFilterMode : 1; // Wird gerade ein Filter auf die Controls angesetzt
238 : bool m_bChangingDesignMode:1; // sal_True within SetDesignMode
239 : bool m_bPreparedClose : 1; // for the current modification state of the current form
240 : // PrepareClose had been called and the user denied to save changes
241 : bool m_bFirstActivation : 1; // has the shell ever been activated?
242 :
243 : public:
244 : // attribute access
245 : SAL_DLLPRIVATE inline const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
246 0 : getHostFrame() const { return m_xAttachedFrame; }
247 : SAL_DLLPRIVATE inline const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >&
248 0 : getExternallyDisplayedForm() const { return m_xExternalDisplayedForm; }
249 :
250 : SAL_DLLPRIVATE inline bool
251 7630 : didPrepareClose() const { return m_bPreparedClose; }
252 : SAL_DLLPRIVATE inline void
253 0 : didPrepareClose( bool _bDid ) { m_bPreparedClose = _bDid; }
254 :
255 : public:
256 : SAL_DLLPRIVATE FmXFormShell(FmFormShell& _rShell, SfxViewFrame* _pViewFrame);
257 :
258 : protected:
259 : SAL_DLLPRIVATE virtual ~FmXFormShell();
260 :
261 : // EventListener
262 : SAL_DLLPRIVATE virtual void SAL_CALL disposing(const ::com::sun::star::lang::EventObject& Source) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
263 :
264 : // ::com::sun::star::container::XContainerListener
265 : SAL_DLLPRIVATE virtual void SAL_CALL elementInserted(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
266 : SAL_DLLPRIVATE virtual void SAL_CALL elementReplaced(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
267 : SAL_DLLPRIVATE virtual void SAL_CALL elementRemoved(const ::com::sun::star::container::ContainerEvent& rEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
268 :
269 : // XSelectionChangeListener
270 : SAL_DLLPRIVATE virtual void SAL_CALL selectionChanged(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
271 :
272 : // ::com::sun::star::beans::XPropertyChangeListener
273 : SAL_DLLPRIVATE virtual void SAL_CALL propertyChange(const ::com::sun::star::beans::PropertyChangeEvent& evt) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
274 :
275 : // ::com::sun::star::form::XFormControllerListener
276 : SAL_DLLPRIVATE virtual void SAL_CALL formActivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
277 : SAL_DLLPRIVATE virtual void SAL_CALL formDeactivated(const ::com::sun::star::lang::EventObject& rEvent) throw( ::com::sun::star::uno::RuntimeException, std::exception ) SAL_OVERRIDE;
278 :
279 : // OComponentHelper
280 : SAL_DLLPRIVATE virtual void SAL_CALL disposing() SAL_OVERRIDE;
281 :
282 : public:
283 6516 : SAL_DLLPRIVATE void EnableTrackProperties( bool bEnable) { m_bTrackProperties = bEnable; }
284 3294 : SAL_DLLPRIVATE bool IsTrackPropertiesEnabled() {return m_bTrackProperties;}
285 :
286 : // activation handling
287 : SAL_DLLPRIVATE void viewActivated( FmFormView& _rCurrentView, bool _bSyncAction = false );
288 : SAL_DLLPRIVATE void viewDeactivated( FmFormView& _rCurrentView, bool _bDeactivateController = true );
289 :
290 : // IControllerFeatureInvalidation
291 : SAL_DLLPRIVATE virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures ) SAL_OVERRIDE;
292 :
293 : SAL_DLLPRIVATE void ExecuteTabOrderDialog( // execute SID_FM_TAB_DIALOG
294 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XTabControllerModel >& _rxForForm
295 : );
296 :
297 : // stuff
298 : SAL_DLLPRIVATE void AddElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
299 : SAL_DLLPRIVATE void RemoveElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
300 :
301 : /** updates m_xForms, to be either <NULL/>, if we're in alive mode, or our current page's forms collection,
302 : if in design mode
303 : */
304 : SAL_DLLPRIVATE void UpdateForms( bool _bInvalidate );
305 :
306 : SAL_DLLPRIVATE void ExecuteSearch(); // execute SID_FM_SEARCH
307 : SAL_DLLPRIVATE void CreateExternalView(); // execute SID_FM_VIEW_AS_GRID
308 :
309 : SAL_DLLPRIVATE bool GetY2KState(sal_uInt16& n);
310 : SAL_DLLPRIVATE void SetY2KState(sal_uInt16 n);
311 :
312 : protected:
313 : // activation handling
314 3853 : SAL_DLLPRIVATE inline bool hasEverBeenActivated( ) const { return !m_bFirstActivation; }
315 3153 : SAL_DLLPRIVATE inline void setHasBeenActivated( ) { m_bFirstActivation = false; }
316 :
317 : // form handling
318 : /// load or unload the forms on a page
319 : SAL_DLLPRIVATE void loadForms( FmFormPage* _pPage, const sal_uInt16 _nBehaviour = FORMS_LOAD | FORMS_SYNC );
320 : SAL_DLLPRIVATE void smartControlReset( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& _rxModels );
321 :
322 :
323 : SAL_DLLPRIVATE void startListening();
324 : SAL_DLLPRIVATE void stopListening();
325 :
326 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >
327 : impl_getControl(
328 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel>& i_rxModel,
329 : const FmFormObj& i_rKnownFormObj
330 : );
331 :
332 : // sammelt in strNames die Namen aller Formulare
333 : SAL_DLLPRIVATE static void impl_collectFormSearchContexts_nothrow(
334 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _rxStartingPoint,
335 : const OUString& _rCurrentLevelPrefix,
336 : FmFormArray& _out_rForms,
337 : ::std::vector< OUString >& _out_rNames );
338 :
339 : /** checks whether the instance is already disposed, if so, this is reported as assertion error (debug
340 : builds only) and <TRUE/> is returned.
341 : */
342 : SAL_DLLPRIVATE bool impl_checkDisposed() const;
343 :
344 : public:
345 : // methode fuer nicht designmode (alive mode)
346 : SAL_DLLPRIVATE void setActiveController( const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& _xController, bool _bNoSaveOldContent = false );
347 701 : SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getActiveController() const {return m_xActiveController;}
348 0 : SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getActiveInternalController() const { return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; }
349 2 : SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& getActiveForm() const {return m_xActiveForm;}
350 0 : SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController>& getNavController() const {return m_xNavigationController;}
351 :
352 3 : SAL_DLLPRIVATE inline const svx::ControllerFeatures& getActiveControllerFeatures() const
353 3 : { return m_aActiveControllerFeatures; }
354 0 : SAL_DLLPRIVATE inline const svx::ControllerFeatures& getNavControllerFeatures() const
355 0 : { return m_aNavControllerFeatures.isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; }
356 :
357 : /** announces a new "current selection"
358 : @return
359 : <TRUE/> if and only if the to-bet-set selection was different from the previous selection
360 : */
361 : SAL_DLLPRIVATE bool setCurrentSelection( const InterfaceBag& _rSelection );
362 :
363 : /** sets the new selection to the last known marked controls
364 : */
365 : SAL_DLLPRIVATE bool selectLastMarkedControls();
366 :
367 : /** retrieves the current selection
368 : */
369 : void getCurrentSelection( InterfaceBag& /* [out] */ _rSelection ) const;
370 :
371 : /** sets a new current selection as indicated by a mark list
372 : @return
373 : <TRUE/> if and only if the to-bet-set selection was different from the previous selection
374 : */
375 : SAL_DLLPRIVATE bool setCurrentSelectionFromMark(const SdrMarkList& rMarkList);
376 :
377 : /// returns the currently selected form, or the form which all currently selected controls belong to, or <NULL/>
378 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >
379 0 : getCurrentForm() const { return m_xCurrentForm; }
380 : SAL_DLLPRIVATE void forgetCurrentForm();
381 : /// returns whether the last known marking contained only controls
382 0 : SAL_DLLPRIVATE bool onlyControlsAreMarked() const { return !m_aLastKnownMarkedControls.empty(); }
383 :
384 : /// determines whether the current selection consists of exactly the given object
385 : SAL_DLLPRIVATE bool isSolelySelected(
386 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxObject
387 : );
388 :
389 : /// handles a MouseButtonDown event of the FmFormView
390 : SAL_DLLPRIVATE void handleMouseButtonDown( const SdrViewEvent& _rViewEvent );
391 : /// handles the request for showing the "Properties"
392 : SAL_DLLPRIVATE void handleShowPropertiesRequest();
393 :
394 11910 : SAL_DLLPRIVATE bool hasForms() const {return m_xForms.is() && m_xForms->getCount() != 0;}
395 1113 : SAL_DLLPRIVATE bool hasDatabaseBar() const {return m_bDatabaseBar;}
396 : SAL_DLLPRIVATE bool canNavigate() const {return m_xNavigationController.is();}
397 :
398 : SAL_DLLPRIVATE void ShowSelectionProperties( bool bShow );
399 : SAL_DLLPRIVATE bool IsPropBrwOpen() const;
400 :
401 : SAL_DLLPRIVATE void DetermineSelection(const SdrMarkList& rMarkList);
402 : SAL_DLLPRIVATE void SetSelection(const SdrMarkList& rMarkList);
403 : SAL_DLLPRIVATE void SetSelectionDelayed();
404 :
405 : SAL_DLLPRIVATE void SetDesignMode(bool bDesign);
406 :
407 0 : SAL_DLLPRIVATE bool GetWizardUsing() const { return m_bUseWizards; }
408 : SAL_DLLPRIVATE void SetWizardUsing(bool _bUseThem);
409 :
410 : // Setzen des Filtermodus
411 812 : SAL_DLLPRIVATE bool isInFilterMode() const {return m_bFilterMode;}
412 : SAL_DLLPRIVATE void startFiltering();
413 : SAL_DLLPRIVATE void stopFiltering(bool bSave);
414 :
415 : SAL_DLLPRIVATE static PopupMenu* GetConversionMenu();
416 : // ein Menue, das alle ControlConversion-Eintraege enthaelt
417 :
418 : /// checks whethere a given control conversion slot can be applied to the current selection
419 : SAL_DLLPRIVATE bool canConvertCurrentSelectionToControl( sal_Int16 nConversionSlot );
420 : /// enables or disables all conversion slots in a menu, according to the current selection
421 : SAL_DLLPRIVATE void checkControlConversionSlotsForCurrentSelection( Menu& rMenu );
422 : /// executes a control conversion slot for a given object
423 : SAL_DLLPRIVATE bool executeControlConversionSlot( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& _rxObject, sal_uInt16 _nSlotId );
424 : /** executes a control conversion slot for the current selection
425 : @precond canConvertCurrentSelectionToControl( <arg>_nSlotId</arg> ) must return <TRUE/>
426 : */
427 : SAL_DLLPRIVATE bool executeControlConversionSlot( sal_uInt16 _nSlotId );
428 : /// checks whether the given slot id denotes a control conversion slot
429 : SAL_DLLPRIVATE static bool isControlConversionSlot( sal_uInt16 _nSlotId );
430 :
431 : SAL_DLLPRIVATE void ExecuteTextAttribute( SfxRequest& _rReq );
432 : SAL_DLLPRIVATE void GetTextAttributeState( SfxItemSet& _rSet );
433 : SAL_DLLPRIVATE bool IsActiveControl( bool _bCountRichTextOnly = false ) const;
434 : SAL_DLLPRIVATE void ForgetActiveControl();
435 : SAL_DLLPRIVATE void SetControlActivationHandler( const Link<>& _rHdl );
436 :
437 : /// classifies our host document
438 : SAL_DLLPRIVATE ::svxform::DocumentType
439 : getDocumentType() const;
440 : SAL_DLLPRIVATE bool isEnhancedForm() const;
441 :
442 : /// determines whether our host document is currently read-only
443 : SAL_DLLPRIVATE bool IsReadonlyDoc() const;
444 :
445 : // das Setzen des curObject/selObject/curForm erfolgt verzoegert (SetSelectionDelayed), mit den folgenden
446 : // Funktionen laesst sich das abfragen/erzwingen
447 : SAL_DLLPRIVATE inline bool IsSelectionUpdatePending();
448 : SAL_DLLPRIVATE void ForceUpdateSelection(bool bLockInvalidation);
449 :
450 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel> getContextDocument() const;
451 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>& _xForm) const;
452 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> getInternalForm(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet>& _xForm) const;
453 : // if the form belongs to the controller (extern) displaying a grid, the according internal form will
454 : // be displayed, _xForm else
455 :
456 : // check if the current control of the active controller has the focus
457 : SAL_DLLPRIVATE bool HasControlFocus() const;
458 :
459 : private:
460 : DECL_DLLPRIVATE_LINK(OnFoundData, FmFoundRecordInformation*);
461 : DECL_DLLPRIVATE_LINK(OnCanceledNotFound, FmFoundRecordInformation*);
462 : DECL_DLLPRIVATE_LINK(OnSearchContextRequest, FmSearchContext*);
463 : DECL_DLLPRIVATE_LINK_TYPED(OnTimeOut, Timer*, void);
464 : DECL_DLLPRIVATE_LINK(OnFirstTimeActivation, void*);
465 : DECL_DLLPRIVATE_LINK(OnFormsCreated, FmFormPage*);
466 :
467 : SAL_DLLPRIVATE void LoopGrids(sal_Int16 nWhat);
468 :
469 : // Invalidierung von Slots
470 : SAL_DLLPRIVATE void InvalidateSlot( sal_Int16 nId, bool bWithId );
471 : SAL_DLLPRIVATE void UpdateSlot( sal_Int16 nId );
472 : // Locking der Invalidierung - wenn der interne Locking-Counter auf 0 geht, werden alle aufgelaufenen Slots
473 : // (asynchron) invalidiert
474 : SAL_DLLPRIVATE void LockSlotInvalidation(bool bLock);
475 :
476 : DECL_DLLPRIVATE_LINK(OnInvalidateSlots, void*);
477 :
478 : SAL_DLLPRIVATE void CloseExternalFormViewer();
479 : // closes the task-local beamer displaying a grid view for a form
480 :
481 : // ConfigItem related stuff
482 : SAL_DLLPRIVATE virtual void Notify( const com::sun::star::uno::Sequence< OUString >& _rPropertyNames) SAL_OVERRIDE;
483 : SAL_DLLPRIVATE void implAdjustConfigCache();
484 :
485 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
486 : getControlContainerForView();
487 :
488 : /** finds and sets a default for m_xCurrentForm, if it is currently NULL
489 : */
490 : SAL_DLLPRIVATE void impl_defaultCurrentForm_nothrow();
491 :
492 : /** sets m_xCurrentForm to the provided form, and updates everything which
493 : depends on the current form
494 : */
495 : SAL_DLLPRIVATE void impl_updateCurrentForm( const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxNewCurForm );
496 :
497 : /** adds or removes ourself as XEventListener at m_xActiveController
498 : */
499 : SAL_DLLPRIVATE void impl_switchActiveControllerListening( const bool _bListen );
500 :
501 : /** add an element
502 : */
503 : SAL_DLLPRIVATE void impl_AddElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
504 :
505 : /** remove an element
506 : */
507 : SAL_DLLPRIVATE void impl_RemoveElement_nothrow(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& Element);
508 :
509 : SAL_DLLPRIVATE virtual void ImplCommit() SAL_OVERRIDE;
510 :
511 : // asynchronous cursor actions/navigation slot handling
512 :
513 : public:
514 : /** execute the given form slot
515 : <p>Warning. Only a small set of slots implemented currently.</p>
516 : @param _nSlot
517 : the slot to execute
518 : */
519 : SAL_DLLPRIVATE void ExecuteFormSlot( sal_Int32 _nSlot );
520 :
521 : /** determines whether the current form slot is currently enabled
522 : */
523 : SAL_DLLPRIVATE bool IsFormSlotEnabled( sal_Int32 _nSlot, ::com::sun::star::form::runtime::FeatureState* _pCompleteState = NULL );
524 :
525 : protected:
526 : DECL_DLLPRIVATE_LINK( OnLoadForms, FmFormPage* );
527 : };
528 :
529 :
530 0 : inline bool FmXFormShell::IsSelectionUpdatePending()
531 : {
532 0 : return m_aMarkTimer.IsActive();
533 : }
534 :
535 :
536 : // = ein Iterator, der ausgehend von einem Interface ein Objekt sucht, dessen
537 : // = ::com::sun::star::beans::Property-Set eine ControlSource- sowie eine BoundField-Eigenschaft hat,
538 : // = wobei letztere einen Wert ungleich NULL haben muss.
539 : // = Wenn das Interface selber diese Bedingung nicht erfuellt, wird getestet,
540 : // = ob es ein Container ist (also ueber eine ::com::sun::star::container::XIndexAccess verfuegt), dann
541 : // = wird dort abgestiegen und fuer jedes Element des Containers das selbe
542 : // = versucht (wiederum eventuell mit Abstieg).
543 : // = Wenn irgendein Objekt dabei die geforderte Eigenschaft hat, entfaellt
544 : // = der Teil mit dem Container-Test fuer dieses Objekt.
545 : // =
546 :
547 0 : class SearchableControlIterator : public ::comphelper::IndexAccessIterator
548 : {
549 : OUString m_sCurrentValue;
550 : // der aktuelle Wert der ControlSource-::com::sun::star::beans::Property
551 :
552 : public:
553 0 : OUString getCurrentValue() const { return m_sCurrentValue; }
554 :
555 : public:
556 : SearchableControlIterator(::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xStartingPoint);
557 :
558 : virtual bool ShouldHandleElement(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& rElement) SAL_OVERRIDE;
559 : virtual bool ShouldStepInto(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& xContainer) const SAL_OVERRIDE;
560 0 : virtual void Invalidate() SAL_OVERRIDE { IndexAccessIterator::Invalidate(); m_sCurrentValue.clear(); }
561 : };
562 :
563 :
564 : typedef boost::ptr_vector<SfxStatusForwarder> StatusForwarderArray;
565 : class SVX_DLLPUBLIC ControlConversionMenuController : public SfxMenuControl
566 : {
567 : protected:
568 : StatusForwarderArray m_aStatusForwarders;
569 : Menu* m_pMainMenu;
570 : PopupMenu* m_pConversionMenu;
571 :
572 : public:
573 : SVX_DLLPRIVATE ControlConversionMenuController(sal_uInt16 nId, Menu& rMenu, SfxBindings& rBindings);
574 : SVX_DLLPRIVATE virtual ~ControlConversionMenuController();
575 : SFX_DECL_MENU_CONTROL();
576 :
577 : SVX_DLLPRIVATE virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
578 : };
579 :
580 : #endif // INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
581 :
582 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|