19#ifndef INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
20#define INCLUDED_SVX_SOURCE_INC_FMSHIMP_HXX
22#include <config_options.h>
23#include <com/sun/star/sdbc/XResultSet.hpp>
24#include <com/sun/star/container/ContainerEvent.hpp>
25#include <com/sun/star/container/XContainerListener.hpp>
26#include <com/sun/star/awt/XControl.hpp>
27#include <com/sun/star/awt/XControlContainer.hpp>
28#include <com/sun/star/form/XForm.hpp>
29#include <com/sun/star/form/runtime/XFormController.hpp>
30#include <com/sun/star/form/XFormComponent.hpp>
31#include <com/sun/star/form/NavigationBarMode.hpp>
32#include <com/sun/star/frame/XFrame.hpp>
33#include <com/sun/star/view/XSelectionChangeListener.hpp>
34#include <com/sun/star/beans/XPropertyChangeListener.hpp>
35#include <com/sun/star/beans/PropertyChangeEvent.hpp>
36#include <com/sun/star/form/runtime/FeatureState.hpp>
44#include <osl/mutex.hxx>
60typedef std::vector< css::uno::Reference< css::form::XForm > >
FmFormArray;
63#define DO_SAFE(statement) try { statement; } catch( const Exception& ) { TOOLS_WARN_EXCEPTION("svx", "unhandled exception (I tried to move a cursor (or something like that).)"); }
104 virtual bool ShouldHandleElement(
const css::uno::Reference< css::uno::XInterface>& _rElement)
override;
105 virtual bool ShouldStepInto(
const css::uno::Reference< css::uno::XInterface>& _rContainer)
const override;
125typedef ::cppu::WeakComponentImplHelper< css::beans::XPropertyChangeListener
126 , css::container::XContainerListener
127 , css::view::XSelectionChangeListener
128 , css::form::XFormControllerListener
134 using css::beans::XPropertyChangeListener::disposing;
137 using WeakComponentImplHelperBase::disposing;
143 class FmTextControlShell;
154class UNLESS_MERGELIBS(SVXCORE_DLLPUBLIC) FmXFormShell final :
private cppu::BaseMutex
162 class SuspendPropertyTracking;
163 friend class SuspendPropertyTracking;
167 std::vector<SdrObject*> m_arrSearchedControls;
171 struct SAL_DLLPRIVATE InvalidSlotInfo {
174 InvalidSlotInfo(sal_uInt16 slotId,
sal_uInt8 flgs) : id(slotId), flags(flgs) {};
176 std::vector<InvalidSlotInfo> m_arrInvalidSlots;
180 css::form::NavigationBarMode m_eNavigate;
185 std::vector<sal_Int16> m_arrRelativeGridColumn;
189 ::std::queue< FmLoadAction >
193 std::unique_ptr<svx::FmTextControlShell> m_pTextShell;
200 css::uno::Reference< css::form::runtime::XFormController > m_xActiveController;
201 css::uno::Reference< css::form::runtime::XFormController > m_xNavigationController;
202 css::uno::Reference< css::form::XForm > m_xActiveForm;
206 css::uno::Reference< css::container::XIndexAccess> m_xForms;
211 css::uno::Reference< css::form::XForm > m_xCurrentForm;
220 css::uno::Reference< css::awt::XControlModel> m_xLastGridFound;
222 css::uno::Reference< css::frame::XFrame> m_xAttachedFrame;
224 css::uno::Reference< css::frame::XController > m_xExternalViewController;
225 css::uno::Reference< css::form::runtime::XFormController > m_xExtViewTriggerController;
226 css::uno::Reference< css::sdbc::XResultSet > m_xExternalDisplayedForm;
230 sal_Int16 m_nLockSlotInvalidation;
231 bool m_bHadPropertyBrowserInDesignMode : 1;
233 bool m_bTrackProperties : 1;
236 bool m_bUseWizards : 1;
238 bool m_bDatabaseBar : 1;
239 bool m_bInActivate : 1;
240 bool m_bSetFocus : 1;
241 bool m_bFilterMode : 1;
242 bool m_bChangingDesignMode:1;
243 bool m_bPreparedClose : 1;
245 bool m_bFirstActivation : 1;
249 SAL_DLLPRIVATE
const css::uno::Reference< css::frame::XFrame >&
250 getHostFrame_Lock()
const {
return m_xAttachedFrame; }
251 SAL_DLLPRIVATE
const css::uno::Reference< css::sdbc::XResultSet >&
252 getExternallyDisplayedForm_Lock()
const {
return m_xExternalDisplayedForm; }
255 didPrepareClose_Lock()
const {
return m_bPreparedClose; }
257 didPrepareClose_Lock(
bool bDid) { m_bPreparedClose = bDid; }
262 SAL_DLLPRIVATE
virtual ~FmXFormShell()
override;
265 SAL_DLLPRIVATE
virtual void SAL_CALL disposing(
const css::lang::EventObject& Source)
override;
268 SAL_DLLPRIVATE
virtual void SAL_CALL
elementInserted(
const css::container::ContainerEvent& rEvent)
override;
269 SAL_DLLPRIVATE
virtual void SAL_CALL
elementReplaced(
const css::container::ContainerEvent& rEvent)
override;
270 SAL_DLLPRIVATE
virtual void SAL_CALL
elementRemoved(
const css::container::ContainerEvent& rEvent)
override;
273 SAL_DLLPRIVATE
virtual void SAL_CALL
selectionChanged(
const css::lang::EventObject& rEvent)
override;
276 SAL_DLLPRIVATE
virtual void SAL_CALL propertyChange(
const css::beans::PropertyChangeEvent& evt)
override;
279 SAL_DLLPRIVATE
virtual void SAL_CALL formActivated(
const css::lang::EventObject& rEvent)
override;
280 SAL_DLLPRIVATE
virtual void SAL_CALL formDeactivated(
const css::lang::EventObject& rEvent)
override;
283 SAL_DLLPRIVATE
virtual void SAL_CALL disposing()
override;
286 SAL_DLLPRIVATE
void EnableTrackProperties_Lock(
bool bEnable) { m_bTrackProperties = bEnable; }
287 SAL_DLLPRIVATE
bool IsTrackPropertiesEnabled_Lock()
const {
return m_bTrackProperties; }
290 SAL_DLLPRIVATE
void viewActivated_Lock(
FmFormView& _rCurrentView,
bool _bSyncAction =
false);
291 SAL_DLLPRIVATE
void viewDeactivated_Lock(
FmFormView& _rCurrentView,
bool _bDeactivateController =
true);
294 SAL_DLLPRIVATE
virtual void invalidateFeatures( const ::std::vector< sal_Int32 >& _rFeatures )
override;
296 SAL_DLLPRIVATE
void ExecuteTabOrderDialog_Lock(
297 const css::uno::Reference< css::awt::XTabControllerModel >& _rxForForm
301 SAL_DLLPRIVATE
void AddElement_Lock(
const css::uno::Reference< css::uno::XInterface>& Element);
302 SAL_DLLPRIVATE
void RemoveElement_Lock(
const css::uno::Reference< css::uno::XInterface>& Element);
307 SAL_DLLPRIVATE
void UpdateForms_Lock(
bool bInvalidate);
309 SAL_DLLPRIVATE
void ExecuteSearch_Lock();
310 SAL_DLLPRIVATE
void CreateExternalView_Lock();
312 SAL_DLLPRIVATE
bool GetY2KState_Lock(sal_uInt16 & n);
313 SAL_DLLPRIVATE
void SetY2KState_Lock(sal_uInt16 n);
319 SAL_DLLPRIVATE
void smartControlReset(
const css::uno::Reference< css::container::XIndexAccess >& _rxModels );
322 SAL_DLLPRIVATE
void startListening_Lock();
323 SAL_DLLPRIVATE
void stopListening_Lock();
325 SAL_DLLPRIVATE css::uno::Reference< css::awt::XControl >
326 impl_getControl_Lock(
327 const css::uno::Reference< css::awt::XControlModel>& i_rxModel,
328 const FmFormObj& i_rKnownFormObj
332 SAL_DLLPRIVATE
static void impl_collectFormSearchContexts_nothrow_Lock(
333 const css::uno::Reference< css::uno::XInterface>& _rxStartingPoint,
334 std::u16string_view _rCurrentLevelPrefix,
336 ::std::vector< OUString >& _out_rNames );
341 SAL_DLLPRIVATE
bool impl_checkDisposed_Lock()
const;
345 SAL_DLLPRIVATE
void setActiveController_Lock(
const css::uno::Reference< css::form::runtime::XFormController>& _xController,
bool _bNoSaveOldContent =
false);
346 SAL_DLLPRIVATE
const css::uno::Reference< css::form::runtime::XFormController>& getActiveController_Lock()
const {
return m_xActiveController; }
347 SAL_DLLPRIVATE
const css::uno::Reference< css::form::runtime::XFormController>& getActiveInternalController_Lock()
const {
return m_xActiveController == m_xExternalViewController ? m_xExtViewTriggerController : m_xActiveController; }
348 SAL_DLLPRIVATE
const css::uno::Reference< css::form::XForm>& getActiveForm_Lock()
const {
return m_xActiveForm; }
349 SAL_DLLPRIVATE
const css::uno::Reference< css::form::runtime::XFormController>& getNavController_Lock()
const {
return m_xNavigationController; }
352 {
return m_aActiveControllerFeatures; }
354 {
return m_aNavControllerFeatures.
isAssigned() ? m_aNavControllerFeatures : m_aActiveControllerFeatures; }
360 SAL_DLLPRIVATE
bool setCurrentSelection_Lock(
InterfaceBag&& rSelection);
364 SAL_DLLPRIVATE
bool selectLastMarkedControls_Lock();
368 void getCurrentSelection_Lock(
InterfaceBag& _rSelection)
const;
374 SAL_DLLPRIVATE
bool setCurrentSelectionFromMark_Lock(
const SdrMarkList& rMarkList);
377 SAL_DLLPRIVATE
const css::uno::Reference< css::form::XForm >&
378 getCurrentForm_Lock()
const {
return m_xCurrentForm; }
379 SAL_DLLPRIVATE
void forgetCurrentForm_Lock();
381 SAL_DLLPRIVATE
bool onlyControlsAreMarked_Lock()
const {
return !m_aLastKnownMarkedControls.
empty(); }
384 SAL_DLLPRIVATE
bool isSolelySelected_Lock(
385 const css::uno::Reference< css::uno::XInterface >& _rxObject
389 SAL_DLLPRIVATE
void handleMouseButtonDown_Lock(
const SdrViewEvent& _rViewEvent );
391 SAL_DLLPRIVATE
void handleShowPropertiesRequest_Lock();
393 SAL_DLLPRIVATE
bool hasForms_Lock()
const {
return m_xForms.is() && m_xForms->getCount() != 0; }
394 SAL_DLLPRIVATE
bool hasDatabaseBar_Lock()
const {
return m_bDatabaseBar; }
396 SAL_DLLPRIVATE
void ShowSelectionProperties_Lock(
bool bShow);
397 SAL_DLLPRIVATE
bool IsPropBrwOpen_Lock()
const;
399 SAL_DLLPRIVATE
void DetermineSelection_Lock(
const SdrMarkList& rMarkList);
400 SAL_DLLPRIVATE
void SetSelection_Lock(
const SdrMarkList& rMarkList);
401 SAL_DLLPRIVATE
void SetSelectionDelayed_Lock();
403 SAL_DLLPRIVATE
void SetDesignMode_Lock(
bool bDesign);
405 SAL_DLLPRIVATE
bool GetWizardUsing_Lock()
const {
return m_bUseWizards; }
406 SAL_DLLPRIVATE
void SetWizardUsing_Lock(
bool _bUseThem);
409 SAL_DLLPRIVATE
bool isInFilterMode_Lock()
const {
return m_bFilterMode; }
410 SAL_DLLPRIVATE
void startFiltering_Lock();
411 SAL_DLLPRIVATE
void stopFiltering_Lock(
bool bSave);
414 SAL_DLLPRIVATE
static void GetConversionMenu_Lock(
weld::Menu& rMenu);
417 SAL_DLLPRIVATE
bool canConvertCurrentSelectionToControl_Lock(std::u16string_view rIdent);
419 SAL_DLLPRIVATE
void checkControlConversionSlotsForCurrentSelection_Lock(
weld::Menu& rMenu);
421 SAL_DLLPRIVATE
bool executeControlConversionSlot_Lock(
const css::uno::Reference< css::form::XFormComponent >& _rxObject, std::u16string_view rIdent);
425 SAL_DLLPRIVATE
void executeControlConversionSlot_Lock(std::u16string_view rIdent);
427 SAL_DLLPRIVATE
static bool isControlConversionSlot(std::u16string_view rIdent);
429 SAL_DLLPRIVATE
void ExecuteTextAttribute_Lock(
SfxRequest& _rReq);
430 SAL_DLLPRIVATE
void GetTextAttributeState_Lock(
SfxItemSet& _rSet);
431 SAL_DLLPRIVATE
bool IsActiveControl_Lock(
bool _bCountRichTextOnly)
const;
432 SAL_DLLPRIVATE
void ForgetActiveControl_Lock();
437 SAL_DLLPRIVATE
bool isEnhancedForm_Lock()
const;
440 SAL_DLLPRIVATE
bool IsReadonlyDoc_Lock()
const;
444 SAL_DLLPRIVATE
inline bool IsSelectionUpdatePending_Lock()
const;
445 SAL_DLLPRIVATE
void ForceUpdateSelection_Lock();
447 SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel> getContextDocument_Lock()
const;
448 SAL_DLLPRIVATE css::uno::Reference< css::form::XForm> getInternalForm_Lock(
const css::uno::Reference< css::form::XForm>& _xForm)
const;
449 SAL_DLLPRIVATE css::uno::Reference< css::sdbc::XResultSet> getInternalForm_Lock(
const css::uno::Reference< css::sdbc::XResultSet>& _xForm)
const;
454 SAL_DLLPRIVATE
bool HasControlFocus_Lock()
const;
467 SAL_DLLPRIVATE
void InvalidateSlot_Lock(sal_Int16 nId,
bool bWithId);
468 SAL_DLLPRIVATE
void UpdateSlot_Lock(sal_Int16 nId);
471 SAL_DLLPRIVATE
void LockSlotInvalidation_Lock(
bool bLock);
475 SAL_DLLPRIVATE
void CloseExternalFormViewer_Lock();
479 SAL_DLLPRIVATE
virtual void Notify(
const css::uno::Sequence< OUString >& _rPropertyNames)
override;
480 SAL_DLLPRIVATE
void implAdjustConfigCache_Lock();
482 SAL_DLLPRIVATE css::uno::Reference< css::awt::XControlContainer >
483 getControlContainerForView_Lock()
const;
487 SAL_DLLPRIVATE
void impl_defaultCurrentForm_nothrow_Lock();
492 SAL_DLLPRIVATE
void impl_updateCurrentForm_Lock(
const css::uno::Reference< css::form::XForm >& _rxNewCurForm );
496 SAL_DLLPRIVATE
void impl_switchActiveControllerListening_Lock(
const bool _bListen);
500 SAL_DLLPRIVATE
void impl_AddElement_nothrow(
const css::uno::Reference< css::uno::XInterface>& Element);
504 SAL_DLLPRIVATE
void impl_RemoveElement_nothrow_Lock(
const css::uno::Reference< css::uno::XInterface>& Element);
506 SAL_DLLPRIVATE
virtual void ImplCommit()
override;
516 SAL_DLLPRIVATE
void ExecuteFormSlot_Lock(sal_Int32 _nSlot);
520 SAL_DLLPRIVATE
bool IsFormSlotEnabled( sal_Int32 _nSlot, css::form::runtime::FeatureState* _pCompleteState )
const;
522 SAL_DLLPRIVATE
static OUString SlotToIdent(sal_uInt16 nSlot);
529inline bool FmXFormShell::IsSelectionUpdatePending_Lock()
const
531 return m_aMarkTimer.IsActive();
555 virtual bool ShouldHandleElement(
const css::uno::Reference< css::uno::XInterface>& rElement)
override;
556 virtual bool ShouldStepInto(
const css::uno::Reference< css::uno::XInterface>& xContainer)
const override;
557 virtual void Invalidate()
override { IndexAccessIterator::Invalidate(); m_sCurrentValue.clear(); }
const OUString & getCurrentValue() const
virtual void Invalidate() override
IndexAccessIterator(css::uno::Reference< css::uno::XInterface > xStartingPoint)
easier access to a FormControllerHelper instance
bool isAssigned() const
checks whether the instance is properly assigned to a form and/or controller
virtual void Notify(const css::uno::Sequence< OUString > &aPropertyNames)=0
virtual void ImplCommit()=0
::cppu::WeakComponentImplHelper< css::beans::XPropertyChangeListener, css::container::XContainerListener, css::view::XSelectionChangeListener, css::form::XFormControllerListener > FmXFormShell_BD_BASE
std::vector< css::uno::Reference< css::form::XForm > > FmFormArray
FmXFormShell_Base_Disambiguation FmXFormShell_BASE
::utl::ConfigItem FmXFormShell_CFGBASE
#define DECL_DLLPRIVATE_LINK(Member, ArgType, RetType)
virtual DECL_LISTENERMULTIPLEXER_END void SAL_CALL selectionChanged(const css::lang::EventObject &aEvent) override
void SAL_CALL elementReplaced(const css::container::ContainerEvent &Event) override
void SAL_CALL elementRemoved(const css::container::ContainerEvent &Event) override
DECL_LISTENERMULTIPLEXER_END void SAL_CALL elementInserted(const css::container::ContainerEvent &Event) override
class SvxPropertySetInfoPool
FmLoadAction(FmFormPage *_pPage, LoadFormsFlags _nFlags, ImplSVEvent *_nEventId)