Version 4.3.0.0.beta1, tag libreoffice-4.3.0.0.beta1
[LibreOffice.git] / include / svx / fmshell.hxx
blobb733b253d06ce959d6b09e26bd51924126017a22
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
19 #ifndef INCLUDED_SVX_FMSHELL_HXX
20 #define INCLUDED_SVX_FMSHELL_HXX
22 // ***************************************************************************************************
23 // ***************************************************************************************************
24 // ***************************************************************************************************
26 #include <sfx2/shell.hxx>
27 #include <sfx2/module.hxx>
28 #include <vcl/event.hxx>
30 #include <svx/svxids.hrc>
31 #include <svx/fmview.hxx>
32 #include <svx/svxdllapi.h>
34 #include <svx/ifaceids.hxx>
37 class FmFormModel;
38 class FmFormPage;
39 class FmXFormShell;
40 class FmFormView;
41 class SdrView;
42 class SdrPage;
43 class SdrUnoObj;
45 namespace com { namespace sun { namespace star { namespace form {
46 class XForm;
47 namespace runtime {
48 class XFormController;
50 } } } }
52 namespace svx
54 class ISdrObjectFilter;
58 class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint
60 bool m_bDesignMode;
62 public:
63 TYPEINFO_OVERRIDE();
64 FmDesignModeChangedHint( bool bDesMode );
65 virtual ~FmDesignModeChangedHint();
67 bool GetDesignMode() const { return m_bDesignMode; }
71 class SVX_DLLPUBLIC FmFormShell : public SfxShell
73 friend class FmFormView;
74 friend class FmXFormShell;
76 FmXFormShell* m_pImpl;
77 FmFormView* m_pFormView;
78 FmFormModel* m_pFormModel;
79 SfxViewShell* m_pParentShell;
81 sal_uInt16 m_nLastSlot;
82 bool m_bDesignMode : 1;
83 bool m_bHasForms : 1; // flag storing if the forms on a page exist,
84 // only for the DesignMode, see UIFeatureChanged!
86 // the marks of a FormView have changed...
87 void NotifyMarkListChanged(FmFormView*);
88 // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
89 // form explorer who is interested in the event)
91 class FormShellWaitObject
93 Window* m_pWindow;
94 public:
95 FormShellWaitObject(const FmFormShell* _pShell);
96 ~FormShellWaitObject();
98 friend class FormShellWaitObject;
100 const OutputDevice* GetCurrentViewDevice() const { return m_pFormView ? m_pFormView->GetActualOutDev() : NULL; }
102 public:
103 SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH)
104 TYPEINFO_OVERRIDE();
106 private:
107 /// SfxInterface initializer.
108 static void InitInterface_Impl();
110 public:
111 FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL);
112 virtual ~FmFormShell();
114 virtual void Execute( SfxRequest& );
115 virtual void GetState( SfxItemSet& );
116 virtual bool HasUIFeature( sal_uInt32 nFeature ) SAL_OVERRIDE;
118 void ExecuteTextAttribute( SfxRequest& );
119 void GetTextAttributeState( SfxItemSet& );
121 bool GetY2KState(sal_uInt16& nReturn);
122 void SetY2KState(sal_uInt16 n);
124 void SetView(FmFormView* pView);
126 FmFormView* GetFormView() const { return m_pFormView; }
127 FmFormModel* GetFormModel() const { return m_pFormModel; }
128 FmFormPage* GetCurPage() const;
129 FmXFormShell* GetImpl() const {return m_pImpl;};
131 bool PrepareClose(bool bUI = true);
133 bool IsActiveControl() const;
134 void ForgetActiveControl();
135 void SetControlActivationHandler( const Link& _rHdl );
137 virtual void Activate(bool bMDI) SAL_OVERRIDE;
138 virtual void Deactivate(bool bMDI) SAL_OVERRIDE;
140 // helper methods for implementing XFormLayerAccess
141 SdrUnoObj* GetFormControl(
142 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
143 const SdrView& _rView,
144 const OutputDevice& _rDevice,
145 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl
146 ) const;
148 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(
149 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
150 const SdrView& _rView,
151 const OutputDevice& _rDevice
152 ) const;
154 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
155 to the control belonging to the given SdrUnoObj.
157 void ToggleControlFocus(
158 const SdrUnoObj& i_rNextCandidate,
159 const SdrView& i_rView,
160 OutputDevice& i_rDevice
161 ) const;
163 ::std::auto_ptr< ::svx::ISdrObjectFilter >
164 CreateFocusableControlFilter(
165 const SdrView& i_rView,
166 const OutputDevice& i_rDevice
167 ) const;
169 bool IsDesignMode() const { return m_bDesignMode; }
170 void SetDesignMode( bool _bDesignMode );
172 protected:
173 void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
175 // is there a form on the current page?
176 void DetermineForms(bool bInvalidate);
177 void impl_setDesignMode( bool bDesign);
180 // ***************************************************************************************************
181 // ***************************************************************************************************
182 // ***************************************************************************************************
184 #endif // INCLUDED_SVX_FMSHELL_HXX
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */