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 .
20 #include "prnsave.hxx"
22 #include "address.hxx"
24 #include <osl/diagnose.h>
30 ScPrintSaverTab::ScPrintSaverTab() :
37 ScPrintSaverTab::~ScPrintSaverTab()
43 void ScPrintSaverTab::SetAreas( const ScRangeVec
& rRanges
, bool bEntireSheet
)
45 maPrintRanges
= rRanges
;
46 mbEntireSheet
= bEntireSheet
;
49 void ScPrintSaverTab::SetRepeat( const ScRange
* pCol
, const ScRange
* pRow
)
52 mpRepeatCol
= pCol
? new ScRange(*pCol
) : NULL
;
54 mpRepeatRow
= pRow
? new ScRange(*pRow
) : NULL
;
57 inline bool PtrEqual( const ScRange
* p1
, const ScRange
* p2
)
59 return ( !p1
&& !p2
) || ( p1
&& p2
&& *p1
== *p2
);
62 bool ScPrintSaverTab::operator==( const ScPrintSaverTab
& rCmp
) const
65 PtrEqual( mpRepeatCol
, rCmp
.mpRepeatCol
) &&
66 PtrEqual( mpRepeatRow
, rCmp
.mpRepeatRow
) &&
67 (mbEntireSheet
== rCmp
.mbEntireSheet
) &&
68 (maPrintRanges
== rCmp
.maPrintRanges
);
71 // Daten fuer das ganze Dokument
73 ScPrintRangeSaver::ScPrintRangeSaver( SCTAB nCount
) :
77 pData
= new ScPrintSaverTab
[nCount
];
82 ScPrintRangeSaver::~ScPrintRangeSaver()
87 ScPrintSaverTab
& ScPrintRangeSaver::GetTabData(SCTAB nTab
)
89 OSL_ENSURE(nTab
<nTabCount
,"ScPrintRangeSaver Tab too big");
93 const ScPrintSaverTab
& ScPrintRangeSaver::GetTabData(SCTAB nTab
) const
95 OSL_ENSURE(nTab
<nTabCount
,"ScPrintRangeSaver Tab too big");
99 bool ScPrintRangeSaver::operator==( const ScPrintRangeSaver
& rCmp
) const
101 bool bEqual
= ( nTabCount
== rCmp
.nTabCount
);
103 for (SCTAB i
=0; i
<nTabCount
; i
++)
104 if (!(pData
[i
]==rCmp
.pData
[i
]))
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */