Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "prnsave.hxx"
30 : : #include "global.hxx"
31 : : #include "address.hxx"
32 : :
33 : : // STATIC DATA -----------------------------------------------------------
34 : :
35 : : //------------------------------------------------------------------
36 : :
37 : : //
38 : : // Daten pro Tabelle
39 : : //
40 : :
41 : 155 : ScPrintSaverTab::ScPrintSaverTab() :
42 : : mpRepeatCol(NULL),
43 : : mpRepeatRow(NULL),
44 : 155 : mbEntireSheet(false)
45 : : {
46 : 155 : }
47 : :
48 : 131 : ScPrintSaverTab::~ScPrintSaverTab()
49 : : {
50 : 131 : delete mpRepeatCol;
51 : 131 : delete mpRepeatRow;
52 : 131 : }
53 : :
54 : 155 : void ScPrintSaverTab::SetAreas( const ScRangeVec& rRanges, sal_Bool bEntireSheet )
55 : : {
56 : 155 : maPrintRanges = rRanges;
57 : 155 : mbEntireSheet = bEntireSheet;
58 : 155 : }
59 : :
60 : 155 : void ScPrintSaverTab::SetRepeat( const ScRange* pCol, const ScRange* pRow )
61 : : {
62 : 155 : delete mpRepeatCol;
63 [ + + ]: 155 : mpRepeatCol = pCol ? new ScRange(*pCol) : NULL;
64 : 155 : delete mpRepeatRow;
65 [ + + ]: 155 : mpRepeatRow = pRow ? new ScRange(*pRow) : NULL;
66 : 155 : }
67 : :
68 : 66 : inline sal_Bool PtrEqual( const ScRange* p1, const ScRange* p2 )
69 : : {
70 [ + - ][ - + ]: 66 : return ( !p1 && !p2 ) || ( p1 && p2 && *p1 == *p2 );
[ # # ][ # # ]
[ # # ]
71 : : }
72 : :
73 : 33 : sal_Bool ScPrintSaverTab::operator==( const ScPrintSaverTab& rCmp ) const
74 : : {
75 : : return
76 : 33 : PtrEqual( mpRepeatCol, rCmp.mpRepeatCol ) &&
77 : 33 : PtrEqual( mpRepeatRow, rCmp.mpRepeatRow ) &&
78 : : (mbEntireSheet == rCmp.mbEntireSheet) &&
79 [ + - ][ + - ]: 66 : (maPrintRanges == rCmp.maPrintRanges);
[ + - + - ]
80 : : }
81 : :
82 : : //
83 : : // Daten fuer das ganze Dokument
84 : : //
85 : :
86 : 92 : ScPrintRangeSaver::ScPrintRangeSaver( SCTAB nCount ) :
87 : 92 : nTabCount( nCount )
88 : : {
89 [ + - ]: 92 : if (nCount > 0)
90 [ + - ][ + + ]: 247 : pData = new ScPrintSaverTab[nCount];
[ # # # # ]
91 : : else
92 : 0 : pData = NULL;
93 : 92 : }
94 : :
95 : 84 : ScPrintRangeSaver::~ScPrintRangeSaver()
96 : : {
97 [ + - ][ + + ]: 215 : delete[] pData;
98 : 84 : }
99 : :
100 : 155 : ScPrintSaverTab& ScPrintRangeSaver::GetTabData(SCTAB nTab)
101 : : {
102 : : OSL_ENSURE(nTab<nTabCount,"ScPrintRangeSaver Tab zu gross");
103 : 155 : return pData[nTab];
104 : : }
105 : :
106 : 0 : const ScPrintSaverTab& ScPrintRangeSaver::GetTabData(SCTAB nTab) const
107 : : {
108 : : OSL_ENSURE(nTab<nTabCount,"ScPrintRangeSaver Tab zu gross");
109 : 0 : return pData[nTab];
110 : : }
111 : :
112 : 42 : sal_Bool ScPrintRangeSaver::operator==( const ScPrintRangeSaver& rCmp ) const
113 : : {
114 : 42 : sal_Bool bEqual = ( nTabCount == rCmp.nTabCount );
115 [ + + ]: 42 : if (bEqual)
116 [ + + ]: 56 : for (SCTAB i=0; i<nTabCount; i++)
117 [ - + ]: 33 : if (!(pData[i]==rCmp.pData[i]))
118 : : {
119 : 0 : bEqual = false;
120 : 0 : break;
121 : : }
122 : 42 : return bEqual;
123 : : }
124 : :
125 : :
126 : :
127 : :
128 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|