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

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_SC_SOURCE_UI_INC_PFUNCACHE_HXX
      21             : #define INCLUDED_SC_SOURCE_UI_INC_PFUNCACHE_HXX
      22             : 
      23             : #include <vector>
      24             : #include <tools/gen.hxx>
      25             : #include "rangelst.hxx"
      26             : #include "printopt.hxx"
      27             : 
      28             : class ScDocShell;
      29             : class ScMarkData;
      30             : 
      31             : /** Possible types of selection for print functions */
      32             : 
      33             : enum ScPrintSelectionMode
      34             : {
      35             :     SC_PRINTSEL_INVALID,
      36             :     SC_PRINTSEL_DOCUMENT,
      37             :     SC_PRINTSEL_CURSOR,
      38             :     SC_PRINTSEL_RANGE,
      39             :     SC_PRINTSEL_RANGE_EXCLUSIVELY_OLE_AND_DRAW_OBJECTS
      40             : };
      41             : 
      42             : /** Stores the selection in the ScPrintFuncCache so it is only used
      43             :     for the same selection again. */
      44             : 
      45           0 : class ScPrintSelectionStatus
      46             : {
      47             :     ScPrintSelectionMode    eMode;
      48             :     ScRangeList             aRanges;
      49             :     ScPrintOptions          aOptions;
      50             : 
      51             : public:
      52           0 :             ScPrintSelectionStatus() : eMode(SC_PRINTSEL_INVALID) {}
      53           0 :             ~ScPrintSelectionStatus() {}
      54             : 
      55           0 :     void    SetMode(ScPrintSelectionMode eNew)  { eMode = eNew; }
      56           0 :     void    SetRanges(const ScRangeList& rNew)  { aRanges = rNew; }
      57           0 :     void    SetOptions(const ScPrintOptions& rNew) { aOptions = rNew; }
      58             : 
      59           0 :     bool    operator==(const ScPrintSelectionStatus& rOther) const
      60           0 :             { return eMode == rOther.eMode && aRanges == rOther.aRanges && aOptions == rOther.aOptions; }
      61             : 
      62           0 :     ScPrintSelectionMode GetMode() const { return eMode; }
      63           0 :     const ScPrintOptions& GetOptions() const { return aOptions; }
      64             : };
      65             : 
      66             : /** The range that is printed on a page (excluding repeated columns/rows),
      67             :     and its position on the page, used to find hyperlink targets. */
      68             : 
      69           0 : struct ScPrintPageLocation
      70             : {
      71             :     long        nPage;
      72             :     ScRange     aCellRange;
      73             :     Rectangle   aRectangle;     // pixels
      74             : 
      75           0 :     ScPrintPageLocation() :
      76           0 :         nPage(-1) {}            // default: invalid
      77             : 
      78           0 :     ScPrintPageLocation( long nP, const ScRange& rRange, const Rectangle& rRect ) :
      79           0 :         nPage(nP), aCellRange(rRange), aRectangle(rRect) {}
      80             : };
      81             : 
      82             : /** Stores the data for printing that is needed from several sheets,
      83             :     so it doesn't have to be calculated for rendering each page. */
      84             : 
      85             : class ScPrintFuncCache
      86             : {
      87             :     ScPrintSelectionStatus  aSelection;
      88             :     ScDocShell*             pDocSh;
      89             :     long                    nTotalPages;
      90             :     std::vector<long>       nPages;
      91             :     std::vector<long>       nFirstAttr;
      92             :     std::vector<ScPrintPageLocation> aLocations;
      93             :     bool                    bLocInitialized;
      94             : 
      95             : public:
      96             :             ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark,
      97             :                                 const ScPrintSelectionStatus& rStatus );
      98             :             ~ScPrintFuncCache();
      99             : 
     100             :     bool    IsSameSelection( const ScPrintSelectionStatus& rStatus ) const;
     101             : 
     102             :     void    InitLocations( const ScMarkData& rMark, OutputDevice* pDev );
     103             :     bool    FindLocation( const ScAddress& rCell, ScPrintPageLocation& rLocation ) const;
     104             : 
     105           0 :     long    GetPageCount() const                { return nTotalPages; }
     106           0 :     long    GetFirstAttr( SCTAB nTab ) const    { return nFirstAttr[nTab]; }
     107             :     SCTAB   GetTabForPage( long nPage ) const;
     108             :     long    GetTabStart( SCTAB nTab ) const;
     109             :     long    GetDisplayStart( SCTAB nTab ) const;
     110             : };
     111             : 
     112             : #endif
     113             : 
     114             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11