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