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