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 #include <osl/diagnose.h>
26 ScPrintRangeData::ScPrintRangeData()
28 nPagesX
= nPagesY
= 0;
31 bTopDown
= bAutomatic
= 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 ScPageBreakData::ScPageBreakData(size_t nMax
)
71 pData
= new ScPrintRangeData
[nMax
];
77 ScPageBreakData::~ScPageBreakData()
82 ScPrintRangeData
& ScPageBreakData::GetData(size_t nPos
)
84 OSL_ENSURE(nPos
< nAlloc
, "ScPageBreakData::GetData bumm");
88 OSL_ENSURE(nPos
== nUsed
, "ScPageBreakData::GetData falsche Reihenfolge");
95 bool ScPageBreakData::operator==( const ScPageBreakData
& rOther
) const
97 if ( nUsed
!= rOther
.nUsed
)
100 for (sal_uInt16 i
=0; i
<nUsed
; i
++)
101 if ( pData
[i
].GetPrintRange() != rOther
.pData
[i
].GetPrintRange() )
104 //! ScPrintRangeData komplett vergleichen ??
109 void ScPageBreakData::AddPages()
113 long nPage
= pData
[0].GetFirstPage();
114 for (sal_uInt16 i
=0; sal::static_int_cast
<size_t>(i
+1)<nUsed
; i
++)
116 nPage
+= ((long)pData
[i
].GetPagesX())*pData
[i
].GetPagesY();
117 pData
[i
+1].SetFirstPage( nPage
);
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */