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 _SVX_FMSHELL_HXX
20 : #define _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 : sal_Bool m_bDesignMode;
61 :
62 : public:
63 : TYPEINFO();
64 : FmDesignModeChangedHint( sal_Bool bDesMode );
65 : virtual ~FmDesignModeChangedHint();
66 :
67 790 : sal_Bool GetDesignMode() const { return m_bDesignMode; }
68 : };
69 :
70 : //========================================================================
71 : class SVX_DLLPUBLIC FmFormShell : public SfxShell
72 : {
73 : friend class FmFormView;
74 : friend class FmXFormShell;
75 :
76 : FmXFormShell* m_pImpl;
77 : FmFormView* m_pFormView;
78 : FmFormModel* m_pFormModel;
79 : SfxViewShell* m_pParentShell;
80 :
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!
85 :
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)
90 :
91 : class FormShellWaitObject
92 : {
93 : Window* m_pWindow;
94 : public:
95 : FormShellWaitObject(const FmFormShell* _pShell);
96 : ~FormShellWaitObject();
97 : };
98 : friend class FormShellWaitObject;
99 :
100 0 : const OutputDevice* GetCurrentViewDevice() const { return m_pFormView ? m_pFormView->GetActualOutDev() : NULL; }
101 :
102 : public:
103 68 : SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH)
104 : TYPEINFO();
105 :
106 : FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL);
107 : virtual ~FmFormShell();
108 :
109 : virtual void Execute( SfxRequest& );
110 : virtual void GetState( SfxItemSet& );
111 : virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
112 :
113 : void ExecuteTextAttribute( SfxRequest& );
114 : void GetTextAttributeState( SfxItemSet& );
115 :
116 : sal_Bool GetY2KState(sal_uInt16& nReturn);
117 : void SetY2KState(sal_uInt16 n);
118 :
119 : void SetView(FmFormView* pView);
120 :
121 2751 : FmFormView* GetFormView() const { return m_pFormView; }
122 1977 : FmFormModel* GetFormModel() const { return m_pFormModel; }
123 : FmFormPage* GetCurPage() const;
124 17062 : FmXFormShell* GetImpl() const {return m_pImpl;};
125 :
126 : sal_uInt16 PrepareClose(sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
127 :
128 : bool IsActiveControl() const;
129 : void ForgetActiveControl();
130 : void SetControlActivationHandler( const Link& _rHdl );
131 :
132 : virtual void Activate(sal_Bool bMDI);
133 : virtual void Deactivate(sal_Bool bMDI);
134 :
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;
142 :
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;
148 :
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.
151 : */
152 : void ToggleControlFocus(
153 : const SdrUnoObj& i_rNextCandidate,
154 : const SdrView& i_rView,
155 : OutputDevice& i_rDevice
156 : ) const;
157 :
158 : ::std::auto_ptr< ::svx::ISdrObjectFilter >
159 : CreateFocusableControlFilter(
160 : const SdrView& i_rView,
161 : const OutputDevice& i_rDevice
162 : ) const;
163 :
164 1294 : sal_Bool IsDesignMode() const { return m_bDesignMode; }
165 : void SetDesignMode( sal_Bool _bDesignMode );
166 :
167 : protected:
168 : void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
169 :
170 : // is there a form on the current page?
171 : void DetermineForms(sal_Bool bInvalidate);
172 : void impl_setDesignMode( sal_Bool bDesign);
173 : };
174 :
175 : // ***************************************************************************************************
176 : // ***************************************************************************************************
177 : // ***************************************************************************************************
178 :
179 : #endif // _SVX_FMSHELL_HXX
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|