update dev300-m57
[ooovba.git] / sc / inc / scmod.hxx
bloba3d6ad185e41ad8707432a29b12564e995c9c668
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scmod.hxx,v $
10 * $Revision: 1.24.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_SCMOD_HXX
32 #define SC_SCMOD_HXX
34 #include "scdllapi.h"
35 #include "scdll.hxx"
36 #include <vcl/timer.hxx>
37 #include <svtools/lstner.hxx>
38 #include "global.hxx" // ScInputMode
39 #include "markdata.hxx" //ScMarkData
40 #include "shellids.hxx"
42 #include <tools/shl.hxx>
45 class KeyEvent;
46 class SdrModel;
47 class SdrView;
48 class EditView;
49 class SfxErrorHandler;
50 class SvxErrorHandler;
51 class SvtAccessibilityOptions;
52 class SvtCTLOptions;
53 class SvtUserOptions;
55 namespace svtools { class ColorConfig; }
57 class ScRange;
58 class ScDocument;
59 class ScViewCfg;
60 class ScDocCfg;
61 class ScAppCfg;
62 class ScInputCfg;
63 class ScPrintCfg;
64 class ScViewOptions;
65 class ScDocOptions;
66 class ScAppOptions;
67 class ScInputOptions;
68 class ScPrintOptions;
69 class ScInputHandler;
70 class ScInputWindow;
71 class ScTabViewShell;
72 class ScFunctionDlg;
73 class ScArgDlgBase;
74 class ScTeamDlg;
75 class ScEditFunctionDlg;
76 class ScMessagePool;
77 class EditFieldInfo;
78 class ScNavipiCfg;
79 class ScAddInCfg;
81 class ScTransferObj;
82 class ScDrawTransferObj;
83 class ScSelectionTransferObj;
85 class ScFormEditData;
87 //==================================================================
89 // for internal Drag&Drop:
91 #define SC_DROP_NAVIGATOR 1
92 #define SC_DROP_TABLE 2
94 struct ScDragData
96 ScTransferObj* pCellTransfer;
97 ScDrawTransferObj* pDrawTransfer;
99 String aLinkDoc;
100 String aLinkTable;
101 String aLinkArea;
102 ScDocument* pJumpLocalDoc;
103 String aJumpTarget;
104 String aJumpText;
107 struct ScClipData
109 ScTransferObj* pCellClipboard;
110 ScDrawTransferObj* pDrawClipboard;
113 //==================================================================
116 class ScModule: public SfxModule, public SfxListener
118 Timer aIdleTimer;
119 Timer aSpellTimer;
120 ScDragData aDragData;
121 ScClipData aClipData;
122 ScSelectionTransferObj* pSelTransfer;
123 ScMessagePool* pMessagePool;
124 // globalen InputHandler gibt's nicht mehr, jede View hat einen
125 ScInputHandler* pRefInputHandler;
126 ScTeamDlg* pTeamDlg;
127 ScViewCfg* pViewCfg;
128 ScDocCfg* pDocCfg;
129 ScAppCfg* pAppCfg;
130 ScInputCfg* pInputCfg;
131 ScPrintCfg* pPrintCfg;
132 ScNavipiCfg* pNavipiCfg;
133 ScAddInCfg* pAddInCfg;
134 svtools::ColorConfig* pColorConfig;
135 SvtAccessibilityOptions* pAccessOptions;
136 SvtCTLOptions* pCTLOptions;
137 SvtUserOptions* pUserOptions;
138 SfxErrorHandler* pErrorHdl;
139 SvxErrorHandler* pSvxErrorHdl;
140 ScFormEditData* pFormEditData;
141 USHORT nCurRefDlgId;
142 BOOL bIsWaterCan;
143 BOOL bIsInEditCommand;
144 BOOL bIsInExecuteDrop;
145 bool mbIsInSharedDocLoading;
146 bool mbIsInSharedDocSaving;
148 public:
149 SFX_DECL_INTERFACE(SCID_APP)
151 ScModule( SfxObjectFactory* pFact );
152 virtual ~ScModule();
154 virtual void FillStatusBar(StatusBar &rBar);
155 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
156 void DeleteCfg();
158 // von der Applikation verschoben:
160 DECL_LINK( IdleHandler, Timer* ); // Timer statt idle
161 DECL_LINK( SpellTimerHdl, Timer* );
162 DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
164 void Execute( SfxRequest& rReq );
165 void GetState( SfxItemSet& rSet );
166 void HideDisabledSlots( SfxItemSet& rSet );
168 void AnythingChanged();
170 // Drag & Drop:
171 const ScDragData& GetDragData() const { return aDragData; }
172 void SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
173 void ResetDragObject();
174 void SetDragLink( const String& rDoc, const String& rTab, const String& rArea );
175 void SetDragJump( ScDocument* pLocalDoc,
176 const String& rTarget, const String& rText );
178 // clipboard:
179 const ScClipData& GetClipData() const { return aClipData; }
180 void SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
182 ScDocument* GetClipDoc(); // called from document - should be removed later
184 // X selection:
185 ScSelectionTransferObj* GetSelectionTransfer() const { return pSelTransfer; }
186 void SetSelectionTransfer( ScSelectionTransferObj* pNew );
188 void SetWaterCan( BOOL bNew ) { bIsWaterCan = bNew; }
189 BOOL GetIsWaterCan() const { return bIsWaterCan; }
191 void SetInEditCommand( BOOL bNew ) { bIsInEditCommand = bNew; }
192 BOOL IsInEditCommand() const { return bIsInEditCommand; }
194 void SetInExecuteDrop( BOOL bNew ) { bIsInExecuteDrop = bNew; }
195 BOOL IsInExecuteDrop() const { return bIsInExecuteDrop; }
197 // Options:
198 const ScViewOptions& GetViewOptions ();
199 const ScDocOptions& GetDocOptions ();
200 SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
201 const ScInputOptions& GetInputOptions ();
202 SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
203 void SetViewOptions ( const ScViewOptions& rOpt );
204 void SetDocOptions ( const ScDocOptions& rOpt );
205 SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
206 void SetInputOptions ( const ScInputOptions& rOpt );
207 void SetPrintOptions ( const ScPrintOptions& rOpt );
208 void InsertEntryToLRUList(USHORT nFIndex);
209 void RecentFunctionsChanged();
211 static void GetSpellSettings( USHORT& rDefLang, USHORT& rCjkLang, USHORT& rCtlLang,
212 BOOL& rAutoSpell );
213 static void SetAutoSpellProperty( BOOL bSet );
214 static BOOL HasThesaurusLanguage( USHORT nLang );
216 USHORT GetOptDigitLanguage(); // from CTL options
218 ScNavipiCfg& GetNavipiCfg();
219 ScAddInCfg& GetAddInCfg();
220 svtools::ColorConfig& GetColorConfig();
221 SvtAccessibilityOptions& GetAccessOptions();
222 SvtCTLOptions& GetCTLOptions();
223 SvtUserOptions& GetUserOptions();
225 void ModifyOptions( const SfxItemSet& rOptSet );
227 // InputHandler:
228 BOOL IsEditMode(); // nicht bei SC_INPUT_TYPE
229 BOOL IsInputMode(); // auch bei SC_INPUT_TYPE
230 void SetInputMode( ScInputMode eMode );
231 BOOL InputKeyEvent( const KeyEvent& rKEvt, BOOL bStartEdit = FALSE );
232 SC_DLLPUBLIC void InputEnterHandler( BYTE nBlockMode = 0 );
233 void InputCancelHandler();
234 void InputSelection( EditView* pView );
235 void InputChanged( EditView* pView );
236 ScInputHandler* GetInputHdl( ScTabViewShell* pViewSh = NULL, BOOL bUseRef = TRUE );
238 void SetRefInputHdl( ScInputHandler* pNew );
239 ScInputHandler* GetRefInputHdl();
241 void ViewShellGone(ScTabViewShell* pViewSh);
242 void ViewShellChanged();
243 // Kommunikation mit Funktionsautopilot
244 void InputGetSelection( xub_StrLen& rStart, xub_StrLen& rEnd );
245 void InputSetSelection( xub_StrLen nStart, xub_StrLen nEnd );
246 void InputReplaceSelection( const String& rStr );
247 String InputGetFormulaStr();
248 void ActivateInputWindow( const String* pStr = NULL,
249 BOOL bMatrix = FALSE );
251 void InitFormEditData();
252 void ClearFormEditData();
253 ScFormEditData* GetFormEditData() { return pFormEditData; }
255 // Referenzeingabe:
256 void SetRefDialog( USHORT nId, BOOL bVis, SfxViewFrame* pViewFrm = NULL );
257 BOOL IsModalMode(SfxObjectShell* pDocSh = NULL);
258 BOOL IsFormulaMode();
259 BOOL IsRefDialogOpen();
260 BOOL IsTableLocked();
261 void OpenTeamDlg();
262 void SetTeamDlg( ScTeamDlg* pDlg ) { pTeamDlg = pDlg; }
263 ScTeamDlg* GetTeamDlg() const { return pTeamDlg; }
264 void SetReference( const ScRange& rRef, ScDocument* pDoc,
265 const ScMarkData* pMarkData = NULL );
266 void AddRefEntry();
267 void EndReference();
268 USHORT GetCurRefDlgId() const { return nCurRefDlgId; }
270 //virtuelle Methoden fuer den Optionendialog
271 virtual SfxItemSet* CreateItemSet( USHORT nId );
272 virtual void ApplyItemSet( USHORT nId, const SfxItemSet& rSet );
273 virtual SfxTabPage* CreateTabPage( USHORT nId, Window* pParent, const SfxItemSet& rSet );
275 void SetInSharedDocLoading( bool bNew ) { mbIsInSharedDocLoading = bNew; }
276 bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading; }
277 void SetInSharedDocSaving( bool bNew ) { mbIsInSharedDocSaving = bNew; }
278 bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving; }
281 #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
283 #endif