1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scmod.hxx,v $
10 * $Revision: 1.24.32.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
36 #include <vcl/timer.hxx>
37 #include <svtools/lstner.hxx>
38 #include "global.hxx" // ScInputMode
39 #include "markdata.hxx" //ScMarkData
40 #include "shellids.hxx"
42 #include <tools/shl.hxx>
49 class SfxErrorHandler
;
50 class SvxErrorHandler
;
51 class SvtAccessibilityOptions
;
55 namespace svtools
{ class ColorConfig
; }
75 class ScEditFunctionDlg
;
82 class ScDrawTransferObj
;
83 class ScSelectionTransferObj
;
87 //==================================================================
89 // for internal Drag&Drop:
91 #define SC_DROP_NAVIGATOR 1
92 #define SC_DROP_TABLE 2
96 ScTransferObj
* pCellTransfer
;
97 ScDrawTransferObj
* pDrawTransfer
;
102 ScDocument
* pJumpLocalDoc
;
109 ScTransferObj
* pCellClipboard
;
110 ScDrawTransferObj
* pDrawClipboard
;
113 //==================================================================
116 class ScModule
: public SfxModule
, public SfxListener
120 ScDragData aDragData
;
121 ScClipData aClipData
;
122 ScSelectionTransferObj
* pSelTransfer
;
123 ScMessagePool
* pMessagePool
;
124 // globalen InputHandler gibt's nicht mehr, jede View hat einen
125 ScInputHandler
* pRefInputHandler
;
130 ScInputCfg
* pInputCfg
;
131 ScPrintCfg
* pPrintCfg
;
132 ScNavipiCfg
* pNavipiCfg
;
133 ScAddInCfg
* pAddInCfg
;
134 svtools::ColorConfig
* pColorConfig
;
135 SvtAccessibilityOptions
* pAccessOptions
;
136 SvtCTLOptions
* pCTLOptions
;
137 SvtUserOptions
* pUserOptions
;
138 SfxErrorHandler
* pErrorHdl
;
139 SvxErrorHandler
* pSvxErrorHdl
;
140 ScFormEditData
* pFormEditData
;
143 BOOL bIsInEditCommand
;
144 BOOL bIsInExecuteDrop
;
145 bool mbIsInSharedDocLoading
;
146 bool mbIsInSharedDocSaving
;
149 SFX_DECL_INTERFACE(SCID_APP
)
151 ScModule( SfxObjectFactory
* pFact
);
154 virtual void FillStatusBar(StatusBar
&rBar
);
155 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
158 // von der Applikation verschoben:
160 DECL_LINK( IdleHandler
, Timer
* ); // Timer statt idle
161 DECL_LINK( SpellTimerHdl
, Timer
* );
162 DECL_LINK( CalcFieldValueHdl
, EditFieldInfo
* );
164 void Execute( SfxRequest
& rReq
);
165 void GetState( SfxItemSet
& rSet
);
166 void HideDisabledSlots( SfxItemSet
& rSet
);
168 void AnythingChanged();
171 const ScDragData
& GetDragData() const { return aDragData
; }
172 void SetDragObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
);
173 void ResetDragObject();
174 void SetDragLink( const String
& rDoc
, const String
& rTab
, const String
& rArea
);
175 void SetDragJump( ScDocument
* pLocalDoc
,
176 const String
& rTarget
, const String
& rText
);
179 const ScClipData
& GetClipData() const { return aClipData
; }
180 void SetClipObject( ScTransferObj
* pCellObj
, ScDrawTransferObj
* pDrawObj
);
182 ScDocument
* GetClipDoc(); // called from document - should be removed later
185 ScSelectionTransferObj
* GetSelectionTransfer() const { return pSelTransfer
; }
186 void SetSelectionTransfer( ScSelectionTransferObj
* pNew
);
188 void SetWaterCan( BOOL bNew
) { bIsWaterCan
= bNew
; }
189 BOOL
GetIsWaterCan() const { return bIsWaterCan
; }
191 void SetInEditCommand( BOOL bNew
) { bIsInEditCommand
= bNew
; }
192 BOOL
IsInEditCommand() const { return bIsInEditCommand
; }
194 void SetInExecuteDrop( BOOL bNew
) { bIsInExecuteDrop
= bNew
; }
195 BOOL
IsInExecuteDrop() const { return bIsInExecuteDrop
; }
198 const ScViewOptions
& GetViewOptions ();
199 const ScDocOptions
& GetDocOptions ();
200 SC_DLLPUBLIC
const ScAppOptions
& GetAppOptions ();
201 const ScInputOptions
& GetInputOptions ();
202 SC_DLLPUBLIC
const ScPrintOptions
& GetPrintOptions ();
203 void SetViewOptions ( const ScViewOptions
& rOpt
);
204 void SetDocOptions ( const ScDocOptions
& rOpt
);
205 SC_DLLPUBLIC
void SetAppOptions ( const ScAppOptions
& rOpt
);
206 void SetInputOptions ( const ScInputOptions
& rOpt
);
207 void SetPrintOptions ( const ScPrintOptions
& rOpt
);
208 void InsertEntryToLRUList(USHORT nFIndex
);
209 void RecentFunctionsChanged();
211 static void GetSpellSettings( USHORT
& rDefLang
, USHORT
& rCjkLang
, USHORT
& rCtlLang
,
213 static void SetAutoSpellProperty( BOOL bSet
);
214 static BOOL
HasThesaurusLanguage( USHORT nLang
);
216 USHORT
GetOptDigitLanguage(); // from CTL options
218 ScNavipiCfg
& GetNavipiCfg();
219 ScAddInCfg
& GetAddInCfg();
220 svtools::ColorConfig
& GetColorConfig();
221 SvtAccessibilityOptions
& GetAccessOptions();
222 SvtCTLOptions
& GetCTLOptions();
223 SvtUserOptions
& GetUserOptions();
225 void ModifyOptions( const SfxItemSet
& rOptSet
);
228 BOOL
IsEditMode(); // nicht bei SC_INPUT_TYPE
229 BOOL
IsInputMode(); // auch bei SC_INPUT_TYPE
230 void SetInputMode( ScInputMode eMode
);
231 BOOL
InputKeyEvent( const KeyEvent
& rKEvt
, BOOL bStartEdit
= FALSE
);
232 SC_DLLPUBLIC
void InputEnterHandler( BYTE nBlockMode
= 0 );
233 void InputCancelHandler();
234 void InputSelection( EditView
* pView
);
235 void InputChanged( EditView
* pView
);
236 ScInputHandler
* GetInputHdl( ScTabViewShell
* pViewSh
= NULL
, BOOL bUseRef
= TRUE
);
238 void SetRefInputHdl( ScInputHandler
* pNew
);
239 ScInputHandler
* GetRefInputHdl();
241 void ViewShellGone(ScTabViewShell
* pViewSh
);
242 void ViewShellChanged();
243 // Kommunikation mit Funktionsautopilot
244 void InputGetSelection( xub_StrLen
& rStart
, xub_StrLen
& rEnd
);
245 void InputSetSelection( xub_StrLen nStart
, xub_StrLen nEnd
);
246 void InputReplaceSelection( const String
& rStr
);
247 String
InputGetFormulaStr();
248 void ActivateInputWindow( const String
* pStr
= NULL
,
249 BOOL bMatrix
= FALSE
);
251 void InitFormEditData();
252 void ClearFormEditData();
253 ScFormEditData
* GetFormEditData() { return pFormEditData
; }
256 void SetRefDialog( USHORT nId
, BOOL bVis
, SfxViewFrame
* pViewFrm
= NULL
);
257 BOOL
IsModalMode(SfxObjectShell
* pDocSh
= NULL
);
258 BOOL
IsFormulaMode();
259 BOOL
IsRefDialogOpen();
260 BOOL
IsTableLocked();
262 void SetTeamDlg( ScTeamDlg
* pDlg
) { pTeamDlg
= pDlg
; }
263 ScTeamDlg
* GetTeamDlg() const { return pTeamDlg
; }
264 void SetReference( const ScRange
& rRef
, ScDocument
* pDoc
,
265 const ScMarkData
* pMarkData
= NULL
);
268 USHORT
GetCurRefDlgId() const { return nCurRefDlgId
; }
270 //virtuelle Methoden fuer den Optionendialog
271 virtual SfxItemSet
* CreateItemSet( USHORT nId
);
272 virtual void ApplyItemSet( USHORT nId
, const SfxItemSet
& rSet
);
273 virtual SfxTabPage
* CreateTabPage( USHORT nId
, Window
* pParent
, const SfxItemSet
& rSet
);
275 void SetInSharedDocLoading( bool bNew
) { mbIsInSharedDocLoading
= bNew
; }
276 bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading
; }
277 void SetInSharedDocSaving( bool bNew
) { mbIsInSharedDocSaving
= bNew
; }
278 bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving
; }
281 #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) )