LCOV - code coverage report
Current view: top level - sc/inc - scmod.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 13 23.1 %
Date: 2012-08-25 Functions: 3 13 23.1 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

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

Generated by: LCOV version 1.10