1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include "pagedata.hxx"
24 //============================================================================
26 ScPrintRangeData::ScPrintRangeData()
28 nPagesX
= nPagesY
= 0;
31 bTopDown
= bAutomatic
= sal_True
;
35 ScPrintRangeData::~ScPrintRangeData()
41 void ScPrintRangeData::SetPagesX( size_t nCount
, const SCCOL
* pData
)
46 pPageEndX
= new SCCOL
[nCount
];
47 memcpy( pPageEndX
, pData
, nCount
* sizeof(SCCOL
) );
54 void ScPrintRangeData::SetPagesY( size_t nCount
, const SCROW
* pData
)
59 pPageEndY
= new SCROW
[nCount
];
60 memcpy( pPageEndY
, pData
, nCount
* sizeof(SCROW
) );
67 //============================================================================
69 ScPageBreakData::ScPageBreakData(size_t nMax
)
73 pData
= new ScPrintRangeData
[nMax
];
79 ScPageBreakData::~ScPageBreakData()
84 ScPrintRangeData
& ScPageBreakData::GetData(size_t nPos
)
86 OSL_ENSURE(nPos
< nAlloc
, "ScPageBreakData::GetData bumm");
90 OSL_ENSURE(nPos
== nUsed
, "ScPageBreakData::GetData falsche Reihenfolge");
97 sal_Bool
ScPageBreakData::IsEqual( const ScPageBreakData
& rOther
) const
99 if ( nUsed
!= rOther
.nUsed
)
102 for (sal_uInt16 i
=0; i
<nUsed
; i
++)
103 if ( pData
[i
].GetPrintRange() != rOther
.pData
[i
].GetPrintRange() )
106 //! ScPrintRangeData komplett vergleichen ??
111 void ScPageBreakData::AddPages()
115 long nPage
= pData
[0].GetFirstPage();
116 for (sal_uInt16 i
=0; sal::static_int_cast
<size_t>(i
+1)<nUsed
; i
++)
118 nPage
+= ((long)pData
[i
].GetPagesX())*pData
[i
].GetPagesY();
119 pData
[i
+1].SetFirstPage( nPage
);
126 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */