LibreOffice Module sc (master) 1
pagedata.cxx
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#include <string.h>
21
22#include <pagedata.hxx>
23
24#include <osl/diagnose.h>
25
27{
28 bTopDown = bAutomatic = true;
29 nFirstPage = 1;
30}
31
33{
34}
35
36void ScPrintRangeData::SetPagesX( size_t nCount, const SCCOL* pData )
37{
38 mvPageEndX.resize( nCount );
39 memcpy( mvPageEndX.data(), pData, nCount * sizeof(SCCOL) );
40}
41
42void ScPrintRangeData::SetPagesY( size_t nCount, const SCROW* pData )
43{
44 mvPageEndY.resize(nCount);
45 memcpy( mvPageEndY.data(), pData, nCount * sizeof(SCROW) );
46}
47
49{
50 nUsed = 0;
51 if (nMax)
52 pData.reset( new ScPrintRangeData[nMax] );
53 nAlloc = nMax;
54}
55
57{
58}
59
61{
62 OSL_ENSURE(nPos < nAlloc, "ScPageBreakData::GetData bumm");
63
64 if ( nPos >= nUsed )
65 {
66 OSL_ENSURE(nPos == nUsed, "ScPageBreakData::GetData wrong order");
67 nUsed = nPos+1;
68 }
69
70 return pData[nPos];
71}
72
74{
75 if ( nUsed != rOther.nUsed )
76 return false;
77
78 for (size_t i=0; i<nUsed; i++)
79 if ( pData[i].GetPrintRange() != rOther.pData[i].GetPrintRange() )
80 return false;
81
83
84 return true;
85}
86
88{
89 if ( nUsed > 1 )
90 {
91 tools::Long nPage = pData[0].GetFirstPage();
92 for (size_t i=0; i+1<nUsed; i++)
93 {
94 nPage += static_cast<tools::Long>(pData[i].GetPagesX())*pData[i].GetPagesY();
95 pData[i+1].SetFirstPage( nPage );
96 }
97 }
98}
99
100/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< ScPrintRangeData[]> pData
Definition: pagedata.hxx:67
ScPageBreakData(size_t nMax)
Definition: pagedata.cxx:48
void AddPages()
Definition: pagedata.cxx:87
bool operator==(const ScPageBreakData &rOther) const
Definition: pagedata.cxx:73
ScPrintRangeData & GetData(size_t i)
Definition: pagedata.cxx:60
tools::Long nFirstPage
Definition: pagedata.hxx:35
std::vector< SCCOL > mvPageEndX
Definition: pagedata.hxx:32
void SetPagesY(size_t nCount, const SCROW *pEnd)
Definition: pagedata.cxx:42
void SetPagesX(size_t nCount, const SCCOL *pEnd)
Definition: pagedata.cxx:36
std::vector< SCROW > mvPageEndY
Definition: pagedata.hxx:34
int nCount
sal_uInt16 nPos
std::unique_ptr< sal_Int32[]> pData
int i
long Long
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17