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_FMSHELL_HXX
20 : #define INCLUDED_SVX_FMSHELL_HXX
21 :
22 : // ***************************************************************************************************
23 : // ***************************************************************************************************
24 : // ***************************************************************************************************
25 :
26 : #include <sfx2/shell.hxx>
27 : #include <sfx2/module.hxx>
28 : #include <vcl/event.hxx>
29 :
30 : #include <svx/svxids.hrc>
31 : #include <svx/fmview.hxx>
32 : #include <svx/svxdllapi.h>
33 :
34 : #include <svx/ifaceids.hxx>
35 :
36 :
37 : class FmFormModel;
38 : class FmFormPage;
39 : class FmXFormShell;
40 : class FmFormView;
41 : class SdrView;
42 : class SdrPage;
43 : class SdrUnoObj;
44 :
45 : namespace com { namespace sun { namespace star { namespace form {
46 : class XForm;
47 : namespace runtime {
48 : class XFormController;
49 : }
50 : } } } }
51 :
52 : namespace svx
53 : {
54 : class ISdrObjectFilter;
55 : }
56 :
57 :
58 : class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint
59 : {
60 : bool m_bDesignMode;
61 :
62 : public:
63 : FmDesignModeChangedHint( bool bDesMode );
64 : virtual ~FmDesignModeChangedHint();
65 :
66 4734 : bool GetDesignMode() const { return m_bDesignMode; }
67 : };
68 :
69 :
70 : class SVX_DLLPUBLIC FmFormShell : public SfxShell
71 : {
72 : friend class FmFormView;
73 : friend class FmXFormShell;
74 :
75 : FmXFormShell* m_pImpl;
76 : FmFormView* m_pFormView;
77 : FmFormModel* m_pFormModel;
78 : SfxViewShell* m_pParentShell;
79 :
80 : sal_uInt16 m_nLastSlot;
81 : bool m_bDesignMode : 1;
82 : bool m_bHasForms : 1; // flag storing if the forms on a page exist,
83 : // only for the DesignMode, see UIFeatureChanged!
84 :
85 : // the marks of a FormView have changed...
86 : void NotifyMarkListChanged(FmFormView*);
87 : // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
88 : // form explorer who is interested in the event)
89 :
90 : class FormShellWaitObject
91 : {
92 : vcl::Window* m_pWindow;
93 : public:
94 : FormShellWaitObject(const FmFormShell* _pShell);
95 : ~FormShellWaitObject();
96 : };
97 : friend class FormShellWaitObject;
98 :
99 0 : const OutputDevice* GetCurrentViewDevice() const { return m_pFormView ? m_pFormView->GetActualOutDev() : NULL; }
100 :
101 : public:
102 170 : SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH)
103 : TYPEINFO_OVERRIDE();
104 :
105 : private:
106 : /// SfxInterface initializer.
107 : static void InitInterface_Impl();
108 :
109 : public:
110 : FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL);
111 : virtual ~FmFormShell();
112 :
113 : virtual void Execute( SfxRequest& );
114 : virtual void GetState( SfxItemSet& );
115 : virtual bool HasUIFeature( sal_uInt32 nFeature ) SAL_OVERRIDE;
116 :
117 : void ExecuteTextAttribute( SfxRequest& );
118 : void GetTextAttributeState( SfxItemSet& );
119 :
120 : bool GetY2KState(sal_uInt16& nReturn);
121 : void SetY2KState(sal_uInt16 n);
122 :
123 : void SetView(FmFormView* pView);
124 :
125 12534 : FmFormView* GetFormView() const { return m_pFormView; }
126 7627 : FmFormModel* GetFormModel() const { return m_pFormModel; }
127 : FmFormPage* GetCurPage() const;
128 71346 : FmXFormShell* GetImpl() const {return m_pImpl;};
129 :
130 : bool PrepareClose(bool bUI = true);
131 :
132 : bool IsActiveControl() const;
133 : void ForgetActiveControl();
134 : void SetControlActivationHandler( const Link& _rHdl );
135 :
136 : virtual void Activate(bool bMDI) SAL_OVERRIDE;
137 : virtual void Deactivate(bool bMDI) SAL_OVERRIDE;
138 :
139 : // helper methods for implementing XFormLayerAccess
140 : SdrUnoObj* GetFormControl(
141 : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
142 : const SdrView& _rView,
143 : const OutputDevice& _rDevice,
144 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl
145 : ) const;
146 :
147 : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(
148 : const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
149 : const SdrView& _rView,
150 : const OutputDevice& _rDevice
151 : ) const;
152 :
153 : /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
154 : to the control belonging to the given SdrUnoObj.
155 : */
156 : void ToggleControlFocus(
157 : const SdrUnoObj& i_rNextCandidate,
158 : const SdrView& i_rView,
159 : OutputDevice& i_rDevice
160 : ) const;
161 :
162 : ::std::unique_ptr< ::svx::ISdrObjectFilter >
163 : CreateFocusableControlFilter(
164 : const SdrView& i_rView,
165 : const OutputDevice& i_rDevice
166 : ) const;
167 :
168 6072 : virtual bool IsDesignMode() const SAL_OVERRIDE { return m_bDesignMode; }
169 : void SetDesignMode( bool _bDesignMode );
170 :
171 : protected:
172 : void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
173 :
174 : // is there a form on the current page?
175 : void DetermineForms(bool bInvalidate);
176 : void impl_setDesignMode( bool bDesign);
177 : };
178 :
179 : // ***************************************************************************************************
180 : // ***************************************************************************************************
181 : // ***************************************************************************************************
182 :
183 : #endif // INCLUDED_SVX_FMSHELL_HXX
184 :
185 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|