update credits
[LibreOffice.git] / include / svx / fmshell.hxx
blobc6091aa4ba2406617111d181a72466f8acfe3694
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 _SVX_FMSHELL_HXX
20 #define _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>
36 //========================================================================
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;
57 //========================================================================
58 class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint
60 sal_Bool m_bDesignMode;
62 public:
63 TYPEINFO();
64 FmDesignModeChangedHint( sal_Bool bDesMode );
65 virtual ~FmDesignModeChangedHint();
67 sal_Bool GetDesignMode() const { return m_bDesignMode; }
70 //========================================================================
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 sal_Bool m_bDesignMode : 1;
83 sal_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();
106 FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL);
107 virtual ~FmFormShell();
109 virtual void Execute( SfxRequest& );
110 virtual void GetState( SfxItemSet& );
111 virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
113 void ExecuteTextAttribute( SfxRequest& );
114 void GetTextAttributeState( SfxItemSet& );
116 sal_Bool GetY2KState(sal_uInt16& nReturn);
117 void SetY2KState(sal_uInt16 n);
119 void SetView(FmFormView* pView);
121 FmFormView* GetFormView() const { return m_pFormView; }
122 FmFormModel* GetFormModel() const { return m_pFormModel; }
123 FmFormPage* GetCurPage() const;
124 FmXFormShell* GetImpl() const {return m_pImpl;};
126 sal_uInt16 PrepareClose(sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
128 bool IsActiveControl() const;
129 void ForgetActiveControl();
130 void SetControlActivationHandler( const Link& _rHdl );
132 virtual void Activate(sal_Bool bMDI);
133 virtual void Deactivate(sal_Bool bMDI);
135 // helper methods for implementing XFormLayerAccess
136 SdrUnoObj* GetFormControl(
137 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
138 const SdrView& _rView,
139 const OutputDevice& _rDevice,
140 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl
141 ) const;
143 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(
144 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
145 const SdrView& _rView,
146 const OutputDevice& _rDevice
147 ) const;
149 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
150 to the control belonging to the given SdrUnoObj.
152 void ToggleControlFocus(
153 const SdrUnoObj& i_rNextCandidate,
154 const SdrView& i_rView,
155 OutputDevice& i_rDevice
156 ) const;
158 ::std::auto_ptr< ::svx::ISdrObjectFilter >
159 CreateFocusableControlFilter(
160 const SdrView& i_rView,
161 const OutputDevice& i_rDevice
162 ) const;
164 sal_Bool IsDesignMode() const { return m_bDesignMode; }
165 void SetDesignMode( sal_Bool _bDesignMode );
167 protected:
168 void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
170 // is there a form on the current page?
171 void DetermineForms(sal_Bool bInvalidate);
172 void impl_setDesignMode( sal_Bool bDesign);
175 // ***************************************************************************************************
176 // ***************************************************************************************************
177 // ***************************************************************************************************
179 #endif // _SVX_FMSHELL_HXX
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */