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 .
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
)
119 ScModule( SfxObjectFactory
* pFact
);
122 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
123 virtual void ConfigurationChanged( utl::ConfigurationBroadcaster
*, sal_uInt32
);
126 // moved by the application
128 DECL_LINK( IdleHandler
, void* ); // Timer instead of idle
129 DECL_LINK( SpellTimerHdl
, void* );
130 DECL_LINK( CalcFieldValueHdl
, EditFieldInfo
* );
132 void Execute( SfxRequest
& rReq
);
133 void GetState( SfxItemSet
& rSet
);
134 void HideDisabledSlots( SfxItemSet
& rSet
);
136 void AnythingChanged();
139 const ScDragData
& GetDragData() const;
140 void SetDragObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
);
141 void ResetDragObject();
143 const OUString
& rDoc
, const OUString
& rTab
, const OUString
& rArea
);
145 ScDocument
* pLocalDoc
, const OUString
& rTarget
, const OUString
& rText
);
148 const ScClipData
& GetClipData() const;
149 void SetClipObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
);
151 ScDocument
* GetClipDoc(); // called from document - should be removed later
154 ScSelectionTransferObj
* GetSelectionTransfer() const { return pSelTransfer
; }
155 void SetSelectionTransfer( ScSelectionTransferObj
* pNew
);
157 void SetWaterCan( bool bNew
) { bIsWaterCan
= bNew
; }
158 bool GetIsWaterCan() const { return bIsWaterCan
; }
160 void SetInEditCommand( bool bNew
) { bIsInEditCommand
= bNew
; }
161 bool IsInEditCommand() const { return bIsInEditCommand
; }
163 void SetInExecuteDrop( bool bNew
) { bIsInExecuteDrop
= bNew
; }
164 bool IsInExecuteDrop() const { return bIsInExecuteDrop
; }
167 const ScViewOptions
& GetViewOptions ();
168 SC_DLLPUBLIC
const ScDocOptions
& GetDocOptions ();
169 SC_DLLPUBLIC
const ScAppOptions
& GetAppOptions ();
170 SC_DLLPUBLIC
const ScDefaultsOptions
& GetDefaultsOptions ();
171 SC_DLLPUBLIC
const ScFormulaOptions
& GetFormulaOptions ();
172 const ScInputOptions
& GetInputOptions ();
173 SC_DLLPUBLIC
const ScPrintOptions
& GetPrintOptions ();
174 void SetViewOptions ( const ScViewOptions
& rOpt
);
175 SC_DLLPUBLIC
void SetDocOptions ( const ScDocOptions
& rOpt
);
176 SC_DLLPUBLIC
void SetAppOptions ( const ScAppOptions
& rOpt
);
177 void SetDefaultsOptions ( const ScDefaultsOptions
& rOpt
);
178 SC_DLLPUBLIC
void SetFormulaOptions ( const ScFormulaOptions
& rOpt
);
179 void SetInputOptions ( const ScInputOptions
& rOpt
);
180 void SetPrintOptions ( const ScPrintOptions
& rOpt
);
181 void InsertEntryToLRUList(sal_uInt16 nFIndex
);
182 void RecentFunctionsChanged();
184 static void GetSpellSettings( sal_uInt16
& rDefLang
, sal_uInt16
& rCjkLang
, sal_uInt16
& rCtlLang
,
185 sal_Bool
& rAutoSpell
);
186 static void SetAutoSpellProperty( sal_Bool bSet
);
187 static sal_Bool
HasThesaurusLanguage( sal_uInt16 nLang
);
189 sal_uInt16
GetOptDigitLanguage(); // from CTL options
191 ScNavipiCfg
& GetNavipiCfg();
192 ScAddInCfg
& GetAddInCfg();
193 svtools::ColorConfig
& GetColorConfig();
194 SvtAccessibilityOptions
& GetAccessOptions();
195 SvtCTLOptions
& GetCTLOptions();
196 SvtUserOptions
& GetUserOptions();
198 void ModifyOptions( const SfxItemSet
& rOptSet
);
201 sal_Bool
IsEditMode(); // not for SC_INPUT_TYPE
202 sal_Bool
IsInputMode(); // also for SC_INPUT_TYPE
203 void SetInputMode( ScInputMode eMode
);
204 sal_Bool
InputKeyEvent( const KeyEvent
& rKEvt
, sal_Bool bStartEdit
= false );
205 SC_DLLPUBLIC
void InputEnterHandler( sal_uInt8 nBlockMode
= 0 );
206 void InputCancelHandler();
207 void InputSelection( EditView
* pView
);
208 void InputChanged( EditView
* pView
);
209 ScInputHandler
* GetInputHdl( ScTabViewShell
* pViewSh
= NULL
, sal_Bool bUseRef
= sal_True
);
211 void SetRefInputHdl( ScInputHandler
* pNew
);
212 ScInputHandler
* GetRefInputHdl();
214 void ViewShellGone(ScTabViewShell
* pViewSh
);
215 void ViewShellChanged();
216 // communication with function-autopilot
217 void InputGetSelection( xub_StrLen
& rStart
, xub_StrLen
& rEnd
);
218 void InputSetSelection( xub_StrLen nStart
, xub_StrLen nEnd
);
219 void InputReplaceSelection( const OUString
& rStr
);
220 void InputTurnOffWinEngine();
221 OUString
InputGetFormulaStr();
222 void ActivateInputWindow( const OUString
* pStr
= NULL
,
223 sal_Bool bMatrix
= false );
225 void InitFormEditData();
226 void ClearFormEditData();
227 ScFormEditData
* GetFormEditData() { return pFormEditData
; }
229 // input of reference:
230 SC_DLLPUBLIC
void SetRefDialog( sal_uInt16 nId
, sal_Bool bVis
, SfxViewFrame
* pViewFrm
= NULL
);
231 sal_Bool
IsModalMode(SfxObjectShell
* pDocSh
= NULL
);
232 sal_Bool
IsFormulaMode();
233 sal_Bool
IsRefDialogOpen();
234 sal_Bool
IsTableLocked();
235 void SetReference( const ScRange
& rRef
, ScDocument
* pDoc
,
236 const ScMarkData
* pMarkData
= NULL
);
239 sal_uInt16
GetCurRefDlgId() const { return nCurRefDlgId
; }
241 // virtual methods for the options dialog
242 virtual SfxItemSet
* CreateItemSet( sal_uInt16 nId
);
243 virtual void ApplyItemSet( sal_uInt16 nId
, const SfxItemSet
& rSet
);
244 virtual SfxTabPage
* CreateTabPage( sal_uInt16 nId
, Window
* pParent
, const SfxItemSet
& rSet
);
246 void SetInSharedDocLoading( bool bNew
) { mbIsInSharedDocLoading
= bNew
; }
247 bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading
; }
248 void SetInSharedDocSaving( bool bNew
) { mbIsInSharedDocSaving
= bNew
; }
249 bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving
; }
251 SC_DLLPUBLIC sal_Bool
RegisterRefWindow( sal_uInt16 nSlotId
, Window
*pWnd
);
252 SC_DLLPUBLIC sal_Bool
UnregisterRefWindow( sal_uInt16 nSlotId
, Window
*pWnd
);
253 SC_DLLPUBLIC sal_Bool
IsAliveRefDlg( sal_uInt16 nSlotId
, Window
*pWnd
);
254 SC_DLLPUBLIC Window
* Find1RefWindow( sal_uInt16 nSlotId
, Window
*pWndAncestor
);
256 ScAnyRefModalDlg
* GetCurrentAnyRefDlg();
257 void PushNewAnyRefDlg( ScAnyRefModalDlg
* pDlg
);
261 #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )
265 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */