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

Generated by: LCOV version 1.10