LibreOffice Module sc (master)  1
pfuncache.hxx
Go to the documentation of this file.
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 class OutputDevice;
31 
35 {
41 };
42 
47 {
51 
52 public:
54 
55  void SetMode(ScPrintSelectionMode eNew) { eMode = eNew; }
56  void SetRanges(const ScRangeList& rNew) { aRanges = rNew; }
57  void SetOptions(const ScPrintOptions& rNew) { aOptions = rNew; }
58 
59  bool operator==(const ScPrintSelectionStatus& rOther) const
60  { return eMode == rOther.eMode && aRanges == rOther.aRanges && aOptions == rOther.aOptions; }
61 
62  ScPrintSelectionMode GetMode() const { return eMode; }
63  const ScPrintOptions& GetOptions() const { return aOptions; }
64 };
65 
70 {
71  long nPage;
74 
76  nPage(-1) {} // default: invalid
77 
78  ScPrintPageLocation( long nP, const ScRange& rRange, const tools::Rectangle& rRect ) :
79  nPage(nP), aCellRange(rRange), aRectangle(rRect) {}
80 };
81 
86 {
90  std::vector<long> nPages;
91  std::vector<long> nFirstAttr;
92  std::vector<ScPrintPageLocation> aLocations;
94 
95 public:
96  ScPrintFuncCache( ScDocShell* pD, const ScMarkData& rMark,
97  const ScPrintSelectionStatus& rStatus );
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  long GetPageCount() const { return nTotalPages; }
106  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: */
Stores the selection in the ScPrintFuncCache so it is only used for the same selection again...
Definition: pfuncache.hxx:46
ScPrintSelectionMode GetMode() const
Definition: pfuncache.hxx:62
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
std::vector< long > nFirstAttr
Definition: pfuncache.hxx:91
ScPrintSelectionMode eMode
Definition: pfuncache.hxx:48
bool operator==(const ScPrintSelectionStatus &rOther) const
Definition: pfuncache.hxx:59
ScPrintPageLocation(long nP, const ScRange &rRange, const tools::Rectangle &rRect)
Definition: pfuncache.hxx:78
The range that is printed on a page (excluding repeated columns/rows), and its position on the page...
Definition: pfuncache.hxx:69
void SetMode(ScPrintSelectionMode eNew)
Definition: pfuncache.hxx:55
long GetPageCount() const
Definition: pfuncache.hxx:105
Stores the data for printing that is needed from several sheets, so it doesn't have to be calculated ...
Definition: pfuncache.hxx:85
ScPrintFuncCache(ScDocShell *pD, const ScMarkData &rMark, const ScPrintSelectionStatus &rStatus)
Definition: pfuncache.cxx:29
ScPrintSelectionMode
Possible types of selection for print functions.
Definition: pfuncache.hxx:34
long GetTabStart(SCTAB nTab) const
Definition: pfuncache.cxx:162
ScDocShell * pDocSh
Definition: pfuncache.hxx:88
long GetFirstAttr(SCTAB nTab) const
Definition: pfuncache.hxx:106
bool FindLocation(const ScAddress &rCell, ScPrintPageLocation &rLocation) const
Definition: pfuncache.cxx:133
void InitLocations(const ScMarkData &rMark, OutputDevice *pDev)
Definition: pfuncache.cxx:82
ScPrintOptions aOptions
Definition: pfuncache.hxx:50
bool IsSameSelection(const ScPrintSelectionStatus &rStatus) const
Definition: pfuncache.cxx:145
long GetDisplayStart(SCTAB nTab) const
Definition: pfuncache.cxx:171
void SetRanges(const ScRangeList &rNew)
Definition: pfuncache.hxx:56
const ScPrintOptions & GetOptions() const
Definition: pfuncache.hxx:63
tools::Rectangle aRectangle
Definition: pfuncache.hxx:73
void SetOptions(const ScPrintOptions &rNew)
Definition: pfuncache.hxx:57
ScPrintSelectionStatus aSelection
Definition: pfuncache.hxx:87
std::vector< ScPrintPageLocation > aLocations
Definition: pfuncache.hxx:92
sal_Int16 SCTAB
Definition: types.hxx:23
std::vector< long > nPages
Definition: pfuncache.hxx:90
SCTAB GetTabForPage(long nPage) const
Definition: pfuncache.cxx:150