blob: 60aa0f5ecaf875532af8465e976b514caee159ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
/***************************************************************************
mpagecollection.cpp - Kugar report page collection
-------------------
begin : Fri Aug 20 1999
copyright : (C) 1999 by Mutiny Bay Software
email : info@mutinybaysoftware.com
***************************************************************************/
#include "mpagecollection.h"
#include "mreportengine.h"
#include <kdebug.h>
namespace Kugar
{
/** Constructor */
MPageCollection::MPageCollection( TQObject *parent ) : TQObject( parent )
{
// Set page list to AutoDelete
pages.setAutoDelete( true );
// Set the metrics
size = MReportEngine::Letter;
orientation = MReportEngine::Portrait;
dimensions.setWidth( 0 );
dimensions.setHeight( 0 );
m_ref = 1;
}
/** Copy constructor */
MPageCollection::MPageCollection( const MPageCollection& mPageCollection ) /*: TQObject((TQObject &) mPageCollection)*/
{
copy( &mPageCollection );
}
/** Assignment operator */
MPageCollection MPageCollection::operator=( const MPageCollection& mPageCollection )
{
if ( &mPageCollection == this )
return * this;
// Copy the derived class's data
copy( &mPageCollection );
// Copy the base class's data
//((TQObject &) *this) = mPageCollection;
return *this;
}
/** Destructor */
MPageCollection::~MPageCollection()
{
pages.clear();
kdDebug(31000) << k_funcinfo << endl;
}
/** Clears the page collection */
void MPageCollection::clear()
{
pages.clear();
}
/** Appends a new page to the page collection */
void MPageCollection::appendPage()
{
pages.append( new TQPicture() );
}
/** Gets the current page in the page collection,
* the current page may be null
*/
TQPicture* MPageCollection::getCurrentPage()
{
return pages.current();
}
/** Gets the first page in the page collection,
* returns NULL if the list is empty
*/
TQPicture* MPageCollection::getFirstPage()
{
return pages.first();
}
/** Gets the next page in the page collection,
* returns NULL if the end of the list has been reached
*/
TQPicture* MPageCollection::getNextPage()
{
return pages.next();
}
/** Get the previous page in the page collection,
* returns NULL if the beginning of the list has been reached
*/
TQPicture* MPageCollection::getPreviousPage()
{
return pages.prev();
}
/** Gets the last page in the page collection,
* returns NULL if the list is empty
*/
TQPicture* MPageCollection::getLastPage()
{
return pages.last();
}
/** Get the index of the current page */
int MPageCollection::getCurrentIndex()
{
return pages.at();
}
/** Set the current page to page at idx */
void MPageCollection::setCurrentPage( int idx )
{
pages.at( idx );
}
/** Sets the page size */
void MPageCollection::setPageSize( int s )
{
size = s;
}
/** Sets the page orientation */
void MPageCollection::setPageOrientation( int o )
{
orientation = o;
}
/** Sets the page dimensions */
void MPageCollection::setPageDimensions( TQSize dim )
{
dimensions = dim;
}
/** Returns the page size */
int MPageCollection::pageSize()
{
return size;
}
/** Returns the page orientation */
int MPageCollection::pageOrientation()
{
return orientation;
}
/** Returns the page dimensions */
TQSize MPageCollection::pageDimensions()
{
return dimensions;
}
/** Returns the number of pages in the page collection */
int MPageCollection::pageCount()
{
return pages.count();
}
/** Copies member data from one object to another.
Used by the copy constructor and assignment operator */
void MPageCollection::copy( const MPageCollection* mPageCollection )
{
// Copy the page collection
pages = mPageCollection->pages;
// Copy the page metrics
dimensions = mPageCollection->dimensions;
size = mPageCollection->size;
orientation = mPageCollection->orientation;
m_ref = 1;
}
void MPageCollection::addRef()
{
m_ref++;
}
void MPageCollection::removeRef()
{
m_ref--;
if ( !m_ref )
deleteLater();
}
}
|