bump product version to 4.1.6.2
[LibreOffice.git] / sc / inc / scmod.hxx
blob014edb121ff0a5db34da86a2676e09fd63f52a4a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef SC_SCMOD_HXX
21 #define SC_SCMOD_HXX
23 #include "scdllapi.h"
24 #include "scdll.hxx"
25 #include <vcl/timer.hxx>
26 #include <svl/lstner.hxx>
27 #include "global.hxx" // ScInputMode
28 #include "shellids.hxx"
29 #include <unotools/options.hxx>
30 #include <tools/shl.hxx>
32 #include <map>
33 #include <list>
34 #include <algorithm>
35 #include <stack>
38 class KeyEvent;
39 class EditView;
40 class SfxErrorHandler;
41 class SvtAccessibilityOptions;
42 class SvtCTLOptions;
43 class SvtUserOptions;
45 namespace svtools { class ColorConfig; }
47 class ScRange;
48 class ScDocument;
49 class ScViewCfg;
50 class ScDocCfg;
51 class ScAppCfg;
52 class ScDefaultsCfg;
53 class ScFormulaCfg;
54 class ScInputCfg;
55 class ScPrintCfg;
56 class ScViewOptions;
57 class ScDocOptions;
58 class ScAppOptions;
59 class ScDefaultsOptions;
60 class ScFormulaOptions;
61 class ScInputOptions;
62 class ScPrintOptions;
63 class ScInputHandler;
64 class ScTabViewShell;
65 class ScMessagePool;
66 class EditFieldInfo;
67 class ScNavipiCfg;
68 class ScAddInCfg;
69 class ScTransferObj;
70 class ScDrawTransferObj;
71 class ScSelectionTransferObj;
72 class ScFormEditData;
73 class ScMarkData;
74 struct ScDragData;
75 struct ScClipData;
76 class ScAnyRefModalDlg;
78 //==================================================================
80 // for internal Drag&Drop:
82 #define SC_DROP_NAVIGATOR 1
83 #define SC_DROP_TABLE 2
85 //==================================================================
87 class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener
89 Timer aIdleTimer;
90 Timer aSpellTimer;
91 ScDragData* mpDragData;
92 ScClipData* mpClipData;
93 ScSelectionTransferObj* pSelTransfer;
94 ScMessagePool* pMessagePool;
95 // there is no global InputHandler anymore, each View has it's own
96 ScInputHandler* pRefInputHandler;
97 ScViewCfg* pViewCfg;
98 ScDocCfg* pDocCfg;
99 ScAppCfg* pAppCfg;
100 ScDefaultsCfg* pDefaultsCfg;
101 ScFormulaCfg* pFormulaCfg;
102 ScInputCfg* pInputCfg;
103 ScPrintCfg* pPrintCfg;
104 ScNavipiCfg* pNavipiCfg;
105 ScAddInCfg* pAddInCfg;
106 svtools::ColorConfig* pColorConfig;
107 SvtAccessibilityOptions* pAccessOptions;
108 SvtCTLOptions* pCTLOptions;
109 SvtUserOptions* pUserOptions;
110 SfxErrorHandler* pErrorHdl;
111 ScFormEditData* pFormEditData;
112 sal_uInt16 nCurRefDlgId;
113 bool bIsWaterCan:1;
114 bool bIsInEditCommand:1;
115 bool bIsInExecuteDrop:1;
116 bool mbIsInSharedDocLoading:1;
117 bool mbIsInSharedDocSaving:1;
119 std::map<sal_uInt16, std::list<Window*> > m_mapRefWindow;
120 std::stack<ScAnyRefModalDlg*> maAnyRefDlgStack;
121 public:
122 SFX_DECL_INTERFACE(SCID_APP)
124 ScModule( SfxObjectFactory* pFact );
125 virtual ~ScModule();
127 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
128 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
129 void DeleteCfg();
131 // moved by the application
133 DECL_LINK( IdleHandler, void* ); // Timer instead of idle
134 DECL_LINK( SpellTimerHdl, void* );
135 DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
137 void Execute( SfxRequest& rReq );
138 void GetState( SfxItemSet& rSet );
139 void HideDisabledSlots( SfxItemSet& rSet );
141 void AnythingChanged();
143 // Drag & Drop:
144 const ScDragData& GetDragData() const;
145 void SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
146 void ResetDragObject();
147 void SetDragLink(
148 const OUString& rDoc, const OUString& rTab, const OUString& rArea );
149 void SetDragJump(
150 ScDocument* pLocalDoc, const OUString& rTarget, const OUString& rText );
152 // clipboard:
153 const ScClipData& GetClipData() const;
154 void SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
156 ScDocument* GetClipDoc(); // called from document - should be removed later
158 // X selection:
159 ScSelectionTransferObj* GetSelectionTransfer() const { return pSelTransfer; }
160 void SetSelectionTransfer( ScSelectionTransferObj* pNew );
162 void SetWaterCan( bool bNew ) { bIsWaterCan = bNew; }
163 bool GetIsWaterCan() const { return bIsWaterCan; }
165 void SetInEditCommand( bool bNew ) { bIsInEditCommand = bNew; }
166 bool IsInEditCommand() const { return bIsInEditCommand; }
168 void SetInExecuteDrop( bool bNew ) { bIsInExecuteDrop = bNew; }
169 bool IsInExecuteDrop() const { return bIsInExecuteDrop; }
171 // Options:
172 const ScViewOptions& GetViewOptions ();
173 SC_DLLPUBLIC const ScDocOptions& GetDocOptions ();
174 SC_DLLPUBLIC const ScAppOptions& GetAppOptions ();
175 SC_DLLPUBLIC const ScDefaultsOptions& GetDefaultsOptions ();
176 SC_DLLPUBLIC const ScFormulaOptions& GetFormulaOptions ();
177 const ScInputOptions& GetInputOptions ();
178 SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions ();
179 void SetViewOptions ( const ScViewOptions& rOpt );
180 SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt );
181 SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt );
182 void SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
183 SC_DLLPUBLIC void SetFormulaOptions ( const ScFormulaOptions& rOpt );
184 void SetInputOptions ( const ScInputOptions& rOpt );
185 void SetPrintOptions ( const ScPrintOptions& rOpt );
186 void InsertEntryToLRUList(sal_uInt16 nFIndex);
187 void RecentFunctionsChanged();
189 static void GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang,
190 sal_Bool& rAutoSpell );
191 static void SetAutoSpellProperty( sal_Bool bSet );
192 static sal_Bool HasThesaurusLanguage( sal_uInt16 nLang );
194 sal_uInt16 GetOptDigitLanguage(); // from CTL options
196 ScNavipiCfg& GetNavipiCfg();
197 ScAddInCfg& GetAddInCfg();
198 svtools::ColorConfig& GetColorConfig();
199 SvtAccessibilityOptions& GetAccessOptions();
200 SvtCTLOptions& GetCTLOptions();
201 SvtUserOptions& GetUserOptions();
203 void ModifyOptions( const SfxItemSet& rOptSet );
205 // InputHandler:
206 sal_Bool IsEditMode(); // not for SC_INPUT_TYPE
207 sal_Bool IsInputMode(); // also for SC_INPUT_TYPE
208 void SetInputMode( ScInputMode eMode );
209 sal_Bool InputKeyEvent( const KeyEvent& rKEvt, sal_Bool bStartEdit = false );
210 SC_DLLPUBLIC void InputEnterHandler( sal_uInt8 nBlockMode = 0 );
211 void InputCancelHandler();
212 void InputSelection( EditView* pView );
213 void InputChanged( EditView* pView );
214 ScInputHandler* GetInputHdl( ScTabViewShell* pViewSh = NULL, sal_Bool bUseRef = sal_True );
216 void SetRefInputHdl( ScInputHandler* pNew );
217 ScInputHandler* GetRefInputHdl();
219 void ViewShellGone(ScTabViewShell* pViewSh);
220 void ViewShellChanged();
221 // communication with function-autopilot
222 void InputGetSelection( xub_StrLen& rStart, xub_StrLen& rEnd );
223 void InputSetSelection( xub_StrLen nStart, xub_StrLen nEnd );
224 void InputReplaceSelection( const String& rStr );
225 void InputTurnOffWinEngine();
226 String InputGetFormulaStr();
227 void ActivateInputWindow( const String* pStr = NULL,
228 sal_Bool bMatrix = false );
230 void InitFormEditData();
231 void ClearFormEditData();
232 ScFormEditData* GetFormEditData() { return pFormEditData; }
234 // input of reference:
235 SC_DLLPUBLIC void SetRefDialog( sal_uInt16 nId, sal_Bool bVis, SfxViewFrame* pViewFrm = NULL );
236 sal_Bool IsModalMode(SfxObjectShell* pDocSh = NULL);
237 sal_Bool IsFormulaMode();
238 sal_Bool IsRefDialogOpen();
239 sal_Bool IsTableLocked();
240 void SetReference( const ScRange& rRef, ScDocument* pDoc,
241 const ScMarkData* pMarkData = NULL );
242 void AddRefEntry();
243 void EndReference();
244 sal_uInt16 GetCurRefDlgId() const { return nCurRefDlgId; }
246 // virtual methods for the options dialog
247 virtual SfxItemSet* CreateItemSet( sal_uInt16 nId );
248 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet );
249 virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet );
251 void SetInSharedDocLoading( bool bNew ) { mbIsInSharedDocLoading = bNew; }
252 bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading; }
253 void SetInSharedDocSaving( bool bNew ) { mbIsInSharedDocSaving = bNew; }
254 bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving; }
256 SC_DLLPUBLIC sal_Bool RegisterRefWindow( sal_uInt16 nSlotId, Window *pWnd );
257 SC_DLLPUBLIC sal_Bool UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd );
258 SC_DLLPUBLIC sal_Bool IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd );
259 SC_DLLPUBLIC Window * Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor );
261 ScAnyRefModalDlg* GetCurrentAnyRefDlg();
262 void PushNewAnyRefDlg( ScAnyRefModalDlg* pDlg );
263 void PopAnyRefDlg();
266 #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
268 #endif
271 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */