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