Bump version to 4.3-4
[LibreOffice.git] / sc / inc / scmod.hxx
blobcafefdf5d8363dfc7309f90bafe19b27eeafd7ca
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 INCLUDED_SC_INC_SCMOD_HXX
21 #define INCLUDED_SC_INC_SCMOD_HXX
23 #include "scdllapi.h"
24 #include "scdll.hxx"
25 #include <vcl/timer.hxx>
26 #include <svl/lstner.hxx>
27 #include "global.hxx"
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>
37 class KeyEvent;
38 class EditView;
39 class SfxErrorHandler;
40 class SvtAccessibilityOptions;
41 class SvtCTLOptions;
42 class SvtUserOptions;
44 namespace svtools { class ColorConfig; }
46 class ScRange;
47 class ScDocument;
48 class ScViewCfg;
49 class ScDocCfg;
50 class ScAppCfg;
51 class ScDefaultsCfg;
52 class ScFormulaCfg;
53 class ScInputCfg;
54 class ScPrintCfg;
55 class ScViewOptions;
56 class ScDocOptions;
57 class ScAppOptions;
58 class ScDefaultsOptions;
59 class ScFormulaOptions;
60 class ScInputOptions;
61 class ScPrintOptions;
62 class ScInputHandler;
63 class ScTabViewShell;
64 class ScMessagePool;
65 class EditFieldInfo;
66 class ScNavipiCfg;
67 class ScAddInCfg;
68 class ScTransferObj;
69 class ScDrawTransferObj;
70 class ScSelectionTransferObj;
71 class ScFormEditData;
72 class ScMarkData;
73 struct ScDragData;
74 struct ScClipData;
75 class ScAnyRefModalDlg;
77 // for internal Drag&Drop:
79 #define SC_DROP_NAVIGATOR 1
80 #define SC_DROP_TABLE 2
82 class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener
84 Timer aIdleTimer;
85 Timer aSpellTimer;
86 ScDragData* mpDragData;
87 ScClipData* mpClipData;
88 ScSelectionTransferObj* pSelTransfer;
89 ScMessagePool* pMessagePool;
90 // there is no global InputHandler anymore, each View has it's own
91 ScInputHandler* pRefInputHandler;
92 ScViewCfg* pViewCfg;
93 ScDocCfg* pDocCfg;
94 ScAppCfg* pAppCfg;
95 ScDefaultsCfg* pDefaultsCfg;
96 ScFormulaCfg* pFormulaCfg;
97 ScInputCfg* pInputCfg;
98 ScPrintCfg* pPrintCfg;
99 ScNavipiCfg* pNavipiCfg;
100 ScAddInCfg* pAddInCfg;
101 svtools::ColorConfig* pColorConfig;
102 SvtAccessibilityOptions* pAccessOptions;
103 SvtCTLOptions* pCTLOptions;
104 SvtUserOptions* pUserOptions;
105 SfxErrorHandler* pErrorHdl;
106 ScFormEditData* pFormEditData;
107 sal_uInt16 nCurRefDlgId;
108 bool bIsWaterCan:1;
109 bool bIsInEditCommand:1;
110 bool bIsInExecuteDrop:1;
111 bool mbIsInSharedDocLoading:1;
112 bool mbIsInSharedDocSaving:1;
114 std::map<sal_uInt16, std::list<Window*> > m_mapRefWindow;
115 std::stack<ScAnyRefModalDlg*> maAnyRefDlgStack;
116 public:
117 SFX_DECL_INTERFACE(SCID_APP)
119 private:
120 /// SfxInterface initializer.
121 static void InitInterface_Impl();
123 public:
124 ScModule( SfxObjectFactory* pFact );
125 virtual ~ScModule();
127 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
128 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
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 bool& rAutoSpell );
191 static void SetAutoSpellProperty( bool bSet );
192 static 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 bool IsEditMode(); // not for SC_INPUT_TYPE
207 bool IsInputMode(); // also for SC_INPUT_TYPE
208 void SetInputMode( ScInputMode eMode, const OUString* pInitText = NULL );
209 bool InputKeyEvent( const KeyEvent& rKEvt, 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, bool bUseRef = 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( sal_Int32& rStart, sal_Int32& rEnd );
223 void InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd );
224 void InputReplaceSelection( const OUString& rStr );
225 void InputTurnOffWinEngine();
226 OUString InputGetFormulaStr();
227 void ActivateInputWindow( const OUString* pStr = NULL,
228 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, bool bVis, SfxViewFrame* pViewFrm = NULL );
236 bool IsModalMode(SfxObjectShell* pDocSh = NULL);
237 bool IsFormulaMode();
238 bool IsRefDialogOpen();
239 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 ) SAL_OVERRIDE;
248 virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
249 virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
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 bool RegisterRefWindow( sal_uInt16 nSlotId, Window *pWnd );
257 SC_DLLPUBLIC bool UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd );
258 SC_DLLPUBLIC Window * Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor );
260 ScAnyRefModalDlg* GetCurrentAnyRefDlg();
261 void PushNewAnyRefDlg( ScAnyRefModalDlg* pDlg );
262 void PopAnyRefDlg();
265 #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
267 void global_InitAppOptions();
269 #endif
271 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */