LCOV - code coverage report
Current view: top level - sc/inc - scmod.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 7 16 43.8 %
Date: 2015-06-13 12:38:46 Functions: 7 16 43.8 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SC_INC_SCMOD_HXX
      21             : #define INCLUDED_SC_INC_SCMOD_HXX
      22             : 
      23             : #include "scdllapi.h"
      24             : #include "scdll.hxx"
      25             : #include <vcl/timer.hxx>
      26             : #include <vcl/idle.hxx>
      27             : #include <svl/lstner.hxx>
      28             : #include "global.hxx"
      29             : #include "shellids.hxx"
      30             : #include <unotools/options.hxx>
      31             : #include <tools/shl.hxx>
      32             : 
      33             : #include <map>
      34             : #include <list>
      35             : #include <algorithm>
      36             : #include <stack>
      37             : 
      38             : class KeyEvent;
      39             : class EditView;
      40             : class SfxErrorHandler;
      41             : class SvtAccessibilityOptions;
      42             : class SvtCTLOptions;
      43             : class SvtUserOptions;
      44             : 
      45             : namespace svtools { class ColorConfig; }
      46             : 
      47             : class ScRange;
      48             : class ScDocument;
      49             : class ScViewCfg;
      50             : class ScDocCfg;
      51             : class ScAppCfg;
      52             : class ScDefaultsCfg;
      53             : class ScFormulaCfg;
      54             : class ScInputCfg;
      55             : class ScPrintCfg;
      56             : class ScViewOptions;
      57             : class ScDocOptions;
      58             : class ScAppOptions;
      59             : class ScDefaultsOptions;
      60             : class ScFormulaOptions;
      61             : class ScInputOptions;
      62             : class ScPrintOptions;
      63             : class ScInputHandler;
      64             : class ScTabViewShell;
      65             : class ScMessagePool;
      66             : class EditFieldInfo;
      67             : class ScNavipiCfg;
      68             : class ScAddInCfg;
      69             : class ScTransferObj;
      70             : class ScDrawTransferObj;
      71             : class ScSelectionTransferObj;
      72             : class ScFormEditData;
      73             : class ScMarkData;
      74             : struct ScDragData;
      75             : struct ScClipData;
      76             : 
      77             : //      for internal Drag&Drop:
      78             : 
      79             : #define SC_DROP_NAVIGATOR       1
      80             : #define SC_DROP_TABLE           2
      81             : 
      82             : class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener
      83             : {
      84             :     Timer               aIdleTimer;
      85             :     Idle                aSpellIdle;
      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;
      92             :     ScViewCfg*          pViewCfg;
      93             :     ScDocCfg*           pDocCfg;
      94             :     ScAppCfg*           pAppCfg;
      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;
     108             :     bool                bIsWaterCan:1;
     109             :     bool                bIsInEditCommand:1;
     110             :     bool                bIsInExecuteDrop:1;
     111             :     bool                mbIsInSharedDocLoading:1;
     112             :     bool                mbIsInSharedDocSaving:1;
     113             : 
     114             :     std::map<sal_uInt16, std::list<VclPtr<vcl::Window> > > m_mapRefWindow;
     115             : public:
     116          52 :                     SFX_DECL_INTERFACE(SCID_APP)
     117             : 
     118             : private:
     119             :     /// SfxInterface initializer.
     120             :     static void InitInterface_Impl();
     121             : 
     122             : public:
     123             :                     ScModule( SfxObjectFactory* pFact );
     124             :     virtual         ~ScModule();
     125             : 
     126             :     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
     127             :     virtual void        ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
     128             :     void                DeleteCfg();
     129             : 
     130             :                         // moved by the application
     131             : 
     132             :     DECL_LINK_TYPED( IdleHandler, Timer*, void ); // Timer instead of idle
     133             :     DECL_LINK_TYPED( SpellTimerHdl, Idle*, void );
     134             :     DECL_LINK( CalcFieldValueHdl, EditFieldInfo* );
     135             : 
     136             :     void                Execute( SfxRequest& rReq );
     137             :     void                GetState( SfxItemSet& rSet );
     138             :     static void         HideDisabledSlots( SfxItemSet& rSet );
     139             : 
     140             :     void                AnythingChanged();
     141             : 
     142             :     //  Drag & Drop:
     143          11 :     const ScDragData&   GetDragData() const { return *mpDragData;}
     144             :     void                SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
     145             :     void                ResetDragObject();
     146             :     void                SetDragLink(
     147             :         const OUString& rDoc, const OUString& rTab, const OUString& rArea );
     148             :     void                SetDragJump(
     149             :         ScDocument* pLocalDoc, const OUString& rTarget, const OUString& rText );
     150             : 
     151             :     //  clipboard:
     152        1667 :     const ScClipData&   GetClipData() const { return *mpClipData;}
     153             :     void                SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj );
     154             : 
     155             :     static ScDocument*  GetClipDoc();       // called from document - should be removed later
     156             : 
     157             :     //  X selection:
     158        3986 :     ScSelectionTransferObj* GetSelectionTransfer() const    { return pSelTransfer; }
     159             :     void                SetSelectionTransfer( ScSelectionTransferObj* pNew );
     160             : 
     161           0 :     void                SetWaterCan( bool bNew )    { bIsWaterCan = bNew; }
     162           0 :     bool                GetIsWaterCan() const       { return bIsWaterCan; }
     163             : 
     164           0 :     void                SetInEditCommand( bool bNew )   { bIsInEditCommand = bNew; }
     165             :     bool                IsInEditCommand() const         { return bIsInEditCommand; }
     166             : 
     167           0 :     void                SetInExecuteDrop( bool bNew )   { bIsInExecuteDrop = bNew; }
     168           0 :     bool                IsInExecuteDrop() const         { return bIsInExecuteDrop; }
     169             : 
     170             :     // Options:
     171             :     const ScViewOptions&    GetViewOptions  ();
     172             : SC_DLLPUBLIC    const ScDocOptions&     GetDocOptions   ();
     173             : SC_DLLPUBLIC    const ScAppOptions&     GetAppOptions   ();
     174             : SC_DLLPUBLIC    const ScDefaultsOptions&   GetDefaultsOptions ();
     175             :     SC_DLLPUBLIC const ScFormulaOptions&   GetFormulaOptions ();
     176             :     SC_DLLPUBLIC const ScInputOptions& GetInputOptions ();
     177             : SC_DLLPUBLIC    const ScPrintOptions&   GetPrintOptions ();
     178             :     void                    SetViewOptions  ( const ScViewOptions& rOpt );
     179             : SC_DLLPUBLIC    void                    SetDocOptions   ( const ScDocOptions& rOpt );
     180             : SC_DLLPUBLIC    void                    SetAppOptions   ( const ScAppOptions& rOpt );
     181             :     void                    SetDefaultsOptions ( const ScDefaultsOptions& rOpt );
     182             :     SC_DLLPUBLIC void                    SetFormulaOptions ( const ScFormulaOptions& rOpt );
     183             :     SC_DLLPUBLIC void   SetInputOptions ( const ScInputOptions& rOpt );
     184             :     void                    SetPrintOptions ( const ScPrintOptions& rOpt );
     185             :     void                    InsertEntryToLRUList(sal_uInt16 nFIndex);
     186             :     static void         RecentFunctionsChanged();
     187             : 
     188             :     static void         GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang,
     189             :                                         bool& rAutoSpell );
     190             :     static void         SetAutoSpellProperty( bool bSet );
     191             :     static bool         HasThesaurusLanguage( sal_uInt16 nLang );
     192             : 
     193             :     sal_uInt16              GetOptDigitLanguage();      // from CTL options
     194             : 
     195             :     ScNavipiCfg&        GetNavipiCfg();
     196             :     ScAddInCfg&         GetAddInCfg();
     197             :     svtools::ColorConfig&   GetColorConfig();
     198             :     SvtAccessibilityOptions& GetAccessOptions();
     199             :     SvtCTLOptions&      GetCTLOptions();
     200             :     SC_DLLPUBLIC SvtUserOptions& GetUserOptions();
     201             : 
     202             :     void                ModifyOptions( const SfxItemSet& rOptSet );
     203             : 
     204             :     // InputHandler:
     205             :     bool                IsEditMode();   // not for SC_INPUT_TYPE
     206             :     bool                IsInputMode();  // also for SC_INPUT_TYPE
     207             :     void SetInputMode( ScInputMode eMode, const OUString* pInitText = NULL );
     208             :     bool                InputKeyEvent( const KeyEvent& rKEvt, bool bStartEdit = false );
     209             :     SC_DLLPUBLIC void                InputEnterHandler( sal_uInt8 nBlockMode = 0 );
     210             :     void                InputCancelHandler();
     211             :     void                InputSelection( EditView* pView );
     212             :     void                InputChanged( EditView* pView );
     213             :     ScInputHandler*     GetInputHdl( ScTabViewShell* pViewSh = NULL, bool bUseRef = true );
     214             : 
     215             :     void                SetRefInputHdl( ScInputHandler* pNew );
     216         345 :     ScInputHandler*     GetRefInputHdl() { return pRefInputHandler;}
     217             : 
     218             :     void                ViewShellGone(ScTabViewShell* pViewSh);
     219             :     void                ViewShellChanged();
     220             :     // communication with function-autopilot
     221             :     void                InputGetSelection( sal_Int32& rStart, sal_Int32& rEnd );
     222             :     void                InputSetSelection( sal_Int32 nStart, sal_Int32 nEnd );
     223             :     void                InputReplaceSelection( const OUString& rStr );
     224             :     void                InputTurnOffWinEngine();
     225             :     OUString            InputGetFormulaStr();
     226             :     void                ActivateInputWindow( const OUString* pStr = NULL,
     227             :                                                 bool bMatrix = false );
     228             : 
     229             :     void                InitFormEditData();
     230             :     void                ClearFormEditData();
     231        1322 :     ScFormEditData*     GetFormEditData()       { return pFormEditData; }
     232             : 
     233             :     // input of reference:
     234             :     SC_DLLPUBLIC void               SetRefDialog( sal_uInt16 nId, bool bVis, SfxViewFrame* pViewFrm = NULL );
     235             :     bool                IsModalMode(SfxObjectShell* pDocSh = NULL);
     236             :     bool                IsFormulaMode();
     237             :     bool                IsRefDialogOpen();
     238             :     bool                IsTableLocked();
     239             :     void                SetReference( const ScRange& rRef, ScDocument* pDoc,
     240             :                                         const ScMarkData* pMarkData = NULL );
     241             :     void                AddRefEntry();
     242             :     void                EndReference();
     243           2 :     sal_uInt16              GetCurRefDlgId() const                  { return nCurRefDlgId; }
     244             : 
     245             :     // virtual methods for the options dialog
     246             :     virtual SfxItemSet*  CreateItemSet( sal_uInt16 nId ) SAL_OVERRIDE;
     247             :     virtual void         ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
     248             :     virtual VclPtr<SfxTabPage> CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
     249             : 
     250           0 :     void                SetInSharedDocLoading( bool bNew )  { mbIsInSharedDocLoading = bNew; }
     251           0 :     bool                IsInSharedDocLoading() const        { return mbIsInSharedDocLoading; }
     252           0 :     void                SetInSharedDocSaving( bool bNew )   { mbIsInSharedDocSaving = bNew; }
     253           0 :     bool                IsInSharedDocSaving() const         { return mbIsInSharedDocSaving; }
     254             : 
     255             :     SC_DLLPUBLIC bool   RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd );
     256             :     SC_DLLPUBLIC bool   UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd );
     257             :     SC_DLLPUBLIC vcl::Window * Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAncestor );
     258             : };
     259             : 
     260             : #define SC_MOD() ( *reinterpret_cast<ScModule**>(GetAppData(SHL_CALC)) )
     261             : 
     262             : void global_InitAppOptions();
     263             : 
     264             : #endif
     265             : 
     266             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11