LCOV - code coverage report
Current view: top level - sc/source/ui/inc - viewdata.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 73 111 65.8 %
Date: 2014-11-03 Functions: 65 92 70.7 %
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             : #ifndef INCLUDED_SC_SOURCE_UI_INC_VIEWDATA_HXX
      20             : #define INCLUDED_SC_SOURCE_UI_INC_VIEWDATA_HXX
      21             : 
      22             : #include <sfx2/zoomitem.hxx>
      23             : #include "rangelst.hxx"
      24             : #include "scdllapi.h"
      25             : #include "viewopti.hxx"
      26             : #include "docsh.hxx"
      27             : 
      28             : #include <boost/scoped_ptr.hpp>
      29             : 
      30             : #define SC_SMALL3DSHADOW    COL_BLACK
      31             : #define SC_SIZE_NONE        65535
      32             : const SCCOL SC_TABSTART_NONE = SCCOL_MAX;
      33             : 
      34             : #define SC_FILL_NONE        0
      35             : #define SC_FILL_FILL        1
      36             : #define SC_FILL_EMBED_LT    2
      37             : #define SC_FILL_EMBED_RB    3
      38             : #define SC_FILL_MATRIX      4
      39             : 
      40             : enum ScSplitMode { SC_SPLIT_NONE = 0, SC_SPLIT_NORMAL, SC_SPLIT_FIX };
      41             : 
      42             : enum ScSplitPos { SC_SPLIT_TOPLEFT, SC_SPLIT_TOPRIGHT, SC_SPLIT_BOTTOMLEFT, SC_SPLIT_BOTTOMRIGHT };
      43             : enum ScHSplitPos { SC_SPLIT_LEFT, SC_SPLIT_RIGHT };
      44             : enum ScVSplitPos { SC_SPLIT_TOP, SC_SPLIT_BOTTOM };
      45             : 
      46             : inline ScHSplitPos WhichH( ScSplitPos ePos );
      47             : inline ScVSplitPos WhichV( ScSplitPos ePos );
      48             : inline ScSplitPos Which( ScHSplitPos eHPos );
      49             : inline ScSplitPos Which( ScVSplitPos eVPos );
      50             : 
      51             : /**  Screen behavior related to cursor movements */
      52             : enum ScFollowMode { SC_FOLLOW_NONE, SC_FOLLOW_LINE, SC_FOLLOW_FIX, SC_FOLLOW_JUMP };
      53             : 
      54             : /** Mouse mode to select areas */
      55             : enum ScRefType { SC_REFTYPE_NONE, SC_REFTYPE_REF, SC_REFTYPE_FILL,
      56             :                     SC_REFTYPE_EMBED_LT, SC_REFTYPE_EMBED_RB };
      57             : 
      58             : /** States GetSimpleArea() returns for the underlying selection marks, so the
      59             :     caller can react if the result is not of type SC_MARK_SIMPLE. */
      60             : enum ScMarkType
      61             : {
      62             :     SC_MARK_NONE            = 0,    // Not returned by GetSimpleArea(), used internally.
      63             :                                     // Nothing marked always results in the
      64             :                                     // current cursor position being selected and a simple mark.
      65             :     SC_MARK_SIMPLE          = 1,    // Simple rectangular area marked, no filtered rows.
      66             :     SC_MARK_FILTERED        = 2,    // At least one mark contains filtered rows.
      67             :     SC_MARK_SIMPLE_FILTERED =       // Simple rectangular area marked containing filtered rows.
      68             :         SC_MARK_SIMPLE |
      69             :         SC_MARK_FILTERED,  // 3
      70             :     SC_MARK_MULTI           = 4     // Multiple selection marks.
      71             :     /* TODO: if filtered multi-selection was implemented, this would be the value to use. */
      72             : #if 0
      73             :         ,
      74             :     SC_MARK_MULTI_FILTERED  =       // Multiple selection marks containing filtered rows.
      75             :         SC_MARK_MULTI |
      76             :         SC_MARK_FILTERED   // 6
      77             : #endif
      78             : };
      79             : 
      80             : enum ScPasteFlags
      81             : {
      82             :     SC_PASTE_NONE   = 0,    // No flags specified
      83             :     SC_PASTE_MODE   = 1,    // Enable paste-mode
      84             :     SC_PASTE_BORDER = 2,    // Show a border around the source cells
      85             : };
      86             : 
      87             : class ScDocFunc;
      88             : class ScDocShell;
      89             : class ScDocument;
      90             : class ScDBFunc;
      91             : class ScTabViewShell;
      92             : class ScDrawView;
      93             : class ScEditEngineDefaulter;
      94             : class EditView;
      95             : class EditStatus;
      96             : class Outliner;
      97             : namespace vcl { class Window; }
      98             : class SfxObjectShell;
      99             : class SfxBindings;
     100             : class SfxDispatcher;
     101             : class ScPatternAttr;
     102             : class ScExtDocOptions;
     103             : class ScViewData;
     104             : class ScMarkData;
     105             : class ScGridWindow;
     106             : 
     107           0 : class ScViewDataTable                           // per-sheet data
     108             : {
     109             : friend class ScViewData;
     110             : private:
     111             :     SvxZoomType     eZoomType;                  // selected zoom type (normal view)
     112             :     Fraction        aZoomX;                     // selected zoom X
     113             :     Fraction        aZoomY;                     // selected zoom Y (displayed)
     114             :     Fraction        aPageZoomX;                 // zoom in page break preview mode
     115             :     Fraction        aPageZoomY;
     116             : 
     117             :     long            nTPosX[2];                  // MapMode - Offset (Twips)
     118             :     long            nTPosY[2];
     119             :     long            nMPosX[2];                  // MapMode - Offset (1/100 mm)
     120             :     long            nMPosY[2];
     121             :     long            nPixPosX[2];                // Offset in Pixels
     122             :     long            nPixPosY[2];
     123             :     long            nHSplitPos;
     124             :     long            nVSplitPos;
     125             : 
     126             :     ScSplitMode     eHSplitMode;
     127             :     ScSplitMode     eVSplitMode;
     128             :     ScSplitPos      eWhichActive;
     129             : 
     130             :     SCCOL           nFixPosX;                   // Cell position of the splitter when freeze pane
     131             :     SCROW           nFixPosY;
     132             : 
     133             :     SCCOL           nCurX;
     134             :     SCROW           nCurY;
     135             :     SCCOL           nOldCurX;
     136             :     SCROW           nOldCurY;
     137             :     SCCOL           nPosX[2];
     138             :     SCROW           nPosY[2];
     139             : 
     140             :     bool            bShowGrid;                  // per sheet show grid lines option.
     141             :     bool            mbOldCursorValid;           // "virtual" Cursor position when combined
     142             :                     ScViewDataTable();
     143             : 
     144             :     void            WriteUserDataSequence(
     145             :                         com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
     146             :                         const ScViewData& rViewData, SCTAB nTab ) const;
     147             : 
     148             :     void            ReadUserDataSequence(
     149             :                         const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings,
     150             :                         ScViewData& rViewData, SCTAB nTab, bool& rHasZoom);
     151             : public:
     152             :     ~ScViewDataTable();
     153             : };
     154             : 
     155             : class SC_DLLPUBLIC ScViewData
     156             : {
     157             : private:
     158             :     double              nPPTX, nPPTY;               // Scaling factors
     159             : 
     160             :     ::std::vector<ScViewDataTable*> maTabData;
     161             :     boost::scoped_ptr<ScMarkData> mpMarkData;
     162             :     ScViewDataTable*    pThisTab;                   // Data of the displayed sheet
     163             :     ScDocShell*         pDocShell;
     164             :     ScDocument*         pDoc;
     165             :     ScDBFunc*           pView;
     166             :     ScTabViewShell*     pViewShell;
     167             :     EditView*           pEditView[4];               // Belongs to the window
     168             :     ScViewOptions*      pOptions;
     169             :     EditView*           pSpellingView;
     170             : 
     171             :     Size                aScenButSize;
     172             : 
     173             :     Size                aScrSize;
     174             :     MapMode             aLogicMode;                 // skalierter 1/100mm-MapMode
     175             : 
     176             :     SvxZoomType         eDefZoomType;               // default zoom and type for missing TabData
     177             :     Fraction            aDefZoomX;
     178             :     Fraction            aDefZoomY;
     179             :     Fraction            aDefPageZoomX;              // zoom in page break preview mode
     180             :     Fraction            aDefPageZoomY;
     181             : 
     182             :     ScRefType           eRefType;
     183             : 
     184             :     SCTAB               nTabNo;                     // displayed sheet
     185             :     SCTAB               nRefTabNo;                  // sheet which contains RefInput
     186             :     SCCOL               nRefStartX;
     187             :     SCROW               nRefStartY;
     188             :     SCTAB               nRefStartZ;
     189             :     SCCOL               nRefEndX;
     190             :     SCROW               nRefEndY;
     191             :     SCTAB               nRefEndZ;
     192             :     SCCOL               nFillStartX;                // Fill Cursor
     193             :     SCROW               nFillStartY;
     194             :     SCCOL               nFillEndX;
     195             :     SCROW               nFillEndY;
     196             :     SCCOL               nEditCol;                   // Related position
     197             :     SCROW               nEditRow;
     198             :     SCCOL               nEditStartCol;
     199             :     SCCOL               nEditEndCol;                // End of Edit View
     200             :     SCROW               nEditEndRow;
     201             :     SCCOL               nTabStartCol;               // for Enter after Tab
     202             :     ScRange             aDelRange;                  // for delete AutoFill
     203             : 
     204             :     ScPasteFlags        nPasteFlags;
     205             : 
     206             :     ScSplitPos          eEditActivePart;            // the part that was active when edit mode was started
     207             :     sal_uInt8           nFillMode;
     208             :     bool                bEditActive[4];             // Active?
     209             :     bool                bActive:1;                  // Active Window ?
     210             :     bool                bIsRefMode:1;               // Reference input
     211             :     bool                bDelMarkValid:1;            // Only valid at SC_REFTYPE_FILL
     212             :     bool                bPagebreak:1;               // Page break preview mode
     213             :     bool                bSelCtrlMouseClick:1;       // special selection handling for ctrl-mouse-click
     214             : 
     215             :     SAL_DLLPRIVATE DECL_LINK (EmptyEditHdl, void*);
     216             :     SAL_DLLPRIVATE DECL_LINK (EditEngineHdl, EditStatus*);
     217             : 
     218             :     SAL_DLLPRIVATE void          CalcPPT();
     219             :     SAL_DLLPRIVATE void          CreateTabData( SCTAB nNewTab );
     220             :     SAL_DLLPRIVATE void          CreateTabData( std::vector< SCTAB >& rvTabs );
     221             :     SAL_DLLPRIVATE void          CreateSelectedTabData();
     222             :     SAL_DLLPRIVATE void          EnsureTabDataSize(size_t nSize);
     223             :     SAL_DLLPRIVATE void          UpdateCurrentTab();
     224             : 
     225             : public:
     226             :                     ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh );
     227             :                     ScViewData( const ScViewData& rViewData );
     228             :                     ~ScViewData();
     229             : 
     230             :     void            InitData( ScDocument* pDocument );
     231             : 
     232      109492 :     ScDocShell*     GetDocShell() const     { return pDocShell; }
     233             :     ScDocFunc&      GetDocFunc() const;
     234       68659 :     ScDBFunc*       GetView() const         { return pView; }
     235       85010 :     ScTabViewShell* GetViewShell() const    { return pViewShell; }
     236        5736 :     SfxObjectShell* GetSfxDocShell() const  { return pDocShell; }
     237             :     SfxBindings&    GetBindings();          // from ViewShell's ViewFrame
     238             :     SfxDispatcher&  GetDispatcher();        // from ViewShell's ViewFrame
     239             : 
     240             :     ScMarkData&     GetMarkData();
     241             :     const ScMarkData& GetMarkData() const;
     242             : 
     243             :     vcl::Window*         GetDialogParent();          // forwarded from tabvwsh
     244             :     ScGridWindow*   GetActiveWin();             // from View
     245             :     ScDrawView*     GetScDrawView();            // from View
     246             :     bool            IsMinimized();              // from View
     247             : 
     248             :     void            UpdateInputHandler( bool bForce = false, bool bStopEditing = true );
     249             : 
     250             :     void            WriteUserData(OUString& rData);
     251             :     void            ReadUserData(const OUString& rData);
     252             :     void            WriteExtOptions( ScExtDocOptions& rOpt ) const;
     253             :     void            ReadExtOptions( const ScExtDocOptions& rOpt );
     254             :     void            WriteUserDataSequence(com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings) const;
     255             :     void            ReadUserDataSequence(const com::sun::star::uno::Sequence <com::sun::star::beans::PropertyValue>& rSettings);
     256             : 
     257             :     ScDocument*     GetDocument() const;
     258             : 
     259       26176 :     bool            IsActive() const            { return bActive; }
     260        1084 :     void            Activate(bool bActivate)    { bActive = bActivate; }
     261             : 
     262             :     void            InsertTab( SCTAB nTab );
     263             :     void            InsertTabs( SCTAB nTab, SCTAB nNewSheets );
     264             :     void            DeleteTab( SCTAB nTab );
     265             :     void            DeleteTabs( SCTAB nTab, SCTAB nSheets );
     266             :     void            CopyTab( SCTAB nSrcTab, SCTAB nDestTab );
     267             :     void            MoveTab( SCTAB nSrcTab, SCTAB nDestTab );
     268             : 
     269           0 :     SCTAB           GetRefTabNo() const                     { return nRefTabNo; }
     270         752 :     void            SetRefTabNo( SCTAB nNewTab )            { nRefTabNo = nNewTab; }
     271             : 
     272      364671 :     SCTAB           GetTabNo() const                        { return nTabNo; }
     273       40985 :     ScSplitPos      GetActivePart() const                   { return pThisTab->eWhichActive; }
     274      142746 :     SCCOL           GetPosX( ScHSplitPos eWhich ) const     { return pThisTab->nPosX[eWhich]; }
     275      159815 :     SCROW           GetPosY( ScVSplitPos eWhich ) const     { return pThisTab->nPosY[eWhich]; }
     276       53539 :     SCCOL           GetCurX() const                         { return pThisTab->nCurX; }
     277       49161 :     SCROW           GetCurY() const                         { return pThisTab->nCurY; }
     278             :     bool            HasOldCursor() const                    { return pThisTab->mbOldCursorValid; }
     279             :     SCCOL           GetOldCurX() const;
     280             :     SCROW           GetOldCurY() const;
     281       30212 :     ScSplitMode     GetHSplitMode() const                   { return pThisTab->eHSplitMode; }
     282       44726 :     ScSplitMode     GetVSplitMode() const                   { return pThisTab->eVSplitMode; }
     283          50 :     long            GetHSplitPos() const                    { return pThisTab->nHSplitPos; }
     284          68 :     long            GetVSplitPos() const                    { return pThisTab->nVSplitPos; }
     285           4 :     SCCOL           GetFixPosX() const                      { return pThisTab->nFixPosX; }
     286           8 :     SCROW           GetFixPosY() const                      { return pThisTab->nFixPosY; }
     287       19044 :     bool            IsPagebreakMode() const                 { return bPagebreak; }
     288           0 :     bool            IsPasteMode() const                     { return (nPasteFlags & SC_PASTE_MODE) != 0; }
     289        3168 :     bool            ShowPasteSource() const                 { return (nPasteFlags & SC_PASTE_BORDER) != 0; }
     290             : 
     291             :     void            SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX );
     292             :     void            SetPosY( ScVSplitPos eWhich, SCROW nNewPosY );
     293         902 :     void            SetCurX( SCCOL nNewCurX )                       { pThisTab->nCurX = nNewCurX; }
     294         902 :     void            SetCurY( SCROW nNewCurY )                       { pThisTab->nCurY = nNewCurY; }
     295             :     void            SetOldCursor( SCCOL nNewX, SCROW nNewY );
     296             :     void            ResetOldCursor();
     297          40 :     void            SetHSplitMode( ScSplitMode eMode )              { pThisTab->eHSplitMode = eMode; }
     298          40 :     void            SetVSplitMode( ScSplitMode eMode )              { pThisTab->eVSplitMode = eMode; }
     299          38 :     void            SetHSplitPos( long nPos )                       { pThisTab->nHSplitPos = nPos; }
     300          40 :     void            SetVSplitPos( long nPos )                       { pThisTab->nVSplitPos = nPos; }
     301           2 :     void            SetFixPosX( SCCOL nPos )                        { pThisTab->nFixPosX = nPos; }
     302           4 :     void            SetFixPosY( SCROW nPos )                        { pThisTab->nFixPosY = nPos; }
     303             :     void            SetPagebreakMode( bool bSet );
     304           0 :     void            SetPasteMode ( ScPasteFlags nFlags )            { nPasteFlags = nFlags; }
     305             : 
     306             :     void            SetZoomType( SvxZoomType eNew, bool bAll );
     307             :     void            SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
     308             :     void            SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
     309             :     void            SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll );
     310             :     void            RefreshZoom();
     311             : 
     312           0 :     void            SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; }
     313             : 
     314        3070 :     SvxZoomType     GetZoomType() const     { return pThisTab->eZoomType; }
     315       29280 :     const Fraction& GetZoomX() const        { return bPagebreak ? pThisTab->aPageZoomX : pThisTab->aZoomX; }
     316       30292 :     const Fraction& GetZoomY() const        { return bPagebreak ? pThisTab->aPageZoomY : pThisTab->aZoomY; }
     317             : 
     318             :     void            SetShowGrid( bool bShow );
     319        1712 :     bool            GetShowGrid() const { return pThisTab->bShowGrid; }
     320             : 
     321             :     const MapMode&  GetLogicMode( ScSplitPos eWhich );
     322             :     const MapMode&  GetLogicMode();                     // Offset 0
     323             : 
     324             :     long            GetTPosX( ScHSplitPos eWhich ) const        { return pThisTab->nTPosX[eWhich]; }
     325             :     long            GetTPosY( ScVSplitPos eWhich ) const        { return pThisTab->nTPosY[eWhich]; }
     326             : 
     327       61882 :     double          GetPPTX() const { return nPPTX; }
     328      105014 :     double          GetPPTY() const { return nPPTY; }
     329             : 
     330             :     ScMarkType      GetSimpleArea( SCCOL& rStartCol, SCROW& rStartRow, SCTAB& rStartTab,
     331             :                                     SCCOL& rEndCol, SCROW& rEndRow, SCTAB& rEndTab ) const;
     332             :     ScMarkType      GetSimpleArea( ScRange& rRange ) const;
     333             :                     /// May modify rNewMark using MarkToSimple().
     334             :     ScMarkType      GetSimpleArea( ScRange & rRange, ScMarkData & rNewMark ) const;
     335             :     void            GetMultiArea( ScRangeListRef& rRange ) const;
     336             : 
     337             :     bool            SimpleColMarked();
     338             :     bool            SimpleRowMarked();
     339             : 
     340             :     bool            IsMultiMarked();
     341             : 
     342             :     void            SetFillMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow );
     343             :     void            SetDragMode( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
     344             :                                     sal_uInt8 nMode );
     345             :     void            GetFillData( SCCOL& rStartCol, SCROW& rStartRow,
     346             :                                  SCCOL& rEndCol, SCROW& rEndRow );
     347             :     void            ResetFillMode();
     348         166 :     bool            IsAnyFillMode()             { return nFillMode != SC_FILL_NONE; }
     349          28 :     bool            IsFillMode()                { return nFillMode == SC_FILL_FILL; }
     350          28 :     sal_uInt8       GetFillMode()               { return nFillMode; }
     351             : 
     352             :                     // TRUE: Cell is merged
     353             :     bool            GetMergeSizePixel( SCCOL nX, SCROW nY, long& rSizeXPix, long& rSizeYPix ) const;
     354             :     bool            GetPosFromPixel( long nClickX, long nClickY, ScSplitPos eWhich,
     355             :                                         SCsCOL& rPosX, SCsROW& rPosY,
     356             :                                         bool bTestMerge = true, bool bRepair = false,
     357             :                                         bool bNextIfLarge = true );
     358             :     void            GetMouseQuadrant( const Point& rClickPos, ScSplitPos eWhich,
     359             :                                         SCsCOL nPosX, SCsROW nPosY, bool& rLeft, bool& rTop );
     360             : 
     361        4820 :     bool            IsRefMode() const                       { return bIsRefMode; }
     362           0 :     ScRefType       GetRefType() const                      { return eRefType; }
     363           0 :     SCCOL           GetRefStartX() const                    { return nRefStartX; }
     364           0 :     SCROW           GetRefStartY() const                    { return nRefStartY; }
     365           0 :     SCTAB           GetRefStartZ() const                    { return nRefStartZ; }
     366           0 :     SCCOL           GetRefEndX() const                      { return nRefEndX; }
     367           0 :     SCROW           GetRefEndY() const                      { return nRefEndY; }
     368           0 :     SCTAB           GetRefEndZ() const                      { return nRefEndZ; }
     369             : 
     370           0 :     void            SetRefMode( bool bNewMode, ScRefType eNewType )
     371           0 :                                     { bIsRefMode = bNewMode; eRefType = eNewType; }
     372             : 
     373             :     void            SetRefStart( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ );
     374             :     void            SetRefEnd( SCCOL nNewX, SCROW nNewY, SCTAB nNewZ );
     375             : 
     376           0 :     void            ResetDelMark()                          { bDelMarkValid = false; }
     377           0 :     void            SetDelMark( const ScRange& rRange )
     378           0 :                             { aDelRange = rRange; bDelMarkValid = true; }
     379             : 
     380           0 :     bool            GetDelMark( ScRange& rRange ) const
     381           0 :                             { rRange = aDelRange; return bDelMarkValid; }
     382             : 
     383             :     inline void     GetMoveCursor( SCCOL& rCurX, SCROW& rCurY );
     384             : 
     385       16934 :     const ScViewOptions&    GetOptions() const { return *pOptions; }
     386             :     void                    SetOptions( const ScViewOptions& rOpt );
     387             : 
     388           0 :     bool    IsGridMode      () const            { return pOptions->GetOption( VOPT_GRID ); }
     389         558 :     void    SetGridMode     ( bool bNewMode )   { pOptions->SetOption( VOPT_GRID, bNewMode ); }
     390        1474 :     bool    IsSyntaxMode    () const            { return pOptions->GetOption( VOPT_SYNTAX ); }
     391         558 :     void    SetSyntaxMode   ( bool bNewMode )   { pOptions->SetOption( VOPT_SYNTAX, bNewMode ); }
     392        8760 :     bool    IsHeaderMode    () const            { return pOptions->GetOption( VOPT_HEADER ); }
     393         558 :     void    SetHeaderMode   ( bool bNewMode )   { pOptions->SetOption( VOPT_HEADER, bNewMode ); }
     394        6762 :     bool    IsTabMode       () const            { return pOptions->GetOption( VOPT_TABCONTROLS ); }
     395         558 :     void    SetTabMode      ( bool bNewMode )   { pOptions->SetOption( VOPT_TABCONTROLS, bNewMode ); }
     396        8760 :     bool    IsVScrollMode   () const            { return pOptions->GetOption( VOPT_VSCROLL ); }
     397         558 :     void    SetVScrollMode  ( bool bNewMode )   { pOptions->SetOption( VOPT_VSCROLL, bNewMode ); }
     398        6184 :     bool    IsHScrollMode   () const            { return pOptions->GetOption( VOPT_HSCROLL ); }
     399         558 :     void    SetHScrollMode  ( bool bNewMode )   { pOptions->SetOption( VOPT_HSCROLL, bNewMode ); }
     400        8760 :     bool    IsOutlineMode   () const            { return pOptions->GetOption( VOPT_OUTLINER ); }
     401         558 :     void    SetOutlineMode  ( bool bNewMode )   { pOptions->SetOption( VOPT_OUTLINER, bNewMode ); }
     402             : 
     403             :     void            KillEditView();
     404             :     void            ResetEditView();
     405             :     void            SetEditEngine( ScSplitPos eWhich,
     406             :                                     ScEditEngineDefaulter* pNewEngine,
     407             :                                     vcl::Window* pWin, SCCOL nNewX, SCROW nNewY );
     408             :     void            GetEditView( ScSplitPos eWhich, EditView*& rViewPtr, SCCOL& rCol, SCROW& rRow );
     409       42637 :     bool            HasEditView( ScSplitPos eWhich ) const
     410       42637 :                                         { return pEditView[eWhich] && bEditActive[eWhich]; }
     411           0 :     EditView*       GetEditView( ScSplitPos eWhich ) const
     412           0 :                                         { return pEditView[eWhich]; }
     413             : 
     414             :     void            EditGrowX();
     415             :     void            EditGrowY( bool bInitial = false );
     416             : 
     417           0 :     ScSplitPos      GetEditActivePart() const       { return eEditActivePart; }
     418           0 :     SCCOL           GetEditViewCol() const          { return nEditCol; }
     419           0 :     SCROW           GetEditViewRow() const          { return nEditRow; }
     420        3484 :     SCCOL           GetEditStartCol() const         { return nEditStartCol; }
     421        3484 :     SCROW           GetEditStartRow() const         { return nEditRow; }        // never editing above the cell
     422        3484 :     SCCOL           GetEditEndCol() const           { return nEditEndCol; }
     423        3484 :     SCROW           GetEditEndRow() const           { return nEditEndRow; }
     424             : 
     425             :     Rectangle       GetEditArea( ScSplitPos eWhich, SCCOL nPosX, SCROW nPosY, vcl::Window* pWin,
     426             :                                     const ScPatternAttr* pPattern, bool bForceToTop );
     427             : 
     428             :     void            SetTabNo( SCTAB nNewTab );
     429             :     void            SetActivePart( ScSplitPos eNewActive );
     430             : 
     431             :     Point           GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScSplitPos eWhich,
     432             :                                 bool bAllowNeg = false ) const;
     433             :     Point           GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScHSplitPos eWhich ) const;
     434             :     Point           GetScrPos( SCCOL nWhereX, SCROW nWhereY, ScVSplitPos eWhich ) const;
     435             : 
     436             :     SCCOL           CellsAtX( SCsCOL nPosX, SCsCOL nDir, ScHSplitPos eWhichX, sal_uInt16 nScrSizeY = SC_SIZE_NONE ) const;
     437             :     SCROW           CellsAtY( SCsROW nPosY, SCsROW nDir, ScVSplitPos eWhichY, sal_uInt16 nScrSizeX = SC_SIZE_NONE ) const;
     438             : 
     439             :     SCCOL           VisibleCellsX( ScHSplitPos eWhichX ) const;     // Completely visible cell
     440             :     SCROW           VisibleCellsY( ScVSplitPos eWhichY ) const;
     441             :     SCCOL           PrevCellsX( ScHSplitPos eWhichX ) const;        // Cells on the preceding page
     442             :     SCROW           PrevCellsY( ScVSplitPos eWhichY ) const;
     443             : 
     444             :     bool            IsOle();
     445             :     void            SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
     446             :     void            SetScreen( const Rectangle& rVisArea );
     447             :     void            SetScreenPos( const Point& rVisAreaStart );
     448             : 
     449             :     void            UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY );
     450             : 
     451         166 :     Size            GetScrSize() const              { return aScrSize; }
     452             : 
     453             :     void            RecalcPixPos();
     454       34216 :     Point           GetPixPos( ScSplitPos eWhich ) const
     455       34216 :                     { return Point( pThisTab->nPixPosX[WhichH(eWhich)],
     456       68432 :                                     pThisTab->nPixPosY[WhichV(eWhich)] ); }
     457           0 :     void            SetSpellingView( EditView* pSpView) { pSpellingView = pSpView; }
     458           0 :     EditView*       GetSpellingView() const { return pSpellingView; }
     459             : 
     460             :     void            UpdateOutlinerFlags( Outliner& rOutl ) const;
     461             : 
     462             :     Point           GetMousePosPixel();
     463             : 
     464             :     bool            UpdateFixX(SCTAB nTab = MAXTAB+1);
     465             :     bool            UpdateFixY(SCTAB nTab = MAXTAB+1);
     466             : 
     467           0 :     SCCOL           GetTabStartCol() const          { return nTabStartCol; }
     468         890 :     void            SetTabStartCol(SCCOL nNew)      { nTabStartCol = nNew; }
     469             : 
     470             :     ScAddress       GetCurPos() const;
     471             : 
     472           0 :     const Size&     GetScenButSize() const              { return aScenButSize; }
     473           0 :     void            SetScenButSize(const Size& rNew)    { aScenButSize = rNew; }
     474             : 
     475          28 :     bool            IsSelCtrlMouseClick() { return bSelCtrlMouseClick; }
     476             : 
     477             :     static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
     478             : 
     479             :     /** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
     480             :         heights converted with nPPTY to rScrY, optimized for row height
     481             :         segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
     482             :         may be > nEndPixels!
     483             :      */
     484             :     static void     AddPixelsWhile( long & rScrY, long nEndPixels,
     485             :                                     SCROW & rPosY, SCROW nEndRow, double nPPTY,
     486             :                                     const ScDocument * pDoc, SCTAB nTabNo );
     487             : 
     488             :     /** while (rScrY <= nEndPixels && rPosY >= nStartRow) add pixels of row
     489             :         heights converted with nPPTY to rScrY, optimized for row height
     490             :         segments. Upon return rPosY is the last row evaluated >= nStartRow,
     491             :         rScrY may be > nEndPixels!
     492             :      */
     493             :     static void     AddPixelsWhileBackward( long & rScrY, long nEndPixels,
     494             :                                     SCROW & rPosY, SCROW nStartRow, double nPPTY,
     495             :                                     const ScDocument * pDoc, SCTAB nTabNo );
     496             : };
     497             : 
     498     1002341 : inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor )
     499             : {
     500     1002341 :     long nRet = (long)( nTwips * nFactor );
     501     1002341 :     if ( !nRet && nTwips )
     502           0 :         nRet = 1;
     503     1002341 :     return nRet;
     504             : }
     505             : 
     506           0 : inline void ScViewData::GetMoveCursor( SCCOL& rCurX, SCROW& rCurY )
     507             : {
     508           0 :     if ( bIsRefMode )
     509             :     {
     510           0 :         rCurX = nRefEndX;
     511           0 :         rCurY = nRefEndY;
     512             :     }
     513             :     else
     514             :     {
     515           0 :         rCurX = GetCurX();
     516           0 :         rCurY = GetCurY();
     517             :     }
     518           0 : }
     519             : 
     520       56751 : inline ScHSplitPos WhichH( ScSplitPos ePos )
     521             : {
     522             :     return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_BOTTOMLEFT) ?
     523       56751 :                 SC_SPLIT_LEFT : SC_SPLIT_RIGHT;
     524             : }
     525             : 
     526       56751 : inline ScVSplitPos WhichV( ScSplitPos ePos )
     527             : {
     528             :     return (ePos==SC_SPLIT_TOPLEFT || ePos==SC_SPLIT_TOPRIGHT) ?
     529       56751 :                 SC_SPLIT_TOP : SC_SPLIT_BOTTOM;
     530             : }
     531             : 
     532             : inline ScSplitPos Which( ScHSplitPos eHPos )
     533             : {
     534             :     return (eHPos==SC_SPLIT_LEFT) ?
     535             :                 SC_SPLIT_BOTTOMLEFT : SC_SPLIT_BOTTOMRIGHT;
     536             : }
     537             : 
     538             : inline ScSplitPos Which( ScVSplitPos eVPos )
     539             : {
     540             :     return (eVPos==SC_SPLIT_TOP) ?
     541             :                 SC_SPLIT_TOPLEFT : SC_SPLIT_BOTTOMLEFT;
     542             : }
     543             : 
     544             : #endif
     545             : 
     546             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10