LCOV - code coverage report
Current view: top level - sc/source/ui/inc - preview.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 7 11 63.6 %
Date: 2012-08-25 Functions: 7 11 63.6 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 5 8 62.5 %

           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                 :            : #ifndef SC_PREVIEW_HXX
      29                 :            : #define SC_PREVIEW_HXX
      30                 :            : 
      31                 :            : 
      32                 :            : #include <vcl/window.hxx>
      33                 :            : #include "printfun.hxx"     // ScPrintState
      34                 :            : #include "markdata.hxx"
      35                 :            : 
      36                 :            : #include <vector>
      37                 :            : 
      38                 :            : class ScDocShell;
      39                 :            : class ScPreviewShell;
      40                 :            : class FmFormView;
      41                 :            : 
      42                 :            : class ScPreview : public Window
      43                 :            : {
      44                 :            : private:
      45                 :            :     ScMarkData::MarkedTabsType maSelectedTabs;
      46                 :            :                                         // set:
      47                 :            :     long            nPageNo;            // Pages in document
      48                 :            :     sal_uInt16          nZoom;              // set Zoom
      49                 :            :     Point           aOffset;            // positive
      50                 :            : 
      51                 :            :                                         // calculated:
      52                 :            :     SCTAB           nTabCount;
      53                 :            :     SCTAB           nTabsTested;        // for how many sheets is nPages valid?
      54                 :            :     std::vector<long>       nPages;
      55                 :            :     std::vector<long>       nFirstAttr;
      56                 :            :     SCTAB           nTab;               // Sheet
      57                 :            :     long            nTabPage;           // Page of sheet
      58                 :            :     long            nTabStart;          // First (real) page of the sheet
      59                 :            :     long            nDisplayStart;      // same as above, relative to the start of counting
      60                 :            :     Date            aDate;
      61                 :            :     Time            aTime;
      62                 :            :     long            nTotalPages;
      63                 :            :     Size            aPageSize;          // for GetOptimalZoom
      64                 :            :     ScPrintState    aState;
      65                 :            :     ScPreviewLocationData* pLocationData;   // stores table layout for accessibility API
      66                 :            :     FmFormView*     pDrawView;
      67                 :            : 
      68                 :            :                                         // internal:
      69                 :            :     ScDocShell*     pDocShell;
      70                 :            :     ScPreviewShell* pViewShell;
      71                 :            : 
      72                 :            :     bool            bInGetState:1;
      73                 :            :     bool            bValid:1;             // the following values true
      74                 :            :     bool            bStateValid:1;
      75                 :            :     bool            bLocationValid:1;
      76                 :            :     bool            bInPaint:1;
      77                 :            :     bool            bInSetZoom:1;
      78                 :            :     bool            bLeftRulerMove:1;
      79                 :            :     bool            bRightRulerMove:1;
      80                 :            :     bool            bTopRulerMove:1;
      81                 :            :     bool            bBottomRulerMove:1;
      82                 :            :     bool            bHeaderRulerMove:1;
      83                 :            :     bool            bFooterRulerMove:1;
      84                 :            :     bool            bLeftRulerChange:1;
      85                 :            :     bool            bRightRulerChange:1;
      86                 :            :     bool            bTopRulerChange:1;
      87                 :            :     bool            bBottomRulerChange:1;
      88                 :            :     bool            bHeaderRulerChange:1;
      89                 :            :     bool            bFooterRulerChange:1;
      90                 :            :     bool            bPageMargin:1;
      91                 :            :     bool            bColRulerMove:1;
      92                 :            : 
      93                 :            :     ScRange         aPageArea;
      94                 :            :     long            nRight[ MAXCOL+1 ];
      95                 :            :     long            nLeftPosition;
      96                 :            :     long            mnScale;
      97                 :            :     SCCOL           nColNumberButttonDown;
      98                 :            :     Point           aButtonDownChangePoint;
      99                 :            :     Point           aButtonDownPt;
     100                 :            :     Point           aButtonUpPt;
     101                 :            :     long            nHeaderHeight;
     102                 :            :     long            nFooterHeight;
     103                 :            : 
     104                 :            :     void    TestLastPage();
     105                 :            :     void    CalcPages();
     106                 :            :     void    RecalcPages();
     107                 :            :     void    UpdateDrawView();
     108                 :            :     void    DoPrint( ScPreviewLocationData* pFillLocation );
     109                 :            : 
     110                 :            :     void    InvalidateLocationData( sal_uLong nId );
     111                 :            : 
     112                 :            :     using Window::SetZoom;
     113                 :            : 
     114                 :            : protected:
     115                 :            :     virtual void   Paint( const Rectangle& rRect );
     116                 :            :     virtual void   Command( const CommandEvent& rCEvt );
     117                 :            :     virtual void   KeyInput( const KeyEvent& rKEvt );
     118                 :            :     virtual void   MouseMove( const MouseEvent& rMEvt );
     119                 :            :     virtual void   MouseButtonDown( const MouseEvent& rMEvt );
     120                 :            :     virtual void   MouseButtonUp( const MouseEvent& rMEvt );
     121                 :            : 
     122                 :            :     virtual void   GetFocus();
     123                 :            :     virtual void   LoseFocus();
     124                 :            : 
     125                 :            :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
     126                 :            : 
     127                 :            : public:
     128                 :            :             ScPreview( Window* pParent, ScDocShell* pDocSh, ScPreviewShell* pViewSh );
     129                 :            :             ~ScPreview();
     130                 :            : 
     131                 :            :     virtual void DataChanged( const DataChangedEvent& rDCEvt );
     132                 :            : 
     133                 :            :     SC_DLLPUBLIC void    DataChanged(bool bNewTime = false);             //  Instead of calling Invalidate
     134                 :            :     void    DoInvalidate();
     135                 :            : 
     136                 :            :     void    SetXOffset( long nX );
     137                 :            :     void    SetYOffset( long nY );
     138                 :            :     void    SetZoom(sal_uInt16 nNewZoom);
     139                 :            :     SC_DLLPUBLIC void    SetPageNo( long nPage );
     140                 :            : 
     141                 :          0 :     bool    GetPageMargins() const { return bPageMargin; }
     142                 :          0 :     void    SetPageMargins( bool bVal )  { bPageMargin = bVal; }
     143                 :            :     void    DrawInvert( long nDragPos, sal_uInt16 nFlags );
     144                 :            :     void    DragMove( long nDragMovePos, sal_uInt16 nFlags );
     145                 :            : 
     146                 :            : 
     147                 :            :     const ScPreviewLocationData& GetLocationData();
     148                 :            : 
     149                 :            :     String  GetPosString();
     150                 :            : 
     151                 :        504 :     long    GetPageNo() const   { return nPageNo; }
     152                 :        391 :     sal_uInt16  GetZoom() const     { return nZoom; }
     153                 :         97 :     Point   GetOffset() const   { return aOffset; }
     154                 :            : 
     155         [ +  + ]:        573 :     SCTAB   GetTab()            { if (!bValid) { CalcPages(); RecalcPages(); } return nTab; }
     156         [ -  + ]:        504 :     long    GetTotalPages()     { if (!bValid) { CalcPages(); RecalcPages(); } return nTotalPages; }
     157                 :            : 
     158 [ +  - ][ +  - ]:        407 :     bool    AllTested() const   { return bValid && nTabsTested >= nTabCount; }
     159                 :            : 
     160                 :            :     sal_uInt16  GetOptimalZoom(bool bWidthOnly);
     161                 :            :     SC_DLLPUBLIC long    GetFirstPage(SCTAB nTab);
     162                 :            : 
     163                 :          0 :     void    CalcAll()           { CalcPages(); }
     164                 :        778 :     void    SetInGetState(bool bSet) { bInGetState = bSet; }
     165                 :            : 
     166                 :            :     DECL_STATIC_LINK( ScPreview, InvalidateHdl, void* );
     167                 :            :     static void StaticInvalidate();
     168                 :            : 
     169                 :          0 :     FmFormView* GetDrawView() { return pDrawView; }
     170                 :            : 
     171                 :            :     SC_DLLPUBLIC void SetSelectedTabs(const ScMarkData& rMark);
     172                 :            :     SC_DLLPUBLIC const ScMarkData::MarkedTabsType& GetSelectedTabs() const;
     173                 :            : };
     174                 :            : 
     175                 :            : 
     176                 :            : 
     177                 :            : #endif
     178                 :            : 
     179                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10