1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _SVX_FMSHELL_HXX 24 #define _SVX_FMSHELL_HXX 25 26 // *************************************************************************************************** 27 // *************************************************************************************************** 28 // *************************************************************************************************** 29 30 #include <sfx2/shell.hxx> 31 #include <sfx2/module.hxx> 32 #include <vcl/event.hxx> 33 34 #ifndef _SVX_SVXIDS_HRC 35 #include <svx/svxids.hrc> 36 #endif 37 #include <svx/fmview.hxx> 38 #include "svx/svxdllapi.h" 39 40 #include <svx/ifaceids.hxx> 41 42 //======================================================================== 43 class FmFormModel; 44 class FmFormPage; 45 class SvxFmTabWin; 46 class FmXFormShell; 47 class FmFormView; 48 class SdrView; 49 class SdrPage; 50 class SdrUnoObj; 51 52 namespace com { namespace sun { namespace star { namespace form { 53 class XForm; 54 namespace runtime { 55 class XFormController; 56 } 57 } } } } 58 59 namespace svx 60 { 61 class ISdrObjectFilter; 62 } 63 64 //======================================================================== 65 class SVX_DLLPUBLIC FmDesignModeChangedHint : public SfxHint 66 { 67 sal_Bool m_bDesignMode; 68 69 public: 70 TYPEINFO(); 71 FmDesignModeChangedHint( sal_Bool bDesMode ); 72 virtual ~FmDesignModeChangedHint(); 73 GetDesignMode() const74 sal_Bool GetDesignMode() const { return m_bDesignMode; } 75 }; 76 77 //======================================================================== 78 class SVX_DLLPUBLIC FmFormShell : public SfxShell 79 { 80 friend class FmFormView; 81 friend class FmXFormShell; 82 83 FmXFormShell* m_pImpl; 84 FmFormView* m_pFormView; 85 FmFormModel* m_pFormModel; 86 SfxViewShell* m_pParentShell; 87 88 sal_uInt16 m_nLastSlot; 89 sal_Bool m_bDesignMode : 1; 90 sal_Bool m_bHasForms : 1; // Flag welches festhaelt, ob Formulare auf einer Seite 91 // vorhanden sind, nur f�r den DesignMode, siehe UIFeatureChanged! 92 93 // die Markierungen einer FormView haben sich geaendert ... 94 void NotifyMarkListChanged(FmFormView*); 95 // (die FormView selber ist kein Broadcaster, deshalb kann sie den Formular-Explorer, den dieses 96 // Ereignis interesiert, nicht sauber verstaendigen (sie koennte sich lediglich von der Application 97 // das Navigator-Fenster geben lassen, aber das wollen wir ja nicht, ge ? ...)) 98 99 class FormShellWaitObject 100 { 101 Window* m_pWindow; 102 public: 103 FormShellWaitObject(const FmFormShell* _pShell); 104 ~FormShellWaitObject(); 105 }; 106 friend class FormShellWaitObject; 107 GetCurrentViewDevice() const108 const OutputDevice* GetCurrentViewDevice() const { return m_pFormView ? m_pFormView->GetActualOutDev() : NULL; } 109 110 public: 111 SFX_DECL_INTERFACE(SVX_INTERFACE_FORM_SH) 112 TYPEINFO(); 113 114 FmFormShell(SfxViewShell* pParent, FmFormView* pView = NULL); 115 virtual ~FmFormShell(); 116 117 virtual void Execute( SfxRequest& ); 118 virtual void GetState( SfxItemSet& ); 119 virtual sal_Bool HasUIFeature( sal_uInt32 nFeature ); 120 121 void ExecuteTextAttribute( SfxRequest& ); 122 void GetTextAttributeState( SfxItemSet& ); 123 124 sal_Bool GetY2KState(sal_uInt16& nReturn); 125 void SetY2KState(sal_uInt16 n); 126 127 void SetView(FmFormView* pView); 128 GetFormView() const129 FmFormView* GetFormView() const { return m_pFormView; } GetFormModel() const130 FmFormModel* GetFormModel() const { return m_pFormModel; } 131 FmFormPage* GetCurPage() const; GetImpl() const132 FmXFormShell* GetImpl() const {return m_pImpl;}; 133 134 sal_uInt16 PrepareClose(sal_Bool bUI = sal_True, sal_Bool bForBrowsing = sal_False); 135 136 bool IsActiveControl() const; 137 void ForgetActiveControl(); 138 void SetControlActivationHandler( const Link& _rHdl ); 139 140 virtual void Activate(sal_Bool bMDI); 141 virtual void Deactivate(sal_Bool bMDI); 142 143 // helper methods for implementing XFormLayerAccess 144 SdrUnoObj* GetFormControl( 145 const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& _rxModel, 146 const SdrView& _rView, 147 const OutputDevice& _rDevice, 148 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& _out_rxControl 149 ) const; 150 151 ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > GetFormController( 152 const ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm >& _rxForm, 153 const SdrView& _rView, 154 const OutputDevice& _rDevice 155 ) const; 156 157 /** puts the focus into the document window, if current a form control has the focus. Otherwise, moves the focus 158 to the control belonging to the given SdrUnoObj. 159 */ 160 void ToggleControlFocus( 161 const SdrUnoObj& i_rNextCandidate, 162 const SdrView& i_rView, 163 OutputDevice& i_rDevice 164 ) const; 165 166 ::std::auto_ptr< ::svx::ISdrObjectFilter > 167 CreateFocusableControlFilter( 168 const SdrView& i_rView, 169 const OutputDevice& i_rDevice 170 ) const; 171 IsDesignMode() const172 sal_Bool IsDesignMode() const { return m_bDesignMode; } 173 void SetDesignMode( sal_Bool _bDesignMode ); 174 175 protected: 176 void GetFormState(SfxItemSet &rSet, sal_uInt16 nWhich); 177 178 // gibt es ein Formular auf der aktuellen Seite? 179 void DetermineForms(sal_Bool bInvalidate); 180 void impl_setDesignMode( sal_Bool bDesign); 181 }; 182 183 // *************************************************************************************************** 184 // *************************************************************************************************** 185 // *************************************************************************************************** 186 187 #endif // _SVX_FMSHELL_HXX 188