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