~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/kspread/qpro/libqpro/src/record.cc

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
void
34
34
Charout(ostream& pOut, unsigned char pChar)
35
35
{
36
 
   pOut << ( (pChar<32) || (pChar>126) ? '.' : (char)pChar);
 
36
    pOut << ((pChar < 32) || (pChar > 126) ? '.' : (char)pChar);
37
37
}
38
38
 
39
39
void
40
40
Hexout(ostream& pOut, unsigned char pChar)
41
41
{
42
 
   pOut << setiosflags(ios::uppercase)
43
 
        << setfill('0')
44
 
        << setw(2)
45
 
        << hex
46
 
        << (int)pChar
47
 
        << dec;
 
42
    pOut << setiosflags(ios::uppercase)
 
43
    << setfill('0')
 
44
    << setw(2)
 
45
    << hex
 
46
    << (int)pChar
 
47
    << dec;
48
48
}
49
49
 
50
50
int
51
51
Hexout(char* pChar, int pLen)
52
52
{
53
 
   std::ostrstream*   lOStr = new std::ostrstream;
54
 
 
55
 
   while( pLen )
56
 
   {
57
 
      int lIdx = 0;
58
 
 
59
 
      for( lIdx=0; lIdx < 16; ++lIdx )
60
 
      {
61
 
         if( pLen )
62
 
         {
63
 
            Hexout(cerr, *pChar);
64
 
            cerr << (lIdx==8 ? "-" : " ");
65
 
            Charout(*lOStr, (unsigned char)*pChar);
66
 
            ++pChar;
67
 
            --pLen;
68
 
         }
69
 
         else
70
 
         {
71
 
            cerr << "   ";
72
 
         }
73
 
      }
74
 
 
75
 
      cerr << lOStr->rdbuf() << endl;
76
 
 
77
 
      delete lOStr;
78
 
      lOStr = new std::ostrstream;
79
 
   }
80
 
 
81
 
   delete lOStr;
82
 
   lOStr = 0;
83
 
 
84
 
   return 0;
 
53
    std::ostrstream*   lOStr = new std::ostrstream;
 
54
 
 
55
    while (pLen) {
 
56
        int lIdx = 0;
 
57
 
 
58
        for (lIdx = 0; lIdx < 16; ++lIdx) {
 
59
            if (pLen) {
 
60
                Hexout(cerr, *pChar);
 
61
                cerr << (lIdx == 8 ? "-" : " ");
 
62
                Charout(*lOStr, (unsigned char)*pChar);
 
63
                ++pChar;
 
64
                --pLen;
 
65
            } else {
 
66
                cerr << "   ";
 
67
            }
 
68
        }
 
69
 
 
70
        cerr << lOStr->rdbuf() << endl;
 
71
 
 
72
        delete lOStr;
 
73
        lOStr = new std::ostrstream;
 
74
    }
 
75
 
 
76
    delete lOStr;
 
77
    lOStr = 0;
 
78
 
 
79
    return 0;
85
80
}
86
81
 
87
82
// -----------------------------------------------------------------------
88
83
 
89
84
QpRec::QpRec(QpRecType pType)
90
 
   : cType( pType )
 
85
        : cType(pType)
91
86
{
92
87
}
93
88
 
98
93
QP_INT16
99
94
QpRec::type()
100
95
{
101
 
   return cType;
 
96
    return cType;
102
97
}
103
98
 
104
99
// -----------------------------------------------------------------------
133
128
// -----------------------------------------------------------------------
134
129
 
135
130
QpRecCell::QpRecCell(QpRecType pType)
136
 
   : QpRec(pType)
137
 
   , cAttributes(0)
138
 
   , cColumn(0)
139
 
   , cPage(0)
140
 
   , cRow(0)
141
 
   , cCellRef(0)
 
131
        : QpRec(pType)
 
132
        , cAttributes(0)
 
133
        , cColumn(0)
 
134
        , cPage(0)
 
135
        , cRow(0)
 
136
        , cCellRef(0)
142
137
{
143
138
}
144
139
 
145
140
QpRecCell::~QpRecCell()
146
141
{
147
 
   delete [] cCellRef;
148
 
   cCellRef = 0;
 
142
    delete [] cCellRef;
 
143
    cCellRef = 0;
149
144
}
150
145
 
151
146
 
152
147
void
153
148
QpRecCell::attributes(QP_INT16 pAttributes)
154
149
{
155
 
   cAttributes = pAttributes;
 
150
    cAttributes = pAttributes;
156
151
}
157
152
 
158
153
QP_INT16
159
154
QpRecCell::attributes()
160
155
{
161
 
   return cAttributes;
 
156
    return cAttributes;
162
157
}
163
158
 
164
159
void
165
160
QpRecCell::column(QP_UINT8 pColumn)
166
161
{
167
 
   cColumn = pColumn;
 
162
    cColumn = pColumn;
168
163
}
169
164
 
170
165
QP_UINT8
171
166
QpRecCell::column()
172
167
{
173
 
   return cColumn;
 
168
    return cColumn;
174
169
}
175
170
 
176
171
void
177
172
QpRecCell::row(QP_INT16 pRow)
178
173
{
179
 
   cRow = pRow;
 
174
    cRow = pRow;
180
175
}
181
176
 
182
177
QP_INT16
183
178
QpRecCell::row()
184
179
{
185
 
   return cRow;
 
180
    return cRow;
186
181
}
187
182
 
188
183
int
189
184
QpRecCell::loadCellInfo(QpIStream& pIn)
190
185
{
191
 
   pIn >> cColumn >> cPage >> cRow >> cAttributes;
 
186
    pIn >> cColumn >> cPage >> cRow >> cAttributes;
192
187
 
193
 
   QP_DEBUG(" col " << (unsigned)cColumn << ", Page " << (unsigned)cPage
194
 
            << ", Row " << cRow << ", Ref "
195
 
            << /*???cellRef()
 
188
    QP_DEBUG(" col " << (unsigned)cColumn << ", Page " << (unsigned)cPage
 
189
             << ", Row " << cRow << ", Ref "
 
190
             << /*???cellRef()
196
191
            <<*/ ", Attr " << cAttributes
197
 
           );
 
192
            );
198
193
 
199
 
   return 6;  // number of bytes consumed
 
194
    return 6;  // number of bytes consumed
200
195
}
201
196
 
202
197
//const char*
218
213
{
219
214
//??? cope with relative/absolute references
220
215
 
221
 
   std::strstream lOut(pText, 20, ios::out); // ??? ard coded len
222
 
   int       lPageRelative = pRow & 0x8000;
223
 
   int       lColRelative  = pRow & 0x4000;
224
 
   int       lRowRelative  = pRow & 0x2000;
225
 
   QP_UINT8  lCol          = (lColRelative ? cColumn + pColumn : pColumn);
226
 
 
227
 
   // Sign bit for row is in bit 0x1000, so either set all top bits or lose all top bits
228
 
   QP_INT16  lRow = (lRowRelative ? cRow + (pRow & 0x1000 ? pRow | 0xE000 : pRow & 0x1FFF)
229
 
                                  : pRow & 0x1FFF
230
 
                    );
231
 
 
232
 
   // Are we referencing a different page ?
233
 
 
234
 
   if( lPageRelative && (pPage == 0) )
235
 
   {
236
 
      // no - page is zero relative to this one
237
 
   }
238
 
   else
239
 
   if( pPage != cPage )
240
 
   {
241
 
      // yes - not relative & page is a different one
242
 
 
243
 
      QP_UINT8 lPage = ( lPageRelative ? pPage + cPage : pPage );
244
 
 
245
 
      QP_DEBUG("pTable.name((unsigned)lPage) = " <<  pTable.name((unsigned)lPage) << endl);
246
 
 
247
 
      lOut << pTable.name((unsigned)lPage) << '!'; // is '!' compat with QPRO???
248
 
   }
249
 
 
250
 
   if( !lColRelative )
251
 
   {
252
 
      lOut << '$';
253
 
   }
254
 
   if( lCol < 26 )
255
 
   {
256
 
      lOut << (char)('A' + lCol);
257
 
   }
258
 
   else
259
 
   {
260
 
      lOut << (char)('A' -1 + lCol / 26)
261
 
           << (char)('A' + lCol % 26);
262
 
   }
263
 
 
264
 
   if( !lRowRelative )
265
 
   {
266
 
      lOut << '$';
267
 
   }
268
 
 
269
 
   lOut << (lRow & 0x1FFF) +1 << ends;
 
216
    std::strstream lOut(pText, 20, ios::out); // ??? ard coded len
 
217
    int       lPageRelative = pRow & 0x8000;
 
218
    int       lColRelative  = pRow & 0x4000;
 
219
    int       lRowRelative  = pRow & 0x2000;
 
220
    QP_UINT8  lCol          = (lColRelative ? cColumn + pColumn : pColumn);
 
221
 
 
222
    // Sign bit for row is in bit 0x1000, so either set all top bits or lose all top bits
 
223
    QP_INT16  lRow = (lRowRelative ? cRow + (pRow & 0x1000 ? pRow | 0xE000 : pRow & 0x1FFF)
 
224
                              : pRow & 0x1FFF
 
225
                             );
 
226
 
 
227
    // Are we referencing a different page ?
 
228
 
 
229
    if (lPageRelative && (pPage == 0)) {
 
230
        // no - page is zero relative to this one
 
231
    } else
 
232
        if (pPage != cPage) {
 
233
            // yes - not relative & page is a different one
 
234
 
 
235
            QP_UINT8 lPage = (lPageRelative ? pPage + cPage : pPage);
 
236
 
 
237
            QP_DEBUG("pTable.name((unsigned)lPage) = " <<  pTable.name((unsigned)lPage) << endl);
 
238
 
 
239
            lOut << pTable.name((unsigned)lPage) << '!'; // is '!' compat with QPRO???
 
240
        }
 
241
 
 
242
    if (!lColRelative) {
 
243
        lOut << '$';
 
244
    }
 
245
    if (lCol < 26) {
 
246
        lOut << (char)('A' + lCol);
 
247
    } else {
 
248
        lOut << (char)('A' -1 + lCol / 26)
 
249
        << (char)('A' + lCol % 26);
 
250
    }
 
251
 
 
252
    if (!lRowRelative) {
 
253
        lOut << '$';
 
254
    }
 
255
 
 
256
    lOut << (lRow & 0x1FFF) + 1 << ends;
270
257
}
271
258
 
272
259
void
273
260
QpRecCell::cellRef(char* pText, QpTableNames& pTable, QpIStream& pFormulaRef)
274
261
{
275
 
   QP_INT16 lNoteBook;
276
 
   pFormulaRef >> lNoteBook;
277
 
 
278
 
   // block references (eg. A1..A9) have bit 0x1000 set
279
 
 
280
 
   if( lNoteBook & 0x1000 )
281
 
   {
282
 
      QP_UINT8 lFirstColumn;
283
 
      QP_UINT8 lFirstPage;
284
 
      QP_INT16 lFirstRow;
285
 
      QP_UINT8 lLastColumn;
286
 
      QP_UINT8 lLastPage;
287
 
      QP_INT16 lLastRow;
288
 
 
289
 
      pFormulaRef >> lFirstColumn
290
 
                  >> lFirstPage
291
 
                  >> lFirstRow
292
 
                  >> lLastColumn
293
 
                  >> lLastPage
294
 
                  >> lLastRow;
295
 
 
296
 
      QP_DEBUG("BlockRef: NoteBook " << lNoteBook
297
 
               << ", 1st col " << lFirstColumn
298
 
               << ", 1st page " << (unsigned)lFirstPage
299
 
               << ", 1st row " << lFirstRow
300
 
               << ", last col " << lLastColumn
301
 
               << ", last page " << (unsigned)lLastPage
302
 
               << ", last row " << lLastRow
303
 
               << endl
304
 
              );
 
262
    QP_INT16 lNoteBook;
 
263
    pFormulaRef >> lNoteBook;
 
264
 
 
265
    // block references (eg. A1..A9) have bit 0x1000 set
 
266
 
 
267
    if (lNoteBook & 0x1000) {
 
268
        QP_UINT8 lFirstColumn;
 
269
        QP_UINT8 lFirstPage;
 
270
        QP_INT16 lFirstRow;
 
271
        QP_UINT8 lLastColumn;
 
272
        QP_UINT8 lLastPage;
 
273
        QP_INT16 lLastRow;
 
274
 
 
275
        pFormulaRef >> lFirstColumn
 
276
        >> lFirstPage
 
277
        >> lFirstRow
 
278
        >> lLastColumn
 
279
        >> lLastPage
 
280
        >> lLastRow;
 
281
 
 
282
        QP_DEBUG("BlockRef: NoteBook " << lNoteBook
 
283
                 << ", 1st col " << lFirstColumn
 
284
                 << ", 1st page " << (unsigned)lFirstPage
 
285
                 << ", 1st row " << lFirstRow
 
286
                 << ", last col " << lLastColumn
 
287
                 << ", last page " << (unsigned)lLastPage
 
288
                 << ", last row " << lLastRow
 
289
                 << endl
 
290
                );
305
291
// ??? next few lines shouldn't just add rows together
306
 
      cellRef( pText, pTable, lNoteBook, lFirstPage, lFirstColumn, lFirstRow );
 
292
        cellRef(pText, pTable, lNoteBook, lFirstPage, lFirstColumn, lFirstRow);
307
293
// ?? temp next line      strcat( pText, ".." );
308
 
      strcat( pText, ":" );
309
 
      cellRef( &pText[strlen(pText)], pTable, lNoteBook, lLastPage, lLastColumn, lLastRow );
310
 
   }
311
 
   else
312
 
   {
313
 
      QP_UINT8 lColumn;
314
 
      QP_UINT8 lPage;
315
 
      QP_INT16 lRow;
316
 
 
317
 
      pFormulaRef >> lColumn >> lPage >> lRow;
318
 
 
319
 
      QP_DEBUG("FormulaRef: NoteBook " << lNoteBook << ", Col " << (unsigned)lColumn
320
 
               << ", Page " << (unsigned)lPage << ", Row " << lRow << endl
321
 
              );
 
294
        strcat(pText, ":");
 
295
        cellRef(&pText[strlen(pText)], pTable, lNoteBook, lLastPage, lLastColumn, lLastRow);
 
296
    } else {
 
297
        QP_UINT8 lColumn;
 
298
        QP_UINT8 lPage;
 
299
        QP_INT16 lRow;
 
300
 
 
301
        pFormulaRef >> lColumn >> lPage >> lRow;
 
302
 
 
303
        QP_DEBUG("FormulaRef: NoteBook " << lNoteBook << ", Col " << (unsigned)lColumn
 
304
                 << ", Page " << (unsigned)lPage << ", Row " << lRow << endl
 
305
                );
322
306
 
323
307
// ??? sort out what to do about lNotebook
324
308
// ??? next few lines shouldn't just add rows together
325
 
      cellRef( pText, pTable, lNoteBook, lPage, lColumn, lRow );
326
 
   }
 
309
        cellRef(pText, pTable, lNoteBook, lPage, lColumn, lRow);
 
310
    }
327
311
}
328
312
 
329
313
// -----------------------------------------------------------------------
330
314
 
331
315
QpRecBof::QpRecBof(QP_INT16, QpIStream& pIn)
332
 
   : QpRec( QpBof )
 
316
        : QpRec(QpBof)
333
317
{
334
 
   pIn >> cFileFormat;
 
318
    pIn >> cFileFormat;
335
319
 
336
 
   QP_DEBUG("BOF fileformat=" << cFileFormat << endl);
 
320
    QP_DEBUG("BOF fileformat=" << cFileFormat << endl);
337
321
}
338
322
 
339
323
QpRecBof::~QpRecBof()
343
327
// -----------------------------------------------------------------------
344
328
 
345
329
QpRecEof::QpRecEof(QP_INT16, QpIStream&)
346
 
   : QpRec( QpEof )
 
330
        : QpRec(QpEof)
347
331
{
348
 
   QP_DEBUG("EOF" << endl);
 
332
    QP_DEBUG("EOF" << endl);
349
333
}
350
334
 
351
335
QpRecEof::~QpRecEof()
356
340
// -----------------------------------------------------------------------
357
341
 
358
342
QpRecRecalcMode::QpRecRecalcMode(QP_INT16, QpIStream& pIn)
359
 
   : QpRec( QpRecalcMode )
 
343
        : QpRec(QpRecalcMode)
360
344
{
361
 
   QP_INT8 lMode;
362
 
 
363
 
   pIn >> lMode;
364
 
 
365
 
   cMode = (MODE)(unsigned char) lMode;
366
 
 
367
 
   QP_DEBUG("Recalc Mode = "
368
 
            << (int)lMode << ( cMode == Manual ? " (Manual)"
369
 
                             : cMode == Background ? " (Background)"
370
 
                             : cMode == Automatic  ? " (Automatic)"
371
 
                             : " (Unknown)"
372
 
                             )
373
 
            << endl
374
 
           );
 
345
    QP_INT8 lMode;
 
346
 
 
347
    pIn >> lMode;
 
348
 
 
349
    cMode = (MODE)(unsigned char) lMode;
 
350
 
 
351
    QP_DEBUG("Recalc Mode = "
 
352
             << (int)lMode << (cMode == Manual ? " (Manual)"
 
353
                               : cMode == Background ? " (Background)"
 
354
                               : cMode == Automatic  ? " (Automatic)"
 
355
                               : " (Unknown)"
 
356
                              )
 
357
             << endl
 
358
            );
375
359
}
376
360
 
377
361
QpRecRecalcMode::~QpRecRecalcMode()
382
366
void
383
367
QpRecRecalcMode::mode(MODE pMode)
384
368
{
385
 
   cMode = pMode;
 
369
    cMode = pMode;
386
370
}
387
371
 
388
372
QpRecRecalcMode::MODE
389
373
QpRecRecalcMode::mode()
390
374
{
391
 
   return cMode;
 
375
    return cMode;
392
376
}
393
377
 
394
378
 
395
379
// -----------------------------------------------------------------------
396
380
 
397
381
QpRecRecalcOrder::QpRecRecalcOrder(QP_INT16, QpIStream& pIn)
398
 
   : QpRec( QpRecalcOrder )
 
382
        : QpRec(QpRecalcOrder)
399
383
{
400
 
   QP_INT8 lOrder;
401
 
 
402
 
   pIn >> lOrder;
403
 
 
404
 
   cOrder = (ORDER)(unsigned char) lOrder;
405
 
 
406
 
   QP_DEBUG("Recalc Order = "
407
 
            << (int)lOrder << ( cOrder == Natural ? " (Natural)"
408
 
                              : cOrder == Column ? " (Column)"
409
 
                              : cOrder == Row  ? " (Row)"
410
 
                              : " (Unknown)"
411
 
                              )
412
 
            << endl
413
 
           );
 
384
    QP_INT8 lOrder;
 
385
 
 
386
    pIn >> lOrder;
 
387
 
 
388
    cOrder = (ORDER)(unsigned char) lOrder;
 
389
 
 
390
    QP_DEBUG("Recalc Order = "
 
391
             << (int)lOrder << (cOrder == Natural ? " (Natural)"
 
392
                                : cOrder == Column ? " (Column)"
 
393
                                : cOrder == Row  ? " (Row)"
 
394
                                : " (Unknown)"
 
395
                               )
 
396
             << endl
 
397
            );
414
398
}
415
399
 
416
400
QpRecRecalcOrder::~QpRecRecalcOrder()
421
405
void
422
406
QpRecRecalcOrder::order(ORDER pOrder)
423
407
{
424
 
   cOrder = pOrder;
 
408
    cOrder = pOrder;
425
409
}
426
410
 
427
411
QpRecRecalcOrder::ORDER
428
412
QpRecRecalcOrder::order()
429
413
{
430
 
   return cOrder;
 
414
    return cOrder;
431
415
}
432
416
 
433
417
 
434
418
// -----------------------------------------------------------------------
435
419
 
436
420
QpRecEmptyCell::QpRecEmptyCell(QP_INT16, QpIStream& pIn)
437
 
   : QpRecCell( QpEmptyCell )
 
421
        : QpRecCell(QpEmptyCell)
438
422
{
439
 
   QP_DEBUG("Empty Cell - ");
440
 
 
441
 
   loadCellInfo(pIn);
442
 
 
443
 
   QP_DEBUG(endl);
 
423
    QP_DEBUG("Empty Cell - ");
 
424
 
 
425
    loadCellInfo(pIn);
 
426
 
 
427
    QP_DEBUG(endl);
444
428
}
445
429
 
446
430
QpRecEmptyCell::~QpRecEmptyCell()
451
435
// -----------------------------------------------------------------------
452
436
 
453
437
QpRecIntegerCell::QpRecIntegerCell(QP_INT16, QpIStream& pIn)
454
 
   : QpRecCell( QpIntegerCell )
 
438
        : QpRecCell(QpIntegerCell)
455
439
{
456
 
   QP_DEBUG("Integer Cell - ");
457
 
 
458
 
   loadCellInfo(pIn);
459
 
 
460
 
   pIn >> cInt;
461
 
 
462
 
   QP_DEBUG(", Int " << cInt << endl);
 
440
    QP_DEBUG("Integer Cell - ");
 
441
 
 
442
    loadCellInfo(pIn);
 
443
 
 
444
    pIn >> cInt;
 
445
 
 
446
    QP_DEBUG(", Int " << cInt << endl);
463
447
}
464
448
 
465
449
QpRecIntegerCell::~QpRecIntegerCell()
469
453
QP_INT16
470
454
QpRecIntegerCell::integer()
471
455
{
472
 
   return cInt;
 
456
    return cInt;
473
457
}
474
458
 
475
459
// -----------------------------------------------------------------------
476
460
 
477
461
QpRecFloatingPointCell::QpRecFloatingPointCell(QP_INT16, QpIStream& pIn)
478
 
   : QpRecCell( QpFloatingPointCell )
 
462
        : QpRecCell(QpFloatingPointCell)
479
463
{
480
 
   QP_DEBUG("Float Cell - ");
481
 
 
482
 
   loadCellInfo(pIn);
483
 
 
484
 
   pIn >> cValue;
485
 
 
486
 
   QP_DEBUG(", Value " << cValue << endl);
 
464
    QP_DEBUG("Float Cell - ");
 
465
 
 
466
    loadCellInfo(pIn);
 
467
 
 
468
    pIn >> cValue;
 
469
 
 
470
    QP_DEBUG(", Value " << cValue << endl);
487
471
}
488
472
 
489
473
QpRecFloatingPointCell::~QpRecFloatingPointCell()
493
477
QP_INT64
494
478
QpRecFloatingPointCell::value()
495
479
{
496
 
   return cValue;
 
480
    return cValue;
497
481
}
498
482
 
499
483
// -----------------------------------------------------------------------
500
484
 
501
485
QpRecLabelCell::QpRecLabelCell(QP_INT16 pLen, QpIStream& pIn)
502
 
   : QpRecCell( QpLabelCell )
 
486
        : QpRecCell(QpLabelCell)
503
487
{
504
 
   QP_DEBUG("Label Cell - ");
505
 
   int lLabelLen = pLen - loadCellInfo(pIn) - 1;
506
 
 
507
 
   pIn >> cLabelPrefix;
508
 
 
509
 
   cLabel = new char[lLabelLen];
510
 
 
511
 
   pIn.read( cLabel, lLabelLen );
512
 
 
513
 
   QP_DEBUG(", Prefix " << cLabelPrefix << ", Label " << cLabel << endl);
 
488
    QP_DEBUG("Label Cell - ");
 
489
    int lLabelLen = pLen - loadCellInfo(pIn) - 1;
 
490
 
 
491
    pIn >> cLabelPrefix;
 
492
 
 
493
    cLabel = new char[lLabelLen];
 
494
 
 
495
    pIn.read(cLabel, lLabelLen);
 
496
 
 
497
    QP_DEBUG(", Prefix " << cLabelPrefix << ", Label " << cLabel << endl);
514
498
}
515
499
 
516
500
QpRecLabelCell::~QpRecLabelCell()
517
501
{
518
 
   delete [] cLabel;
519
 
   cLabel =  0;
 
502
    delete [] cLabel;
 
503
    cLabel =  0;
520
504
}
521
505
 
522
506
char
523
507
QpRecLabelCell::labelPrefix()
524
508
{
525
 
   return cLabelPrefix;
 
509
    return cLabelPrefix;
526
510
}
527
511
 
528
512
const char*
529
513
QpRecLabelCell::label()
530
514
{
531
 
   return cLabel;
 
515
    return cLabel;
532
516
}
533
517
 
534
518
// -----------------------------------------------------------------------
535
519
 
536
520
QpRecFormulaCell::QpRecFormulaCell(QP_INT16 pLen, QpIStream& pIn)
537
 
   : QpRecCell( QpFormulaCell )
538
 
   , cFormula(0)
 
521
        : QpRecCell(QpFormulaCell)
 
522
        , cFormula(0)
539
523
{
540
 
   QP_DEBUG("Formula Cell - ");
541
 
 
542
 
   int lFormulaLen = pLen - loadCellInfo(pIn);
543
 
 
544
 
   pIn >> cLastValue;
545
 
   lFormulaLen -= 8;
546
 
 
547
 
   pIn >> cState;
548
 
   lFormulaLen -= 2;
549
 
 
550
 
   pIn >> cLen;
551
 
   lFormulaLen -= 2;
552
 
 
553
 
   pIn >> cCellRef;
554
 
   lFormulaLen -= 2;
555
 
 
556
 
   cFormula = new char[lFormulaLen];
557
 
 
558
 
   pIn.read( cFormula, lFormulaLen );
559
 
 
560
 
   QP_DEBUG(", LastValue " << cLastValue << ", State " << cState << endl);
561
 
   QP_DEBUG("   FormulaLen " << cLen << ", CellRef " << cCellRef << ", Formula" << endl);
 
524
    QP_DEBUG("Formula Cell - ");
 
525
 
 
526
    int lFormulaLen = pLen - loadCellInfo(pIn);
 
527
 
 
528
    pIn >> cLastValue;
 
529
    lFormulaLen -= 8;
 
530
 
 
531
    pIn >> cState;
 
532
    lFormulaLen -= 2;
 
533
 
 
534
    pIn >> cLen;
 
535
    lFormulaLen -= 2;
 
536
 
 
537
    pIn >> cCellRef;
 
538
    lFormulaLen -= 2;
 
539
 
 
540
    cFormula = new char[lFormulaLen];
 
541
 
 
542
    pIn.read(cFormula, lFormulaLen);
 
543
 
 
544
    QP_DEBUG(", LastValue " << cLastValue << ", State " << cState << endl);
 
545
    QP_DEBUG("   FormulaLen " << cLen << ", CellRef " << cCellRef << ", Formula" << endl);
562
546
#ifdef QP_TRACE
563
 
   Hexout( cFormula, lFormulaLen );
 
547
    Hexout(cFormula, lFormulaLen);
564
548
#endif
565
 
   QP_DEBUG(endl);
 
549
    QP_DEBUG(endl);
566
550
}
567
551
 
568
552
QpRecFormulaCell::~QpRecFormulaCell()
569
553
{
570
 
   delete [] cFormula;
571
 
   cFormula = 0;
 
554
    delete [] cFormula;
 
555
    cFormula = 0;
572
556
}
573
557
 
574
558
const char*
575
559
QpRecFormulaCell::formula()
576
560
{
577
 
   return cFormula;
 
561
    return cFormula;
578
562
}
579
563
 
580
564
QP_INT16
581
565
QpRecFormulaCell::formulaLen()
582
566
{
583
 
   return cLen;
 
567
    return cLen;
584
568
}
585
569
 
586
570
QP_INT16
587
571
QpRecFormulaCell::formulaReferences()
588
572
{
589
 
   return cCellRef;
 
573
    return cCellRef;
590
574
}
591
575
 
592
576
// -----------------------------------------------------------------------
593
577
 
594
578
QpRecUnknown::QpRecUnknown(QP_INT16 /*pType*/, QP_INT16 pLen, QpIStream& pIn)
595
 
   : QpRec( QpUnknown )
 
579
        : QpRec(QpUnknown)
596
580
{
597
 
   QP_DEBUG("Unknown Type " << pType << ", len " << pLen << endl);
598
 
 
599
 
   if( pLen > 0 )
600
 
   {
601
 
      char* lBuf = new char[pLen];
602
 
 
603
 
      pIn.read(lBuf, pLen);
604
 
 
605
 
      delete [] lBuf;
606
 
      lBuf = 0;
607
 
   }
 
581
    QP_DEBUG("Unknown Type " << pType << ", len " << pLen << endl);
 
582
 
 
583
    if (pLen > 0) {
 
584
        char* lBuf = new char[pLen];
 
585
 
 
586
        pIn.read(lBuf, pLen);
 
587
 
 
588
        delete [] lBuf;
 
589
        lBuf = 0;
 
590
    }
608
591
}
609
592
 
610
593
QpRecUnknown::~QpRecUnknown()
614
597
// -----------------------------------------------------------------------
615
598
 
616
599
QpRecBop::QpRecBop(QP_INT16, QpIStream& pIn)
617
 
   : QpRec( QpBop )
 
600
        : QpRec(QpBop)
618
601
{
619
 
   pIn >> cPageIndex;
620
 
   QP_DEBUG("BOP: " << (unsigned)cPageIndex << endl);
 
602
    pIn >> cPageIndex;
 
603
    QP_DEBUG("BOP: " << (unsigned)cPageIndex << endl);
621
604
}
622
605
 
623
606
QpRecBop::~QpRecBop()
628
611
QP_UINT8
629
612
QpRecBop::pageIndex()
630
613
{
631
 
   return cPageIndex;
 
614
    return cPageIndex;
632
615
}
633
616
 
634
617
 
635
618
// -----------------------------------------------------------------------
636
619
 
637
620
QpRecPageName::QpRecPageName(QP_INT16, QpIStream& pIn)
638
 
   : QpRec( QpPageName )
 
621
        : QpRec(QpPageName)
639
622
{
640
 
   pIn >> cPageName;
 
623
    pIn >> cPageName;
641
624
 
642
 
   QP_DEBUG("Page Name: " << cPageName << endl);
 
625
    QP_DEBUG("Page Name: " << cPageName << endl);
643
626
}
644
627
 
645
628
QpRecPageName::~QpRecPageName()
646
629
{
647
 
   delete [] cPageName;
 
630
    delete [] cPageName;
648
631
}
649
632
 
650
633
const char*
651
634
QpRecPageName::pageName()
652
635
{
653
 
   return cPageName;
 
636
    return cPageName;
654
637
}
655
638
// -----------------------------------------------------------------------
656
639
 
657
640
QpRecPassword::QpRecPassword(QP_INT16 pLen, QpIStream& pIn)
658
 
   : QpRec( QpPassword )
 
641
        : QpRec(QpPassword)
659
642
{
660
 
   QP_DEBUG("Password len = " << pLen << endl);
661
 
 
662
 
   cPassword = new QP_UINT8[pLen];
663
 
 
664
 
   pIn.read( (char*)cPassword, pLen );
665
 
 
666
 
   QP_DEBUG("Password(Hex) = ");
 
643
    QP_DEBUG("Password len = " << pLen << endl);
 
644
 
 
645
    cPassword = new QP_UINT8[pLen];
 
646
 
 
647
    pIn.read((char*)cPassword, pLen);
 
648
 
 
649
    QP_DEBUG("Password(Hex) = ");
667
650
#ifdef QP_TRACE
668
 
   Hexout( (char*)cPassword, pLen );
 
651
    Hexout((char*)cPassword, pLen);
669
652
#endif
670
 
   QP_DEBUG(endl);
 
653
    QP_DEBUG(endl);
671
654
}
672
655
 
673
656
QpRecPassword::~QpRecPassword()
674
657
{
675
 
   delete [] cPassword;
676
 
   cPassword = 0;
 
658
    delete [] cPassword;
 
659
    cPassword = 0;
677
660
}
678
661
 
679
662
const QP_UINT8*
680
663
QpRecPassword::password()
681
664
{
682
 
   return cPassword;
 
665
    return cPassword;
683
666
}
684
667