LibreOffice Module sc (master)
1
sc
source
ui
docshell
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
26
ScPrintRangeData::ScPrintRangeData
()
27
{
28
bTopDown
=
bAutomatic
=
true
;
29
nFirstPage
= 1;
30
}
31
32
ScPrintRangeData::~ScPrintRangeData
()
33
{
34
}
35
36
void
ScPrintRangeData::SetPagesX
(
size_t
nCount,
const
SCCOL
* pData )
37
{
38
mvPageEndX
.resize(
nCount
);
39
memcpy(
mvPageEndX
.data(),
pData
,
nCount
*
sizeof
(
SCCOL
) );
40
}
41
42
void
ScPrintRangeData::SetPagesY
(
size_t
nCount,
const
SCROW
* pData )
43
{
44
mvPageEndY
.resize(
nCount
);
45
memcpy(
mvPageEndY
.data(),
pData
,
nCount
*
sizeof
(
SCROW
) );
46
}
47
48
ScPageBreakData::ScPageBreakData
(
size_t
nMax)
49
{
50
nUsed
= 0;
51
if
(nMax)
52
pData
.reset(
new
ScPrintRangeData
[nMax] );
53
nAlloc
= nMax;
54
}
55
56
ScPageBreakData::~ScPageBreakData
()
57
{
58
}
59
60
ScPrintRangeData
&
ScPageBreakData::GetData
(
size_t
nPos)
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
73
bool
ScPageBreakData::operator==
(
const
ScPageBreakData
& rOther )
const
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
87
void
ScPageBreakData::AddPages
()
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: */
ScPageBreakData
Definition:
pagedata.hxx:63
ScPageBreakData::pData
std::unique_ptr< ScPrintRangeData[]> pData
Definition:
pagedata.hxx:67
ScPageBreakData::nAlloc
size_t nAlloc
Definition:
pagedata.hxx:65
ScPageBreakData::ScPageBreakData
ScPageBreakData(size_t nMax)
Definition:
pagedata.cxx:48
ScPageBreakData::AddPages
void AddPages()
Definition:
pagedata.cxx:87
ScPageBreakData::~ScPageBreakData
~ScPageBreakData()
Definition:
pagedata.cxx:56
ScPageBreakData::nUsed
size_t nUsed
Definition:
pagedata.hxx:66
ScPageBreakData::operator==
bool operator==(const ScPageBreakData &rOther) const
Definition:
pagedata.cxx:73
ScPageBreakData::GetData
ScPrintRangeData & GetData(size_t i)
Definition:
pagedata.cxx:60
ScPrintRangeData
Definition:
pagedata.hxx:28
ScPrintRangeData::nFirstPage
tools::Long nFirstPage
Definition:
pagedata.hxx:35
ScPrintRangeData::ScPrintRangeData
ScPrintRangeData()
Definition:
pagedata.cxx:26
ScPrintRangeData::mvPageEndX
std::vector< SCCOL > mvPageEndX
Definition:
pagedata.hxx:32
ScPrintRangeData::bAutomatic
bool bAutomatic
Definition:
pagedata.hxx:37
ScPrintRangeData::SetPagesY
void SetPagesY(size_t nCount, const SCROW *pEnd)
Definition:
pagedata.cxx:42
ScPrintRangeData::SetPagesX
void SetPagesX(size_t nCount, const SCCOL *pEnd)
Definition:
pagedata.cxx:36
ScPrintRangeData::mvPageEndY
std::vector< SCROW > mvPageEndY
Definition:
pagedata.hxx:34
ScPrintRangeData::bTopDown
bool bTopDown
Definition:
pagedata.hxx:36
ScPrintRangeData::~ScPrintRangeData
~ScPrintRangeData()
Definition:
pagedata.cxx:32
nCount
int nCount
nPos
sal_uInt16 nPos
pData
std::unique_ptr< sal_Int32[]> pData
i
int i
tools::Long
long Long
pagedata.hxx
SCCOL
sal_Int16 SCCOL
Definition:
types.hxx:21
SCROW
sal_Int32 SCROW
Definition:
types.hxx:17
Generated on Sun Jul 30 2023 04:29:17 for LibreOffice Module sc (master) by
1.9.3