1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SC_SCMOD_HXX 29*cdf0e10cSrcweir #define SC_SCMOD_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "scdllapi.h" 32*cdf0e10cSrcweir #include "scdll.hxx" 33*cdf0e10cSrcweir #include <vcl/timer.hxx> 34*cdf0e10cSrcweir #include <svl/lstner.hxx> 35*cdf0e10cSrcweir #include "global.hxx" // ScInputMode 36*cdf0e10cSrcweir #include "markdata.hxx" //ScMarkData 37*cdf0e10cSrcweir #include "shellids.hxx" 38*cdf0e10cSrcweir #include <unotools/options.hxx> 39*cdf0e10cSrcweir #include <tools/shl.hxx> 40*cdf0e10cSrcweir 41*cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker 42*cdf0e10cSrcweir #include <map> 43*cdf0e10cSrcweir #include <list> 44*cdf0e10cSrcweir #include <algorithm> 45*cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir class KeyEvent; 49*cdf0e10cSrcweir class SdrModel; 50*cdf0e10cSrcweir class SdrView; 51*cdf0e10cSrcweir class EditView; 52*cdf0e10cSrcweir class SfxErrorHandler; 53*cdf0e10cSrcweir class SvxErrorHandler; 54*cdf0e10cSrcweir class SvtAccessibilityOptions; 55*cdf0e10cSrcweir class SvtCTLOptions; 56*cdf0e10cSrcweir class SvtUserOptions; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir namespace svtools { class ColorConfig; } 59*cdf0e10cSrcweir 60*cdf0e10cSrcweir class ScRange; 61*cdf0e10cSrcweir class ScDocument; 62*cdf0e10cSrcweir class ScViewCfg; 63*cdf0e10cSrcweir class ScDocCfg; 64*cdf0e10cSrcweir class ScAppCfg; 65*cdf0e10cSrcweir class ScInputCfg; 66*cdf0e10cSrcweir class ScPrintCfg; 67*cdf0e10cSrcweir class ScViewOptions; 68*cdf0e10cSrcweir class ScDocOptions; 69*cdf0e10cSrcweir class ScAppOptions; 70*cdf0e10cSrcweir class ScInputOptions; 71*cdf0e10cSrcweir class ScPrintOptions; 72*cdf0e10cSrcweir class ScInputHandler; 73*cdf0e10cSrcweir class ScInputWindow; 74*cdf0e10cSrcweir class ScTabViewShell; 75*cdf0e10cSrcweir class ScFunctionDlg; 76*cdf0e10cSrcweir class ScArgDlgBase; 77*cdf0e10cSrcweir class ScEditFunctionDlg; 78*cdf0e10cSrcweir class ScMessagePool; 79*cdf0e10cSrcweir class EditFieldInfo; 80*cdf0e10cSrcweir class ScNavipiCfg; 81*cdf0e10cSrcweir class ScAddInCfg; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir class ScTransferObj; 84*cdf0e10cSrcweir class ScDrawTransferObj; 85*cdf0e10cSrcweir class ScSelectionTransferObj; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir class ScFormEditData; 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir //================================================================== 90*cdf0e10cSrcweir 91*cdf0e10cSrcweir // for internal Drag&Drop: 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir #define SC_DROP_NAVIGATOR 1 94*cdf0e10cSrcweir #define SC_DROP_TABLE 2 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir struct ScDragData 97*cdf0e10cSrcweir { 98*cdf0e10cSrcweir ScTransferObj* pCellTransfer; 99*cdf0e10cSrcweir ScDrawTransferObj* pDrawTransfer; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir String aLinkDoc; 102*cdf0e10cSrcweir String aLinkTable; 103*cdf0e10cSrcweir String aLinkArea; 104*cdf0e10cSrcweir ScDocument* pJumpLocalDoc; 105*cdf0e10cSrcweir String aJumpTarget; 106*cdf0e10cSrcweir String aJumpText; 107*cdf0e10cSrcweir }; 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir struct ScClipData 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir ScTransferObj* pCellClipboard; 112*cdf0e10cSrcweir ScDrawTransferObj* pDrawClipboard; 113*cdf0e10cSrcweir }; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir //================================================================== 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir Timer aIdleTimer; 121*cdf0e10cSrcweir Timer aSpellTimer; 122*cdf0e10cSrcweir ScDragData aDragData; 123*cdf0e10cSrcweir ScClipData aClipData; 124*cdf0e10cSrcweir ScSelectionTransferObj* pSelTransfer; 125*cdf0e10cSrcweir ScMessagePool* pMessagePool; 126*cdf0e10cSrcweir // globalen InputHandler gibt's nicht mehr, jede View hat einen 127*cdf0e10cSrcweir ScInputHandler* pRefInputHandler; 128*cdf0e10cSrcweir ScViewCfg* pViewCfg; 129*cdf0e10cSrcweir ScDocCfg* pDocCfg; 130*cdf0e10cSrcweir ScAppCfg* pAppCfg; 131*cdf0e10cSrcweir ScInputCfg* pInputCfg; 132*cdf0e10cSrcweir ScPrintCfg* pPrintCfg; 133*cdf0e10cSrcweir ScNavipiCfg* pNavipiCfg; 134*cdf0e10cSrcweir ScAddInCfg* pAddInCfg; 135*cdf0e10cSrcweir svtools::ColorConfig* pColorConfig; 136*cdf0e10cSrcweir SvtAccessibilityOptions* pAccessOptions; 137*cdf0e10cSrcweir SvtCTLOptions* pCTLOptions; 138*cdf0e10cSrcweir SvtUserOptions* pUserOptions; 139*cdf0e10cSrcweir SfxErrorHandler* pErrorHdl; 140*cdf0e10cSrcweir SvxErrorHandler* pSvxErrorHdl; 141*cdf0e10cSrcweir ScFormEditData* pFormEditData; 142*cdf0e10cSrcweir sal_uInt16 nCurRefDlgId; 143*cdf0e10cSrcweir sal_Bool bIsWaterCan; 144*cdf0e10cSrcweir sal_Bool bIsInEditCommand; 145*cdf0e10cSrcweir sal_Bool bIsInExecuteDrop; 146*cdf0e10cSrcweir bool mbIsInSharedDocLoading; 147*cdf0e10cSrcweir bool mbIsInSharedDocSaving; 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker 150*cdf0e10cSrcweir std::map<sal_uInt16, std::list<Window*> > m_mapRefWindow; 151*cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker 152*cdf0e10cSrcweir public: 153*cdf0e10cSrcweir SFX_DECL_INTERFACE(SCID_APP) 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir ScModule( SfxObjectFactory* pFact ); 156*cdf0e10cSrcweir virtual ~ScModule(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 159*cdf0e10cSrcweir virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); 160*cdf0e10cSrcweir void DeleteCfg(); 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir // von der Applikation verschoben: 163*cdf0e10cSrcweir 164*cdf0e10cSrcweir DECL_LINK( IdleHandler, Timer* ); // Timer statt idle 165*cdf0e10cSrcweir DECL_LINK( SpellTimerHdl, Timer* ); 166*cdf0e10cSrcweir DECL_LINK( CalcFieldValueHdl, EditFieldInfo* ); 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir void Execute( SfxRequest& rReq ); 169*cdf0e10cSrcweir void GetState( SfxItemSet& rSet ); 170*cdf0e10cSrcweir void HideDisabledSlots( SfxItemSet& rSet ); 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir void AnythingChanged(); 173*cdf0e10cSrcweir 174*cdf0e10cSrcweir // Drag & Drop: 175*cdf0e10cSrcweir const ScDragData& GetDragData() const { return aDragData; } 176*cdf0e10cSrcweir void SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj ); 177*cdf0e10cSrcweir void ResetDragObject(); 178*cdf0e10cSrcweir void SetDragLink( const String& rDoc, const String& rTab, const String& rArea ); 179*cdf0e10cSrcweir void SetDragJump( ScDocument* pLocalDoc, 180*cdf0e10cSrcweir const String& rTarget, const String& rText ); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // clipboard: 183*cdf0e10cSrcweir const ScClipData& GetClipData() const { return aClipData; } 184*cdf0e10cSrcweir void SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj ); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir ScDocument* GetClipDoc(); // called from document - should be removed later 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir // X selection: 189*cdf0e10cSrcweir ScSelectionTransferObj* GetSelectionTransfer() const { return pSelTransfer; } 190*cdf0e10cSrcweir void SetSelectionTransfer( ScSelectionTransferObj* pNew ); 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir void SetWaterCan( sal_Bool bNew ) { bIsWaterCan = bNew; } 193*cdf0e10cSrcweir sal_Bool GetIsWaterCan() const { return bIsWaterCan; } 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir void SetInEditCommand( sal_Bool bNew ) { bIsInEditCommand = bNew; } 196*cdf0e10cSrcweir sal_Bool IsInEditCommand() const { return bIsInEditCommand; } 197*cdf0e10cSrcweir 198*cdf0e10cSrcweir void SetInExecuteDrop( sal_Bool bNew ) { bIsInExecuteDrop = bNew; } 199*cdf0e10cSrcweir sal_Bool IsInExecuteDrop() const { return bIsInExecuteDrop; } 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir // Options: 202*cdf0e10cSrcweir const ScViewOptions& GetViewOptions (); 203*cdf0e10cSrcweir const ScDocOptions& GetDocOptions (); 204*cdf0e10cSrcweir SC_DLLPUBLIC const ScAppOptions& GetAppOptions (); 205*cdf0e10cSrcweir const ScInputOptions& GetInputOptions (); 206*cdf0e10cSrcweir SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions (); 207*cdf0e10cSrcweir void SetViewOptions ( const ScViewOptions& rOpt ); 208*cdf0e10cSrcweir void SetDocOptions ( const ScDocOptions& rOpt ); 209*cdf0e10cSrcweir SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt ); 210*cdf0e10cSrcweir void SetInputOptions ( const ScInputOptions& rOpt ); 211*cdf0e10cSrcweir void SetPrintOptions ( const ScPrintOptions& rOpt ); 212*cdf0e10cSrcweir void InsertEntryToLRUList(sal_uInt16 nFIndex); 213*cdf0e10cSrcweir void RecentFunctionsChanged(); 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir static void GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang, 216*cdf0e10cSrcweir sal_Bool& rAutoSpell ); 217*cdf0e10cSrcweir static void SetAutoSpellProperty( sal_Bool bSet ); 218*cdf0e10cSrcweir static sal_Bool HasThesaurusLanguage( sal_uInt16 nLang ); 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir sal_uInt16 GetOptDigitLanguage(); // from CTL options 221*cdf0e10cSrcweir 222*cdf0e10cSrcweir ScNavipiCfg& GetNavipiCfg(); 223*cdf0e10cSrcweir ScAddInCfg& GetAddInCfg(); 224*cdf0e10cSrcweir svtools::ColorConfig& GetColorConfig(); 225*cdf0e10cSrcweir SvtAccessibilityOptions& GetAccessOptions(); 226*cdf0e10cSrcweir SvtCTLOptions& GetCTLOptions(); 227*cdf0e10cSrcweir SvtUserOptions& GetUserOptions(); 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir void ModifyOptions( const SfxItemSet& rOptSet ); 230*cdf0e10cSrcweir 231*cdf0e10cSrcweir // InputHandler: 232*cdf0e10cSrcweir sal_Bool IsEditMode(); // nicht bei SC_INPUT_TYPE 233*cdf0e10cSrcweir sal_Bool IsInputMode(); // auch bei SC_INPUT_TYPE 234*cdf0e10cSrcweir void SetInputMode( ScInputMode eMode ); 235*cdf0e10cSrcweir sal_Bool InputKeyEvent( const KeyEvent& rKEvt, sal_Bool bStartEdit = sal_False ); 236*cdf0e10cSrcweir SC_DLLPUBLIC void InputEnterHandler( sal_uInt8 nBlockMode = 0 ); 237*cdf0e10cSrcweir void InputCancelHandler(); 238*cdf0e10cSrcweir void InputSelection( EditView* pView ); 239*cdf0e10cSrcweir void InputChanged( EditView* pView ); 240*cdf0e10cSrcweir ScInputHandler* GetInputHdl( ScTabViewShell* pViewSh = NULL, sal_Bool bUseRef = sal_True ); 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir void SetRefInputHdl( ScInputHandler* pNew ); 243*cdf0e10cSrcweir ScInputHandler* GetRefInputHdl(); 244*cdf0e10cSrcweir 245*cdf0e10cSrcweir void ViewShellGone(ScTabViewShell* pViewSh); 246*cdf0e10cSrcweir void ViewShellChanged(); 247*cdf0e10cSrcweir // Kommunikation mit Funktionsautopilot 248*cdf0e10cSrcweir void InputGetSelection( xub_StrLen& rStart, xub_StrLen& rEnd ); 249*cdf0e10cSrcweir void InputSetSelection( xub_StrLen nStart, xub_StrLen nEnd ); 250*cdf0e10cSrcweir void InputReplaceSelection( const String& rStr ); 251*cdf0e10cSrcweir String InputGetFormulaStr(); 252*cdf0e10cSrcweir void ActivateInputWindow( const String* pStr = NULL, 253*cdf0e10cSrcweir sal_Bool bMatrix = sal_False ); 254*cdf0e10cSrcweir 255*cdf0e10cSrcweir void InitFormEditData(); 256*cdf0e10cSrcweir void ClearFormEditData(); 257*cdf0e10cSrcweir ScFormEditData* GetFormEditData() { return pFormEditData; } 258*cdf0e10cSrcweir 259*cdf0e10cSrcweir // Referenzeingabe: 260*cdf0e10cSrcweir //<!--Added by PengYunQuan for Validity Cell Range Picker 261*cdf0e10cSrcweir //void SetRefDialog( sal_uInt16 nId, sal_Bool bVis, SfxViewFrame* pViewFrm = NULL ); 262*cdf0e10cSrcweir SC_DLLPUBLIC void SetRefDialog( sal_uInt16 nId, sal_Bool bVis, SfxViewFrame* pViewFrm = NULL ); 263*cdf0e10cSrcweir //-->Added by PengYunQuan for Validity Cell Range Picker 264*cdf0e10cSrcweir sal_Bool IsModalMode(SfxObjectShell* pDocSh = NULL); 265*cdf0e10cSrcweir sal_Bool IsFormulaMode(); 266*cdf0e10cSrcweir sal_Bool IsRefDialogOpen(); 267*cdf0e10cSrcweir sal_Bool IsTableLocked(); 268*cdf0e10cSrcweir void SetReference( const ScRange& rRef, ScDocument* pDoc, 269*cdf0e10cSrcweir const ScMarkData* pMarkData = NULL ); 270*cdf0e10cSrcweir void AddRefEntry(); 271*cdf0e10cSrcweir void EndReference(); 272*cdf0e10cSrcweir sal_uInt16 GetCurRefDlgId() const { return nCurRefDlgId; } 273*cdf0e10cSrcweir 274*cdf0e10cSrcweir //virtuelle Methoden fuer den Optionendialog 275*cdf0e10cSrcweir virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); 276*cdf0e10cSrcweir virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); 277*cdf0e10cSrcweir virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ); 278*cdf0e10cSrcweir 279*cdf0e10cSrcweir void SetInSharedDocLoading( bool bNew ) { mbIsInSharedDocLoading = bNew; } 280*cdf0e10cSrcweir bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading; } 281*cdf0e10cSrcweir void SetInSharedDocSaving( bool bNew ) { mbIsInSharedDocSaving = bNew; } 282*cdf0e10cSrcweir bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving; } 283*cdf0e10cSrcweir 284*cdf0e10cSrcweir SC_DLLPUBLIC sal_Bool RegisterRefWindow( sal_uInt16 nSlotId, Window *pWnd ); 285*cdf0e10cSrcweir SC_DLLPUBLIC sal_Bool UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd ); 286*cdf0e10cSrcweir SC_DLLPUBLIC sal_Bool IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd ); 287*cdf0e10cSrcweir SC_DLLPUBLIC Window * Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor ); 288*cdf0e10cSrcweir SC_DLLPUBLIC Window * Find1RefWindow( Window *pWndAncestor ); 289*cdf0e10cSrcweir }; 290*cdf0e10cSrcweir 291*cdf0e10cSrcweir #define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) ) 292*cdf0e10cSrcweir 293*cdf0e10cSrcweir #endif 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir 296