Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #ifndef _SVX_FMSHELL_HXX
29 : : #define _SVX_FMSHELL_HXX
30 : :
31 : : // ***************************************************************************************************
32 : : // ***************************************************************************************************
33 : : // ***************************************************************************************************
34 : :
35 : : #include <sfx2/shell.hxx>
36 : : #include <sfx2/module.hxx>
37 : : #include <vcl/event.hxx>
38 : :
39 : : #include <svx/svxids.hrc>
40 : : #include <svx/fmview.hxx>
41 : : #include "svx/svxdllapi.h"
42 : :
43 : : #include <svx/ifaceids.hxx>
44 : :
45 : : //========================================================================
46 : : class FmFormModel;
47 : : class FmFormPage;
48 : : class FmXFormShell;
49 : : class FmFormView;
50 : : class SdrView;
51 : : class SdrPage;
52 : : class SdrUnoObj;
53 : :
54 : : namespace com { namespace sun { namespace star { namespace form {
55 : : class XForm;
56 : : namespace runtime {
57 : : class XFormController;
58 : : }
59 : : } } } }
60 : :
61 : : namespace svx
62 : : {
63 : : class ISdrObjectFilter;
64 : : }
65 : :
66 : : //========================================================================
67 : : class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint
68 : : {
69 : : sal_Bool m_bDesignMode;
70 : :
71 : : public:
72 : : TYPEINFO();
73 : : FmDesignModeChangedHint( sal_Bool bDesMode );
74 : : virtual ~FmDesignModeChangedHint();
75 : :
76 : 1308 : sal_Bool GetDesignMode() const { return m_bDesignMode; }
77 : : };
78 : :
79 : : //========================================================================
80 : : class SVX_DLLPUBLIC FmFormShell : public SfxShell
81 : : {
82 : : friend class FmFormView;
83 : : friend class FmXFormShell;
84 : :
85 : : FmXFormShell* m_pImpl;
86 : : FmFormView* m_pFormView;
87 : : FmFormModel* m_pFormModel;
88 : : SfxViewShell* m_pParentShell;
89 : :
90 : : sal_uInt16 m_nLastSlot;
91 : : sal_Bool m_bDesignMode : 1;
92 : : sal_Bool m_bHasForms : 1; // flag storing if the forms on a page exist,
93 : : // only for the DesignMode, see UIFeatureChanged!
94 : :
95 : : // the marks of a FormView have changed...
96 : : void NotifyMarkListChanged(FmFormView*);
97 : : // (the FormView itself is not a broadcaster, therefore it can't always correctly notify the
98 : : // form explorer who is interested in the event)
99 : :
100 : : class FormShellWaitObject
101 : : {
102 : : Window* m_pWindow;
103 : : public:
104 : : FormShellWaitObject(const FmFormShell* _pShell);
105 : : ~FormShellWaitObject();
106 : : };
107 : : friend class FormShellWaitObject;
108 : :
109 : : const OutputDevice* GetCurrentViewDevice() const { return m_pFormView ? m_pFormView->GetActualOutDev() : NULL; }
110 : :
111 : : public:
112 : : SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH)
113 : : TYPEINFO();
114 : :
115 : : FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL);
116 : : virtual ~FmFormShell();
117 : :
118 : : virtual void Execute( SfxRequest& );
119 : : virtual void GetState( SfxItemSet& );
120 : : virtual sal_Bool HasUIFeature( sal_uInt32 nFeature );
121 : :
122 : : void ExecuteTextAttribute( SfxRequest& );
123 : : void GetTextAttributeState( SfxItemSet& );
124 : :
125 : : sal_Bool GetY2KState(sal_uInt16& nReturn);
126 : : void SetY2KState(sal_uInt16 n);
127 : :
128 : : void SetView(FmFormView* pView);
129 : :
130 : 130 : FmFormView* GetFormView() const { return m_pFormView; }
131 : : FmFormModel* GetFormModel() const { return m_pFormModel; }
132 : : FmFormPage* GetCurPage() const;
133 : : FmXFormShell* GetImpl() const {return m_pImpl;};
134 : :
135 : : sal_uInt16 PrepareClose(sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False);
136 : :
137 : : bool IsActiveControl() const;
138 : : void ForgetActiveControl();
139 : : void SetControlActivationHandler( const Link& _rHdl );
140 : :
141 : : virtual void Activate(sal_Bool bMDI);
142 : : virtual void Deactivate(sal_Bool bMDI);
143 : :
144 : : // helper methods for implementing XFormLayerAccess
145 : : SdrUnoObj* GetFormControl(
146 : : const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel,
147 : : const SdrView& _rView,
148 : : const OutputDevice& _rDevice,
149 : : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl
150 : : ) const;
151 : :
152 : : ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController(
153 : : const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm,
154 : : const SdrView& _rView,
155 : : const OutputDevice& _rDevice
156 : : ) const;
157 : :
158 : : /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus
159 : : to the control belonging to the given SdrUnoObj.
160 : : */
161 : : void ToggleControlFocus(
162 : : const SdrUnoObj& i_rNextCandidate,
163 : : const SdrView& i_rView,
164 : : OutputDevice& i_rDevice
165 : : ) const;
166 : :
167 : : ::std::auto_ptr< ::svx::ISdrObjectFilter >
168 : : CreateFocusableControlFilter(
169 : : const SdrView& i_rView,
170 : : const OutputDevice& i_rDevice
171 : : ) const;
172 : :
173 : 0 : sal_Bool IsDesignMode() const { return m_bDesignMode; }
174 : : void SetDesignMode( sal_Bool _bDesignMode );
175 : :
176 : : protected:
177 : : void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich);
178 : :
179 : : // is there a form on the current page?
180 : : void DetermineForms(sal_Bool bInvalidate);
181 : : void impl_setDesignMode( sal_Bool bDesign);
182 : : };
183 : :
184 : : // ***************************************************************************************************
185 : : // ***************************************************************************************************
186 : : // ***************************************************************************************************
187 : :
188 : : #endif // _SVX_FMSHELL_HXX
189 : :
190 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|