1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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
25 #include <vcl/timer.hxx>
26 #include <svl/lstner.hxx>
28 #include "shellids.hxx"
29 #include <unotools/options.hxx>
30 #include <tools/shl.hxx>
39 class SfxErrorHandler
;
40 class SvtAccessibilityOptions
;
44 namespace svtools
{ class ColorConfig
; }
58 class ScDefaultsOptions
;
59 class ScFormulaOptions
;
69 class ScDrawTransferObj
;
70 class ScSelectionTransferObj
;
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
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
;
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
;
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
;
117 SFX_DECL_INTERFACE(SCID_APP
)
120 /// SfxInterface initializer.
121 static void InitInterface_Impl();
124 ScModule( SfxObjectFactory
* pFact
);
127 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
128 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster
*, sal_uInt32
) SAL_OVERRIDE
;
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();
144 const ScDragData
& GetDragData() const;
145 void SetDragObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
);
146 void ResetDragObject();
148 const OUString
& rDoc
, const OUString
& rTab
, const OUString
& rArea
);
150 ScDocument
* pLocalDoc
, const OUString
& rTarget
, const OUString
& rText
);
153 const ScClipData
& GetClipData() const;
154 void SetClipObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
);
156 ScDocument
* GetClipDoc(); // called from document - should be removed later
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
; }
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
,
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
);
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
);
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
);
265 #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
267 void global_InitAppOptions();
271 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */