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