diff --git a/uppdev/AccessKey/AccessKey.upp b/uppdev/AccessKey/AccessKey.upp index 1adaae36b..c79da13f7 100644 --- a/uppdev/AccessKey/AccessKey.upp +++ b/uppdev/AccessKey/AccessKey.upp @@ -9,3 +9,4 @@ file mainconfig "" = "GUI ST"; + diff --git a/uppdev/AccessKey/init b/uppdev/AccessKey/init new file mode 100644 index 000000000..e24b891b9 --- /dev/null +++ b/uppdev/AccessKey/init @@ -0,0 +1,4 @@ +#ifndef _AccessKey_icpp_init_stub +#define _AccessKey_icpp_init_stub +#include "CtrlLib/init" +#endif diff --git a/uppdev/ArrayCtrl/ArrayCtrl.upp b/uppdev/ArrayCtrl/ArrayCtrl.upp index 2af767c87..fd10d1890 100644 --- a/uppdev/ArrayCtrl/ArrayCtrl.upp +++ b/uppdev/ArrayCtrl/ArrayCtrl.upp @@ -1,16 +1,16 @@ -description "\377B"; - -uses - CtrlLib, - Crypto; - -file - app.tpp, - ArrayCtrl.h include_path, - main.cpp optimize_speed, - src.tpp, - srcimp.tpp; - -mainconfig - "" = "GUI"; - +description "\377B"; + +uses + CtrlLib, + Crypto; + +file + app.tpp, + ArrayCtrl.h, + main.cpp optimize_speed, + src.tpp, + srcimp.tpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/Blending/Blending.upp b/uppdev/Blending1/Blending.upp similarity index 100% rename from uppdev/Blending/Blending.upp rename to uppdev/Blending1/Blending.upp diff --git a/uppdev/Blending/main.cpp b/uppdev/Blending1/main.cpp similarity index 100% rename from uppdev/Blending/main.cpp rename to uppdev/Blending1/main.cpp diff --git a/uppdev/Blending/tst.tpp/all.i b/uppdev/Blending1/tst.tpp/all.i similarity index 100% rename from uppdev/Blending/tst.tpp/all.i rename to uppdev/Blending1/tst.tpp/all.i diff --git a/uppdev/Blending/tst.tpp/xxx$en-us.tpp b/uppdev/Blending1/tst.tpp/xxx$en-us.tpp similarity index 100% rename from uppdev/Blending/tst.tpp/xxx$en-us.tpp rename to uppdev/Blending1/tst.tpp/xxx$en-us.tpp diff --git a/uppdev/Blending/tst.tpp/yyyy$en-us.tpp b/uppdev/Blending1/tst.tpp/yyyy$en-us.tpp similarity index 100% rename from uppdev/Blending/tst.tpp/yyyy$en-us.tpp rename to uppdev/Blending1/tst.tpp/yyyy$en-us.tpp diff --git a/uppdev/CreatePNGObject/CreatePNGObject.upp b/uppdev/CreatePNGObject/CreatePNGObject.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/uppdev/CreatePNGObject/CreatePNGObject.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/CreatePNGObject/main.cpp b/uppdev/CreatePNGObject/main.cpp new file mode 100644 index 000000000..2c3df3bec --- /dev/null +++ b/uppdev/CreatePNGObject/main.cpp @@ -0,0 +1,10 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + String chk0 = AsQTF(CreatePNGObject(CtrlImg::exclamation(), 400, 400)); + PromptOK(chk0); +} + diff --git a/uppdev/QTFHeight/QTFHeight.upp b/uppdev/QTFHeight/QTFHeight.upp new file mode 100644 index 000000000..5872304d3 --- /dev/null +++ b/uppdev/QTFHeight/QTFHeight.upp @@ -0,0 +1,9 @@ +uses + CtrlLib; + +file + main.cpp; + +mainconfig + "" = "GUI"; + diff --git a/uppdev/QTFHeight/main.cpp b/uppdev/QTFHeight/main.cpp new file mode 100644 index 000000000..4f6814d89 --- /dev/null +++ b/uppdev/QTFHeight/main.cpp @@ -0,0 +1,15 @@ +#include + +using namespace Upp; + +GUI_APP_MAIN +{ + TopWindow win; + RichTextCtrl rt; + String str = "[3A^test^ Graphical introduction]"; + rt = str; + rt.SetFrame(BlackFrame()); + rt.NoSb(); + win.Add(rt.LeftPos(10, rt.GetWidth() + 2).TopPos(rt.GetHeight(INT_MAX) + 2)); + win.Run(); +} \ No newline at end of file diff --git a/uppdev/XLS/XLS.h b/uppdev/XLS/XLS.h new file mode 100644 index 000000000..793300327 --- /dev/null +++ b/uppdev/XLS/XLS.h @@ -0,0 +1,9 @@ +#ifndef _XLS_XLS_h +#define _XLS_XLS_h + +#include +#include + +using namespace Upp; + +#endif diff --git a/uppdev/XLS/XLS.upp b/uppdev/XLS/XLS.upp new file mode 100644 index 000000000..993b78f24 --- /dev/null +++ b/uppdev/XLS/XLS.upp @@ -0,0 +1,40 @@ +description "U++ wrapper for XlsLib 1.2.0 (library for XLS spreadsheets, by David Hoerl)\377"; + +uses + Core; + +file + binfile.cpp, + blank.cpp, + cbridge.cpp, + cell.cpp, + colinfo.cpp, + continue.cpp, + crc.cpp, + datast.cpp, + docsumminfo.cpp, + extformat.cpp, + font.cpp, + format.cpp, + globalrec.cpp, + index.cpp, + label.cpp, + merged.cpp, + number.cpp, + oledoc.cpp, + olefs.cpp, + oleprop.cpp, + overnew.cpp, + range.cpp, + recdef.cpp, + record.cpp, + row.cpp, + sheetrec.cpp, + summinfo.cpp, + unit.cpp, + workbook.cpp, + XLS.h; + +mainconfig + "" = ""; + diff --git a/uppdev/XLS/biffsection.h b/uppdev/XLS/biffsection.h new file mode 100644 index 000000000..0ea5bc1d5 --- /dev/null +++ b/uppdev/XLS/biffsection.h @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/biffsection.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef BIFFSECTION_H +#define BIFFSECTION_H + +#include +#include + + +/* +****************************** +CBiffSection class declaration +****************************** +*/ + + +class CBiffSection +{ + protected: + + public: + CBiffSection() {}; + ~CBiffSection() {}; +}; + +#endif //BIFFSECTION_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: biffsection.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/uppdev/XLS/binfile.cpp b/uppdev/XLS/binfile.cpp new file mode 100644 index 000000000..2b5a4491e --- /dev/null +++ b/uppdev/XLS/binfile.cpp @@ -0,0 +1,278 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/binfile.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +****************************** +CBinFile class Implementation +****************************** +*/ + +CBinFile::CBinFile() +// : is_stroke(false) +{ + +} + +CBinFile::CBinFile(const string& name) +// : is_stroke(false) +{ + Open(name); + +} + +CBinFile::~CBinFile () +{ + Close(); + +} + +/* +****************************** +****************************** +*/ +int CBinFile::Open(const string& file_name) +{ + Close(); + m_File.open(file_name.c_str(),ios_base::binary|ios_base::out); + + return m_File.good()? NO_ERRORS: FILE_ERROR; +} + +/* +****************************** +****************************** +*/ +int CBinFile::Close ( ) +{ + if(m_File.is_open()) + m_File.close(); + + return NO_ERRORS; +} +/* +****************************** +****************************** +*/ + +unsigned32_t CBinFile::Position ( ) +{ + unsigned32_t pt = 0; + if(m_File.is_open()) { + pt = (unsigned32_t)m_File.tellp(); + } + + return pt; +} + +/* +****************************** +****************************** +*/ +int CBinFile::Write ( unsigned8_t * data, unsigned32_t size ) +{ + int errcode = NO_ERRORS; + + write_service((const char*)data, size); + return errcode; +} + + +/* +****************************** +****************************** +*/ +int CBinFile::Write ( CUnit& data_unit ) +{ + + int errcode = NO_ERRORS; + write_service((const char*)data_unit.GetBuffer(), data_unit.GetDataSize()); + return errcode; +} + +/* +****************************** +****************************** +*/ +int CBinFile::WriteByte(unsigned8_t byte) +{ + + int errcode = NO_ERRORS; + write_service((const char*)&byte, 1); + return errcode; +} + +/* +****************************** +****************************** +*/ +int CBinFile::WriteUnsigned16(unsigned16_t data) +{ + int errcode = NO_ERRORS; + + WriteByte(BYTE_0(data)); + WriteByte(BYTE_1(data)); + + return errcode; +} + +/* +****************************** +****************************** +*/ +int CBinFile::WriteUnsigned32(unsigned32_t data) +{ + int errcode = NO_ERRORS; + + WriteByte(BYTE_0(data)); + WriteByte(BYTE_1(data)); + WriteByte(BYTE_2(data)); + WriteByte(BYTE_3(data)); + + return errcode; +} + +/* +****************************** +****************************** +*/ +int CBinFile::WriteSigned16(signed16_t data) +{ + int errcode = NO_ERRORS; + + WriteByte(BYTE_0(data)); + WriteByte(BYTE_1(data)); + + return errcode; +} + +/* +****************************** +****************************** +*/ +int CBinFile::WriteSigned32(signed32_t data) +{ + int errcode = NO_ERRORS; + WriteByte(BYTE_0(data)); + WriteByte(BYTE_1(data)); + WriteByte(BYTE_2(data)); + WriteByte(BYTE_3(data)); + + return errcode; +} + +int CBinFile::WriteByteArray(const unsigned8_t *data, size_t size) +{ + int errcode = NO_ERRORS; + write_service((const char*)data, size); + return errcode; +} + +/* +****************************** +****************************** +*/ + +int CBinFile::SerializeFixedArray(const unsigned8_t data, unsigned32_t size) +{ + int errcode = NO_ERRORS; + + for (unsigned32_t i = 0; i 1) + m_File.write((const char*)buffer, size); + else if(size == 1) + m_File.put(*buffer); + } + } +#ifdef XLS_PHP + int sent = 0; + else { + if (write_fptr != NULL) + { + do + { + if(size >= STROKE_CHUNK_SIZE) + { + sent = write_fptr(buffer, STROKE_CHUNK_SIZE); + size -= sent; + buffer += sent; + } else { + sent = write_fptr(buffer, size); + size -= sent; + buffer += sent; + } + } while(size != 0); + } + } +#endif + return 0; +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: binfile.cpp,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/blank.cpp b/uppdev/XLS/blank.cpp new file mode 100644 index 000000000..e53df8efb --- /dev/null +++ b/uppdev/XLS/blank.cpp @@ -0,0 +1,104 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/blank.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + +using namespace std; +using namespace xlslib_core; + +CBlank::CBlank(unsigned16_t row, + unsigned16_t col, + xf_t* pxfval) +{ + + SetRecordType(RECTYPE_BLANK); + AddValue16(row); + AddValue16(col); + + unsigned16_t xfindex; + pxfval != NULL? + xfindex = pxfval->GetIndex() + :xfindex = 0x000f; + AddValue16(xfindex); + SetRecordLength(GetDataSize()-4); + +} + +CBlank::CBlank(blank_t& blankdef) +{ + SetRecordType(RECTYPE_BLANK); // DFH - was RECTYPE_LABEL, typo ??? (just like the number class) + AddValue16(blankdef.GetRow()); + AddValue16(blankdef.GetCol()); + AddValue16(blankdef.GetXFIndex()); + + SetRecordLength(GetDataSize()-4); +} + +CBlank::~CBlank() +{ +} + +/* +********************************* +blank_t class implementation +********************************* +*/ +blank_t::blank_t(unsigned16_t rowval, + unsigned16_t colval, + xf_t* pxfval) +{ + row = rowval; + col = colval; + + if(pxfval != NULL) + pxfval->MarkUsed(); + pxf = pxfval; +} + +CUnit* blank_t::GetData() { + CUnit* datablank = + (CUnit*)( new CBlank(row,col,pxf)); + return datablank; // NOTE: this pointer HAS to be deleted elsewhere. +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: blank.cpp,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:54 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/blank.h b/uppdev/XLS/blank.h new file mode 100644 index 000000000..2307bc2e2 --- /dev/null +++ b/uppdev/XLS/blank.h @@ -0,0 +1,92 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/blank.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef BLANK_H +#define BLANK_H + +#include +#include + +#include +#include +#include + +namespace xlslib_core +{ + + class blank_t; + class CBlank: public CRecord + { + private: + + public: + CBlank(unsigned16_t row, + unsigned16_t col, + xf_t* pxfval = NULL); + + CBlank(blank_t& blankdef); + ~CBlank(); + }; + + + class blank_t: public cell_t + { + + private: + + public: + blank_t(unsigned16_t rowval, + unsigned16_t colval, + xf_t* pxfval = NULL); + + ~blank_t(){}; + unsigned16_t GetSize() {return 10;}; + CUnit* GetData(); + + }; + +} + +#endif //BLANK_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: blank.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/cbridge.cpp b/uppdev/XLS/cbridge.cpp new file mode 100644 index 000000000..1e1ecd129 --- /dev/null +++ b/uppdev/XLS/cbridge.cpp @@ -0,0 +1,228 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/cbridge.cpp,v $ + * $Revision: 1.1 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:44:32 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include + +#include + +using namespace std; +//using namespace xlslib_core; + +#if 0 +EXTERN_TYPE worksheet *newWorksheet(CGlobalRecords *pglobalrec); +EXTERN_TYPE void deleteWorksheet(worksheet *w); + worksheet *newWorksheet(CGlobalRecords *pglobalrec) { return new worksheet(pglobalrec); } + void deleteWorksheet(worksheet *w) { delete w; } +#endif + +extern "C" { + // Workbook + workbook *newWorkbook(void) { return new workbook; } + //workbook *newWorkbook_w_fptr(write_fptr_t w_fptr) { return new workbook(w_fptr); } + void deleteWorkbook(workbook *w) { delete w; } + worksheet *callWorkbookSheet(workbook *w, char *sheetname) { + std::string str = sheetname; + return w->sheet(str); + } +#if VERSION_BIFF == VERSION_BIFF8 + worksheet *callWorkbookSheetW(workbook *w, uchar_t *sheetname) { + std::ustring str = sheetname; + return w->sheet(str); + } +#endif + worksheet *callWorkbookGetSheet(workbook *w, unsigned16_t sheetnum) { return w->GetSheet(sheetnum); } + + font_t *callWorkbookFont(workbook *w, char *name) { + std::string str = name; + return w->font(str); + } + xf_t *callWorkbookxFormat(workbook *w) { return w->xformat(); } + xf_t *callWorkbookxFormatFont(workbook *w, font_t *font) { return w->xformat(font); } + int callWorkbookDump(workbook *w, char *filename) { + std::string str = filename; + return w->Dump(str); + } +#ifdef XLS_PHP + void callWorkbookDisposition(workbook *w, Stroke_Disposition_t disp) { return w->Disposition(disp); } + void callWorkbookStroke(workbook *w, char *filename) { + std::string str = filename; + return w->Stroke(str); + } +#endif + // Worksheet + cell_t *callWorksheetFindCell(worksheet *w, unsigned16_t row, unsigned16_t col) { return w->FindCell(row, col); } + // Cell operations + void callWorksheetMerge(worksheet *w, unsigned16_t first_row, unsigned16_t first_col, unsigned16_t last_row, unsigned16_t last_col) + { return w->merge(first_row, first_col, last_row, last_col); } + void callWorksheetColwidth(worksheet *w, unsigned16_t col, unsigned16_t width) + { return w->colwidth(col, width); } + void callWorksheetRowheight(worksheet *w, unsigned16_t row, unsigned16_t height) + { return w->rowheight(row, height); } + // Ranges + range *callWorksheetRangegroup(worksheet *w, unsigned16_t row1, unsigned16_t col1, unsigned16_t row2, unsigned16_t col2) + { return w->rangegroup(row1, col1, row2, col2); } + // Cells + cell_t *callWorksheetLabel(worksheet *w, unsigned16_t row, unsigned16_t col, char *strlabel, xf_t *pxformat) + { + std:string str = strlabel; + return w->label(row, col, strlabel, pxformat); + } +#if VERSION_BIFF == VERSION_BIFF8 + cell_t *callWorksheetLabelW(worksheet *w, unsigned16_t row, unsigned16_t col, uchar_t *strlabel, xf_t *pxformat) + { + std:ustring str = strlabel; + return w->label(row, col, strlabel, pxformat); + } +#endif + cell_t *callWorksheetBlank(worksheet *w, unsigned16_t row, unsigned16_t col, xf_t *pxformat) + { return w->blank(row, col, pxformat); } + + cell_t *callWorksheetNumber(worksheet *w, unsigned16_t row, unsigned16_t col, double numval, format_number_t fmtval, xf_t *pxformat) + { return w->number(row, col, numval, fmtval, pxformat); } + + // Cells + // xf_i interface + void callCellFont(cell_t *c, font_t *fontidx) { return c->font(fontidx); } + void callCellFormat(cell_t *c, format_number_t formatidx) { return c->format(formatidx); } + void callCellHalign(cell_t *c, halign_option_t ha_option) { return c->halign(ha_option); } + void callCellValign(cell_t *c, valign_option_t va_option) { return c->valign(va_option); } + void callCellOrientation(cell_t *c, txtori_option_t ori_option) { return c->orientation(ori_option); } + void callCellFillfgcolor(cell_t *c, color_name_t color) { return c->fillfgcolor(color); } + void callCellFillbgcolor(cell_t *c, color_name_t color) { return c->fillbgcolor(color); } + void callCellFillstyle(cell_t *c, fill_option_t fill) { return c->fillstyle(fill); } + void callCellLocked(cell_t *c, bool locked_opt) { return c->locked(locked_opt); } + void callCellHidden(cell_t *c, bool hidden_opt) { return c->hidden(hidden_opt); } + void callCellWrap(cell_t *c, bool wrap_opt) { return c->wrap(wrap_opt); } + void callCellBorderstyle(cell_t *c, border_side_t side, border_style_t style, color_name_t color) + { return c->borderstyle(side, style, color); } + //font_i interface + void callCellFontname(cell_t *c, char *fntname) { + std::string str = fntname; + return c->fontname(str); + } + void callCellFontheight(cell_t *c, unsigned16_t fntheight) { return c->fontheight(fntheight); } + void callCellFontbold(cell_t *c, boldness_option_t fntboldness) { return c->fontbold(fntboldness); } + void callCellFontunderline(cell_t *c, underline_option_t fntunderline) { return c->fontunderline(fntunderline); } + void callCellFontscript(cell_t *c, script_option_t fntscript) { return c->fontscript(fntscript); } + void callCellFontcolor(cell_t *c, color_name_t fntcolor) { return c->fontcolor(fntcolor); } + void callCellFontattr(cell_t *c, unsigned16_t attr) { return c->fontattr(attr); } + void callCellFontitalic(cell_t *c, bool italic) { return c->fontitalic(italic); } + void callCellFontstrikeout(cell_t *c, bool so) { return c->fontstrikeout(so); } + void callCellFontoutline(cell_t *c, bool ol) { return c->fontoutline(ol); } + void callCellFontshadow(cell_t *c, bool sh) { return c->fontshadow(sh); } + + unsigned16_t callCellGetRow(cell_t *c) { return c->GetRow(); } + unsigned16_t callCellGetCol(cell_t *c) { return c->GetCol(); } + unsigned16_t callCellGetXFIndex(cell_t *c) { return c->GetXFIndex(); } + void callCellSetXF(cell_t *c, xf_t *pxfval) { return c->SetXF(pxfval); } + + // range + void callRangeCellcolor(range *r, color_name_t color) { return r->cellcolor(color); } + + // xformat + void callXformatSetFont(xf_t *x, font_t* fontidx) { return x->SetFont(fontidx); } + unsigned16_t callXformatGetFontIndex(xf_t *x) { return x->GetFontIndex(); } + font_t* callXformatGetFont(xf_t *x) { return x->GetFont(); } + /* Format Index wrappers*/ + void callXformatSetFormat(xf_t *x, format_number_t formatidx) { return x->SetFormat(formatidx); } + unsigned16_t callXformatGetFormatIndex(xf_t *x) { return x->GetFormatIndex(); } + format_number_t callXformatGetFormat(xf_t *x) { return x->GetFormat(); } + /* Horizontal Align option wrappers*/ + void callXformatSetHAlign(xf_t *x, halign_option_t ha_option) { return x->SetHAlign(ha_option); } + unsigned8_t callXformatGetHAlign(xf_t *x) { return x->GetHAlign(); } + /* Vertical Align option wrappers*/ + void callXformatSetVAlign(xf_t *x, valign_option_t va_option) { return x->SetVAlign(va_option); } + unsigned8_t callXformatGetVAlign(xf_t *x) { return x->GetVAlign(); } + /* Text orientation option wrappers*/ + void callXformatSetTxtOrientation(xf_t *x, txtori_option_t ori_option) { return x->SetTxtOrientation(ori_option); } + unsigned8_t callXformatGetTxtOrientation(xf_t *x) { return x->GetTxtOrientation(); } + /* Fill Foreground color option wrappers*/ + void callXformatSetFillFGColor(xf_t *x, color_name_t color) { return x->SetFillFGColor(color); } + unsigned8_t callXformatGetFillFGColor(xf_t *x) { return x->GetFillFGColor(); } + /* Fill Background color option wrappers*/ + void callXformatSetFillBGColor(xf_t *x, color_name_t color) { return x->SetFillBGColor(color); } + unsigned8_t callXformatGetFillBGColor(xf_t *x) { return x->GetFillBGColor(); } + /* Fill Style option wrappers*/ + void callXformatSetFillStyle(xf_t *x, fill_option_t fill) { return x->SetFillStyle(fill); } + unsigned8_t callXformatGetFillStyle(xf_t *x) { return x->GetFillStyle(); } + /* Locked option wrappers*/ + void callXformatSetLocked(xf_t *x, bool locked_opt) { return x->SetLocked(locked_opt); } + bool callXformatIsLocked(xf_t *x) { return x->IsLocked(); } + /* Hidden option wrappers*/ + void callXformatSetHidden(xf_t *x, bool hidden_opt) { return x->SetHidden(hidden_opt); } + bool callXformatIsHidden(xf_t *x) { return x->IsHidden(); } + /* Wrap option wrappers*/ + void callXformatSetWrap(xf_t *x, bool wrap_opt) { return x->SetWrap(wrap_opt); } + bool callXformatIsWrap(xf_t *x) { return x->IsWrap(); } + /* Cell option wrappers*/ + void callXformatSetCellMode(xf_t *x, bool cellmode) { return x->SetCellMode(cellmode); } + bool callXformatIsCell(xf_t *x) { return x->IsCell(); } + /* Cell option wrappers*/ + void callXformatSetBorderStyle(xf_t *x, border_side_t side, border_style_t style, color_name_t color) + { return x->SetBorderStyle(side, style, color); } + unsigned8_t callXformatGetBorderStyle(xf_t *x, border_side_t side) { return x->GetBorderStyle(side); } + unsigned8_t callXformatGetBorderColor(xf_t *x, border_side_t side) { return x->GetBorderColor(side); } + unsigned32_t callXformatGetSignature(xf_t *x) { return x->GetSignature(); } + + // Font + void callFontSetName(font_t *f, char *fntname) { + std::string str = fntname; + f->SetName(str); + return; + } + char *callFontGetName(font_t *f, char *fntname) { return strcpy(fntname, (f->GetName()).c_str() ); } + /* FONT height wrappers*/ + void callFontSetHeight(font_t *f, unsigned16_t fntheight) { return f->SetHeight(fntheight); } + unsigned16_t callFontGetHeight(font_t *f) { return f->GetHeight(); } + /* FONT boldstyle wrappers*/ + void callFontSetBoldStyle(font_t *f, boldness_option_t fntboldness) { return f->SetBoldStyle(fntboldness); } + unsigned16_t callFontGetBoldStyle(font_t *f) { return f->GetBoldStyle(); } + /* FONT underline wrappers*/ + void callFontSetUnderlineStyle(font_t *f, underline_option_t fntunderline) { return f->SetUnderlineStyle(fntunderline); } + unsigned8_t callFontGetUnderlineStyle(font_t *f) { return f->GetUnderlineStyle(); } + /* FONT script wrappers*/ + void callFontSetScriptStyle(font_t *f, script_option_t fntscript) { return f->SetScriptStyle(fntscript); } + unsigned16_t callFontGetScriptStyle(font_t *f) { return f->GetScriptStyle(); } + /* FONT script wrappers*/ + void callFontSetColor(font_t *f, color_name_t fntcolor) { return f->SetColor(fntcolor); } + unsigned16_t callFontGetColor(font_t *f) { return f->GetColor(); } + void callFontSetItalic(font_t *f, bool italic) { return f->SetItalic(italic); } + void callFontSetStrikeout(font_t *f, bool so) { return f->SetStrikeout(so); } + /* FONT attributes wrappers */ + void callFontSetAttributes(font_t *f, unsigned16_t attr) { return f->SetAttributes(attr); } + unsigned16_t callFontGetAttributes(font_t *f) { return f->GetAttributes(); } + // Macintosh only + void callFontSetOutline(font_t *f, bool ol) { return f->SetOutline(ol); } + void callFontSetShadow(font_t *f, bool sh) { return f->SetShadow(sh); } +} diff --git a/uppdev/XLS/cbridge.h b/uppdev/XLS/cbridge.h new file mode 100644 index 000000000..79b555cd1 --- /dev/null +++ b/uppdev/XLS/cbridge.h @@ -0,0 +1,33 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/cbridge.h,v $ + * $Revision: 1.1 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:44:32 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/cell.cpp b/uppdev/XLS/cell.cpp new file mode 100644 index 000000000..61d0cde66 --- /dev/null +++ b/uppdev/XLS/cell.cpp @@ -0,0 +1,557 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/cell.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include + +using namespace std; +using namespace xlslib_core; + +cell_t::cell_t() + :m_pGlobalRecs(NULL) +{ + +} + +cell_t::~cell_t() +{ + +} + +unsigned16_t cell_t::GetXFIndex() +{ + unsigned16_t xfindex; +#if 0 + pxf != NULL? + xfindex = pxf->GetIndex() + :xfindex = 0x000f; +#endif + if(pxf != NULL) + xfindex = pxf->GetIndex(); + else + xfindex = 0x000f; + + return xfindex; +} + + +bool cell_t::operator==(const cell_t& right) const +{ + return (row == right.row ? true : false); +} + +bool cell_t::operator!=(const cell_t& right) const +{ + return (row != right.row ? true : false); +} + +/* + bool cell_t::operator<(const cell_t& right) const + { + return (row < right.row); + } + + bool cell_t::operator>(const cell_t& right) const + { + return (row > right.row); + } + + + bool cell_t::operator%(const cell_t& right) const + { + return (row == right.row && col == right.col); + } +*/ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Implementation of the XF record interface (xf_i pure virtual interface) + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#define SET_XF_CELL_FUNCTION(function,value) \ + { \ + xf_t* currentxf = pxf; \ + if(pxf == NULL) \ + currentxf = m_pGlobalRecs->GetDefaultXF(); \ + \ + xf_t* xfbackup = new xf_t; \ + (*xfbackup) = (*currentxf); \ + \ + if(currentxf->Usage() > 1) \ + { \ + xf_t* newxf = new xf_t(); \ + (*newxf) = (*currentxf); \ + newxf->function(value); \ + newxf = m_pGlobalRecs->AddXFormat(newxf); \ + pxf = newxf; \ + pxf->MarkUsed(); \ + \ + } \ + else \ + { \ + xf_t* xfnew = new xf_t; \ + (*xfnew) = (*currentxf); \ + xfnew->function(value); \ + xfnew->MarkUsed(); \ + xfnew = m_pGlobalRecs->ReplaceXFormat(xfbackup, xfnew); \ + pxf = xfnew; \ + pxf->MarkUsed(); \ + \ + } \ + delete xfbackup; \ + } + +void cell_t::borderstyle(border_side_t side, + border_style_t style, + color_name_t color) +{ + + xf_t* currentxf = pxf; + if(pxf == NULL) + currentxf = m_pGlobalRecs->GetDefaultXF(); + + xf_t* xfbackup = new xf_t; + (*xfbackup) = (*currentxf); + + if(currentxf->Usage() > 1) + { + xf_t* newxf = new xf_t(); + (*newxf) = (*currentxf); + newxf->SetBorderStyle(side, style, color); + newxf = m_pGlobalRecs->AddXFormat(newxf); + pxf = newxf; + pxf->MarkUsed(); + + } + else + { + xf_t* xfnew = new xf_t; + (*xfnew) = (*currentxf); + xfnew->SetBorderStyle(side, style, color); + xfnew->MarkUsed(); + xfnew = m_pGlobalRecs->ReplaceXFormat(xfbackup, xfnew); + pxf = xfnew; + pxf->MarkUsed(); + + + } + delete xfbackup; +} + +void cell_t::font(font_t* fontidx) +{ + + SET_XF_CELL_FUNCTION(SetFont, fontidx); +/* + xf_t* currentxf = pxf; + if(pxf == NULL) + currentxf = m_pGlobalRecs->GetDefaultXF(); + + xf_t* xfbackup = new xf_t; + (*xfbackup) = (*currentxf); + + if(currentxf->Usage() > 1) + { + xf_t* newxf = new xf_t(); + (*newxf) = (*currentxf); + newxf->SetFont(fontidx); + newxf = m_pGlobalRecs->AddXFormat(newxf); + pxf = newxf; + pxf->MarkUsed(); + + } + else + { + xf_t* xfnew = new xf_t; + (*xfnew) = (*currentxf); + xfnew->SetFont(fontidx); + xfnew->MarkUsed(); + xfnew = m_pGlobalRecs->ReplaceXFormat(xfbackup, xfnew); + pxf = xfnew; + } + + delete xfbackup; +*/ +} + +void cell_t::format(format_number_t formatidx) +{ + SET_XF_CELL_FUNCTION(SetFormat,formatidx); +} + +void cell_t::halign(halign_option_t ha_option) +{ + + SET_XF_CELL_FUNCTION(SetHAlign,ha_option); + +} + +void cell_t::valign(valign_option_t va_option) +{ + SET_XF_CELL_FUNCTION(SetVAlign,va_option); +} + +void cell_t::indent(indent_option_t indent_option) +{ + SET_XF_CELL_FUNCTION(SetIndent,indent_option); +} + +void cell_t::orientation(txtori_option_t ori_option) +{ + SET_XF_CELL_FUNCTION(SetTxtOrientation,ori_option); +} + +void cell_t::fillfgcolor(color_name_t color) +{ + SET_XF_CELL_FUNCTION(SetFillFGColor,color); +/* + xf_t* currentxf = pxf; + if(pxf == NULL) + currentxf = m_pGlobalRecs->GetDefaultXF(); + + xf_t* xfbackup = new xf_t; + (*xfbackup) = (*currentxf); + + if(currentxf->Usage() > 1) + { + xf_t* newxf = new xf_t(); + (*newxf) = (*currentxf); + newxf->SetFillFGColor(color); + newxf = m_pGlobalRecs->AddXFormat(newxf); + pxf = newxf; + pxf->MarkUsed(); + + } + else + { + xf_t* xfnew = new xf_t; + (*xfnew) = (*currentxf); + xfnew->SetFillFGColor(color); + xfnew->MarkUsed(); + xfnew = m_pGlobalRecs->ReplaceXFormat(xfbackup, xfnew); + pxf = xfnew; + pxf->MarkUsed(); + } + delete xfbackup; +*/ +} + +void cell_t::fillbgcolor(color_name_t color) +{ + SET_XF_CELL_FUNCTION(SetFillBGColor,color); +} + +void cell_t::fillstyle(fill_option_t fill) +{ + SET_XF_CELL_FUNCTION(SetFillStyle,fill); +/* + xf_t* currentxf = pxf; + if(pxf == NULL) + currentxf = m_pGlobalRecs->GetDefaultXF(); + + xf_t* xfbackup = new xf_t; + (*xfbackup) = (*currentxf); + + if(currentxf->Usage() > 1) + { + xf_t* newxf = new xf_t(); + (*newxf) = (*currentxf); + newxf->SetFillStyle(fill); + newxf = m_pGlobalRecs->AddXFormat(newxf); + pxf = newxf; + pxf->MarkUsed(); + + } + else + { + xf_t* xfnew = new xf_t; + (*xfnew) = (*currentxf); + xfnew->SetFillStyle(fill); + xfnew = m_pGlobalRecs->ReplaceXFormat(xfbackup, xfnew); + pxf = xfnew; + pxf->MarkUsed(); + + } + delete xfbackup; +*/ +} + +void cell_t::locked(bool locked_opt) +{ + SET_XF_CELL_FUNCTION(SetLocked,locked_opt); +} + +void cell_t::hidden(bool hidden_opt) +{ + SET_XF_CELL_FUNCTION(SetHidden,hidden_opt); +} + +void cell_t::wrap(bool wrap_opt) +{ + SET_XF_CELL_FUNCTION(SetWrap,wrap_opt); +} + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + Implementation of the FONT record interface (font_i pure virtual interface) + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#define SET_CELL_FONT_FUNCTION(function,value) \ + { \ + bool samexf = true; \ + \ + xf_t* currentxf = pxf; \ + if(pxf == NULL) \ + currentxf = m_pGlobalRecs->GetDefaultXF(); \ + \ + xf_t* xfbackup = new xf_t; \ + (*xfbackup) = (*currentxf); \ + \ + xf_t* newxf = currentxf; \ + if(currentxf->Usage() > 1) \ + samexf = false; \ + \ + newxf = new xf_t(); \ + (*newxf) = (*currentxf); \ + \ + font_t* currentfont = newxf->GetFont(); \ + if(currentfont == NULL) \ + currentfont = m_pGlobalRecs->GetDefaultFont(); \ + if(currentfont->Usage() > 1) \ + { \ + font_t* newfont = new font_t(); \ + (*newfont) = (*currentfont); \ + newfont->function(value); \ + newfont = m_pGlobalRecs->AddFont(newfont); \ + newxf->SetFont(newfont); \ + } \ + else \ + { \ + font_t* fntnew = new font_t; \ + (*fntnew) = (*currentfont); \ + fntnew->function(value); \ + fntnew = m_pGlobalRecs->ReplaceFont(currentfont, fntnew); \ + newxf->SetFont(fntnew) ; \ + } \ + if(samexf) \ + { \ + newxf = m_pGlobalRecs->ReplaceXFormat(xfbackup, newxf); \ + pxf = newxf; \ + pxf->MarkUsed(); \ + } \ + else \ + { \ + newxf = m_pGlobalRecs->AddXFormat(newxf); \ + pxf = newxf; \ + pxf->MarkUsed(); \ + } \ + delete xfbackup; \ + } + +void cell_t::fontname(string fntname) +{ + + + SET_CELL_FONT_FUNCTION(SetName, fntname); +/* + bool samexf = true; + + xf_t* currentxf = pxf; + if(pxf == NULL) + currentxf = m_pGlobalRecs->GetDefaultXF(); + + xf_t* xfbackup = new xf_t; + (*xfbackup) = (*currentxf); + + xf_t* newxf = currentxf; + if(currentxf->Usage() > 1) + samexf = false; + + newxf = new xf_t(); + (*newxf) = (*currentxf); + + font_t* currentfont = newxf->GetFont(); + if(currentfont == NULL) + currentfont = m_pGlobalRecs->GetDefaultFont(); + if(currentfont->Usage() > 1) + { + font_t* newfont = new font_t(); + (*newfont) = (*currentfont); + newfont->SetName(fntname); + newfont = m_pGlobalRecs->AddFont(newfont); + newxf->SetFont(newfont); + } + else + { + font_t* fntnew = new font_t; + (*fntnew) = (*currentfont); + fntnew->SetName(fntname); + fntnew = m_pGlobalRecs->ReplaceFont(currentfont, fntnew); + newxf->SetFont(fntnew) ; + } + if(samexf) + { + newxf = m_pGlobalRecs->ReplaceXFormat(xfbackup, newxf); + pxf = newxf; + pxf->MarkUsed(); + } + else + { + newxf = m_pGlobalRecs->AddXFormat(newxf); + pxf = newxf; + pxf->MarkUsed(); + } + delete xfbackup; +*/ +} + + + + +void cell_t::fontheight(unsigned16_t fntheight) +{ + SET_CELL_FONT_FUNCTION(SetHeight,fntheight); +} + +void cell_t::fontbold(boldness_option_t fntboldness) +{ +/* + bool samexf = true; + + xf_t* currentxf = pxf; + if(pxf == NULL) + currentxf = m_pGlobalRecs->GetDefaultXF(); + + xf_t* xfbackup = new xf_t; + (*xfbackup) = (*currentxf); + + + xf_t* newxf = currentxf; + if(currentxf->Usage() > 1) + samexf = false; + + newxf = new xf_t(); + (*newxf) = (*currentxf); + + font_t* currentfont = newxf->GetFont(); + if(currentfont == NULL) + currentfont = m_pGlobalRecs->GetDefaultFont(); + if(currentfont->Usage() > 1) + { + font_t* newfont = new font_t(); + (*newfont) = (*currentfont); + newfont->SetBoldStyle(fntboldness); + newfont = m_pGlobalRecs->AddFont(newfont); + newxf->SetFont(newfont); + + } + else + { + font_t* fntnew = new font_t; + (*fntnew) = (*currentfont); + fntnew->SetBoldStyle(fntboldness); + fntnew = m_pGlobalRecs->ReplaceFont(currentfont, fntnew); + newxf->SetFont(fntnew) ; + } + + if(samexf) + { + newxf = m_pGlobalRecs->ReplaceXFormat(xfbackup, newxf); + pxf = newxf; + } + else + { + newxf = m_pGlobalRecs->AddXFormat(newxf); + pxf = newxf; + pxf->MarkUsed(); + } + + + delete xfbackup; +*/ + SET_CELL_FONT_FUNCTION(SetBoldStyle,fntboldness); +} + +void cell_t::fontunderline(underline_option_t fntunderline) +{ + SET_CELL_FONT_FUNCTION(SetUnderlineStyle,fntunderline); +} + +void cell_t::fontscript(script_option_t fntscript) +{ + SET_CELL_FONT_FUNCTION(SetScriptStyle,fntscript); +} + +void cell_t::fontcolor(color_name_t fntcolor) +{ + SET_CELL_FONT_FUNCTION(SetColor,fntcolor); +} + +void cell_t::fontattr(unsigned16_t attr) +{ + SET_CELL_FONT_FUNCTION(SetAttributes,attr); +} + +void cell_t::fontitalic(bool italic) +{ + SET_CELL_FONT_FUNCTION(SetItalic,italic); +} + +void cell_t::fontstrikeout(bool so) +{ + SET_CELL_FONT_FUNCTION(SetStrikeout,so); +} + +void cell_t::fontoutline(bool ol) +{ + SET_CELL_FONT_FUNCTION(SetOutline,ol); +} + +void cell_t::fontshadow(bool sh) +{ + SET_CELL_FONT_FUNCTION(SetShadow,sh); +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: cell.cpp,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:54 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/cell.h b/uppdev/XLS/cell.h new file mode 100644 index 000000000..6c4b5707e --- /dev/null +++ b/uppdev/XLS/cell.h @@ -0,0 +1,174 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/cell.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef CELL_H +#define CELL_H + +#include +#include + +#include +#include +#include + +namespace xlslib_core +{ + + class cell_t + : public xf_i , public font_i + { + public: + cell_t(); + virtual ~cell_t(); + unsigned16_t GetXFIndex(void); + unsigned16_t GetRow(void){return row;}; + unsigned16_t GetCol(void){return col;}; + + void SetXF(xf_t* pxfval){pxf = pxfval;}; + xf_t* GetXF(void){return pxf;}; + + virtual unsigned16_t GetSize() = 0; + virtual CUnit* GetData() = 0; + /* + bool operator<(const cell_t& right) const; + bool operator>(const cell_t& right) const; + bool operator%(const cell_t& right) const; + */ + bool operator==(const cell_t& right) const; + bool operator!=(const cell_t& right) const; + + void SetGlobalRecs(CGlobalRecords* pglobalr) {m_pGlobalRecs = pglobalr;}; + private: + CGlobalRecords *m_pGlobalRecs; + + protected: + unsigned16_t row; + unsigned16_t col; + + xf_t* pxf; + public: // xf_i interface + void font(font_t* fontidx); + void format(format_number_t formatidx); + void halign(halign_option_t ha_option); + void valign(valign_option_t va_option); + void indent(indent_option_t indent_option); + void orientation(txtori_option_t ori_option); + void fillfgcolor(color_name_t color); + void fillbgcolor(color_name_t color); + void fillstyle(fill_option_t fill); + void locked(bool locked_opt); + void hidden(bool hidden_opt); + void wrap(bool wrap_opt); + void borderstyle(border_side_t side, + border_style_t style, + color_name_t color); + public: //font_i interface + void fontname(std::string fntname); + void fontheight(unsigned16_t fntheight); + void fontbold(boldness_option_t fntboldness); + void fontunderline(underline_option_t fntunderline); + void fontscript(script_option_t fntscript); + void fontcolor(color_name_t fntcolor); + void fontattr(unsigned16_t attr); + void fontitalic(bool italic); + void fontstrikeout(bool so); + void fontoutline(bool ol); + void fontshadow(bool sh); + }; + + // #ifdef WIN32 + // A bug in the compiler doesn't allow to use the functor direcly + // with the list::sort() function + // template<> + // struct std::greater : public binary_function + // { + // public: + // bool operator()(cell_t* &a, cell_t* &b) + // { + // return (a->GetRow() < b->GetRow()); + // }; + // }; + // + // + // + // struct rowsort: public greater + // { + // public: + // bool operator()(cell_t* &a, cell_t* &b) const + // { + // return (a->GetRow() < b->GetRow()); + // }; + // }; + // #endif + + struct rowsort + { + public: +bool operator()(cell_t* &a, cell_t* &b) const + { + return (a->GetRow() < b->GetRow() ? true : false); + }; + }; + + class insertsort + { + public: + bool operator()(cell_t* a, cell_t* b) const + { + unsigned32_t aval = 100000*(a->GetRow()) + a->GetCol(); + unsigned32_t bval = 100000*(b->GetRow()) + b->GetCol(); + + return (aval < bval ? true : false); + }; + }; + + + typedef std::set Cell_List_t; + typedef Cell_List_t::iterator Cell_List_Itor_t; + + +} + +#endif // CELL_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: cell.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:47 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + diff --git a/uppdev/XLS/colinfo.cpp b/uppdev/XLS/colinfo.cpp new file mode 100644 index 000000000..e78401cf1 --- /dev/null +++ b/uppdev/XLS/colinfo.cpp @@ -0,0 +1,74 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/colinfo.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +using namespace std; +using namespace xlslib_core; + + +CColInfo::CColInfo(colinfo_t* newci) +{ + SetRecordType(RECTYPE_COLINFO); + + AddValue16(newci->colfirst); + AddValue16(newci->collast); + AddValue16(newci->width); + + // TODO: Mark the XFormat as used + if(newci->xformat != NULL) + AddValue16(newci->xformat->GetIndex()); + else + AddValue16(0x0000); + + AddValue16(newci->flags); + + SetRecordLength(GetDataSize()-4); +} + +CColInfo::~CColInfo() +{ + +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: colinfo.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/colinfo.h b/uppdev/XLS/colinfo.h new file mode 100644 index 000000000..6979bc230 --- /dev/null +++ b/uppdev/XLS/colinfo.h @@ -0,0 +1,87 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/colinfo.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef COLINFO_H +#define COLINFO_H + +#include +#include +#include +#include + +namespace xlslib_core +{ + + typedef struct + { + unsigned16_t colfirst; + unsigned16_t collast; + unsigned16_t width; + xf_t* xformat; + unsigned16_t flags; + } colinfo_t; + + struct colinfosort + { + public: +bool operator()(colinfo_t* const &a, colinfo_t* const &b) const + { + return (a->colfirst < b->colfirst); + }; + }; + + + typedef std::set Colinfo_List_t; + typedef Colinfo_List_t::iterator Colinfo_List_Itor_t; + + class CColInfo: public CRecord + { + public: + CColInfo(colinfo_t* newci); + ~CColInfo(); + }; + +} + +#endif //COLINFO_H +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: colinfo.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/colors.h b/uppdev/XLS/colors.h new file mode 100644 index 000000000..c8d4af373 --- /dev/null +++ b/uppdev/XLS/colors.h @@ -0,0 +1,143 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/colors.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +#ifndef COLORS_H +#define COLORS_H + +namespace xlslib_core +{ + + +#define COLOR_CODE_BLACK (0x08) +#define COLOR_CODE_DARK_RED (0x10) +#define COLOR_CODE_RED (0x0a) +#define COLOR_CODE_FUCSIA (0x0e) +#define COLOR_CODE_COMBINED01 (0x2d) +#define COLOR_CODE_COMBINED02 (0x3c) +#define COLOR_CODE_COMBINED03 (0x35) +#define COLOR_CODE_COMBINED04 (0x34) +#define COLOR_CODE_COMBINED05 (0x33) +#define COLOR_CODE_COMBINED06 (0x2f) +#define COLOR_CODE_OLIVE (0x3b) +#define COLOR_CODE_DARK_YELLOW (0x13) +#define COLOR_CODE_COMBINED07 (0x32) +#define COLOR_CODE_YELLOW (0x0d) +#define COLOR_CODE_LIGHT_YELLOW (0x2b) +#define COLOR_CODE_DARK_GREEN (0x3a) +#define COLOR_CODE_GREEN (0x11) +#define COLOR_CODE_COMBINED08 (0x39) +#define COLOR_CODE_LIVING_GREEN (0x0b) +#define COLOR_CODE_LIGHT_GREEN (0x2a) +#define COLOR_CODE_COMBINED09 (0x38) +#define COLOR_CODE_BLUE_GREEN (0x15) +#define COLOR_CODE_AQUAMARINA (0x31) +#define COLOR_CODE_TURQOISE (0x0f) +#define COLOR_CODE_COMBINED10 (0x29) +#define COLOR_CODE_DARK_BLUE (0x12) +#define COLOR_CODE_BLUE (0x0c) +#define COLOR_CODE_LIGHT_BLUE (0x30) +#define COLOR_CODE_SKY_BLUE (0x28) +#define COLOR_CODE_COMBINED11 (0x2c) +#define COLOR_CODE_INDIGO (0x3e) +#define COLOR_CODE_BLUE_GRAY (0x36) +#define COLOR_CODE_VIOLET (0x14) +#define COLOR_CODE_PLUM (0x3d) +#define COLOR_CODE_LAVANDER (0x2e) +#define COLOR_CODE_COMBINED12 (0x3f) +#define COLOR_CODE_GRAY50 (0x17) +#define COLOR_CODE_GRAY40 (0x37) +#define COLOR_CODE_GRAY25 (0x16) +#define COLOR_CODE_WHITE (0x09) + + typedef enum + { + COLOR_BLACK, + COLOR_DARK_RED, + COLOR_RED, + COLOR_FUCSIA, + COLOR_COMBINED01, + COLOR_COMBINED02, + COLOR_COMBINED03, + COLOR_COMBINED04, + COLOR_COMBINED05, + COLOR_COMBINED06, + COLOR_OLIVE, + COLOR_DARK_YELLOW, + COLOR_COMBINED07, + COLOR_YELLOW, + COLOR_LIGHT_YELLOW, + COLOR_DARK_GREEN, + COLOR_GREEN, + COLOR_COMBINED08, + COLOR_LIVING_GREEN, + COLOR_LIGHT_GREEN, + COLOR_COMBINED09, + COLOR_BLUE_GREEN, + COLOR_AQUAMARINA, + COLOR_TURQOISE, + COLOR_COMBINED10, + COLOR_DARK_BLUE, + COLOR_BLUE, + COLOR_LIGHT_BLUE, + COLOR_SKY_BLUE, + COLOR_COMBINED11, + COLOR_INDIGO, + COLOR_BLUE_GRAY, + COLOR_VIOLET, + COLOR_PLUM, + COLOR_LAVANDER, + COLOR_COMBINED12, + COLOR_GRAY50, + COLOR_GRAY40, + COLOR_GRAY25, + COLOR_WHITE + }color_name_t; + +} + +#endif //COLORS_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: colors.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:44 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/common.h b/uppdev/XLS/common.h new file mode 100644 index 000000000..6601014b7 --- /dev/null +++ b/uppdev/XLS/common.h @@ -0,0 +1,91 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/common.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef COMMON_H +#define COMMON_H + +#include +#include +#include +#include + +#include + +#ifdef HAVE_ICONV +#include +#endif + +namespace xlslib_core +{ + + // Some typedefs used only by xlslib core + typedef struct + { + unsigned16_t first_row; + unsigned16_t last_row; + + unsigned16_t first_col; + unsigned16_t last_col; + + } range_t; + + +#if defined(_MSC_VER) && defined(WIN32) + typedef std::list Range_List_t; + typedef Range_List_t::iterator Range_List_Itor_t; + + class range; + typedef std::list RangeObj_List_t; + typedef RangeObj_List_t::iterator RangeObj_List_Itor_t; + +#else + typedef std::list Range_List_t; + typedef Range_List_t::iterator Range_List_Itor_t; + + class range; + typedef std::list RangeObj_List_t; + typedef RangeObj_List_t::iterator RangeObj_List_Itor_t; +#endif +} +#endif //COMMON_H +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: common.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:57 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/config.h b/uppdev/XLS/config.h new file mode 100644 index 000000000..1eeffacbc --- /dev/null +++ b/uppdev/XLS/config.h @@ -0,0 +1,98 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/config.h,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef CONFIG_H +#define CONFIG_H + +#ifdef HAVE_CONFIG_H +#include + +#define CFG_TRUE 1 +#define CFG_FALSE 0 + +#define ALLOCATOR_STL 0 +#define ALLOCATOR_BTI 1 + + +#if defined(USE_BTI_ALLOC) +# define ALLOCATOR_DFLT ALLOCATOR_BTI +#elif defined(ALLOC_BTI) +# define ALLOCATOR_DFLT ALLOCATOR_STL +#else +# define ALLOCATOR_DFLT ALLOCATOR_STL +#endif + + +#else // HAVE_CONFIG_H + +#if defined(_MSC_VER) && defined(WIN32) +// Fakes the inclusion of crtdbg.h to avoid duplicated symbols +// of (inlined) new() and delete() operators +#define _INC_CRTDBG +#else +#endif + +#define CFG_TRUE 1 +#define CFG_FALSE 0 + +#define ALLOCATOR_STL 0 +#define ALLOCATOR_BTI 1 + + +#if defined(ALLOC_STL) +# define ALLOCATOR_DFLT ALLOCATOR_STL +#elif defined(ALLOC_BTI) +# define ALLOCATOR_DFLT ALLOCATOR_BTI +#else +# define ALLOCATOR_DFLT ALLOCATOR_STL +#endif + + +#endif // HAVE_CONFIG_H + +#endif //CONFIG_H +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: config.h,v $ + * Revision 1.3 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:32:05 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/continue.cpp b/uppdev/XLS/continue.cpp new file mode 100644 index 000000000..164b9f266 --- /dev/null +++ b/uppdev/XLS/continue.cpp @@ -0,0 +1,68 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/continue.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +/* +****************************** +CContinue class implementation +****************************** +*/ + +using namespace std; +using namespace xlslib_core; + + +CContinue::CContinue(unsigned8_t* data, unsigned32_t size) +{ + SetRecordType(RECTYPE_CONTINUE ); + AddDataArray(data,size); + + SetRecordLength(GetDataSize()-4); +} + +CContinue::~CContinue() +{} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: continue.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:53 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/continue.h b/uppdev/XLS/continue.h new file mode 100644 index 000000000..f90bc7846 --- /dev/null +++ b/uppdev/XLS/continue.h @@ -0,0 +1,72 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/continue.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef CONTINUE_H +#define CONTINUE_H + +#include +#include +#include + +namespace xlslib_core +{ + + + class CContinue: public CRecord + { + protected: + + public: + + CContinue(unsigned8_t* data, unsigned32_t size); + ~CContinue(); + + + + }; +} + +#endif //CONTINUE_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: continue.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/crc.cpp b/uppdev/XLS/crc.cpp new file mode 100644 index 000000000..77a5c109c --- /dev/null +++ b/uppdev/XLS/crc.cpp @@ -0,0 +1,254 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/crc.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +#include + +using namespace std; +using namespace xlslib_core; + +/* + * Derive parameters from the standard-specific parameters in crc.h. + */ +#define WIDTH (8 * sizeof(crc32_t)) +#define TOPBIT (1 << (WIDTH - 1)) + +#if REFLECT_DATA == TRUE +#undef REFLECT_DATA +#define REFLECT_DATA(X) ((unsigned char) reflect((X), 8)) +#else +#undef REFLECT_DATA +#define REFLECT_DATA(X) (X) +#endif + +#if REFLECT_REMAINDER == TRUE +#undef REFLECT_REMAINDER +#define REFLECT_REMAINDER(X) ((crc32_t) reflect((X), WIDTH)) +#else +#undef REFLECT_REMAINDER +#define REFLECT_REMAINDER(X) (X) +#endif + +/* + const crc32_t crc::CRC_CCITT_TABLE[256] = + { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, + 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, + 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, + 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, + 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, + 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, + 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, + 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, + 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, + 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, + 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, + 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, + 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, + 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, + 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0, + }; + + + const crc32_t crc::CRC_16_TABLE[256] = + { + 0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011, 0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022, + 0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072, 0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041, + 0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2, 0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1, + 0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1, 0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082, + 0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192, 0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1, + 0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1, 0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2, + 0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151, 0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162, + 0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132, 0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101, + 0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312, 0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321, + 0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371, 0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342, + 0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1, 0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2, + 0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2, 0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381, + 0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291, 0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2, + 0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2, 0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1, + 0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252, 0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261, + 0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231, 0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202, + }; +*/ + +const crc32_t crc::CRC_32_TABLE[256] = +{ + 0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b, 0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61, 0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, + 0x4c11db70, 0x48d0c6c7, 0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75, 0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3, 0x709f7b7a, 0x745e66cd, + 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039, 0x8b27c03c, 0x8fe6dd8b, 0x82a5fb52, 0x8664e6e5, 0xbe2b5b58, 0xbaea46ef, 0xb7a96036, 0xb3687d81, 0xad2f2d84, 0xa9ee3033, 0xa4ad16ea, 0xa06c0b5d, + 0xd4326d90, 0xd0f37027, 0xddb056fe, 0xd9714b49, 0xc7361b4c, 0xc3f706fb, 0xceb42022, 0xca753d95, 0xf23a8028, 0xf6fb9d9f, 0xfbb8bb46, 0xff79a6f1, 0xe13ef6f4, 0xe5ffeb43, 0xe8bccd9a, 0xec7dd02d, + 0x34867077, 0x30476dc0, 0x3d044b19, 0x39c556ae, 0x278206ab, 0x23431b1c, 0x2e003dc5, 0x2ac12072, 0x128e9dcf, 0x164f8078, 0x1b0ca6a1, 0x1fcdbb16, 0x018aeb13, 0x054bf6a4, 0x0808d07d, 0x0cc9cdca, + 0x7897ab07, 0x7c56b6b0, 0x71159069, 0x75d48dde, 0x6b93dddb, 0x6f52c06c, 0x6211e6b5, 0x66d0fb02, 0x5e9f46bf, 0x5a5e5b08, 0x571d7dd1, 0x53dc6066, 0x4d9b3063, 0x495a2dd4, 0x44190b0d, 0x40d816ba, + 0xaca5c697, 0xa864db20, 0xa527fdf9, 0xa1e6e04e, 0xbfa1b04b, 0xbb60adfc, 0xb6238b25, 0xb2e29692, 0x8aad2b2f, 0x8e6c3698, 0x832f1041, 0x87ee0df6, 0x99a95df3, 0x9d684044, 0x902b669d, 0x94ea7b2a, + 0xe0b41de7, 0xe4750050, 0xe9362689, 0xedf73b3e, 0xf3b06b3b, 0xf771768c, 0xfa325055, 0xfef34de2, 0xc6bcf05f, 0xc27dede8, 0xcf3ecb31, 0xcbffd686, 0xd5b88683, 0xd1799b34, 0xdc3abded, 0xd8fba05a, + 0x690ce0ee, 0x6dcdfd59, 0x608edb80, 0x644fc637, 0x7a089632, 0x7ec98b85, 0x738aad5c, 0x774bb0eb, 0x4f040d56, 0x4bc510e1, 0x46863638, 0x42472b8f, 0x5c007b8a, 0x58c1663d, 0x558240e4, 0x51435d53, + 0x251d3b9e, 0x21dc2629, 0x2c9f00f0, 0x285e1d47, 0x36194d42, 0x32d850f5, 0x3f9b762c, 0x3b5a6b9b, 0x0315d626, 0x07d4cb91, 0x0a97ed48, 0x0e56f0ff, 0x1011a0fa, 0x14d0bd4d, 0x19939b94, 0x1d528623, + 0xf12f560e, 0xf5ee4bb9, 0xf8ad6d60, 0xfc6c70d7, 0xe22b20d2, 0xe6ea3d65, 0xeba91bbc, 0xef68060b, 0xd727bbb6, 0xd3e6a601, 0xdea580d8, 0xda649d6f, 0xc423cd6a, 0xc0e2d0dd, 0xcda1f604, 0xc960ebb3, + 0xbd3e8d7e, 0xb9ff90c9, 0xb4bcb610, 0xb07daba7, 0xae3afba2, 0xaafbe615, 0xa7b8c0cc, 0xa379dd7b, 0x9b3660c6, 0x9ff77d71, 0x92b45ba8, 0x9675461f, 0x8832161a, 0x8cf30bad, 0x81b02d74, 0x857130c3, + 0x5d8a9099, 0x594b8d2e, 0x5408abf7, 0x50c9b640, 0x4e8ee645, 0x4a4ffbf2, 0x470cdd2b, 0x43cdc09c, 0x7b827d21, 0x7f436096, 0x7200464f, 0x76c15bf8, 0x68860bfd, 0x6c47164a, 0x61043093, 0x65c52d24, + 0x119b4be9, 0x155a565e, 0x18197087, 0x1cd86d30, 0x029f3d35, 0x065e2082, 0x0b1d065b, 0x0fdc1bec, 0x3793a651, 0x3352bbe6, 0x3e119d3f, 0x3ad08088, 0x2497d08d, 0x2056cd3a, 0x2d15ebe3, 0x29d4f654, + 0xc5a92679, 0xc1683bce, 0xcc2b1d17, 0xc8ea00a0, 0xd6ad50a5, 0xd26c4d12, 0xdf2f6bcb, 0xdbee767c, 0xe3a1cbc1, 0xe760d676, 0xea23f0af, 0xeee2ed18, 0xf0a5bd1d, 0xf464a0aa, 0xf9278673, 0xfde69bc4, + 0x89b8fd09, 0x8d79e0be, 0x803ac667, 0x84fbdbd0, 0x9abc8bd5, 0x9e7d9662, 0x933eb0bb, 0x97ffad0c, 0xafb010b1, 0xab710d06, 0xa6322bdf, 0xa2f33668, 0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4 +}; + + +crc::~crc() +{ + +} + +/********************************************************************* + * + * Function: reflect() + * + * Description: Reorder the bits of a binary sequence, by reflecting + * them about the middle position. + * + * Notes: No checking is done that nBits <= 32. + * + * Returns: The reflection of the original data. + * + *********************************************************************/ +unsigned32_t +crc::reflect(unsigned32_t data, unsigned char nBits) +{ + unsigned32_t reflection = 0x00000000; + unsigned char bit; + + /* + * Reflect the data about the center bit. + */ + for (bit = 0; bit < nBits; ++bit) + { + /* + * If the LSB bit is set, set the reflection of it. + */ + if (data & 0x01) + { + reflection |= (1 << ((nBits - 1) - bit)); + } + + data = (data >> 1); + } + + return (reflection); + +} /* reflect() */ + + + + + + + +/********************************************************************* + * + * Function: crcInit() + * + * Description: Populate the partial CRC lookup table. + * + * Notes: This function must be rerun any time the CRC standard + * is changed. If desired, it can be run "offline" and + * the table results stored in an embedded system's ROM. + * + * Returns: None defined. + * + *********************************************************************/ +crc::crc() +{ + +} /* crcInit() */ + + +/********************************************************************* + * + * Function: crcFast() + * + * Description: Compute the CRC of a given message. + * + * Notes: crcInit() must be called first. + * + * Returns: The CRC of the message. + * + *********************************************************************/ +crc32_t +crc::get(string& message) +{ + + unsigned char data; + size_t byte; + + crc32_t remainder = INITIAL_REMAINDER; + /* + * Divide the message by the polynomial, a byte at a time. + */ + size_t nBytes = message.size(); + for (byte = 0; byte < nBytes; ++byte) + { + data = (unsigned char)(REFLECT_DATA(message[byte]) ^ (remainder >> (WIDTH - 8))); + remainder = crc::CRC_32_TABLE[data] ^ (remainder << 8); + } + + /* + * The final remainder is the CRC. + */ + return (REFLECT_REMAINDER(remainder) ^ FINAL_XOR_VALUE); + +} /* crcFast() */ + + +crc32_t +crc::get() +{ + return get(m_data); +} + + +string& crc::getdata() +{ + return m_data; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: crc.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:53 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/crc.h b/uppdev/XLS/crc.h new file mode 100644 index 000000000..54840e2dd --- /dev/null +++ b/uppdev/XLS/crc.h @@ -0,0 +1,104 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/crc.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef _crc_h +#define _crc_h + +#include + +#include +#include +#include + +#define FALSE 0 +#define TRUE !FALSE + +/* + * Select the CRC standard from the list that follows. + */ +#define CRC32 + +#define CRC_NAME "CRC-32" + +#define POLYNOMIAL 0x04C11DB7 +#define INITIAL_REMAINDER 0xFFFFFFFF +#define FINAL_XOR_VALUE 0xFFFFFFFF +#define REFLECT_DATA TRUE +#define REFLECT_REMAINDER TRUE +#define CHECK_VALUE 0xCBF43926 + +namespace xlslib_core +{ + + typedef unsigned32_t crc32_t; + + class crc + { + public: + crc(); + ~crc(); + + crc32_t get(std::string& message); + crc32_t get(); + + void operator<<(std::string newstr) { m_data += newstr; } + void operator<<(unsigned32_t newdata) { m_data += str_stream(newdata); } + void operator<<(unsigned64_t newdata) { m_data += str_stream(newdata); } + void operator<<(unsigned char newdata) { m_data += str_stream(newdata); } + void operator<<(unsigned short newdata) { m_data += str_stream(newdata); } + void operator<<(bool newdata) { m_data += str_stream(newdata); } + void operator<<(double newdata) { m_data += str_stream(newdata); } + + std::string& getdata(); + private: + std::string m_data; + static const crc32_t CRC_32_TABLE[256]; + unsigned32_t reflect(unsigned32_t data, unsigned char nBits); + }; + +} + +#endif /* _crc_h */ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: crc.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/data/data3.h b/uppdev/XLS/data/data3.h new file mode 100644 index 000000000..f3e84f815 --- /dev/null +++ b/uppdev/XLS/data/data3.h @@ -0,0 +1,314 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/data/data3.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef DATA3_H +#define DATA3_H + +// 4096 of the first bytes + +const unsigned8_t xlslib_core::CSummaryInfo::summ_info_data[] = { + 0xfe, 0xff, 0x00, 0x00, 0x05, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe0, 0x85, 0x9f, 0xf2, + 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9, 0x30, 0x00, 0x00, 0x00, + 0xfc, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, + 0x0d, 0x00, 0x00, 0x00, 0xe8, 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0xe4, 0x04, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x58, 0x4c, 0x53, 0x4c, 0x49, 0x42, 0x20, 0x53, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x00, 0x73, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x58, 0x4c, 0x53, 0x4c, 0x69, 0x62, 0x20, 0x76, + 0x58, 0x2e, 0x58, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x59, 0x65, 0x69, 0x63, + 0x6f, 0x20, 0x53, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x0d, 0x0a, 0x77, 0x77, 0x77, 0x2e, + 0x79, 0x65, 0x69, 0x63, 0x6f, 0x2e, 0x63, 0x6f, 0x6d, 0x0d, 0x0a, 0x00, 0x1e, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x44, 0x61, 0x72, 0x69, 0x6f, 0x20, 0x47, 0x6f, 0x6e, 0x7a, 0x61, 0x6c, + 0x65, 0x7a, 0x00, 0x0a, 0x1e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x4d, 0x69, 0x63, 0x72, + 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x45, 0x78, 0x63, 0x65, 0x6c, 0x00, 0x40, 0x00, 0x00, 0x00, + 0x80, 0x7f, 0x5b, 0x0d, 0xb9, 0xa0, 0xc3, 0x01, 0x40, 0x00, 0x00, 0x00, 0x80, 0xd2, 0xc0, 0xa4, + 0xb9, 0xa0, 0xc3, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + + // Master blocks + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +#endif //DATA3_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: data3.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:59 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/data/data4.h b/uppdev/XLS/data/data4.h new file mode 100644 index 000000000..65db5f181 --- /dev/null +++ b/uppdev/XLS/data/data4.h @@ -0,0 +1,315 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/data/data4.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef DATA4_H +#define DATA4_H + + +//////////////////////////////////////////////////////////////////////// + +const unsigned8_t xlslib_core::CDocSummaryInfo::doc_summ_info_data[] = { + 0xfe, 0xff, 0x00, 0x00, 0x05, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0xd5, 0xcd, 0xd5, + 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae, 0x30, 0x00, 0x00, 0x00, + 0x98, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x0f, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x4c, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x54, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xe4, 0x04, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x69, 0x63, 0x72, 0x0b, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x10, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x48, 0x6f, 0x6a, 0x61, 0x31, 0x00, 0x0c, 0x10, + 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0x48, 0x6f, + 0x6a, 0x61, 0x73, 0x20, 0x64, 0x65, 0x20, 0x63, 0xe1, 0x6c, 0x63, 0x75, 0x6c, 0x6f, 0x00, 0x03, + 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + + +#endif //DATA4_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + + * $Log: data4.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:59 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + diff --git a/uppdev/XLS/datast.cpp b/uppdev/XLS/datast.cpp new file mode 100644 index 000000000..c6d0f8592 --- /dev/null +++ b/uppdev/XLS/datast.cpp @@ -0,0 +1,89 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/datast.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +namespace xlslib_core +{ + +/* +*********************************** +CDataStorage class Implementation +*********************************** +*/ + + CDataStorage::CDataStorage() + :m_DataSize(0) + { + + } + + CDataStorage::~CDataStorage() + { + // Delete all the data. (Only if it exists) + if(!empty()) + { + do + { + delete front(); + pop_front(); + + }while(!empty()); + } + } + + + void CDataStorage::operator+=(CUnit* from) + { + push_back(from); + m_DataSize += from->GetDataSize(); + + } + + unsigned32_t CDataStorage::GetDataSize() + { + return m_DataSize; + } +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: datast.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/datast.h b/uppdev/XLS/datast.h new file mode 100644 index 000000000..3e7a4e883 --- /dev/null +++ b/uppdev/XLS/datast.h @@ -0,0 +1,84 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/datast.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +#ifndef DATAST_H +#define DATAST_H + +#include +#include +#include + +/* +****************************** +COleFile class declaration +****************************** +*/ + +namespace xlslib_core +{ + + typedef std::list DataList_t; + typedef DataList_t::iterator DataList_Itor_t; + + class CDataStorage: public DataList_t + { + private: + unsigned32_t m_DataSize; + + protected: + + + public: + CDataStorage ( ); + ~CDataStorage ( ); + + void operator+=(CUnit* from); + unsigned32_t GetDataSize(); + + }; +} +#endif //DATAST_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: datast.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:54 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/docsumminfo.cpp b/uppdev/XLS/docsumminfo.cpp new file mode 100644 index 000000000..542b3dbc2 --- /dev/null +++ b/uppdev/XLS/docsumminfo.cpp @@ -0,0 +1,85 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/docsumminfo.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include // Temporarilly used to add data for summary info + +using namespace std; +using namespace xlslib_core; + +/* +********************************************************************** +CDocSummaryInfo class implementation +********************************************************************** +*/ + +CDocSummaryInfo::CDocSummaryInfo() +{ + XTRACE("WRITE_DOC_SUMMARY"); + + CUnit* ptraildata = new CUnit; + ptraildata->AddDataArray(CDocSummaryInfo::doc_summ_info_data, sizeof(CDocSummaryInfo::doc_summ_info_data)); + (*this) += ptraildata; +} + +CDocSummaryInfo::~CDocSummaryInfo() +{ + + +} + + +/* +*********************************** +*********************************** +*/ + +CUnit* CDocSummaryInfo::DumpData(void) +{ + + XTRACE("CDocSummaryInfo::DumpData"); + return (CUnit*)this; +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: docsumminfo.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/docsumminfo.h b/uppdev/XLS/docsumminfo.h new file mode 100644 index 000000000..63ef32d03 --- /dev/null +++ b/uppdev/XLS/docsumminfo.h @@ -0,0 +1,78 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright (C) Yeico S. A. de C. V. + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/docsumminfo.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef DOCSUMMARYINFO_H +#define DOCSUMMARYINFO_H + +#include +#include +#include + + +namespace xlslib_core +{ + + /* +******************************** +CDocSummaryInfo class declaration +******************************** +*/ + + + class CDocSummaryInfo: public CDataStorage + { + private: + static const unsigned8_t doc_summ_info_data[]; + + protected: + + public: + CDocSummaryInfo(); + ~CDocSummaryInfo(); + + CUnit* DumpData(); + + }; + +} +#endif //DOCSUMMARYINFO_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: docsumminfo.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:54 darioglz + * Initial Import. + * + * Revision 1.6 2004/04/06 22:35:43 dgonzalez + * + Added namespace xlslib_core to isolate the core xlslib library names. + * + * Revision 1.5 2004/01/29 03:18:55 dgonzalez + * + Using the config.h file + * + * Revision 1.4 2003/12/05 00:30:06 dgonzalez + * + Common include files were placed in common.h (and this file was + * included instead. + * + * Revision 1.3 2003/11/26 16:49:26 dgonzalez + * + Indented and untabified + * + * Revision 1.2 2003/10/24 23:24:32 dgonzalez + * + Added CVS-Keyword substitution. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/uppdev/XLS/extformat.cpp b/uppdev/XLS/extformat.cpp new file mode 100644 index 000000000..a7be2f254 --- /dev/null +++ b/uppdev/XLS/extformat.cpp @@ -0,0 +1,1363 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/extformat.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include + +/* +********************************** +CExtFormat class implementation +********************************** +*/ + +using namespace std; +using namespace xlslib_core; + + +CExtFormat::CExtFormat(bool is_cell) +{ + SetRecordType(RECTYPE_XF); + InitDummy(is_cell); + SetRecordLength(GetDataSize()-4); +} + +CExtFormat::CExtFormat(xf_t* xfdef) +{ + SetRecordType(RECTYPE_XF); + InitDummy(xfdef->IsCell()); + SetRecordLength(GetDataSize()-4); + +// Here initialize the record with the values from the input structure + + SetFontIndex(xfdef->GetFontIndex()); + SetFormatIndex(xfdef->GetFormatIndex()); + SetHorizAlign(xfdef->GetHAlign()); + SetVertAlign(xfdef->GetVAlign()); + SetIndent(xfdef->GetIndent()); + SetTxtOrientation(xfdef->GetTxtOrientation()); + + SetFGColorIndex(xfdef->GetFillFGColor()); + SetBGColorIndex(xfdef->GetFillBGColor()); + SetFillPattern(xfdef->GetFillStyle()); + + if(xfdef->IsLocked()) SetLocked(); + if(xfdef->IsHidden()) SetHidden(); + if(xfdef->IsWrap()) SetWrap(); + + SetBorder(BORDER_BOTTOM, xfdef->GetBorderStyle(BORDER_BOTTOM), + xfdef->GetBorderColor(BORDER_BOTTOM)); + SetBorder(BORDER_TOP, xfdef->GetBorderStyle(BORDER_TOP), + xfdef->GetBorderColor(BORDER_TOP)); + SetBorder(BORDER_LEFT, xfdef->GetBorderStyle(BORDER_LEFT), + xfdef->GetBorderColor(BORDER_LEFT)); + SetBorder(BORDER_RIGHT, xfdef->GetBorderStyle(BORDER_RIGHT), + xfdef->GetBorderColor(BORDER_RIGHT)); +} + +CExtFormat::~CExtFormat() +{ +} + + +/* +********************************** +********************************** +*/ +void CExtFormat::InitDummy(bool is_cell) +{ + + // An style-XF record is set by default. + // Each field has to be modified individually before use it + + //The default style is a dummy. The flags that indicate what the style affects (byte 11) + // are disabled (set to 1). + unsigned8_t xfdefault[] = { + +#if VERSION_BIFF == VERSION_BIFF5 +/* + Open Office offsets + 0 2 4 6 8 10 12 14 16 18 20 + 0x00,0x00,0x00,0x00,0xf4,0xff,0x20,0xf0,0xc0,0x00,0x01,0x00,0x00,0x00,0x00,0x00 <- ORIGINAL +*/ + 0x00,0x00,0x00,0x00,0xf4,0xff,0x20,0xf0,0xc0,0x20,0x01,0x00,0x00,0x00,0x00,0x00, + // STYLE_XF | INDEX=0xFFF -> Style + // HALIGN -> General, VALIGN -> BOTTOM + // IGNORE TOP 4 bits (style issue) + // 0x40 Pattern Color, then lowest bit of 0x41 (next) + // 0x41 Pattern background color right shifted one bit + // Fill Pattern -> 1 Black (well, fully colored, not a pattern) + +#else + 0x00,0x00,0x00,0x00,0xf4,0xff,0x20,0x00,0x00,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0xc0,0x20 + // STYLE_XF | INDEX=0xFFF -> Style + // HALIGN -> General, VALIGN -> BOTTOM + // IGNORE TOP 4 bits (style issue) + // Fill Pattern -> 1 Black, left shifted 2 bits + // 0x40 Pattern Color, then lowest bit of 0x41 (next) + // 0x41 Pattern background color right shifted one bit +#endif + + }; + + AddDataArray(xfdefault, sizeof(xfdefault)); + + if(is_cell) + { + unsigned16_t value; + + // Get the field where options are set + GetValue16From((signed16_t*)&value, XF_OFFSET_PROP); + // Set the cell's style parent to Normal + value &= (~XF_PROP_XFPARENT); + // Set the style = cell. + value &= (~XF_PROP_STYLE); + + SetValueAt((signed16_t)value, XF_OFFSET_PROP); + + // The cell doesn't heritage anything from its parent style + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + + value &= (~(XF_ALIGN_ATRFONT|XF_ALIGN_ATRALC|XF_ALIGN_ATRBDR|XF_ALIGN_ATRPAT|XF_ALIGN_ATRPROT)); + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); + } +} + +/* +********************************** +********************************** +*/ +bool CExtFormat::IsCell() +{ + unsigned16_t val; + GetValue16From((signed16_t*)&val, XF_OFFSET_PROP); + + + return(val&XF_PROP_STYLE?true:false); + +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetFlag(unsigned16_t flag) +{ + + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + + if(IsCell()) + { + // Cells indicate that a characteristic is not equal + // from its parent with the flag set. + value |= flag; + } + else + { + // Styles indicate that a characteristic is + // being implemented with the flag cleared. + value &= (~flag); + } + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); + +} + +/* +********************************** +********************************** +*/ +void CExtFormat::ClearFlag(unsigned16_t flag) +{ + + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + + if(!IsCell()) + { + // Cells indicate that a characteristic is not equal + // from its parent with the flag set. + value |= flag; + } + else + { + // Styles indicate that a characteristic is + // being implemented with the flag cleared. + value &= (~flag); + } + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); + +} +/* +********************************** +********************************** +*/ +int CExtFormat::SetFontIndex(unsigned16_t fontindex) +{ + // Set the index value + int errcode = SetValueAt((signed16_t)fontindex, XF_OFFSET_FONT); + + // Set the related flag. + SetFlag(XF_ALIGN_ATRFONT); + + return errcode; +} + +/* +********************************** +********************************** +*/ +unsigned16_t CExtFormat::GetFontIndex(void) +{ + unsigned16_t fontval; + GetValue16From((signed16_t*)&fontval, XF_OFFSET_FONT); + + return(fontval); +} + +/* +********************************** +********************************** +*/ +int CExtFormat::SetFormatIndex(unsigned16_t formatindex) +{ + // Set the index value + int errcode = SetValueAt((signed16_t)formatindex, XF_OFFSET_FORMAT); + + // Set the related flag. + SetFlag(XF_ALIGN_ATRNUM); + + return errcode; +} + +/* +********************************** +********************************** +*/ +unsigned16_t CExtFormat::GetFormatIndex(void) +{ + unsigned16_t formatval; + GetValue16From((signed16_t*)&formatval, XF_OFFSET_FORMAT); + + return(formatval); +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetLocked() +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_PROP); + + value |= XF_PROP_LOCKED; + + SetValueAt((signed16_t)value, XF_OFFSET_PROP); + + SetFlag(XF_ALIGN_ATRPROT); +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetHidden() +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_PROP); + + value |= XF_PROP_HIDDEN; + + SetValueAt((signed16_t)value, XF_OFFSET_PROP); + + SetFlag(XF_ALIGN_ATRPROT); +} + + +/* +********************************** +********************************** +*/ +void CExtFormat::SetHorizAlign(unsigned8_t alignval) +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + value = (value&(~XF_ALIGN_HORIZONTAL))|(alignval & XF_ALIGN_HORIZONTAL); + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); + + SetFlag(XF_ALIGN_ATRALC); +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetWrap() +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + + value |= XF_ALIGN_WRAP; + + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); + + SetFlag(XF_ALIGN_ATRALC); +} +#if VERSION_BIFF == VERSION_BIFF8 +/* +********************************** +********************************** +*/ + +void CExtFormat::SetIndent(unsigned8_t indentval) +{ + unsigned32_t value, mask; + + + if(indentval & XF_INDENT_LVL) { + mask = XF_INDENT_LVL; + } else + if(indentval & XF_INDENT_SHRINK2FIT) { + mask = XF_INDENT_SHRINK2FIT; + } else + if(indentval & (XF_INDENT_CONTEXT|XF_INDENT_L2R|XF_INDENT_R2L)) { + mask = XF_INDENT_DIR; + } else { + mask = XF_INDENT_LVL | XF_INDENT_SHRINK2FIT | XF_INDENT_DIR; + } + + mask <<= XF_INDENT_SHIFTPOS; + + GetValue32From((signed32_t*)&value, XF_OFFSET_ALIGN); + + unsigned32_t indentval32 = (unsigned32_t)indentval << XF_INDENT_SHIFTPOS; // Place the option at the right bit position + value = (value&(~mask))|(indentval32 & mask); + + SetValueAt((signed32_t)value, XF_OFFSET_ALIGN); +} +#endif +/* +********************************** +********************************** +*/ +void CExtFormat::SetVertAlign(unsigned8_t alignval) +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + unsigned16_t alignval16 = alignval << XF_ALIGN_SHIFTPOS_VALIGN; // Place the option at the right bit position + value = (value&(~XF_ALIGN_VERTICAL))|(alignval16 & XF_ALIGN_VERTICAL); + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); + + SetFlag(XF_ALIGN_ATRALC); +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetTxtOrientation(unsigned8_t alignval) +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_ALIGN); + unsigned16_t alignval16 = alignval << XF_ORI_SHIFTPOS; // Place the option at the right bit position + + value = (value&(~XF_ALIGN_ORIENTATION))|(alignval16 & XF_ALIGN_ORIENTATION); + SetValueAt((signed16_t)value, XF_OFFSET_ALIGN); +} + + +/* +********************************** +********************************** +*/ +void CExtFormat::SetFGColorIndex(unsigned8_t color) +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_COLOR); + + + // value = (value&(~XF_COLOR_FOREGROUND))|(color & XF_COLOR_FOREGROUND); + // Clear the field for Foreground color + value &= (~XF_COLOR_FOREGROUND); + // Set the new color + value |= (color & XF_COLOR_FOREGROUND); + + SetValueAt((signed16_t)value, XF_OFFSET_COLOR); + + SetFlag(XF_ALIGN_ATRPAT); + +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetBGColorIndex(unsigned8_t color) +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_COLOR); + unsigned16_t color16 = color << XF_COLOR_SHIFTPOS_BG; + +// value = (value&(~XF_COLOR_FOREGROUND))|(color16 & XF_COLOR_FOREGROUND); + // Clear the field for Foreground color + value &= (~XF_COLOR_BACKGROUND); + // Set the new color + value |= (color16 & XF_COLOR_BACKGROUND); + + + SetValueAt((signed16_t)value, XF_OFFSET_COLOR); + + SetFlag(XF_ALIGN_ATRPAT); +} + +/* +********************************** +********************************** +*/ +void CExtFormat::SetFillPattern(unsigned8_t pattern) +{ +#if VERSION_BIFF == VERSION_BIFF5 + unsigned16_t value; + GetValue16From((signed16_t*)&value, XF_OFFSET_BORDER0); + + value = (value&(~XF_BORDER_FILLPATTERN))|(pattern & XF_BORDER_FILLPATTERN); + SetValueAt((signed16_t)value, XF_OFFSET_BORDER0); + + SetFlag(XF_ALIGN_ATRPAT); +#else + unsigned32_t value, pattern32 = pattern; + GetValue32From((signed32_t*)&value, XF_OFFSET_BORDERB); + + value &= ~XF_BORDER_FILLPATTERN; + + pattern32 <<= XF_SHIFTPOS_FILLPATTERN; + value |= (pattern32 & XF_BORDER_FILLPATTERN); + SetValueAt((signed16_t)value, XF_OFFSET_BORDERB); + + SetFlag(XF_ALIGN_ATRPAT); +#endif +} + + +/* +********************************** +********************************** +*/ +void CExtFormat::SetBorder(border_side_t border, unsigned16_t style, unsigned16_t color) +{ + + switch(border) + { + + case BORDER_BOTTOM: + { +#if VERSION_BIFF == VERSION_BIFF5 + unsigned16_t value, color16 = color; + + GetValue16From((signed16_t*)&value, XF_OFFSET_BORDER0); + value = (value&(~XF_BORDER_BOTTOMSTYLE))| + ((style<= sizeof(unsigned64_t)) { +// xfcrc<<(unsigned64_t)font; +// } else { + xfcrc<<(unsigned64_t)font; +// } + xfcrc<<(unsigned32_t)format; + xfcrc<MarkUsed(); + +} + +/* +********************************** +********************************** +*/ +bool xf_t::IsUsed(void) +{ + return(m_usage_counter != 0); +} + +/* +********************************** +********************************** +*/ +void xf_t::SetFont(font_t* fontidx) +{ + if(fontidx != NULL) + fontidx->MarkUsed(); + font = fontidx; + + m_sigchanged = true; + +} + +font_t* xf_t::GetFont(void) +{ + return font; +} + +unsigned16_t xf_t::GetFontIndex(void) +{ + if(font != NULL) + return font->GetIndex(); + else + return 0x0000; +} + +/* +********************************** +********************************** +*/ + +void xf_t::SetFormat(format_number_t formatidx){ + + format = formatidx; + m_sigchanged = true; +}; + +unsigned16_t xf_t::GetFormatIndex(void) +{ + return xf_t::FORMAT_NUM_OPTIONS_TABLE[format]; +}; + +format_number_t xf_t::GetFormat(void) +{ + return format; +} +/* +********************************** +********************************** +*/ + +/* Cell option wrappers*/ +void xf_t::SetBorderStyle(border_side_t side, + border_style_t style, + color_name_t color) +{ + switch (side) + { + case BORDER_BOTTOM: + bottom_border_style = BORDERSTYLE_OPTIONS_TABLE[style]; + bottom_border_color = COLOR_OPTIONS_TABLE[color]; + + break; + + case BORDER_TOP: + top_border_style = BORDERSTYLE_OPTIONS_TABLE[style]; + top_border_color = COLOR_OPTIONS_TABLE[color]; + + break; + + case BORDER_LEFT: + left_border_style = BORDERSTYLE_OPTIONS_TABLE[style]; + left_border_color = COLOR_OPTIONS_TABLE[color]; + + break; + + case BORDER_RIGHT: + right_border_style = BORDERSTYLE_OPTIONS_TABLE[style]; + right_border_color = COLOR_OPTIONS_TABLE[color]; + + break; + + default: + // It cannot get here + break; + + } + + m_sigchanged = true; + +} + +/* +********************************** +********************************** +*/ +unsigned8_t xf_t::GetBorderStyle(border_side_t side) +{ + unsigned8_t ret_style = XF_BRDOPTION_NONE; + + switch (side) + { + + case BORDER_BOTTOM: + ret_style = bottom_border_style; + break; + + case BORDER_TOP: + ret_style = top_border_style; + break; + + case BORDER_LEFT: + ret_style = left_border_style; + break; + + case BORDER_RIGHT: + ret_style = right_border_style; + break; + + default: + // It cannot get here + break; + + } + + return ret_style; +} + +/* +********************************** +********************************** +*/ +unsigned8_t xf_t::GetBorderColor(border_side_t side) +{ + unsigned8_t ret_color = XF_COLOR_CODE_BLACK; + + switch (side) + { + + case BORDER_BOTTOM: + ret_color = bottom_border_color; + break; + + case BORDER_TOP: + ret_color = top_border_color; + break; + + case BORDER_LEFT: + ret_color = left_border_color; + break; + + case BORDER_RIGHT: + ret_color = right_border_color; + break; + + default: + // It cannot get here + break; + + } + return ret_color; + +} + +void xf_t::operator=(xf_t& right) +{ + index = 0x0000; + font = right.font; + format = right.format; + halign = right.halign; + valign = right.valign; + indent = right.indent; + + txtorientation = right.txtorientation; + fill_fgcolor = right.fill_fgcolor; + fill_bgcolor = right.fill_bgcolor; + fillstyle = right.fillstyle; + + locked = right.locked; + hidden = right.hidden; + wrap = right.wrap; + is_cell = right.is_cell; + + top_border_style = right.top_border_style; + top_border_color = right.top_border_color; + + bottom_border_style = right.bottom_border_style; + bottom_border_color = right.bottom_border_color; + + left_border_style = right.left_border_style; + left_border_color = right.left_border_color; + + right_border_style = right.right_border_style; + right_border_color = right.right_border_color; + + m_sigchanged = true; + +} + +/* Horizontal Align option wrappers*/ +void xf_t::SetHAlign(halign_option_t ha_option) +{ + halign = xf_t::HALIGN_OPTIONS_TABLE[ha_option]; + m_sigchanged = true; +} + +unsigned8_t xf_t::GetHAlign(void) +{ + return halign; +} + +/* Vertical Align option wrappers*/ +void xf_t::SetVAlign(valign_option_t va_option) +{ + valign = xf_t::VALIGN_OPTIONS_TABLE[va_option]; + m_sigchanged = true; +} + +unsigned8_t xf_t::GetVAlign(void) +{ + return valign; +} + +void xf_t::SetIndent(indent_option_t indent_option) +{ + + indent = xf_t::INDENT_OPTIONS_TABLE[indent_option]; + + m_sigchanged = true; +} +unsigned8_t xf_t::GetIndent(void) +{ + return indent; +} + +/* Text orientation option wrappers*/ +void xf_t::SetTxtOrientation(txtori_option_t ori_option) +{ + txtorientation = xf_t::TXTORI_OPTIONS_TABLE[ori_option]; + m_sigchanged = true; +} + +unsigned8_t xf_t::GetTxtOrientation(void) +{ + return txtorientation; +} + +/* Fill Foreground color option wrappers*/ +void xf_t::SetFillFGColor(color_name_t color) +{ + fill_fgcolor = xf_t::COLOR_OPTIONS_TABLE[color]; + m_sigchanged = true; +} + +unsigned8_t xf_t::GetFillFGColor(void) +{ + return fill_fgcolor; +} + + +/* Fill Background color option wrappers*/ +void xf_t::SetFillBGColor(color_name_t color) +{ + fill_bgcolor = xf_t::COLOR_OPTIONS_TABLE[color]; + m_sigchanged = true; +} + +unsigned8_t xf_t::GetFillBGColor(void) +{ + return fill_bgcolor; +} + +/* Fill Style option wrappers*/ +void xf_t::SetFillStyle(fill_option_t fill) +{ + fillstyle = xf_t::FILL_OPTIONS_TABLE[fill]; + m_sigchanged = true; +} + +unsigned8_t xf_t::GetFillStyle(void) +{ + return fillstyle; +} + +/* Locked option wrappers*/ +void xf_t::SetLocked(bool locked_opt) +{ + locked = locked_opt; + m_sigchanged = true; +} + +bool xf_t::IsLocked(void) +{ + return locked; +} + +/* Hidden option wrappers*/ +void xf_t::SetHidden(bool hidden_opt) +{ + hidden = hidden_opt; + m_sigchanged = true; +} +bool xf_t::IsHidden(void) +{ + return hidden; +} + +/* Wrap option wrappers*/ +void xf_t::SetWrap(bool wrap_opt) +{ + wrap = wrap_opt; + m_sigchanged = true; +}; + +bool xf_t::IsWrap(void) +{ + return wrap; +}; + +/* Cell option wrappers*/ +void xf_t::SetCellMode(bool cellmode) +{ + is_cell = cellmode; + m_sigchanged = true; +} + +bool xf_t::IsCell(void) +{ + return is_cell; +} + + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: extformat.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:48 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/extformat.h b/uppdev/XLS/extformat.h new file mode 100644 index 000000000..854ab8237 --- /dev/null +++ b/uppdev/XLS/extformat.h @@ -0,0 +1,696 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/extformat.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef EXTFORMAT_H +#define EXTFORMAT_H + +#include +#include +#include +#include +#include +#include +#include + +namespace xlslib_core +{ + +// COMMON + + // The Cell Properties bit or-masks: +#define XF_PROP_SHIFTPOS_PARENT (4) + +#define XF_PROP_LOCKED ((unsigned16_t)0x0001) +#define XF_PROP_HIDDEN ((unsigned16_t)0x0002) +#define XF_PROP_STYLE ((unsigned16_t)0x0004) +#define XF_PROP_123PREFIX ((unsigned16_t)0x0008) +#define XF_PROP_XFPARENT ((unsigned16_t)0xFFF0) + + // The Alignment field bit or-masks: +#define XF_ALIGN_HORIZONTAL ((unsigned16_t)0x0007) +#define XF_ALIGN_WRAP ((unsigned16_t)0x0008) +#define XF_ALIGN_VERTICAL ((unsigned16_t)0x0070) +#define XF_ALIGN_JUSTLAST ((unsigned32_t)0x0080) /* BIFF8: Used only in far-east versions of excel */ +#define XF_ALIGN_ORIENTATION ((unsigned16_t)0x0300) + + // Geometric Align options +#define XF_ALIGN_SHIFTPOS_HALIGN (0) +#define XF_ALIGN_SHIFTPOS_VALIGN (4) + + // XF_USED_ATTRIB +#define XF_ALIGN_ATRNUM ((unsigned16_t)0x0400) +#define XF_ALIGN_ATRFONT ((unsigned16_t)0x0800) +#define XF_ALIGN_ATRALC ((unsigned16_t)0x1000) +#define XF_ALIGN_ATRBDR ((unsigned16_t)0x2000) +#define XF_ALIGN_ATRPAT ((unsigned16_t)0x4000) +#define XF_ALIGN_ATRPROT ((unsigned16_t)0x8000) + + // Style options +#define XF_FILL_NONE ((unsigned8_t)0x00) +#define XF_FILL_SOLID ((unsigned8_t)0x01) +#define XF_FILL_ATEN75 ((unsigned8_t)0x03) +#define XF_FILL_ATEN50 ((unsigned8_t)0x02) +#define XF_FILL_ATEN25 ((unsigned8_t)0x04) +#define XF_FILL_ATEN12 ((unsigned8_t)0x11) +#define XF_FILL_ATEN06 ((unsigned8_t)0x12) +#define XF_FILL_HORIZ_LIN ((unsigned8_t)0x05) +#define XF_FILL_VERTICAL_LIN ((unsigned8_t)0x06) +#define XF_FILL_DIAG ((unsigned8_t)0x07) +#define XF_FILL_INV_DIAG ((unsigned8_t)0x08) +#define XF_FILL_INTER_DIAG ((unsigned8_t)0x09) +#define XF_FILL_DIAG_THICK_INTER ((unsigned8_t)0x0a) +#define XF_FILL_HORIZ_LINES_THIN ((unsigned8_t)0x0b) +#define XF_FILL_VERTICAL_LINES_THIN ((unsigned8_t)0x0c) +#define XF_FILL_DIAG_THIN ((unsigned8_t)0x0d) +#define XF_FILL_INV_DIAG_THIN ((unsigned8_t)0x0e) +#define XF_FILL_HORIZ_INT_THIN ((unsigned8_t)0x0f) +#define XF_FILL_HORIZ_INTER_THICK ((unsigned8_t)0x10) + typedef enum + { + FILL_NONE = 0, + FILL_SOLID, + FILL_ATEN75, + FILL_ATEN50, + FILL_ATEN25, + FILL_ATEN12, + FILL_ATEN06, + FILL_HORIZ_LIN, + FILL_VERTICAL_LIN, + FILL_DIAG, + FILL_INV_DIAG, + FILL_INTER_DIAG, + FILL_DIAG_THICK_INTER, + FILL_HORIZ_LINES_THIN, + FILL_VERTICAL_LINES_THIN, + FILL_DIAG_THIN, + FILL_INV_DIAG_THIN, + FILL_HORIZ_INT_THIN, + FILL_HORIZ_INTER_THICK + } fill_option_t; + + // Border Options +#define XF_BRDOPTION_NONE ((unsigned8_t)0x00) +#define XF_BRDOPTION_THIN ((unsigned8_t)0x01) +#define XF_BRDOPTION_MEDIUM ((unsigned8_t)0x02) +#define XF_BRDOPTION_DASHED ((unsigned8_t)0x03) +#define XF_BRDOPTION_DOTTED ((unsigned8_t)0x04) +#define XF_BRDOPTION_THICK ((unsigned8_t)0x05) +#define XF_BRDOPTION_DOUBLE ((unsigned8_t)0x06) +#define XF_BRDOPTION_HAIR ((unsigned8_t)0x07) + typedef enum + { + BORDER_NONE = 0, + BORDER_THIN, + BORDER_MEDIUM, + BORDER_DASHED, + BORDER_DOTTED, + BORDER_THICK, + BORDER_DOUBLE, + BORDER_HAIR + } border_style_t; + + // Border options +#define XF_BORDER_BOTTOM ((unsigned8_t)0) +#define XF_BORDER_TOP ((unsigned8_t)1) +#define XF_BORDER_LEFT ((unsigned8_t)2) +#define XF_BORDER_RIGHT ((unsigned8_t)3) + typedef enum + { + BORDER_BOTTOM = 0, + BORDER_TOP, + BORDER_LEFT, + BORDER_RIGHT, + DIAGONALS // BIFF8 + } border_side_t; + + // Horizontal Align options +#define XF_HALIGN_GENERAL ((unsigned8_t)0) +#define XF_HALIGN_LEFT ((unsigned8_t)1) +#define XF_HALIGN_CENTER ((unsigned8_t)2) +#define XF_HALIGN_RIGHT ((unsigned8_t)3) +#define XF_HALIGN_FILL ((unsigned8_t)4) +#define XF_HALIGN_JUSTIFY ((unsigned8_t)5) +#define XF_HALIGN_CENTERACCROSS ((unsigned8_t)6) + typedef enum + { + HALIGN_GENERAL = 0, + HALIGN_LEFT, + HALIGN_CENTER, + HALIGN_RIGHT, + HALIGN_FILL, + HALIGN_JUSTIFY, + HALIGN_CENTERACCROSS + } halign_option_t; + + // Vertical Align options +#define XF_VALIGN_TOP ((unsigned8_t)0) +#define XF_VALIGN_CENTER ((unsigned8_t)1) +#define XF_VALIGN_BOTTOM ((unsigned8_t)2) +#define XF_VALIGN_JUSTIFY ((unsigned8_t)3) + typedef enum + { + VALIGN_TOP = 0, + VALIGN_CENTER, + VALIGN_BOTTOM, + VALIGN_JUSTIFY + } valign_option_t; + + +#define XF_COLOR_CODE_BLACK ((unsigned8_t)(COLOR_CODE_BLACK)) +#define XF_COLOR_CODE_DARK_RED ((unsigned8_t)(COLOR_CODE_DARK_RED)) +#define XF_COLOR_CODE_RED ((unsigned8_t)(COLOR_CODE_RED)) +#define XF_COLOR_CODE_FUCSIA ((unsigned8_t)(COLOR_CODE_FUCSIA)) +#define XF_COLOR_CODE_COMBINED01 ((unsigned8_t)(COLOR_CODE_COMBINED01)) +#define XF_COLOR_CODE_COMBINED02 ((unsigned8_t)(COLOR_CODE_COMBINED02)) +#define XF_COLOR_CODE_COMBINED03 ((unsigned8_t)(COLOR_CODE_COMBINED03)) +#define XF_COLOR_CODE_COMBINED04 ((unsigned8_t)(COLOR_CODE_COMBINED04)) +#define XF_COLOR_CODE_COMBINED05 ((unsigned8_t)(COLOR_CODE_COMBINED05)) +#define XF_COLOR_CODE_COMBINED06 ((unsigned8_t)(COLOR_CODE_COMBINED06)) +#define XF_COLOR_CODE_OLIVE ((unsigned8_t)(COLOR_CODE_OLIVE)) +#define XF_COLOR_CODE_DARK_YELLOW ((unsigned8_t)(COLOR_CODE_DARK_YELLOW)) +#define XF_COLOR_CODE_COMBINED07 ((unsigned8_t)(COLOR_CODE_COMBINED07)) +#define XF_COLOR_CODE_YELLOW ((unsigned8_t)(COLOR_CODE_YELLOW)) +#define XF_COLOR_CODE_LIGHT_YELLOW ((unsigned8_t)(COLOR_CODE_LIGHT_YELLOW)) +#define XF_COLOR_CODE_DARK_GREEN ((unsigned8_t)(COLOR_CODE_DARK_GREEN)) +#define XF_COLOR_CODE_GREEN ((unsigned8_t)(COLOR_CODE_GREEN)) +#define XF_COLOR_CODE_COMBINED08 ((unsigned8_t)(COLOR_CODE_COMBINED08)) +#define XF_COLOR_CODE_LIVING_GREEN ((unsigned8_t)(COLOR_CODE_LIVING_GREEN)) +#define XF_COLOR_CODE_LIGHT_GREEN ((unsigned8_t)(COLOR_CODE_LIGHT_GREEN)) +#define XF_COLOR_CODE_COMBINED09 ((unsigned8_t)(COLOR_CODE_COMBINED09)) +#define XF_COLOR_CODE_BLUE_GREEN ((unsigned8_t)(COLOR_CODE_BLUE_GREEN)) +#define XF_COLOR_CODE_AQUAMARINA ((unsigned8_t)(COLOR_CODE_AQUAMARINA)) +#define XF_COLOR_CODE_TURQOISE ((unsigned8_t)(COLOR_CODE_TURQOISE)) +#define XF_COLOR_CODE_COMBINED10 ((unsigned8_t)(COLOR_CODE_COMBINED10)) +#define XF_COLOR_CODE_DARK_BLUE ((unsigned8_t)(COLOR_CODE_DARK_BLUE)) +#define XF_COLOR_CODE_BLUE ((unsigned8_t)(COLOR_CODE_BLUE)) +#define XF_COLOR_CODE_LIGHT_BLUE ((unsigned8_t)(COLOR_CODE_LIGHT_BLUE)) +#define XF_COLOR_CODE_SKY_BLUE ((unsigned8_t)(COLOR_CODE_SKY_BLUE)) +#define XF_COLOR_CODE_COMBINED11 ((unsigned8_t)(COLOR_CODE_COMBINED11)) +#define XF_COLOR_CODE_INDIGO ((unsigned8_t)(COLOR_CODE_INDIGO)) +#define XF_COLOR_CODE_BLUE_GRAY ((unsigned8_t)(COLOR_CODE_BLUE_GRAY)) +#define XF_COLOR_CODE_VIOLET ((unsigned8_t)(COLOR_CODE_VIOLET)) +#define XF_COLOR_CODE_PLUM ((unsigned8_t)(COLOR_CODE_PLUM)) +#define XF_COLOR_CODE_LAVANDER ((unsigned8_t)(COLOR_CODE_LAVANDER)) +#define XF_COLOR_CODE_COMBINED12 ((unsigned8_t)(COLOR_CODE_COMBINED12)) +#define XF_COLOR_CODE_GRAY50 ((unsigned8_t)(COLOR_CODE_GRAY50)) +#define XF_COLOR_CODE_GRAY40 ((unsigned8_t)(COLOR_CODE_GRAY40)) +#define XF_COLOR_CODE_GRAY25 ((unsigned8_t)(COLOR_CODE_GRAY25)) +#define XF_COLOR_CODE_WHITE ((unsigned8_t)(COLOR_CODE_WHITE)) + +#define XF_LOCKED true +#define XF_NO_LOCKED false + +#define XF_HIDDEN true +#define XF_NO_HIDDEN false + +#define XF_WRAPPED true +#define XF_NO_WRAPPED false + +#define XF_IS_CELL true +#define XF_IS_STYLE false + + + + + + + + // The XF-record field offsets: +#if VERSION_BIFF == VERSION_BIFF5 + +#define XF_OFFSET_FONT ((unsigned32_t) 4) +#define XF_OFFSET_FORMAT ((unsigned32_t) 6) +#define XF_OFFSET_PROP ((unsigned32_t) 8) +#define XF_OFFSET_ALIGN ((unsigned32_t)10) // 2 bytes +#define XF_OFFSET_COLOR ((unsigned32_t)12) +#define XF_OFFSET_BORDER0 ((unsigned32_t)14) +#define XF_OFFSET_BORDER1 ((unsigned32_t)16) +#define XF_OFFSET_BORDER2 ((unsigned32_t)18) + + // Text Orientation Options +#define XF_ORI_SHIFTPOS (8) +#define XF_ORI_NONE ((unsigned8_t)0) +#define XF_ORI_TOPBOTTOMTXT ((unsigned8_t)1) +#define XF_ORI_90NOCLOCKTXT ((unsigned8_t)2) +#define XF_ORI_90CLOCKTXT ((unsigned8_t)3) + typedef enum + { + ORI_NONE = 0, + ORI_TOPBOTTOMTXT, + ORI_90NOCLOCKTXT, + ORI_90CLOCKTXT + } txtori_option_t; + + // XF_USED_ATTRIB +#define XF_ATTRIB_SHIFTPOS (0) + + // The Color field bit or-masks: +#define XF_COLOR_FOREGROUND ((unsigned16_t)0x007f) +#define XF_COLOR_BACKGROUND ((unsigned16_t)0x1f80) + +#define XF_COLOR_SHIFTPOS_FG (0) +#define XF_COLOR_SHIFTPOS_BG (7) + + // The Border0 field bit or-masks: + +#define XF_STYLE_SHIFTPOS_BOTTOM (6) +#define XF_COLOR_SHIFTPOS_BOTTOM (9) + +#define XF_BORDER_FILLPATTERN ((unsigned16_t)0x003f) +#define XF_BORDER_BOTTOMSTYLE ((unsigned16_t)0x01c0) +#define XF_BORDER_BOTTOMCOLOR ((unsigned16_t)0xfe00) + + // The Border1 field bit or-masks: +#define XF_STYLE_SHIFTPOS_TOP (0) +#define XF_STYLE_SHIFTPOS_LEFT (3) +#define XF_STYLE_SHIFTPOS_RIGHT (6) +#define XF_COLOR_SHIFTPOS_TOP (9) + +#define XF_BORDER_TOPSTYLE ((unsigned16_t)0x0007) +#define XF_BORDER_LEFTSTYLE ((unsigned16_t)0x0038) +#define XF_BORDER_RIGHTSTYLE ((unsigned16_t)0x01c0) +#define XF_BORDER_TOPCOLOR ((unsigned16_t)0xfe00) + + // The Border2 field bit or-masks: +#define XF_COLOR_SHIFTPOS_LEFT (0) +#define XF_COLOR_SHIFTPOS_RIGHT (7) + +#define XF_BORDER_LEFTCOLOR ((unsigned16_t)0x007f) +#define XF_BORDER_RIGHTCOLOR ((unsigned16_t)0x3f80) +//#define XF_BORDER2_RESERVED ((unsigned16_t)0xc000) + + + + +#else // VERSION_BIFF == VERSION_BIFF8 + + + + +#define XF_OFFSET_FONT ((unsigned32_t) 4) +#define XF_OFFSET_FORMAT ((unsigned32_t) 6) +#define XF_OFFSET_PROP ((unsigned32_t) 8) +#define XF_OFFSET_ALIGN ((unsigned32_t)10) // 4 bytes +#define XF_OFFSET_BORDERA ((unsigned32_t)14) // 4 bytes +#define XF_OFFSET_BORDERB ((unsigned32_t)18) // 4 bytes +#define XF_OFFSET_COLOR ((unsigned32_t)22) + + // Text Orientation Options +#define XF_ORI_SHIFTPOS (8) +#define XF_ORI_NONE ((unsigned8_t)0) +#define XF_ORI_90NOCLOCKTXT ((unsigned8_t)90) +#define XF_ORI_90CLOCKTXT ((unsigned8_t)180) +#define XF_ORI_TOPBOTTOMTXT ((unsigned8_t)255) + typedef enum + { + ORI_NONE = 0, + ORI_TOPBOTTOMTXT, + ORI_90NOCLOCKTXT, + ORI_90CLOCKTXT + } txtori_option_t; + + // Indent field +#define XF_INDENT_SHIFTPOS (16) +#define XF_INDENT_LVL ((unsigned8_t)0x0F) +#define XF_INDENT_NONE ((unsigned8_t)0x00) +#define XF_INDENT_1 ((unsigned8_t)0x01) +#define XF_INDENT_2 ((unsigned8_t)0x02) +#define XF_INDENT_3 ((unsigned8_t)0x03) +#define XF_INDENT_4 ((unsigned8_t)0x04) +#define XF_INDENT_SHRINK2FIT ((unsigned8_t)0x10) +#define XF_INDENT_DIR ((unsigned8_t)0xC0) +#define XF_INDENT_CONTEXT ((unsigned8_t)0x00) +#define XF_INDENT_L2R ((unsigned8_t)0x40) +#define XF_INDENT_R2L ((unsigned8_t)0x80) + typedef enum + { + INDENT_NONE = 0, + INDENT_1, + INDENT_2, + INDENT_3, + INDENT_4, + INDENT_SHRINK2FIT, + INDENT_L2R, + INDENT_R2L + } indent_option_t; + + // XF_USED_ATTRIB +#define XF_ATTRIB_SHIFTPOS (16) // bits shifted by 8 already + + // The Border A field bit or-masks: + +#define XF_STYLE_SHIFTPOS_LEFT (0) +#define XF_STYLE_SHIFTPOS_RIGHT (4) +#define XF_STYLE_SHIFTPOS_TOP (8) +#define XF_STYLE_SHIFTPOS_BOTTOM (12) + + // The BorderA field bit or-masks: +#define XF_COLOR_SHIFTPOS_LEFT (16) +#define XF_COLOR_SHIFTPOS_RIGHT (23) + +#define XF_BORDER_LEFTSTYLE ((unsigned32_t)0x0000000F) +#define XF_BORDER_RIGHTSTYLE ((unsigned32_t)0x000000F0) +#define XF_BORDER_TOPSTYLE ((unsigned32_t)0x00000F00) +#define XF_BORDER_BOTTOMSTYLE ((unsigned32_t)0x0000F000) + +#define XF_BORDER_LEFTCOLOR ((unsigned32_t)0x007f0000) +#define XF_BORDER_RIGHTCOLOR ((unsigned32_t)0x3f800000) +#define XF_DIAG_TL2BR ((unsigned32_t)0x40000000) +#define XF_DIAG_BL2TR ((unsigned32_t)0x80000000) + + // BORDER B + +#define XF_COLOR_SHIFTPOS_TOP (0) +#define XF_COLOR_SHIFTPOS_BOTTOM (7) +#define XF_COLOR_SHIFTPOS_DIAG (14) +#define XF_STYLE_SHIFTPOS_DIAG (21) +#define XF_SHIFTPOS_FILLPATTERN (26) + +#define XF_BORDER_TOPCOLOR ((unsigned16_t)0x0000007f) +#define XF_BORDER_BOTTOMCOLOR ((unsigned16_t)0x00003f80) +#define XF_BORDER_DIAGCOLOR ((unsigned16_t)0x001fc000) +#define XF_BORDER_DIAGSTYLE ((unsigned16_t)0x01e00000) +#define XF_BORDER_FILLPATTERN ((unsigned32_t)0xFC000000) + +//#define XF_STYLE_SHIFTPOS_LEFT (3) +//#define XF_STYLE_SHIFTPOS_RIGHT (6) +//#define XF_COLOR_SHIFTPOS_TOP (9) +//#define XF_BORDER1_TOPSTYLE ((unsigned16_t)0x0007) +//#define XF_BORDER1_LEFTSTYLE ((unsigned16_t)0x0038) +//#define XF_BORDER1_RIGHTSTYLE ((unsigned16_t)0x01c0) + + // The Color field bit or-masks: +#define XF_COLOR_SHIFTPOS_FG (0) +#define XF_COLOR_SHIFTPOS_BG (7) +#define XF_COLOR_FOREGROUND ((unsigned16_t)0x007f) +#define XF_COLOR_BACKGROUND ((unsigned16_t)0x3f80) +#define XF_COLOR_DIAG ((unsigned16_t)0xc000) + + +#endif + /* +****************************** +CExtFormat class declaration +****************************** +*/ + + typedef struct + { + unsigned16_t index; + + font_t* font; + format_number_t format; + + halign_option_t halign; + valign_option_t valign; + indent_option_t indent; + txtori_option_t txtorientation; + + color_name_t fill_fgcolor; + color_name_t fill_bgcolor; + fill_option_t fillstyle; + + bool locked; + bool hidden; + bool wrap; + bool is_cell; + + border_style_t top_border_style; + color_name_t top_border_color; + + border_style_t bottom_border_style; + color_name_t bottom_border_color; + + border_style_t left_border_style; + color_name_t left_border_color; + + border_style_t right_border_style; + color_name_t right_border_color; + + } xf_init_t; + + struct xf_i + { + virtual void font(font_t* fontidx) = 0; + virtual void format(format_number_t format) = 0; + virtual void halign(halign_option_t ha_option) = 0; + virtual void valign(valign_option_t va_option) = 0; + virtual void indent(indent_option_t indent_opt) = 0; + virtual void orientation(txtori_option_t ori_option) = 0; + virtual void fillfgcolor(color_name_t color) = 0; + virtual void fillbgcolor(color_name_t color) = 0; + virtual void fillstyle(fill_option_t fill) = 0; + virtual void locked(bool locked_opt) = 0; + virtual void hidden(bool hidden_opt) = 0; + virtual void wrap(bool wrap_opt) = 0; + virtual void borderstyle(border_side_t side, + border_style_t style, + color_name_t color) = 0; + }; + + + class xf_t + { + + public: + xf_t(); + xf_t(const xf_init_t& xfinit); + xf_t(unsigned16_t index, font_t* font, format_number_t format, halign_option_t halign, + valign_option_t valign, indent_option_t indent, txtori_option_t txtorientation, color_name_t fill_fgcolor, + color_name_t fill_bgcolor, fill_option_t fillstyle, bool locked, bool hidden, + bool wrap, bool is_cell, border_style_t top_border_style, color_name_t top_border_color, + border_style_t bottom_border_style, color_name_t bottom_border_color, border_style_t left_border_style, + color_name_t left_border_color, border_style_t right_border_style, color_name_t right_border_color); + virtual ~xf_t(); + + void MarkUsed(void); + bool IsUsed(void); + unsigned16_t Usage(){return m_usage_counter;}; + + + /* XF Index wrappers*/ + void SetIndex(unsigned16_t xfidx){index = xfidx;}; + unsigned16_t GetIndex(void){return index;}; + + /* Font Index wrappers*/ + void SetFont(font_t* fontidx); + unsigned16_t GetFontIndex(void); + font_t* GetFont(void); + + /* Format Index wrappers*/ + void SetFormat(format_number_t formatidx); + unsigned16_t GetFormatIndex(void); + format_number_t GetFormat(void); + + + /* Horizontal Align option wrappers*/ + void SetHAlign(halign_option_t ha_option); + unsigned8_t GetHAlign(void); + + /* Vertical Align option wrappers*/ + void SetVAlign(valign_option_t va_option); + unsigned8_t GetVAlign(void); + + /* Vertical Align option wrappers*/ + void SetIndent(indent_option_t indent_option); + unsigned8_t GetIndent(void); + + /* Text orientation option wrappers*/ + void SetTxtOrientation(txtori_option_t ori_option); + unsigned8_t GetTxtOrientation(void); + + + /* Fill Foreground color option wrappers*/ + void SetFillFGColor(color_name_t color); + unsigned8_t GetFillFGColor(void); + + + /* Fill Background color option wrappers*/ + void SetFillBGColor(color_name_t color); + unsigned8_t GetFillBGColor(void); + + + /* Fill Style option wrappers*/ + void SetFillStyle(fill_option_t fill); + unsigned8_t GetFillStyle(void); + + /* Locked option wrappers*/ + void SetLocked(bool locked_opt); + bool IsLocked(void); + + + /* Hidden option wrappers*/ + void SetHidden(bool hidden_opt); + bool IsHidden(void); + + /* Wrap option wrappers*/ + void SetWrap(bool wrap_opt); + bool IsWrap(void); + + + /* Cell option wrappers*/ + void SetCellMode(bool cellmode); + bool IsCell(void); + + /* Cell option wrappers*/ + void SetBorderStyle(border_side_t side, + border_style_t style, + color_name_t color); + unsigned8_t GetBorderStyle(border_side_t side); + unsigned8_t GetBorderColor(border_side_t side); + unsigned32_t GetSignature(); + + void operator=(xf_t& right) ; + + private: + // Lookup tables for options + static const unsigned8_t HALIGN_OPTIONS_TABLE[]; + static const unsigned8_t VALIGN_OPTIONS_TABLE[]; + static const unsigned8_t INDENT_OPTIONS_TABLE[]; + static const unsigned8_t TXTORI_OPTIONS_TABLE[]; + static const unsigned8_t COLOR_OPTIONS_TABLE[]; + static const unsigned8_t FILL_OPTIONS_TABLE[]; + static const unsigned8_t BORDERSTYLE_OPTIONS_TABLE[]; + static const unsigned16_t FORMAT_NUM_OPTIONS_TABLE[]; + void UpdateSignature(); + private: + unsigned16_t m_usage_counter; + + unsigned16_t index; + + font_t* font; + format_number_t format; + + unsigned8_t halign; + unsigned8_t valign; + unsigned8_t indent; + unsigned8_t txtorientation; + + unsigned8_t fill_fgcolor; + unsigned8_t fill_bgcolor; + unsigned8_t fillstyle; + + bool locked; + bool hidden; + bool wrap; + bool is_cell; + + unsigned8_t top_border_style; + unsigned8_t top_border_color; + + unsigned8_t bottom_border_style; + unsigned8_t bottom_border_color; + + unsigned8_t left_border_style; + unsigned8_t left_border_color; + + unsigned8_t right_border_style; + unsigned8_t right_border_color; + + unsigned32_t m_signature; + bool m_sigchanged; + + }; + + class xfbysig + { + public: + bool operator()(xf_t* a, xf_t* b) const + { + return (a->GetSignature() < b->GetSignature() ? true : false ); // DFH + }; + }; + + typedef std::set XF_Set_t; + typedef XF_Set_t::iterator XF_Set_Itor_t; + + typedef std::list XF_List_t; + typedef XF_List_t::iterator XF_List_Itor_t; + + + + class CExtFormat: public CRecord + { + private: + + void SetFlag(unsigned16_t flag); + void ClearFlag(unsigned16_t flag); + + void InitDummy(bool is_cell); + + public: + + CExtFormat(bool is_cell = false); + CExtFormat(xf_t* xfdef); + ~CExtFormat(); + + bool IsCell(); + + int SetFontIndex(unsigned16_t fontindex); + unsigned16_t GetFontIndex(void); + + int SetFormatIndex(unsigned16_t formatindex); + unsigned16_t GetFormatIndex(void); + + void SetLocked(); + void SetHidden(); + void SetHorizAlign(unsigned8_t alignval); + void SetWrap(); +#if VERSION_BIFF == VERSION_BIFF8 + void SetIndent(unsigned8_t indentval); +#endif + void SetVertAlign(unsigned8_t alignval); + void SetTxtOrientation(unsigned8_t alignval); + void SetFGColorIndex(unsigned8_t color); + void SetBGColorIndex(unsigned8_t color); + void SetFillPattern(unsigned8_t color); + void SetBorder(border_side_t border, unsigned16_t style, unsigned16_t color); + void SetXFParent(unsigned16_t parent); + }; + +} +#endif //EXTFORMAT_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: extformat.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + diff --git a/uppdev/XLS/font.cpp b/uppdev/XLS/font.cpp new file mode 100644 index 000000000..4247f4388 --- /dev/null +++ b/uppdev/XLS/font.cpp @@ -0,0 +1,667 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/font.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +#include +#include + +using namespace std; +using namespace xlslib_core; + + +/* +********************************** +CFont class implementation +********************************** +*/ +CFont::CFont(string name, + unsigned16_t height, + unsigned16_t boldstyle, + unsigned8_t underline, + unsigned16_t script, + unsigned16_t color, + unsigned16_t attributes, + unsigned8_t family, + unsigned8_t charset) +{ + SetRecordType(RECTYPE_FONT); + + AddValue16(height); + AddValue16(attributes); + AddValue16(color); + AddValue16(boldstyle); + AddValue16(script); + AddValue8(underline); + AddValue8(family); + AddValue8(charset); + AddValue8(FONT_RESERVED); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue8((unsigned8_t)name.size()); + AddDataArray((const unsigned8_t*)name.c_str(), name.size()); +#else + AddUnicodeStrlen((unsigned8_t)name.size()); + AddUnicodeString((const unsigned8_t*)name.c_str(), name.size()); +#endif + + SetRecordLength(GetDataSize()-4); +} + +CFont::CFont(font_t* fontdef) +{ + SetRecordType(RECTYPE_FONT); + + AddValue16(fontdef->GetHeight()); + AddValue16(fontdef->GetAttributes()); + AddValue16(fontdef->GetColor()); + AddValue16(fontdef->GetBoldStyle()); + AddValue16(fontdef->GetScriptStyle()); + AddValue8(fontdef->GetUnderlineStyle()); + AddValue8(fontdef->GetFamily()); + AddValue8(fontdef->GetCharset()); + AddValue8(FONT_RESERVED); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue8((unsigned8_t)((fontdef->GetName()).size())); + AddDataArray((const unsigned8_t*)((fontdef->GetName()).c_str()), + (fontdef->GetName()).size()); +#else + AddUnicodeStrlen((unsigned8_t)((fontdef->GetName()).size())); + AddUnicodeString((const unsigned8_t*)((fontdef->GetName()).c_str()), + (fontdef->GetName()).size()); +#endif + + SetRecordLength(GetDataSize()-4); +} + +CFont::~CFont() +{ +} + +/* +********************************** +********************************** +*/ + + +int CFont::SetName(string& name) +{ + int errcode = NO_ERRORS; + + name = name; + /* + NOTE: Unimplemented. + Temporarilly this function won't set the name + */ + + return errcode; +} + +/* +********************************** +********************************** +*/ +int CFont::GetName(string& name) +{ + int errcode = NO_ERRORS; + + signed16_t namesize; + GetValue16From(&namesize, FONT_OFFSET_NAMELENGTH); + + name = ""; + for(int i=0; i. + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/font.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef FONT_H +#define FONT_H + +#include +#include +#include +#include +#include + +namespace xlslib_core +{ + // Bold style most used values + // (it can be a number of some range. See Documentation for details): +#define FONT_BOLDNESS_BOLD ((unsigned16_t)0x02bc) +#define FONT_BOLDNESS_HALF ((unsigned16_t)0x0226) +#define FONT_BOLDNESS_NORMAL ((unsigned16_t)0x0190) +#define FONT_BOLDNESS_DOUBLE ((unsigned16_t)0x0320) + + typedef enum + { + BOLDNESS_BOLD = 0, + BOLDNESS_HALF, + BOLDNESS_NORMAL, + BOLDNESS_DOUBLE + } boldness_option_t; + + + // Super/subscript field option values +#define FONT_SCRIPT_NONE ((unsigned16_t)0x0000) +#define FONT_SCRIPT_SUPER ((unsigned16_t)0x0001) +#define FONT_SCRIPT_SUB ((unsigned16_t)0x0002) + + typedef enum + { + SCRIPT_NONE = 0, + SCRIPT_SUPER, + SCRIPT_SUB + } script_option_t; + + // Underline field option values: +#define FONT_UNDERLINE_NONE ((unsigned8_t)0x00) +#define FONT_UNDERLINE_SINGLE ((unsigned8_t)0x01) +#define FONT_UNDERLINE_DOUBLE ((unsigned8_t)0x02) +#define FONT_UNDERLINE_SINGLEACC ((unsigned8_t)0x21) +#define FONT_UNDERLINE_DOUBLEACC ((unsigned8_t)0x22) + + typedef enum + { + UNDERLINE_NONE = 0, + UNDERLINE_SINGLE, + UNDERLINE_DOUBLE, + UNDERLINE_SINGLEACC, + UNDERLINE_DOUBLEACC + } underline_option_t; + + + + // The following are default values used when the font's + // constructor is called without args: +#define FONT_DFLT_FAMILY ((unsigned8_t)0x00) +#define FONT_DFLT_CHARSET ((unsigned8_t)0x00) +#define FONT_DFLT_HEIGHT ((unsigned16_t)0x00c8) +#define FONT_DFLT_ATTRIBUTES ((unsigned16_t)0x0000) +#define FONT_DFLT_PALETTE ((unsigned16_t)0x7fff) +#define FONT_DFLT_FONTNAME ((std::string)"Arial") + +#define FONT_RESERVED ((unsigned8_t)0x00) + + // The font-record field offsets: +#define FONT_OFFSET_HEIGHT ((unsigned32_t) 4) +#define FONT_OFFSET_ATTRIBUTES ((unsigned32_t) 6) +#define FONT_OFFSET_PALETTE ((unsigned32_t) 8) +#define FONT_OFFSET_BOLDSTYLE ((unsigned32_t)10) +#define FONT_OFFSET_SCRIPT ((unsigned32_t)12) +#define FONT_OFFSET_UNDERLINE ((unsigned32_t)14) +#define FONT_OFFSET_FAMILY ((unsigned32_t)15) +#define FONT_OFFSET_CHARSET ((unsigned32_t)16) +#define FONT_OFFSET_NAMELENGTH ((unsigned32_t)18) +#define FONT_OFFSET_NAME ((unsigned32_t)19) + + + // The attribute bit or-masks: +#define FONT_ATTR_RESERVED0 ((unsigned16_t)0x0001) +#define FONT_ATTR_ITALIC ((unsigned16_t)0x0002) +#define FONT_ATTR_RESERVED1 ((unsigned16_t)0x0004) +#define FONT_ATTR_STRIKEOUT ((unsigned16_t)0x0008) +#define FONT_ATTR_OUTLINEMACH ((unsigned16_t)0x0010) +#define FONT_ATTR_SHADOWMACH ((unsigned16_t)0x0020) +#define FONT_ATTR_RESERVED2 ((unsigned16_t)0x00c0) +#define FONT_ATTR_UNUSED ((unsigned16_t)0xff00) + + // Font colors +#define FONT_COLOR_CODE_BLACK ((unsigned16_t)(COLOR_CODE_BLACK)) +#define FONT_COLOR_CODE_DARK_RED ((unsigned16_t)(COLOR_CODE_DARK_RED)) +#define FONT_COLOR_CODE_RED ((unsigned16_t)(COLOR_CODE_RED)) +#define FONT_COLOR_CODE_FUCSIA ((unsigned16_t)(COLOR_CODE_FUCSIA)) +#define FONT_COLOR_CODE_COMBINED01 ((unsigned16_t)(COLOR_CODE_COMBINED01)) +#define FONT_COLOR_CODE_COMBINED02 ((unsigned16_t)(COLOR_CODE_COMBINED02)) +#define FONT_COLOR_CODE_COMBINED03 ((unsigned16_t)(COLOR_CODE_COMBINED03)) +#define FONT_COLOR_CODE_COMBINED04 ((unsigned16_t)(COLOR_CODE_COMBINED04)) +#define FONT_COLOR_CODE_COMBINED05 ((unsigned16_t)(COLOR_CODE_COMBINED05)) +#define FONT_COLOR_CODE_COMBINED06 ((unsigned16_t)(COLOR_CODE_COMBINED06)) +#define FONT_COLOR_CODE_OLIVE ((unsigned16_t)(COLOR_CODE_OLIVE)) +#define FONT_COLOR_CODE_DARK_YELLOW ((unsigned16_t)(COLOR_CODE_DARK_YELLOW)) +#define FONT_COLOR_CODE_COMBINED07 ((unsigned16_t)(COLOR_CODE_COMBINED07)) +#define FONT_COLOR_CODE_YELLOW ((unsigned16_t)(COLOR_CODE_YELLOW)) +#define FONT_COLOR_CODE_LIGHT_YELLOW ((unsigned16_t)(COLOR_CODE_LIGHT_YELLOW)) +#define FONT_COLOR_CODE_DARK_GREEN ((unsigned16_t)(COLOR_CODE_DARK_GREEN)) +#define FONT_COLOR_CODE_GREEN ((unsigned16_t)(COLOR_CODE_GREEN)) +#define FONT_COLOR_CODE_COMBINED08 ((unsigned16_t)(COLOR_CODE_COMBINED08)) +#define FONT_COLOR_CODE_LIVING_GREEN ((unsigned16_t)(COLOR_CODE_LIVING_GREEN)) +#define FONT_COLOR_CODE_LIGHT_GREEN ((unsigned16_t)(COLOR_CODE_LIGHT_GREEN)) +#define FONT_COLOR_CODE_COMBINED09 ((unsigned16_t)(COLOR_CODE_COMBINED09)) +#define FONT_COLOR_CODE_BLUE_GREEN ((unsigned16_t)(COLOR_CODE_BLUE_GREEN)) +#define FONT_COLOR_CODE_AQUAMARINA ((unsigned16_t)(COLOR_CODE_AQUAMARINA)) +#define FONT_COLOR_CODE_TURQOISE ((unsigned16_t)(COLOR_CODE_TURQOISE)) +#define FONT_COLOR_CODE_COMBINED10 ((unsigned16_t)(COLOR_CODE_COMBINED10)) +#define FONT_COLOR_CODE_DARK_BLUE ((unsigned16_t)(COLOR_CODE_DARK_BLUE)) +#define FONT_COLOR_CODE_BLUE ((unsigned16_t)(COLOR_CODE_BLUE)) +#define FONT_COLOR_CODE_LIGHT_BLUE ((unsigned16_t)(COLOR_CODE_LIGHT_BLUE)) +#define FONT_COLOR_CODE_SKY_BLUE ((unsigned16_t)(COLOR_CODE_SKY_BLUE)) +#define FONT_COLOR_CODE_COMBINED11 ((unsigned16_t)(COLOR_CODE_COMBINED11)) +#define FONT_COLOR_CODE_INDIGO ((unsigned16_t)(COLOR_CODE_INDIGO)) +#define FONT_COLOR_CODE_BLUE_GRAY ((unsigned16_t)(COLOR_CODE_BLUE_GRAY)) +#define FONT_COLOR_CODE_VIOLET ((unsigned16_t)(COLOR_CODE_VIOLET)) +#define FONT_COLOR_CODE_PLUM ((unsigned16_t)(COLOR_CODE_PLUM)) +#define FONT_COLOR_CODE_LAVANDER ((unsigned16_t)(COLOR_CODE_LAVANDER)) +#define FONT_COLOR_CODE_COMBINED12 ((unsigned16_t)(COLOR_CODE_COMBINED12)) +#define FONT_COLOR_CODE_GRAY50 ((unsigned16_t)(COLOR_CODE_GRAY50)) +#define FONT_COLOR_CODE_GRAY40 ((unsigned16_t)(COLOR_CODE_GRAY40)) +#define FONT_COLOR_CODE_GRAY25 ((unsigned16_t)(COLOR_CODE_GRAY25)) +#define FONT_COLOR_CODE_WHITE ((unsigned16_t)(COLOR_CODE_WHITE)) + + /* +****************************** +CFont class declaration +****************************** +*/ + + typedef struct + { + unsigned16_t index; + std::string name; + unsigned16_t height; + boldness_option_t boldstyle; + underline_option_t underline; + script_option_t script; + color_name_t color; + unsigned16_t attributes; + unsigned8_t family; + unsigned8_t charset; + + } font_init_t; + + struct font_i + { + virtual void fontname(std::string fntname) = 0; + virtual void fontheight(unsigned16_t fntheight) = 0; + virtual void fontbold(boldness_option_t fntboldness) = 0; + virtual void fontunderline(underline_option_t fntunderline) = 0; + virtual void fontscript(script_option_t fntscript) = 0; + virtual void fontcolor(color_name_t fntcolor) = 0; + virtual void fontattr(unsigned16_t attr) = 0; + virtual void fontitalic(bool italic) = 0; + virtual void fontstrikeout(bool so) = 0; + virtual void fontoutline(bool ol) = 0; + virtual void fontshadow(bool sh) = 0; + }; + + + class font_t + { + public: + font_t(); + font_t(unsigned16_t index, std::string name, + unsigned16_t height, boldness_option_t boldstyle, + underline_option_t underline, script_option_t script, + color_name_t color, unsigned16_t attributes, + unsigned8_t family, unsigned8_t charset); + font_t(const font_init_t& fontinit); + + virtual ~font_t() {}; + + + void MarkUsed(); + bool IsUsed(); + unsigned16_t Usage(){return m_usage_counter;}; + + + /* FONT Index wrappers*/ + void SetIndex(unsigned16_t fntidx); + unsigned16_t GetIndex(void); + + + /* FONT Index wrappers*/ + void SetName(std::string fntname); + std::string GetName(void); + + /* FONT height wrappers*/ + void SetHeight(unsigned16_t fntheight); + unsigned16_t GetHeight(void); + + /* FONT boldstyle wrappers*/ + void SetBoldStyle(boldness_option_t fntboldness); + unsigned16_t GetBoldStyle(void); + + /* FONT underline wrappers*/ + void SetUnderlineStyle(underline_option_t fntunderline); + unsigned8_t GetUnderlineStyle(void); + + /* FONT script wrappers*/ + void SetScriptStyle(script_option_t fntscript); + unsigned16_t GetScriptStyle(void); + + /* FONT script wrappers*/ + void SetColor(color_name_t fntcolor); + unsigned16_t GetColor(void); + + + void SetItalic(bool italic); + void SetStrikeout(bool so); + + + /* FONT attributes wrappers */ + void SetAttributes(unsigned16_t attr); + unsigned16_t GetAttributes(void); + + + // OSX only + void SetOutline(bool ol); + void SetShadow(bool sh); + + + // Miscellaneous; + void SetFamily(unsigned8_t fam); + unsigned8_t GetFamily(void); + + void SetCharset(unsigned8_t chrset); + unsigned8_t GetCharset(void); + unsigned32_t GetSignature(); + + void operator=(font_t& right); + + private: + unsigned16_t index; + std::string name; + unsigned16_t height; + unsigned16_t boldstyle; + unsigned8_t underline; + unsigned16_t script; + unsigned16_t color; + unsigned16_t attributes; + unsigned8_t family; + unsigned8_t charset; + + unsigned16_t m_usage_counter; + void UpdateSignature(); + unsigned32_t m_signature; + bool m_sigchanged; + + static const unsigned16_t BOLD_OPTION_TABLE[]; + static const unsigned16_t SCRIPT_OPTION_TABLE[]; + static const unsigned8_t UNDERLINE_OPTION_TABLE[]; + static const unsigned16_t COLOR_OPTION_TABLE[]; + + }; + + class fontbysig + { + public: + bool operator()(font_t* a, font_t* b) const + { + return (a->GetSignature() < b->GetSignature() ? true : false ); + }; + }; + + typedef std::set Font_Set_t; + typedef Font_Set_t::iterator Font_Set_Itor_t; + + typedef std::list Font_List_t; + typedef Font_List_t::iterator Font_List_Itor_t; + + + class CFont: public CRecord + { + protected: + + public: + + CFont(std::string name = FONT_DFLT_FONTNAME, + unsigned16_t height = FONT_DFLT_HEIGHT, + unsigned16_t boldstyle = FONT_BOLDNESS_NORMAL, + unsigned8_t underline = FONT_UNDERLINE_NONE, + unsigned16_t script = FONT_SCRIPT_NONE, + unsigned16_t color = FONT_DFLT_PALETTE, + unsigned16_t attributes = FONT_DFLT_ATTRIBUTES, + unsigned8_t family = FONT_DFLT_FAMILY, + unsigned8_t charset = FONT_DFLT_CHARSET ); + + CFont(font_t* fontdef); + ~CFont(); + + + int SetName(std::string& name); + int GetName(std::string& name); + + int SetBoldValue(unsigned16_t boldstyle); + unsigned16_t GetBoldValue(void); + + int SetUnderlineStyle(unsigned8_t ul); + unsigned8_t GetUnderlineStyle(void); + + int SetScriptStyle(unsigned16_t script); + unsigned16_t GetScriptStyle(void); + + int SetColorIndex(unsigned16_t color); + unsigned16_t GetColorIndex(void); + + int SetAttributes(unsigned16_t attr); + unsigned16_t GetAttributes(void); + + int SetFamily(unsigned8_t family); + unsigned8_t GetFamily(void); + + int SetCharSet(unsigned8_t charset); + unsigned8_t GetCharSet(void); + + }; + +} + +#endif //FONT_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: font.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * Revision 1.17 2004/04/06 22:35:43 dgonzalez + * + Added namespace xlslib_core to isolate the core xlslib library names. + * + * Revision 1.16 2004/04/06 15:10:24 dgonzalez + * + Added keys to generate distributable headers + * + * Revision 1.15 2004/01/29 03:18:55 dgonzalez + * + Using the config.h file + * + * Revision 1.14 2004/01/15 17:17:31 dgonzalez + * + The memory allocator used by STL-containers is defined #conditionally. + * + * Revision 1.13 2003/12/09 19:04:21 dgonzalez + * + Not a real difference + * + * Revision 1.12 2003/12/05 01:18:27 dgonzalez + * + Common include files were placed in common.h (and this file was + * included instead. + * + The font_interface was redefined to something lighter. Due name + * clashing with xf_i when these interfaces were defined as parent of + * cell_t. + * + Signature was implemented to font_t. Any interface function that modi + * fies any data member of the class set a flag for later signature + * update. The signature is CRC based and is used to uniquify font_t + * instances inside an stl-set-container. + * + The fontbysig functor was added for being used in the set container + * as a sorting criteria. It is based on the signature. + * + The stl-set-container of pointers to font_t* typedef was defined here. + * + * Revision 1.11 2003/11/29 17:53:49 dgonzalez + * + The larger functions were uninlined. + * + The virtual pure interface font_i was defined + * + * Revision 1.10 2003/11/28 01:31:30 dgonzalez + * + The MarkUsed functionality was added (similar to xf_t) + * + * Revision 1.9 2003/11/26 16:49:26 dgonzalez + * + Indented and untabified + * + * Revision 1.8 2003/11/04 17:07:58 dgonzalez + * + Changed the initialization of CGlobalRecord's defaults for compatibility with + * MSVC++. The original code was left commented out for future use. + * + * Revision 1.7 2003/11/04 01:04:42 dgonzalez + * + All the list containers changed to manage pointers. + * + Valgrind utility reports 960 posible memory leaks. TODO: Verify it + * + * Revision 1.6 2003/11/03 16:58:56 dgonzalez + * + The following typedefed enums were added to improve typechecking in the font + * definition: + * - boldness_option_t + * - script_option_t + * - underline_option_t + * + Font colors were defined based in the color codes defined in the module colors.h. + * + font_t is now implemented as a class. A full set of wrapper functions were implemented + * inline for Get/Set font properties. + * + font_init_t struct was added for storing initialization values of default font of a + * document. + * + The following lookup tables were added to retrieve the field's options used for setting + * the font's values. + * + * Revision 1.5 2003/10/24 23:24:32 dgonzalez + * + Added CVS-Keyword substitution. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/format.cpp b/uppdev/XLS/format.cpp new file mode 100644 index 000000000..262bbaf6b --- /dev/null +++ b/uppdev/XLS/format.cpp @@ -0,0 +1,141 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/format.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +********************************** +CFormat class implementation +********************************** +*/ +CFormat::CFormat(string& formatstr, + unsigned16_t index) +{ + SetRecordType(RECTYPE_FORMAT); + + AddValue16(index); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue8((unsigned8_t)formatstr.size()); + AddDataArray((unsigned8_t*)formatstr.c_str(), formatstr.size()); +#else + AddUnicodeStrlen((unsigned16_t)formatstr.size()); + AddUnicodeString((unsigned8_t*)formatstr.c_str(), formatstr.size()); +#endif + + SetRecordLength(GetDataSize()-4); +} + +CFormat::CFormat(format_t* formatdef) +{ + SetRecordType(RECTYPE_FORMAT); + + AddValue16(formatdef->GetIndex()); +#if VERSION_BIFF == VERSION_BIFF5 + AddValue8((unsigned8_t)((formatdef->GetFormatStr()).size())); + AddDataArray((unsigned8_t*)((formatdef->GetFormatStr()).c_str()), + (formatdef->GetFormatStr()).size()); +#else + AddUnicodeStrlen((unsigned16_t)((formatdef->GetFormatStr()).size())); + AddUnicodeString((unsigned8_t*)((formatdef->GetFormatStr()).c_str()), + (formatdef->GetFormatStr()).size()); +#endif + + SetRecordLength(GetDataSize()-4); +} + + +CFormat::~CFormat() +{ +} + +/* +********************************** +********************************** +*/ + +/* +********************************** +********************************** +*/ +int CFormat::GetFormatStr(string& formatstr) +{ + int errcode = NO_ERRORS; + + signed16_t formatsize; + GetValue16From(&formatsize, FORMAT_OFFSET_NAMELENGTH); + + formatstr = ""; + for(int i=0; i. + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/format.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef FORMAT_H +#define FORMAT_H + +#include +#include +#include +#include + +namespace xlslib_core +{ + + // The font-record field offsets: +#define FORMAT_OFFSET_INDEX ((unsigned32_t) 4) +#define FORMAT_OFFSET_NAMELENGTH ((unsigned32_t) 6) +#define FORMAT_OFFSET_NAME ((unsigned32_t) 7) + +#define FMTCODE_GENERAL ((unsigned16_t)0x0000) +#define FMTCODE_NUMBER1 ((unsigned16_t)0x0001) +#define FMTCODE_NUMBER2 ((unsigned16_t)0x0002) +#define FMTCODE_NUMBER3 ((unsigned16_t)0x0003) +#define FMTCODE_NUMBER4 ((unsigned16_t)0x0004) +#define FMTCODE_CURRENCY1 ((unsigned16_t)0x0005) +#define FMTCODE_CURRENCY2 ((unsigned16_t)0x0006) +#define FMTCODE_CURRENCY3 ((unsigned16_t)0x0007) +#define FMTCODE_CURRENCY4 ((unsigned16_t)0x0008) +#define FMTCODE_PERCENT1 ((unsigned16_t)0x0009) +#define FMTCODE_PERCENT2 ((unsigned16_t)0x000a) +#define FMTCODE_SCIENTIFIC1 ((unsigned16_t)0x000b) +#define FMTCODE_FRACTION1 ((unsigned16_t)0x000c) +#define FMTCODE_FRACTION2 ((unsigned16_t)0x000d) +#define FMTCODE_DATE1 ((unsigned16_t)0x000e) +#define FMTCODE_DATE2 ((unsigned16_t)0x000f) +#define FMTCODE_DATE3 ((unsigned16_t)0x0010) +#define FMTCODE_DATE4 ((unsigned16_t)0x0011) +#define FMTCODE_HOUR1 ((unsigned16_t)0x0012) +#define FMTCODE_HOUR2 ((unsigned16_t)0x0013) +#define FMTCODE_HOUR3 ((unsigned16_t)0x0014) +#define FMTCODE_HOUR4 ((unsigned16_t)0x0015) +#define FMTCODE_HOURDATE ((unsigned16_t)0x0016) +#define FMTCODE_NUMBER5 ((unsigned16_t)0x0025) +#define FMTCODE_NUMBER6 ((unsigned16_t)0x0026) +#define FMTCODE_NUMBER7 ((unsigned16_t)0x0027) +#define FMTCODE_NUMBER8 ((unsigned16_t)0x0028) +#define FMTCODE_ACCOUNTING1 ((unsigned16_t)0x0029) +#define FMTCODE_ACCOUNTING2 ((unsigned16_t)0x002a) +#define FMTCODE_ACCOUNTING3 ((unsigned16_t)0x002b) +#define FMTCODE_ACCOUNTING4 ((unsigned16_t)0x002c) +#define FMTCODE_HOUR5 ((unsigned16_t)0x002d) +#define FMTCODE_HOUR6 ((unsigned16_t)0x002e) +#define FMTCODE_HOUR7 ((unsigned16_t)0x002f) +#define FMTCODE_SCIENTIFIC2 ((unsigned16_t)0x0030) +#define FMTCODE_TEXT ((unsigned16_t)0x0031) + + typedef enum + { + FMT_GENERAL = 0, + FMT_NUMBER1, + FMT_NUMBER2, + FMT_NUMBER3, + FMT_NUMBER4, + FMT_CURRENCY1, + FMT_CURRENCY2, + FMT_CURRENCY3, + FMT_CURRENCY4, + FMT_PERCENT1, + FMT_PERCENT2, + FMT_SCIENTIFIC1, + FMT_FRACTION1, + FMT_FRACTION2, + FMT_DATE1, + FMT_DATE2, + FMT_DATE3, + FMT_DATE4, + FMT_HOUR1, + FMT_HOUR2, + FMT_HOUR3, + FMT_HOUR4, + FMT_HOURDATE, + FMT_NUMBER5, + FMT_NUMBER6, + FMT_NUMBER7, + FMT_NUMBER8, + FMT_ACCOUNTING1, + FMT_ACCOUNTING2, + FMT_ACCOUNTING3, + FMT_ACCOUNTING4, + FMT_HOUR5, + FMT_HOUR6, + FMT_HOUR7, + FMT_SCIENTIFIC2, + FMT_TEXT + } format_number_t; + + /* +****************************** +CFormat class declaration +****************************** +*/ + + class format_t + { + public: + format_t(unsigned16_t idx, std::string fmtstr) + : index(idx), formatstr(fmtstr), m_usage_counter(0) + {}; + ~format_t(){}; + + unsigned16_t GetIndex(){return index;}; + void SetIndex(unsigned16_t idx){index = idx;}; + + std::string& GetFormatStr(void) {return formatstr;}; + void SetFormatStr(std::string& fmtstr) {formatstr = fmtstr;}; + + void MarkUsed() {m_usage_counter++;}; + bool IsUsed() {return(m_usage_counter != 0);}; + + private: + + + unsigned16_t index; + std::string formatstr; + + unsigned16_t m_usage_counter; + }; + typedef std::list Format_List_t; + typedef Format_List_t::iterator Format_List_Itor_t; + + + + + class CFormat: public CRecord + { + protected: + + public: + + CFormat(std::string& formatstr, unsigned16_t index); + CFormat(format_t* formatdef); + ~CFormat(); + + + int SetFormatStr(std::string& formatstr); + int GetFormatStr(std::string& formatstr); + + int SetIndex(unsigned16_t index); + unsigned16_t GetIndex(void); + + // int SetName(std::string& formatstr); + + }; + +} + +#endif //FORMAT_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: format.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:57 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + diff --git a/uppdev/XLS/formtags.h b/uppdev/XLS/formtags.h new file mode 100644 index 000000000..6d74e2d8e --- /dev/null +++ b/uppdev/XLS/formtags.h @@ -0,0 +1,240 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/formtags.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +/* + sed -e 's/^\([A-Za-z0-9]*\)$/#define FT_\1 \\/' biff_formula_tags_norm.txt | sed -e 's/^ \([A-F0-9]*\)\h$/ ((unsigned char)0x\1)/' | sed -e "s/^ \([oc].*\)//" > formtags.h +*/ + +#define FT_ptgExp \ + ((unsigned char)0x01) +#define FT_ptgTbl \ + ((unsigned char)0x02) +#define FT_ptgAdd \ + ((unsigned char)0x03) +#define FT_ptgSub \ + ((unsigned char)0x04) +#define FT_ptgMul \ + ((unsigned char)0x05) +#define FT_ptgDiv \ + ((unsigned char)0x06) +#define FT_ptgPower \ + ((unsigned char)0x07) +#define FT_ptgConcat \ + ((unsigned char)0x08) +#define FT_ptgLT \ + ((unsigned char)0x09) +#define FT_ptgLE \ + ((unsigned char)0x0A) +#define FT_ptgEQ \ + ((unsigned char)0x0B) +#define FT_ptgGE \ + ((unsigned char)0x0C) +#define FT_ptgGT \ + ((unsigned char)0x0D) +#define FT_ptgNE \ + ((unsigned char)0x0E) +#define FT_ptgIsect \ + ((unsigned char)0x0F) +#define FT_ptgUnion \ + ((unsigned char)0x10) +#define FT_ptgRange \ + ((unsigned char)0x11) +#define FT_ptgUplus \ + ((unsigned char)0x12) +#define FT_ptgUminus \ + ((unsigned char)0x13) +#define FT_ptgPercent \ + ((unsigned char)0x14) +#define FT_ptgParen \ + ((unsigned char)0x15) +#define FT_ptgMissArg \ + ((unsigned char)0x16) +#define FT_ptgStr \ + ((unsigned char)0x17) +#define FT_ptgAttr \ + ((unsigned char)0x19) +#define FT_ptgSheet \ + ((unsigned char)0x1A) +#define FT_ptgEndSheet \ + ((unsigned char)0x1B) +#define FT_ptgErr \ + ((unsigned char)0x1C) +#define FT_ptgBool \ + ((unsigned char)0x1D) +#define FT_ptgInt \ + ((unsigned char)0x1E) +#define FT_ptgNum \ + ((unsigned char)0x1F) +#define FT_ptgArray \ + ((unsigned char)0x20) +#define FT_ptgFunc \ + ((unsigned char)0x21) +#define FT_ptgFuncVar \ + ((unsigned char)0x22) +#define FT_ptgName \ + ((unsigned char)0x23) +#define FT_ptgRef \ + ((unsigned char)0x24) +#define FT_ptgArea \ + ((unsigned char)0x25) +#define FT_ptgMemArea \ + ((unsigned char)0x26) +#define FT_ptgMemErr \ + ((unsigned char)0x27) +#define FT_ptgMemNoMem \ + ((unsigned char)0x28) +#define FT_ptgMemFunc \ + ((unsigned char)0x29) +#define FT_ptgRefErr \ + ((unsigned char)0x2A) +#define FT_ptgAreaErr \ + ((unsigned char)0x2B) +#define FT_ptgRefN \ + ((unsigned char)0x2C) +#define FT_ptgAreaN \ + ((unsigned char)0x2D) +#define FT_ptgMemAreaN \ + ((unsigned char)0x2E) +#define FT_ptgMemNoMemN \ + ((unsigned char)0x2F) +#define FT_ptgNameX \ + ((unsigned char)0x39) +#define FT_ptgRef3d \ + ((unsigned char)0x3A) +#define FT_ptgArea3d \ + ((unsigned char)0x3B) +#define FT_ptgRefErr3d \ + ((unsigned char)0x3C) +#define FT_ptgAreaErr3d \ + ((unsigned char)0x3D) +#define FT_ptgArrayV \ + ((unsigned char)0x40) +#define FT_ptgFuncV \ + ((unsigned char)0x41) +#define FT_ptgFuncVarV \ + ((unsigned char)0x42) +#define FT_ptgNameV \ + ((unsigned char)0x43) +#define FT_ptgRefV \ + ((unsigned char)0x44) +#define FT_ptgAreaV \ + ((unsigned char)0x45) +#define FT_ptgMemAreaV \ + ((unsigned char)0x46) +#define FT_ptgMemErrV \ + ((unsigned char)0x47) +#define FT_ptgMemNoMemV \ + ((unsigned char)0x48) +#define FT_ptgMemFuncV \ + ((unsigned char)0x49) +#define FT_ptgRefErrV \ + ((unsigned char)0x4A) +#define FT_ptgAreaErrV \ + ((unsigned char)0x4B) +#define FT_ptgRefNV \ + ((unsigned char)0x4C) +#define FT_ptgAreaNV \ + ((unsigned char)0x4D) +#define FT_ptgMemAreaNV \ + ((unsigned char)0x4E) +#define FT_ptgMemNoMemNV \ + ((unsigned char)0x4F) +#define FT_ptgFuncCEV \ + ((unsigned char)0x58) +#define FT_ptgNameXV \ + ((unsigned char)0x59) +#define FT_ptgRef3dV \ + ((unsigned char)0x5A) +#define FT_ptgArea3dV \ + ((unsigned char)0x5B) +#define FT_ptgRefErr3dV \ + ((unsigned char)0x5C) +#define FT_ptgAreaErr3dV \ + ((unsigned char)0x5D) +#define FT_ptgArrayA \ + ((unsigned char)0x60) +#define FT_ptgFuncA \ + ((unsigned char)0x61) +#define FT_ptgFuncVarA \ + ((unsigned char)0x62) +#define FT_ptgNameA \ + ((unsigned char)0x63) +#define FT_ptgRefA \ + ((unsigned char)0x64) +#define FT_ptgAreaA \ + ((unsigned char)0x65) +#define FT_ptgMemAreaA \ + ((unsigned char)0x66) +#define FT_ptgMemErrA \ + ((unsigned char)0x67) +#define FT_ptgMemNoMemA \ + ((unsigned char)0x68) +#define FT_ptgMemFuncA \ + ((unsigned char)0x69) +#define FT_ptgRefErrA \ + ((unsigned char)0x6A) +#define FT_ptgAreaErrA \ + ((unsigned char)0x6B) +#define FT_ptgRefNA \ + ((unsigned char)0x6C) +#define FT_ptgAreaNA \ + ((unsigned char)0x6D) +#define FT_ptgMemAreaNA \ + ((unsigned char)0x6E) +#define FT_ptgMemNoMemNA \ + ((unsigned char)0x6F) +#define FT_ptgFuncCEA \ + ((unsigned char)0x78) +#define FT_ptgNameXA \ + ((unsigned char)0x79) +#define FT_ptgRef3dA \ + ((unsigned char)0x7A) +#define FT_ptgArea3dA \ + ((unsigned char)0x7B) +#define FT_ptgRefErr3dA \ + ((unsigned char)0x7C) +#define FT_ptgAreaErr3dA \ + ((unsigned char)0x7D) + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: formtags.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/globalrec.cpp b/uppdev/XLS/globalrec.cpp new file mode 100644 index 000000000..de35b40b2 --- /dev/null +++ b/uppdev/XLS/globalrec.cpp @@ -0,0 +1,1046 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/globalrec.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + + +/* +********************************************************************** +CGlobalRecords class implementation +********************************************************************** +*/ + +/* + +const font_init_t CGlobalRecords::m_Default_Fonts [GLOBAL_NUM_DEFAULT_FONT ] = +{ +{0x0000, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET}, +{0x0001, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET}, +{0x0002, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET}, +{0x0003, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET}, +{0x0005, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_ATTR_RESERVED0, 0x02, FONT_DFLT_CHARSET} +}; + +const format_t CGlobalRecords::m_Default_Formats[GLOBAL_NUM_DEFAULT_FORMATS ] = +{ + { 0x05, "\"$\"#,##0;\\-\"$\"#,##0" }, + { 0x06, "\"$\"#,##0;[Red]\\-\"$\"#,##0" }, + { 0x07, "\"$\"#,##0.00;\\-\"$\"#,##0.00" }, + { 0x08, "\"$\"#,##0.00;[Red]\\-\"$\"#,##0.00" }, + { 0x2a, "_-\"$\"* #,##0_-;\\-\"$\"* #,##0_-;_-\"$\"* \"-\"_-;_-@_-" }, + { 0x29, "_-* #,##0_-;\\-* #,##0_-;_-* \"-\"_-;_-@_-" }, + { 0x2c, "_-\"$\"* #,##0.00_-;\\-\"$\"* #,##0.00_-;_-\"$\"* \"-\"??_-;_-@_-" }, + { 0x2b, "_-* #,##0.00_-;\\-* #,##0.00_-;_-* \"-\"??_-;_-@_-" } +}; + +const xf_init_t CGlobalRecords::m_Default_XFs[GLOBAL_NUM_DEFAULT_XFS] = +{ + {0x0000, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0001, 0x0001, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0002, 0x0001, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0003, 0x0002, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0004, 0x0002, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0005, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0006, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0007, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0008, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x0009, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x000a, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x000b, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x000c, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x000d, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x000e, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK}, + {0x000f, 0x0000, 0x0000, HALIGN_GENERAL, VALIGN_BOTTOM, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_CELL , BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK} +}; +const style_t CGlobalRecords::m_Default_Styles [GLOBAL_NUM_DEFAULT_STYLES ] = +{ + {0x0010, 0x03 }, + {0x0011, 0x06 }, + {0x0012, 0x00 }, + {0x0013, 0x07 }, + {0x0000, 0x04 }, + {0x0014, 0x05 } +}; + +*/ + +/* +**************************************** +**************************************** +*/ + +CGlobalRecords::CGlobalRecords() + : m_DumpState(GLOBAL_INIT), + m_pCurrentData(NULL) +{ + + + // Initialize default fonts + font_t* newfont; + + newfont = new font_t(0x0000, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET); + newfont->MarkUsed(); + newfont->MarkUsed(); + m_DefaultFonts.push_back(newfont); + + newfont = new font_t(0x0001, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET); + newfont->MarkUsed(); + newfont->MarkUsed(); + m_DefaultFonts.push_back(newfont); + + newfont = new font_t(0x0002, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET); + newfont->MarkUsed(); + newfont->MarkUsed(); + m_DefaultFonts.push_back(newfont); + + newfont = new font_t(0x0003, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_DFLT_ATTRIBUTES, FONT_DFLT_FAMILY, FONT_DFLT_CHARSET); + newfont->MarkUsed(); + newfont->MarkUsed(); + m_DefaultFonts.push_back(newfont); + + newfont = new font_t(0x0004, "Arial", 0x00c8, BOLDNESS_NORMAL, UNDERLINE_NONE, SCRIPT_NONE, COLOR_BLACK, FONT_ATTR_RESERVED0, 0x02, FONT_DFLT_CHARSET); + newfont->MarkUsed(); + newfont->MarkUsed(); + m_DefaultFonts.push_back(newfont); + + // Initialize default formats +/* + format_t* newformat; + newformat = new format_t(0x05,"\"$\"#,##0;\\-\"$\"#,##0"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x06,"\"$\"#,##0;[Red]\\-\"$\"#,##0"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x07,"\"$\"#,##0.00;\\-\"$\"#,##0.00"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x08,"\"$\"#,##0.00;[Red]\\-\"$\"#,##0.00"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x27,"_-\"$\"* #,##0_-;\\-\"$\"* #,##0_-;_-\"$\"* \"-\"_-;_-@_-"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x29,"_-* #,##0_-;\\-* #,##0_-;_-* \"-\"_-;_-@_-"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x2c,"_-\"$\"* #,##0.00_-;\\-\"$\"* #,##0.00_-;_-\"$\"* \"-\"??_-;_-@_-"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + + newformat = new format_t(0x2b,"_-* #,##0.00_-;\\-* #,##0.00_-;_-* \"-\"??_-;_-@_-"); + newformat->MarkUsed(); + m_Formats.push_back(newformat); + +*/ + + // Initialize default XF records + xf_t* newxf; + newxf = new xf_t(0x0000, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0001, NULL/*0x0001*/, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0002, NULL/*0x0001*/, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0003, NULL/*0x0002*/, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0004, NULL/*0x0002*/, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0005, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0006, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0007, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0008, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x0009, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x000a, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x000b, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x000c, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x000d, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x000e, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_STYLE, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + newxf = new xf_t(0x000f, NULL, FMT_GENERAL, HALIGN_GENERAL, VALIGN_BOTTOM, INDENT_NONE, ORI_NONE, COLOR_BLACK, COLOR_WHITE, FILL_NONE, XF_LOCKED, XF_NO_HIDDEN, XF_NO_WRAPPED, XF_IS_CELL , BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK, BORDER_NONE, COLOR_BLACK); + newxf->MarkUsed(); + newxf->MarkUsed(); + m_DefaultXFs.push_back(newxf); + + + style_t* newstyle; + newstyle = new style_t; + newstyle->xfindex = 0x0010; + newstyle->builtintype = 0x03; + m_Styles.push_back(newstyle); + + newstyle = new style_t; + newstyle->xfindex = 0x0011; + newstyle->builtintype = 0x06; + m_Styles.push_back(newstyle); + + newstyle = new style_t; + newstyle->xfindex = 0x0012; + newstyle->builtintype = 0x00; + m_Styles.push_back(newstyle); + + newstyle = new style_t; + newstyle->xfindex = 0x0013; + newstyle->builtintype = 0x07; + m_Styles.push_back(newstyle); + + newstyle = new style_t; + newstyle->xfindex = 0x0000; + newstyle->builtintype = 0x04; + m_Styles.push_back(newstyle); + + newstyle = new style_t; + newstyle->xfindex = 0x0014; + newstyle->builtintype = 0x05; + m_Styles.push_back(newstyle); + + + +/* +// Initialize lists with de default values: +int i; + +for(i = 0; iSetIndex(next_fontindex); + next_fontindex++; + m_pCurrentData = (CUnit*)(new CFont(*font_dflt)); + + if(font_dflt != (--m_DefaultFonts.end())) + {// if it was'nt the last font from the list, increment to get the next one + font_dflt++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_FONTS; + font_dflt = m_DefaultFonts.begin(); + } + + break; + } + case GLOBAL_FONTS:// ********** STATE 3B ************* + XTRACE("\tFONTS"); + { + + repeat = false; + + if(!m_Fonts.empty()) + {// First check if the list of fonts is not empty... + + + if((*font)->IsUsed()) + { + // According documentation, for backwards + // compatibility, there is no index 4. + if(next_fontindex==4) next_fontindex++; + (*font)->SetIndex(next_fontindex); + next_fontindex++; + m_pCurrentData = (CUnit*)(new CFont(*font)); + } + else + { + repeat = true; + } + + + if(font != (--m_Fonts.end())) + {// if it was'nt the last font from the list, increment to get the next one + font++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_FORMATS; + font = m_Fonts.begin(); + } + } + else + {// if the list is empty, change the dump state. + m_DumpState = GLOBAL_FORMATS; + //font = m_Fonts.begin(); + repeat = true; + } + + break; + } + + case GLOBAL_FORMATS: // ********** STATE 4 ************* + { + + repeat = false; + + XTRACE("\tFORMATS"); + if(!m_Formats.empty()) + {// First check if the list of fonts is not empty... + + + if(/*(*format)->IsUsed()*/true) + { + if((*format)->GetIndex()!=0) + next_formatindex = (*format)->GetIndex(); + + (*format)->SetIndex(next_formatindex); + next_formatindex++; + m_pCurrentData = (CUnit*)(new CFormat(*format)); + } + else + { + repeat = true; + } + + if(format != (--m_Formats.end())) + {// if it was'nt the last font from the list, increment to get the next one + format++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_DEFAULTXFS; + format = m_Formats.begin(); + } + } + else + {// if the list is empty, change the dump state. + m_DumpState = GLOBAL_DEFAULTXFS; + // format = m_Formats.begin(); + repeat = true; + } + + break; + } + + case GLOBAL_DEFAULTXFS: // ********** STATE 5a ************* + { + + repeat = false; + + XTRACE("\tXDEFAULTFS"); + + (*xf_dflt)->SetIndex(next_xfindex); + next_xfindex++; + + m_pCurrentData = (CUnit*)(new CExtFormat(*xf_dflt)); + + + if(xf_dflt != (--m_DefaultXFs.end())) + {// if it was'nt the last font from the list, increment to get the next one + xf_dflt++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_XFS; + xf_dflt = m_DefaultXFs.begin(); + } + + break; + } + + case GLOBAL_XFS: // ********** STATE 5b ************* + { + + repeat = false; + + XTRACE("\tXFS"); + if(!m_XFs.empty()) + {// First check if the list of fonts is not empty... + + if((*xf)->IsUsed()) + { + (*xf)->SetIndex(next_xfindex); + next_xfindex++; + + m_pCurrentData = (CUnit*)(new CExtFormat(*xf)); + } + else + { + repeat = true; + } + + if(xf != (--m_XFs.end())) + {// if it was'nt the last font from the list, increment to get the next one + xf++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_STYLES; + xf = m_XFs.begin(); + } + } + else + {// if the list is empty, change the dump state. + m_DumpState = GLOBAL_STYLES; + //xf = m_XFs.begin(); + repeat = true; + } + + break; + } + + case GLOBAL_STYLES: // ********** STATE 6 ************* + { + XTRACE("\tSTYLES"); + repeat = false; + + if(!m_Styles.empty()) + {// First check if the list of fonts is not empty... + + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CStyle(*style)); + + if(style != (--m_Styles.end())) + {// if it was'nt the last font from the list, increment to get the next one + style++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_BOUNDSHEETS; + style = m_Styles.begin(); + } + } + else + {// if the list is empty, change the dump state. + m_DumpState = GLOBAL_BOUNDSHEETS; + //style = m_Styles.begin(); + repeat = true; + } + + break; + } + + + case GLOBAL_BOUNDSHEETS: // ********** STATE 7 ************* + { + repeat = false; + + XTRACE("\tBOUNDSHEETS"); + if(!m_BoundSheets.empty()) + {// First check if the list of fonts is not empty... + + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CBSheet(*bsheet)); + + if(bsheet != (--m_BoundSheets.end())) + {// if it was'nt the last font from the list, increment to get the next one + bsheet++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = GLOBAL_EOF; + bsheet = m_BoundSheets.begin(); + } + } + else + {// if the list is empty, change the dump state. + + m_DumpState = GLOBAL_EOF; + bsheet = m_BoundSheets.begin(); + repeat = true; + } + + break; + } + + case GLOBAL_EOF:// ********** STATE 8 ************* + XTRACE("\tEOF"); + + repeat = false; + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CEof()); + m_DumpState = GLOBAL_FINISH; + + break; + + case GLOBAL_FINISH: // ********** STATE 9 ************* + + XTRACE("\tFINISH"); + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = NULL; + m_DumpState = GLOBAL_INIT; + + break; + + default: + /* It shouldn't get here */ + XTRACE("\tDEFAULT"); + break; + + + } + } while(repeat); + + return m_pCurrentData; + +} + + +/* +**************************************** +**************************************** +*/ +void CGlobalRecords::AddBoundingSheet(unsigned32_t streampos, + unsigned16_t attributes, + string& sheetname) +{ + + boundsheet_t* bsheetdef = new boundsheet_t; + + bsheetdef->worksheet = (bool)((attributes & BSHEET_ATTR_WORKSHEET ) == BSHEET_ATTR_WORKSHEET ); + bsheetdef->ex4macro = (bool)((attributes & BSHEET_ATTR_EX4MACRO ) == BSHEET_ATTR_EX4MACRO ); + bsheetdef->chart = (bool)((attributes & BSHEET_ATTR_CHART ) == BSHEET_ATTR_CHART ); + bsheetdef->vbmodule = (bool)((attributes & BSHEET_ATTR_VBMODULE ) == BSHEET_ATTR_VBMODULE ); + bsheetdef->visible = (bool)((attributes & BSHEET_ATTR_VISIBLE ) == BSHEET_ATTR_VISIBLE ); + bsheetdef->hidden = (bool)((attributes & BSHEET_ATTR_HIDDEN ) == BSHEET_ATTR_HIDDEN ); + bsheetdef->veryhidden = (bool)((attributes & BSHEET_ATTR_VERYHIDDEN ) == BSHEET_ATTR_VERYHIDDEN); + + bsheetdef->asheetname = sheetname; + bsheetdef->streampos = streampos; + + m_BoundSheets.push_back(bsheetdef); + +} +#if VERSION_BIFF == VERSION_BIFF8 +void CGlobalRecords::AddBoundingSheet(unsigned32_t streampos, + unsigned16_t attributes, + ustring& sheetname +#ifdef HAVE_ICONV + , string& iconv_code +#endif + ) +{ + boundsheet_t* bsheetdef = new boundsheet_t; + + bsheetdef->worksheet = (bool)((attributes & BSHEET_ATTR_WORKSHEET ) == BSHEET_ATTR_WORKSHEET ); + bsheetdef->ex4macro = (bool)((attributes & BSHEET_ATTR_EX4MACRO ) == BSHEET_ATTR_EX4MACRO ); + bsheetdef->chart = (bool)((attributes & BSHEET_ATTR_CHART ) == BSHEET_ATTR_CHART ); + bsheetdef->vbmodule = (bool)((attributes & BSHEET_ATTR_VBMODULE ) == BSHEET_ATTR_VBMODULE ); + bsheetdef->visible = (bool)((attributes & BSHEET_ATTR_VISIBLE ) == BSHEET_ATTR_VISIBLE ); + bsheetdef->hidden = (bool)((attributes & BSHEET_ATTR_HIDDEN ) == BSHEET_ATTR_HIDDEN ); + bsheetdef->veryhidden = (bool)((attributes & BSHEET_ATTR_VERYHIDDEN ) == BSHEET_ATTR_VERYHIDDEN); + + bsheetdef->usheetname = sheetname; +#ifdef HAVE_ICONV + bsheetdef->iconv_code = iconv_code; +#endif + bsheetdef->streampos = streampos; + + m_BoundSheets.push_back(bsheetdef); + +} +#endif + +/* +**************************************** +**************************************** +*/ +void CGlobalRecords::AddBoundingSheet(boundsheet_t* bsheetdef) +{ + m_BoundSheets.push_back(bsheetdef); +} + + +/* +**************************************** +It returns pointers to BoundingSheets one by one until +all are spanned, in which case the returned pointer is NULL +**************************************** +*/ +void CGlobalRecords::GetBoundingSheets(Boundsheet_List_Itor_t& bs) +{ + if(bs != m_BoundSheets.end()) + bs++; + else + bs = m_BoundSheets.begin(); +} + + +Boundsheet_List_Itor_t CGlobalRecords::GetFirstBoundSheet() +{ + return m_BoundSheets.begin(); +} + +Boundsheet_List_Itor_t CGlobalRecords::GetEndBoundSheet() +{ + return m_BoundSheets.end(); +} + +/* +**************************************** +**************************************** +*/ + +font_t* CGlobalRecords::AddFont(font_t* newfont ) +{ + + newfont->SetIndex(0x0000); + pair itorpair = m_Fonts.insert(newfont); + + if(newfont != *itorpair.first) + delete newfont; + + return(*itorpair.first); + +} + +/* +**************************************** +**************************************** +*/ + +format_t* CGlobalRecords::AddFormat(format_t* newformat ) +{ + + newformat->SetIndex(0x0000); + m_Formats.push_back(newformat); + return(m_Formats.back()); + +} + + +/* +**************************************** +**************************************** +*/ + +xf_t* CGlobalRecords::AddXFormat(xf_t* xf) +{ + xf->SetIndex(0x0000); + pair itorpair = m_XFs.insert(xf); + + if(xf != *itorpair.first) + delete xf; + + return(*itorpair.first); +} + +xf_t* CGlobalRecords::ReplaceXFormat(xf_t* xf, xf_t* xfnew) +{ + XF_Set_Itor_t existing_xf; + existing_xf = m_XFs.find(xf); + + xf_t* inserted = NULL; + if(existing_xf != m_XFs.end()) + { + xf_t* todiexf = *existing_xf; + m_XFs.erase(existing_xf); + delete todiexf; + pair itorpair = m_XFs.insert(xfnew); + + inserted = *itorpair.first; + if(inserted != xfnew) + delete xfnew; + } + else + { + // This should never happen + // since the previous pointer is taken + // from the container itself... but anyway + pair itorpair = m_XFs.insert(xfnew); + + inserted = *itorpair.first; + if(inserted != xfnew) + delete xfnew; + } + return inserted; +} + +font_t* CGlobalRecords::ReplaceFont(font_t* fnt, font_t* fntnew) +{ + Font_Set_Itor_t existing_font; + existing_font = m_Fonts.find(fnt); + + font_t *inserted = NULL; + if(existing_font != m_Fonts.end()) + { + font_t* todiefont = *existing_font; + m_Fonts.erase(existing_font); + delete todiefont; + + pair itorpair = m_Fonts.insert(fntnew); + + inserted = *itorpair.first; + if(inserted != fntnew) + delete fntnew; + + } + else + { + // This should never happen + // since the previous pointer is taken + // from the container itself... but anyway + pair itorpair = m_Fonts.insert(fntnew); + + inserted = *itorpair.first; + if(inserted != fntnew) + delete fntnew; + + } + return inserted; + +} + + +font_t* CGlobalRecords::GetDefaultFont(void) +{ + return *m_DefaultFonts.begin(); + +} + +xf_t* CGlobalRecords::GetDefaultXF(void) +{ + return m_DefaultXFs.back(); + +} + +/* +**************************************** +Maybe the implementation of this procedure +can be optimized. +**************************************** +*/ + +unsigned32_t CGlobalRecords::GetSize(void) +{ + + CUnit* pdata = NULL; + unsigned32_t total_datasize = 0; + bool keep = true; + do + { + + pdata = DumpData(); + if(pdata != NULL) + { + total_datasize += pdata->GetDataSize(); + delete pdata; + } + else + { + keep = false; + } + + }while(keep); + + return total_datasize; + + +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: globalrec.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:56 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/globalrec.h b/uppdev/XLS/globalrec.h new file mode 100644 index 000000000..78a9fb258 --- /dev/null +++ b/uppdev/XLS/globalrec.h @@ -0,0 +1,179 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/globalrec.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef GLOBALREC_H +#define GLOBALREC_H + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace xlslib_core +{ + + /* +*********************************** +CGlobalRecords class declaration +*********************************** +*/ + + +#define GLOBAL_NUM_DEFAULT_FONT (5) +#define GLOBAL_NUM_DEFAULT_FORMATS (8) +#define GLOBAL_NUM_DEFAULT_XFS (16) +#define GLOBAL_NUM_DEFAULT_STYLES (6) + + + + typedef enum + { + GLOBAL_INIT, + GLOBAL_BOF, + GLOBAL_CODEPAGE, + GLOBAL_WINDOW1, + GLOBAL_DATEMODE, + GLOBAL_DEFAULTFONTS, + GLOBAL_FONTS, + GLOBAL_FORMATS, + GLOBAL_DEFAULTXFS, + GLOBAL_XFS, + GLOBAL_STYLES, + GLOBAL_BOUNDSHEETS, + GLOBAL_EOF, + GLOBAL_FINISH + } GlobalRecordDumpState_t; + + + + class CGlobalRecords: public CBiffSection + { + private: + Font_Set_t m_Fonts; + Font_List_t m_DefaultFonts; + Format_List_t m_Formats; + XF_Set_t m_XFs; + XF_List_t m_DefaultXFs; + Style_List_t m_Styles; + Boundsheet_List_t m_BoundSheets; + + /* + static const font_init_t m_Default_Fonts [GLOBAL_NUM_DEFAULT_FONT ]; + static const format_t m_Default_Formats[GLOBAL_NUM_DEFAULT_FORMATS ]; + static const xf_init_t m_Default_XFs [GLOBAL_NUM_DEFAULT_XFS ]; + static const style_t m_Default_Styles [GLOBAL_NUM_DEFAULT_STYLES ]; + */ + + // State Machine variables + + GlobalRecordDumpState_t m_DumpState; + CUnit* m_pCurrentData; + + public: + CGlobalRecords(); + ~CGlobalRecords(); + + void AddBoundingSheet(unsigned32_t streampos, + unsigned16_t attributes, + std::string& sheetname); +#if VERSION_BIFF == VERSION_BIFF8 + void AddBoundingSheet(unsigned32_t streampos, + unsigned16_t attributes, + std::ustring& sheetname +#ifdef HAVE_ICONV + , std::string& iconv_code +#endif + ); +#endif + void AddBoundingSheet(boundsheet_t* bsheetdef); + + + // TODO: Check if the font already exists (using CRC or raw comparison) + font_t* AddFont(font_t* newfont ); + format_t* AddFormat(format_t*); + + xf_t* AddXFormat(xf_t* xf); + xf_t* ReplaceXFormat(xf_t* xf, xf_t* xfnew); + font_t* ReplaceFont(font_t* fnt, font_t* fntnew); + + void GetBoundingSheets(Boundsheet_List_Itor_t &bs); + + // A Kind of state machine that will return + // a non-null pointer to the data unit until all data has been retrieved. + CUnit* DumpData(bool reset = false); + + Boundsheet_List_Itor_t GetFirstBoundSheet(); + Boundsheet_List_Itor_t GetEndBoundSheet(); + unsigned32_t GetSize(void); + font_t* GetDefaultFont(void); + xf_t* GetDefaultXF(void); + + private: + // Former static variiables + // ======================== + + // From DumpData + Font_Set_Itor_t font; + Font_List_Itor_t font_dflt; + Format_List_Itor_t format; + + XF_Set_Itor_t xf; + XF_List_Itor_t xf_dflt; + + unsigned16_t next_fontindex; + unsigned16_t next_xfindex; + unsigned16_t next_formatindex; + Style_List_Itor_t style; + Boundsheet_List_Itor_t bsheet; + }; + +} +#endif // GLOBALREC_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: globalrec.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/index.cpp b/uppdev/XLS/index.cpp new file mode 100644 index 000000000..951b55428 --- /dev/null +++ b/uppdev/XLS/index.cpp @@ -0,0 +1,158 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/index.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + + +/* +****************************** +CIndex class implementation +****************************** +*/ +CIndex::CIndex(unsigned32_t firstrow, + unsigned32_t lastrow) +{ + SetRecordType((signed32_t)RECTYPE_INDEX); + + AddValue32(INDEX_DFLT_RESERVED); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue16(firstrow); + AddValue16(lastrow+1); +#else + AddValue32(firstrow); + AddValue32(lastrow+1); +#endif + + AddValue32(INDEX_DFLT_RESERVED); +// NOTE: This record is created with an empty array. It should work if the rest +// of the record is not completed later, since the record's size reflects the +// lack of such array + SetRecordLength(GetDataSize()-4); +} + +CIndex::~CIndex() +{ +} + + +/* +********************************** +********************************** +*/ +void CIndex::AddDBCellOffset(unsigned32_t dboffset) +{ + AddValue32(dboffset); + + SetRecordLength(GetDataSize()-4); // Update record's length +} + +/* +********************************** +********************************** +*/ +void CIndex::SetRows(unsigned32_t firstrow, + unsigned32_t lastrow) +{ + +#if VERSION_BIFF == VERSION_BIFF5 + SetValueAt((signed16_t)firstrow, INDEX_OFFSET_B7FIRSTROW); + SetValueAt((signed16_t)lastrow, INDEX_OFFSET_B7LASTROW); +#else + SetValueAt((signed32_t)firstrow, INDEX_OFFSET_B7FIRSTROW); + SetValueAt((signed32_t)lastrow, INDEX_OFFSET_B7LASTROW); +#endif + +} + +/* +********************************** +********************************** +*/ + +unsigned32_t CIndex::GetFirstRow(void) +{ + + unsigned32_t retval; + +#if VERSION_BIFF == VERSION_BIFF5 + signed16_t firstrow; + GetValue16From(&firstrow, INDEX_OFFSET_B7FIRSTROW); + retval = firstrow; +#else + signed32_t firstrow; + GetValue32From(&firstrow, INDEX_OFFSET_B7FIRSTROW); + retval = firstrow; +#endif + + return retval; +} + +/* +********************************** +********************************** +*/ + +unsigned32_t CIndex::GetLastRow(void) +{ + + unsigned32_t retval; + +#if VERSION_BIFF == VERSION_BIFF5 + signed16_t lastrow; + GetValue16From(&lastrow, INDEX_OFFSET_B7LASTROW); + retval = lastrow; +#else + signed32_t lastrow; + GetValue32From(&lastrow, INDEX_OFFSET_B7LASTROW); + retval = lastrow; +#endif + + return retval; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: index.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:53 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/index.h b/uppdev/XLS/index.h new file mode 100644 index 000000000..b4c228f61 --- /dev/null +++ b/uppdev/XLS/index.h @@ -0,0 +1,86 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/index.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef INDEX_H +#define INDEX_H + +#include +#include +#include + +namespace xlslib_core +{ + + /* +****************************** +CIndex class declaration +****************************** +*/ +#define INDEX_DFLT_RESERVED ((unsigned32_t)0x00000000) + +#define INDEX_OFFSET_B7FIRSTROW ((unsigned32_t)8) +#define INDEX_OFFSET_B7LASTROW ((unsigned32_t)10) +#define INDEX_OFFSET_B8FIRSTROW ((unsigned32_t)8) +#define INDEX_OFFSET_B8LASTROW ((unsigned32_t)12) + + class CIndex: public CRecord + { + private: + + public: + + CIndex(unsigned32_t firstrow, + unsigned32_t lastrow); + ~CIndex(); + void AddDBCellOffset(unsigned32_t dbcoffset); + void SetRows(unsigned32_t firstrow, unsigned32_t lastrow); + unsigned32_t GetFirstRow(void); + unsigned32_t GetLastRow(void); + + }; + +} +#endif //INDEX_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: index.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/init b/uppdev/XLS/init new file mode 100644 index 000000000..91bcbc0e2 --- /dev/null +++ b/uppdev/XLS/init @@ -0,0 +1,4 @@ +#ifndef _XLS_icpp_init_stub +#define _XLS_icpp_init_stub +#include "Core/init" +#endif diff --git a/uppdev/XLS/label.cpp b/uppdev/XLS/label.cpp new file mode 100644 index 000000000..cc08791ff --- /dev/null +++ b/uppdev/XLS/label.cpp @@ -0,0 +1,262 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/label.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +****************************** +CLabel class implementation +****************************** +*/ +CLabel::CLabel(unsigned16_t row, + unsigned16_t col, + string& strlabel, + xf_t* pxfval) +{ + SetRecordType(RECTYPE_LABEL); + AddValue16(row); + AddValue16(col); + + unsigned16_t xfindex; + if(pxfval != NULL) + xfindex = pxfval->GetIndex(); + else + xfindex = 0x000f; + + + AddValue16(xfindex); + + signed16_t labelsize = strlabel.size(); +#if VERSION_BIFF == VERSION_BIFF5 + AddValue16((unsigned16_t)labelsize); + AddDataArray((unsigned8_t*)strlabel.c_str(), strlabel.size()); +#else + AddUnicodeStrlen((unsigned16_t)labelsize); + AddUnicodeString((unsigned8_t*)strlabel.c_str(), strlabel.size()); +#endif + + SetRecordLength(GetDataSize()-4); +} + +#if VERSION_BIFF == VERSION_BIFF8 + +CLabel::CLabel(unsigned16_t row, + unsigned16_t col, + ustring& ustrlabel +#ifdef HAVE_ICONV + , string& iconv_code +#endif + , xf_t* pxfval) +{ + unsigned16_t xfindex; + + SetRecordType(RECTYPE_LABEL); + AddValue16(row); + AddValue16(col); + + if(pxfval != NULL) + xfindex = pxfval->GetIndex(); + else + xfindex = 0x000f; + + AddValue16(xfindex); + +#ifdef HAVE_ICONV + u16string u16sheetname; + + Conv32to16(iconv_code, ustrlabel, u16sheetname); +// size_t outSize, resultSize; +// size_t iconv (iconv_t cd, char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft); + AddUnicodeStrlen((unsigned16_t)u16sheetname.size()); + AddUnicodeString((unsigned16_t* )u16sheetname.c_str(), u16sheetname.size()); +#else + AddUnicodeStrlen((unsigned16_t)ustrlabel.size()); + AddUnicodeString((unsigned16_t*)ustrlabel.c_str(), ustrlabel.size()); +#endif + + SetRecordLength(GetDataSize()-4); +} +#endif + +CLabel::CLabel(label_t& labeldef) + +{ + SetRecordType(RECTYPE_LABEL); + AddValue16(labeldef.GetRow()); + AddValue16(labeldef.GetCol()); + AddValue16(labeldef.GetXFIndex()); + + signed16_t labelsize = labeldef.GetStrLabelSize() ; + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue16((unsigned16_t)labelsize); + AddDataArray(labeldef.GetStrLabelBuffer(), labelsize); +#else + if(labeldef.GetStrLabelSize()) { + AddUnicodeStrlen((unsigned16_t)labelsize); + AddUnicodeString(labeldef.GetStrLabelBuffer(), labelsize); + } else { +#ifdef HAVE_ICONV + u16string u16sheetname; + string iconvStr; + ustring label; + + iconvStr = *labeldef.GetIconvCode(); + label = *labeldef.GetUstrLabel(); + + Conv32to16(iconvStr, label, u16sheetname); + // size_t outSize, resultSize; + // size_t iconv (iconv_t cd, char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft); + AddUnicodeStrlen((unsigned16_t)u16sheetname.size()); + AddUnicodeString((unsigned16_t* )u16sheetname.c_str(), u16sheetname.size()); +#else + labelsize = labeldef.GetWStrLabelSize() ; + AddUnicodeStrlen((unsigned16_t)labelsize); + AddUnicodeString((unsigned16_t*)labeldef.GetWStrLabelBuffer(), labelsize); +#endif + } +#endif + + SetRecordLength(GetDataSize()-4); +} + +CLabel::~CLabel() +{ +} + +/* +****************************** +label_t class implementation +****************************** +*/ +xlslib_core::label_t::label_t(unsigned16_t rowval, unsigned16_t colval, + string& labelstrval, xf_t* pxfval) +{ + row = rowval; + col = colval; + if(pxfval != NULL) + pxfval->MarkUsed(); + pxf = pxfval; + +#if VERSION_BIFF == VERSION_BIFF5 + if(labelstrval.size() > 255) + { + + labelstrval.resize(255); + labelstrval[252] = '.'; + labelstrval[253] = '.'; + labelstrval[254] = '.'; + + } +#endif + + aStrlabel = labelstrval; +} + +#if VERSION_BIFF == VERSION_BIFF8 +xlslib_core::label_t::label_t(unsigned16_t rowval, unsigned16_t colval, + ustring& labelstrval +#ifdef HAVE_ICONV + , string& code +#endif + , xf_t* pxfval) +{ + row = rowval; + col = colval; + if(pxfval != NULL) + pxfval->MarkUsed(); + pxf = pxfval; + + uStrlabel = labelstrval; +#ifdef HAVE_ICONV + iconv_code = code; +#endif +} +#endif + +/* +****************************** +****************************** +*/ + +unsigned16_t xlslib_core::label_t::GetSize() +{ + unsigned16_t size = 0; + + size += 12; // Minimal label's size + size += aStrlabel.size(); + + + return size; +} +/* +****************************** +****************************** +*/ + +CUnit* xlslib_core::label_t::GetData() +{ + CUnit* datalabel; + +#if VERSION_BIFF == VERSION_BIFF5 + datalabel = (CUnit*)( new CLabel(row,col,aStrlabel,pxf)); +#else + if(aStrlabel.length() > 0) { + datalabel = (CUnit*)( new CLabel(row,col,aStrlabel,pxf)); + } else { +#ifdef HAVE_ICONV + datalabel = (CUnit*)( new CLabel(row,col,uStrlabel,iconv_code, pxf)); +#else + datalabel = (CUnit*)( new CLabel(row,col,uStrlabel, pxf)); +#endif + } +#endif + + return datalabel; // NOTE: this pointer HAS to be deleted elsewhere. +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: label.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:53 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/label.h b/uppdev/XLS/label.h new file mode 100644 index 000000000..deba781d9 --- /dev/null +++ b/uppdev/XLS/label.h @@ -0,0 +1,131 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/label.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef LABEL_H +#define LABEL_H + +#include +#include +#include +#include +#include +#include + +namespace xlslib_core +{ + +#define LABEL_DFLT_XFINDEX ((unsigned16_t)0x000f) +#define LABEL_OFFSET_FIRSTCOL ((unsigned8_t)6) +#define LABEL_OFFSET_LASTCOL ((unsigned8_t)8) + + class label_t; + class CLabel: public CRecord + { + private: + + public: + CLabel(unsigned16_t row, + unsigned16_t col, + std::string& strlabel, + xf_t* pxfval = NULL); +#if VERSION_BIFF == VERSION_BIFF8 + CLabel(unsigned16_t row, + unsigned16_t col, + std::ustring& strlabel +#ifdef HAVE_ICONV + , std::string& iconv_code +#endif + , xf_t* pxfval = NULL); +#endif + CLabel(label_t& labeldef); + ~CLabel(); + }; + + class label_t: public cell_t + { + + private: + std::string aStrlabel; +#if VERSION_BIFF == VERSION_BIFF8 + std::ustring uStrlabel; +#ifdef HAVE_ICONV + std::string iconv_code; +#endif +#endif + public: + label_t(unsigned16_t rowval, + unsigned16_t colval, + std::string& labelstrval, + xf_t* pxfval = NULL); + +#if VERSION_BIFF == VERSION_BIFF8 + label_t(unsigned16_t rowval, + unsigned16_t colval, + std::ustring& labelstrval +#ifdef HAVE_ICONV + , std::string& code +#endif + , xf_t* pxfval = NULL); +#endif + ~label_t(){}; + + unsigned16_t GetStrLabelSize() {return aStrlabel.size();}; + const unsigned8_t* GetStrLabelBuffer(){return (unsigned8_t*)aStrlabel.c_str();}; +#if VERSION_BIFF == VERSION_BIFF8 + unsigned16_t GetWStrLabelSize() {return uStrlabel.size();}; + const uchar_t *GetWStrLabelBuffer(){return (uchar_t*)uStrlabel.c_str();}; + std::ustring *GetUstrLabel() { return &uStrlabel; }; +#ifdef HAVE_ICONV + std::string *GetIconvCode() { return &iconv_code; }; +#endif +#endif + unsigned16_t GetSize(); + CUnit* GetData(); + + }; + +} +#endif //LABEL_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: label.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/merged.cpp b/uppdev/XLS/merged.cpp new file mode 100644 index 000000000..33a1270d1 --- /dev/null +++ b/uppdev/XLS/merged.cpp @@ -0,0 +1,98 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/merged.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +****************************** +CMergedCells class implementation +****************************** +*/ +CMergedCells::CMergedCells() +{ + SetRecordType(RECTYPE_MERGEDCELLS); + + // By default the record is empty + AddValue16(0x00); + + SetRecordLength(GetDataSize()-4); +} + +CMergedCells::~CMergedCells() +{ +} + +/* +****************************** +****************************** +*/ + +void CMergedCells::AddRange(range_t* rng) +{ + AddValue16(rng->first_row); + AddValue16(rng->last_row); + AddValue16(rng->first_col); + AddValue16(rng->last_col); + + SetRecordLength(GetDataSize()-4); +} + +/* +****************************** +****************************** +*/ +void CMergedCells::SetNumRanges(unsigned16_t numranges) +{ + + SetValueAt((signed16_t)numranges, 0x04); + +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: merged.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:51 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + diff --git a/uppdev/XLS/merged.h b/uppdev/XLS/merged.h new file mode 100644 index 000000000..c49e86282 --- /dev/null +++ b/uppdev/XLS/merged.h @@ -0,0 +1,82 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/merged.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + + + +#ifndef MERGED_H +#define MERGED_H + +#include +#include +#include +#include + +namespace xlslib_core +{ + + /* +****************************** +CMergedCells class declaration +****************************** +*/ + class CMergedCells: public CRecord + { + protected: + + public: + + CMergedCells(); + ~CMergedCells(); + + void AddRange(range_t* rng); + void SetNumRanges(unsigned16_t numranges); + + + }; +} + +#endif //MERGED_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: merged.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:44 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/number.cpp b/uppdev/XLS/number.cpp new file mode 100644 index 000000000..dcf4474da --- /dev/null +++ b/uppdev/XLS/number.cpp @@ -0,0 +1,121 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/number.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +using namespace std; +using namespace xlslib_core; + +CNumber::CNumber(unsigned16_t row, + unsigned16_t col, + double num, + xf_t* pxfval) +{ + + SetRecordType(RECTYPE_NUMBER); + AddValue16(row); + AddValue16(col); + + unsigned16_t xfindex; + pxfval != NULL? + xfindex = pxfval->GetIndex() + :xfindex = 0x000f; + AddValue16(xfindex); + + void* pnumieee = (void*) # + unsigned64_t numieee = *((unsigned64_t*)(pnumieee)); + AddValue64(numieee); + + SetRecordLength(GetDataSize()-4); + +} + +CNumber::CNumber(number_t& numdef) +{ + SetRecordType(RECTYPE_NUMBER); // DFH was RECTYPE_LABEL, must have been a type ???? + AddValue16(numdef.GetRow()); + AddValue16(numdef.GetCol()); + AddValue16(numdef.GetXFIndex()); + + double num = numdef.GetNumber(); + void* pnumieee = (void*) # + unsigned64_t numieee = *((unsigned64_t*)(pnumieee)); + + AddValue64(numieee); + + SetRecordLength(GetDataSize()-4); +} + +CNumber::~CNumber() +{ +} + +/* +********************************* +number_t class implementation +********************************* +*/ +number_t::number_t(unsigned16_t rowval, + unsigned16_t colval, + double numval, + xf_t* pxfval) +{ + row = rowval; + col = colval; + number = numval; + + if(pxfval != NULL) + pxfval->MarkUsed(); + pxf = pxfval; + +} + +CUnit* number_t::GetData() { + CUnit* datanum = + (CUnit*)( new CNumber(row,col,number, pxf)); + return datanum; // NOTE: this pointer HAS to be deleted elsewhere. +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: number.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:55 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/number.h b/uppdev/XLS/number.h new file mode 100644 index 000000000..50dff7f1f --- /dev/null +++ b/uppdev/XLS/number.h @@ -0,0 +1,101 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/number.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef NUMBER_H +#define NUMBER_H + +#include +#include +#include +#include +#include + + +namespace xlslib_core +{ + + class number_t; + class CNumber: public CRecord + { + private: + + + public: + CNumber(unsigned16_t row, + unsigned16_t col, + double num, + xf_t* pxfval = NULL); + + CNumber(number_t& blankdef); + ~CNumber(); + + + }; + + + class number_t: public cell_t + { + + private: + double number; + public: + number_t(unsigned16_t rowval, + unsigned16_t colval, + double numval, + xf_t* pxfval = NULL); + + ~number_t(){}; + + unsigned16_t GetSize(){return 18;}; + double GetNumber() {return number;}; + CUnit* GetData(); + + }; + + +} + +#endif //NUMBER_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: number.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/ole/binfile.h b/uppdev/XLS/ole/binfile.h new file mode 100644 index 000000000..095e6b531 --- /dev/null +++ b/uppdev/XLS/ole/binfile.h @@ -0,0 +1,116 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/binfile.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef BINFILE_H +#define BINFILE_H + +#include +#include + +#include +#include +#include + +namespace xlslib_core +{ + + /* +****************************** +CBinFile class declaration +****************************** +*/ + +#ifdef XLS_PHP + typedef int (*write_fptr_t)(const char *str, unsigned int str_length); +#endif + + class CBinFile + { + private: + int write_service(const char *buffer, size_t size); + static const int STROKE_CHUNK_SIZE; + public: + CBinFile(); + CBinFile(const std::string& name); + ~CBinFile(); + + + int Open(const std::string& name); + int Close(void); + int Write ( unsigned8_t * data, unsigned32_t size ); + int Write (CUnit& data_unit ); + + int WriteByte(unsigned8_t byte); + int WriteUnsigned16(unsigned16_t data); + int WriteUnsigned32(unsigned32_t data); + int WriteSigned16(signed16_t data); + int WriteSigned32(signed32_t data); + int WriteByteArray(const unsigned8_t *data, size_t size); + int SerializeFixedArray(const unsigned8_t data, unsigned32_t size); + + unsigned32_t Position(); // debugging, position of stream + +#ifdef XLS_PHP + void SetStroke(){ + is_stroke= true; + } + void UnSetStroke(){ + is_stroke= false; + } +#endif + + protected: + std::ofstream m_File; +#ifdef XLS_PHP + write_fptr_t write_fptr; + bool is_stroke; +#endif + + }; + +} + +#endif //BINFILE_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: binfile.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/ole/oledoc.h b/uppdev/XLS/ole/oledoc.h new file mode 100644 index 000000000..289bb44cd --- /dev/null +++ b/uppdev/XLS/ole/oledoc.h @@ -0,0 +1,172 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/oledoc.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef OLEDOC_H +#define OLEDOC_H + +#include +#include + +#include +#include +#include + +namespace xlslib_core +{ + +#define HEADPOS_ID ((unsigned16_t)(0x00)) +#define HEADPOS_UK1 ((unsigned16_t)(0x08)) +#define HEADPOS_UK2 ((unsigned16_t)(0x0c)) +#define HEADPOS_UK2b ((unsigned16_t)(0x10)) /* According to the Excel sample... but undocummented */ +#define HEADPOS_UK3 ((unsigned16_t)(0x14)) +#define HEADPOS_UK4 ((unsigned16_t)(0x18)) +#define HEADPOS_UK5 ((unsigned16_t)(0x1a)) +#define HEADPOS_UK6 ((unsigned16_t)(0x1c)) +#define HEADPOS_LOG2_BIGBLOCK ((unsigned16_t)(0x1e)) +#define HEADPOS_LOG2_SMALLBLOCK ((unsigned16_t)(0x20)) +#define HEADPOS_UK7 ((unsigned16_t)(0x24)) +#define HEADPOS_UK8 ((unsigned16_t)(0x28)) +#define HEADPOS_BAT_COUNT ((unsigned16_t)(0x2c)) +#define HEADPOS_PROPERTIES_SB ((unsigned16_t)(0x30)) +#define HEADPOS_UK9 ((unsigned16_t)(0x34)) +#define HEADPOS_UK10 ((unsigned16_t)(0x38)) +#define HEADPOS_SBAT_COUNT ((unsigned16_t)(0x40)) +#define HEADPOS_SBAT_START ((unsigned16_t)(0x3c)) +#define HEADPOS_XBAT_START ((unsigned16_t)(0x44)) +#define HEADPOS_XBAT_COUNT ((unsigned16_t)(0x48)) +#define HEADPOS_BAT_ARRAY ((unsigned16_t)(0x4c)) + + +#define HEADVAL_DFLT_NOTUSED ((unsigned8_t) (0xff) ) +#define HEADVAL_DFLT_UK1 ((signed32_t) (0x00) ) +#define HEADVAL_DFLT_UK2 ((signed32_t) (0x00) ) +#define HEADVAL_DFLT_UK2b ((signed32_t) (0x00) )/* According to the Excel sample... but undocummented */ +#define HEADVAL_DFLT_UK3 ((signed32_t) (0x00) ) +#define HEADVAL_DFLT_UK4 ((signed16_t) (0x3e) )/*POIFS documentations says 0x3b... let's stick with the Excel sample ...*/ +#define HEADVAL_DFLT_UK5 ((signed16_t) (0x03) ) +#define HEADVAL_DFLT_UK6 ((signed16_t) (-2) ) +#define HEADVAL_DFLT_UK7 ((signed32_t) (0x00) ) +#define HEADVAL_DFLT_UK8 ((signed32_t) (0x00) ) +#define HEADVAL_DFLT_UK9 ((signed32_t) (0x00) ) +#define HEADVAL_DFLT_UK10 ((signed32_t) (0x1000)) + + +#define HEADVAL_DFLT_LOG2_BIGBLOCK ((signed16_t)(9)) +#define HEADVAL_DFLT_LOG2_SMALLBLOCK ((signed32_t)(6)) +#define HEADVAL_DFLT_BATCOUNT ((signed32_t)(0) ) +#define HEADVAL_DFLT_PROPERTIES_SB ((signed32_t)(-2) ) +#define HEADVAL_DFLT_SBAT_START ((signed32_t)(-2) ) +#define HEADVAL_DFLT_SBAT_COUNT ((signed32_t)(0) ) //POIFS says it should be 1 ... let's stick to M$ +#define HEADVAL_DFLT_XBAT_START ((signed32_t)(-2) ) +#define HEADVAL_DFLT_XBAT_COUNT ((signed32_t)(0) ) +// #define HEADVAL_DFLT_BAT_ARRAY /* Cannot have a default value */ + +#define HEAD_SIZE BIG_BLOCK_SIZE +#define HEAD_ID_SZ (0x08) + +#define BAT_NOT_USED_BYTE ((unsigned8_t)(0xff)) // could be char is not signed +#define BAT_NOT_USED ((signed32_t)(-1)) +#define BAT_END_CHAIN ((signed32_t)(-2)) +#define BAT_SELF_PLACE ((signed32_t)(-3)) +#define BAT_MSAT_PLACE ((signed32_t)(-4)) + +#define BAT_ENTRIES_PER_BLOCK (BIG_BLOCK_SIZE/4) // BAT blocks are filled - no pointers +#define BAT_BLOCKS_PER_MSAT_BLOCK (BAT_ENTRIES_PER_BLOCK - 1) // pointer to next, or final terminator +#define HEADER_SAT_SIZE 109 + + /* +****************************** +COleFile class declaration +****************************** +*/ + // Block allocation strategy. Within the OLE header are 109 slots for BAT Sectors. + // But, when the file gets big, you run out (127 sectors in each BAT Sector). So, + // the 110th BAT has to go into a special block dedicated to hold these. One additional + // block gets you 127 more BAT entries, and so forth. + // + typedef struct { + unsigned32_t bat_entries; // total number of entries + unsigned32_t _bat_entries; // debug - count'm + unsigned32_t bat_count; // total number of sectors used for real data + unsigned32_t _bat_count; // debug - count'm + unsigned32_t msat_count; // total number of additional Master Sector Allocations Blocks (each hold 127) + unsigned32_t header_bat_count; // first 109 used + unsigned32_t extra_bat_count; // in addition to first 109 + unsigned32_t header_fill; // padding in main header only! + unsigned32_t extra_fill; // padding in last MSAT! + } blocks, *blocksP; + + class COleDoc: public CBinFile, public COleFileSystem + { + private: + int DumpHeader(blocks bks, unsigned32_t total_data_size); + int DumpData(void); + int DumpDepots(blocks bks); + int DumpFileSystem(void); + + signed16_t GetUnicodeName(const char* name, char** ppname_unicode); + int DumpNode(COleProp& node); + + blocks GetBATCount(); + + + static const unsigned8_t OLE_FILETYPE[]; + + + protected: + + + + public: + COleDoc(); + //COleDoc(const string& file_name); + ~COleDoc(); + + int DumpOleFile(); + }; + +} + +#endif //OLEDOC_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: oledoc.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/ole/olefs.h b/uppdev/XLS/ole/olefs.h new file mode 100644 index 000000000..09646776e --- /dev/null +++ b/uppdev/XLS/ole/olefs.h @@ -0,0 +1,104 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/olefs.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef OLEFS_H +#define OLEFS_H + +#include +#include + +#include +#include + +namespace xlslib_core +{ + +#define FS_NO_ERRORS ((int)0) +#define FS_INVALID_PATH ((int)-1) +#define FS_NODE_ALREADY_EXISTS ((int)-2) +#define FS_NODE_NOT_A_DIRECTORY ((int)-3) + + + /* +*********************************** +COleFileSystem class declaration +*********************************** +*/ + class COleFileSystem + { + private: + + public: + COleProp m_RootEntry; /// temporally public (for debugging) + + int GetNode(std::string const &path, Tree_Level_Itor_t& node); + + int AddDirectory(std::string const &dir_path); + int AddFile(std::string const &dir_path, CDataStorage* pdata); + + int AddNode(COleProp* base_node, StringList_t& path_list); + int SearchNode(COleProp* base_node, StringList_t& path_list, Tree_Level_Itor_t& node_level); + + + void GetAllNodesList(NodeList_t& node_list, COleProp* base_node); + void GetAllNodes(NodeList_t& node_list); + void SortList(NodeList_t& node_list); + + + signed32_t m_nProperty_Count; + + COleProp& GetRootEntry(); + unsigned32_t GetTotalDataSize(); + unsigned32_t GetNumDataFiles(); + + public: + COleFileSystem(); + ~COleFileSystem(); + + }; + +} +#endif //OLEFS_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: olefs.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/ole/oleprop.h b/uppdev/XLS/ole/oleprop.h new file mode 100644 index 000000000..53ae6519a --- /dev/null +++ b/uppdev/XLS/ole/oleprop.h @@ -0,0 +1,165 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/oleprop.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef OLEPROP_H +#define OLEPROP_H + +#include +#include + +#include +#include +#include + +namespace xlslib_core +{ + + class COleProp; + + typedef std::list Tree_Level_List_t; + typedef Tree_Level_List_t::iterator Tree_Level_Itor_t; + + + typedef std::list NodeList_t; + typedef NodeList_t::iterator NodeList_Itor_t; + + + /* +****************************** +COleProp class declaration +****************************** +*/ + class COleProp + { + protected: + std::string m_sName; + unsigned16_t m_nNameSize; + unsigned8_t m_nPropType; + unsigned8_t m_nNodeColor; + + signed32_t m_nPrevPropIndex; + signed32_t m_nNextPropIndex; + signed32_t m_nChildPropIndex; + + signed32_t m_nTSCreatedSeconds; + signed32_t m_nTSCreatedDays; + signed32_t m_nTSModifiedSeconds; + signed32_t m_nTSModifiedDays; + + signed32_t m_nStartBlock; + signed32_t m_nSize; + + // The following set of attributes are not part of the definition of + // an OleDoc's property: + + CDataStorage* m_pData; + signed32_t m_nIndex; + + public: + Tree_Level_List_t m_Child_List; + + COleProp(); + COleProp(signed32_t node_index, + std::string name, + CDataStorage* data = NULL); + ~COleProp(); + + + + + int Init(signed32_t node_index, + std::string name, + CDataStorage* data = NULL); + + + int SetName(std::string name); + std::string GetName(void); + + int SetIndex(signed32_t newindex); + signed32_t GetIndex(void); + + int SetSize(signed32_t size); + signed32_t GetSize(void); + + int SetType(unsigned8_t newtype); + unsigned8_t GetType(void); + + int SetColor(unsigned8_t newcolor); + unsigned8_t GetColor(void); + + int SetPreviousIndex(signed32_t prev); + signed32_t GetPreviousIndex(void); + + int SetNextIndex(signed32_t next); + signed32_t GetNextIndex(void); + + int SetChildIndex(signed32_t child); + signed32_t GetChildIndex(void); + + int SetStartBlock(signed32_t sb); + signed32_t GetStartBlock(void); + + + void SetDataPointer(CDataStorage* pdata); + CDataStorage* GetDataPointer(void); + + + void SetCreatedSecs(signed32_t sec1); + signed32_t GetCreatedSecs(void); + void SetCreatedDays(signed32_t day1); + signed32_t GetCreatedDays(void); + + void SetModifiedSecs(signed32_t sec2); + signed32_t GetModifiedSecs(void); + void SetModifiedDays(signed32_t day2); + signed32_t GetModifiedDays(void); + + + }; + +} + + +#endif //OLEPROP_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: oleprop.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/oledoc.cpp b/uppdev/XLS/oledoc.cpp new file mode 100644 index 000000000..8f31e0dd2 --- /dev/null +++ b/uppdev/XLS/oledoc.cpp @@ -0,0 +1,547 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/oledoc.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include + +using namespace std; +using namespace xlslib_core; + +/* +*********************************** +COleDoc class implementation +*********************************** +*/ +const unsigned8_t COleDoc::OLE_FILETYPE[] = +{ 0xd0, 0xcf, 0x11, 0xe0, 0xa1, 0xb1, 0x1a, 0xe1}; + + +COleDoc::COleDoc() +{ + +} +/* + COleDoc::COleDoc(const string& file_name) + { + Open(file_name); + + } +*/ + +COleDoc::~COleDoc() +{ + +} + +/* +*********************************** +*********************************** +*/ + +int COleDoc::DumpHeader(blocks bks, unsigned32_t total_data_size) +{ + unsigned32_t i, total_data_blocks, sectorID, msatID; + int errcode = NO_ERRORS; + + total_data_blocks = total_data_size/BIG_BLOCK_SIZE; + +#if OLE_DEBUG + fprintf(stderr, "dataBlocks=%u\n", total_data_blocks), fflush(stderr); +#endif + // [00]FILETYPE + WriteByteArray(COleDoc::OLE_FILETYPE, /*(unsigned32_t)*/sizeof(COleDoc::OLE_FILETYPE)); + // [08]UK1 + WriteSigned32(HEADVAL_DFLT_UK1); + // [0c]UK2 + WriteSigned32(HEADVAL_DFLT_UK2); + // [10]UK2b + WriteSigned32(HEADVAL_DFLT_UK2b); + // [14]UK3 + WriteSigned32(HEADVAL_DFLT_UK3); + // [18]UK4 + WriteSigned16(HEADVAL_DFLT_UK4); + // [1a]UK5 + WriteSigned16(HEADVAL_DFLT_UK5); + // [1c]UK6 + WriteSigned16(HEADVAL_DFLT_UK6); + // [1e]LOG_2_BIG_BLOCK + WriteSigned16(HEADVAL_DFLT_LOG2_BIGBLOCK); + // [20]LOG_2_SMALL_BLOCK + WriteSigned32(HEADVAL_DFLT_LOG2_SMALLBLOCK); + // [24]UK7 + WriteSigned32(HEADVAL_DFLT_UK7); + // [28]UK8 + WriteSigned32(HEADVAL_DFLT_UK8); + + // [2c] BAT_COUNT (BBDEPOT NUM BLOCKS) + WriteUnsigned32(bks.bat_count); + + //[30] PROPERTIES_START_BLOCK + // Since the big block depot will go immediately after the data, I need + // to know the size of the data and the size of the BAT in blocks (prev) + WriteUnsigned32(bks.msat_count+total_data_blocks+bks.bat_count); +#if OLE_DEBUG + fprintf(stderr, "HEADER says directory at %d\n", bks.msat_count+total_data_blocks+bks.bat_count); +#endif + // [34] UK9 + WriteSigned32(HEADVAL_DFLT_UK9); + // [38] UK10 + WriteSigned32(HEADVAL_DFLT_UK10); + + // [3c] SBAT_START + // No small blocks will be used, so this is set to the default empty value + WriteSigned32(HEADVAL_DFLT_SBAT_START); + + // [40] SBAT_BLOCKCOUNT_NUMBER + // Use the default value + WriteSigned32(HEADVAL_DFLT_SBAT_COUNT); + + // [44] XBAT_START + // we will use first and possibly additional blocks for large files + WriteSigned32(bks.msat_count ? 0 : HEADVAL_DFLT_XBAT_START); +#if OLE_DEBUG + fprintf(stderr, "xbatStart=%d\n", bks.msat_count ? 0 : HEADVAL_DFLT_XBAT_START), fflush(stderr); +#endif + + // [48] XBAT_COUNT + WriteUnsigned32(bks.msat_count); // was HEADVAL_DFLT_XBAT_COUNT (0) +#if OLE_DEBUG + fprintf(stderr, "msat_count=%d\n", bks.msat_count), fflush(stderr); +#endif + + // [4C] BAT_ARRAY + // The BAT_ARRAY shall be calculated from the number of BAT blocks and their position + + // The additional blocks, if needed, are directly below the header block, so we can write + // them out contiguously. The special conditions are: + // * for each MSAT block, the last entry needs to be a pointer to the next block + // * the fill is -1 for all unused entries + // * if there are MSAT blocks, the very last entry in the last block is a special marker + // first sector ID + sectorID = bks.msat_count + total_data_blocks; + for(i=0; iGetType() == PTYPE_FILE) + { + for(DataList_Itor_t j = (*i)->GetDataPointer()->begin(); + j != (*i)->GetDataPointer()->end(); j++) + { + WriteByteArray((*j)->GetBuffer(), (*j)->GetDataSize()); + } + } + } + + return errcode; +} + +/* +*********************************** +*********************************** +*/ +int COleDoc::DumpDepots(blocks bks) +{ + int errcode = NO_ERRORS; + + NodeList_t node_list; + GetAllNodes(node_list); + unsigned32_t bat_index; + + bat_index = 0; + + // tells Excel that these are used by the MSAT + for(unsigned32_t i=0; iSetStartBlock(bat_index); + // Write the chain for this node element + data_size = (*node)->GetDataPointer()->GetDataSize(); + chain_len = data_size/BIG_BLOCK_SIZE - 1; +#if OLE_DEBUG + fprintf(stderr, "NODE[%d]: start_block=%d data=%d Sectors= %d\n", foo, bat_index, chain_len + 1 /* directory_terminator */); +#endif + for(unsigned32_t i = 0; i < chain_len; i++) + { + WriteSigned32(++bat_index); + ++bks._bat_entries; + } + + // Set the terminator number + WriteSigned32(BAT_END_CHAIN); + ++bat_index; + ++bks._bat_entries; + } + +#if OLE_DEBUG + fprintf(stderr, "BAT_SELF_PLACE=%d -> %d TOTAL=%d\n", bat_index+1, bat_index+1+bks.bat_count+1, bks.bat_count); +#endif + // Write the -3 number for every index in the BAT that references to some BAT block (uh!?) + for(unsigned32_t i=0; i bat_block_capacity || bat_num_blocks != bat_blocks_needed) { + bat_num_blocks = bat_blocks_needed; + if(bat_num_blocks > HEADER_SAT_SIZE) { + msat_bats = bat_num_blocks - HEADER_SAT_SIZE; + msat_blocks = msat_bats/BAT_BLOCKS_PER_MSAT_BLOCK; + if(msat_bats % BAT_BLOCKS_PER_MSAT_BLOCK) ++msat_blocks; + } + + bat_num_entries = msat_blocks + data_bat_entries + bat_num_blocks + dir_bat_entries; // bat_bat_entries + + // based on what we know now, this is what we need + bat_blocks_needed = bat_num_entries/BAT_ENTRIES_PER_BLOCK; + if(bat_num_entries % BAT_ENTRIES_PER_BLOCK) ++bat_blocks_needed; + + // number of slots available + bat_block_capacity = HEADER_SAT_SIZE + BAT_BLOCKS_PER_MSAT_BLOCK*msat_blocks; +#if OLE_DEBUG + fprintf(stderr, "bat_blocks=%d capacity=%d needed=%d\n", bat_num_blocks, bat_block_capacity, bat_blocks_needed); +#endif + } + + if(bat_num_blocks > HEADER_SAT_SIZE) { + extra_bats = bat_num_blocks - HEADER_SAT_SIZE; + + bks.msat_count = msat_blocks; + bks.header_bat_count = HEADER_SAT_SIZE; + bks.extra_bat_count = extra_bats; + + last_block_extras = extra_bats % BAT_BLOCKS_PER_MSAT_BLOCK; + if(last_block_extras) { + bks.extra_fill = BAT_BLOCKS_PER_MSAT_BLOCK - last_block_extras; + } + } else { + bks.header_bat_count = bat_num_blocks; + bks.header_fill = HEADER_SAT_SIZE - bat_num_blocks; + } + bks.bat_entries = bat_num_entries; + bks.bat_count = bat_num_blocks; + +#if OLE_DEBUG + fprintf(stderr, "entries=%u bats=%d msats=%d headerBats=%d extraBats=%d headFill=%d extraFill=%d\n", bks.bat_entries, + bks.bat_count, bks.msat_count, bks.header_bat_count, bks.extra_bat_count, bks.header_fill, bks.extra_fill); +#endif + + return bks; +} + + +/* +*********************************** +*********************************** +*/ +// NOTE: name_unicode has to be deleted after this function finishes. +// Ideally, this function should be implemented as part of a std::string +// derived class, so the array would be deleted automatically + + +signed16_t COleDoc::GetUnicodeName(const char* name, char** ppname_unicode) +{ + unsigned16_t name_size = strlen(name); + if(name_size > PROPERTY_MAX_NAME_LENGTH) + name_size = PROPERTY_MAX_NAME_LENGTH; + + unsigned8_t size_unicode = (name_size+1)*2; + + if(*ppname_unicode != NULL) delete[] *ppname_unicode; + *ppname_unicode = (char*)new unsigned8_t[size_unicode]; + memset(*ppname_unicode, 0x00, size_unicode); + + for(int i=0; i<(size_unicode/2-1); i++) + (*ppname_unicode)[2*i] = name[i]; + + return size_unicode; +} + + + +/* +*********************************** +*********************************** +*/ +int COleDoc::DumpNode(COleProp& node) +{ + + int errcode = NO_ERRORS; + char* name_unicode = NULL; + + // Get the unicode name and its size + signed16_t size_name = GetUnicodeName(node.GetName().c_str(), &name_unicode); + + // [00] PROPERTY_NAME + WriteByteArray((const unsigned8_t*)name_unicode, size_name); + + // Fill the rest of the name field with 0x00 + SerializeFixedArray(PROPERTY_DFLT_NOTUSED, PPTPOS_NAMELENGTH - size_name); + + // [40] NAME_SIZE + WriteSigned16(size_name); + + // [42] PROPERTY_TYPE + WriteByte(node.GetType()); + + // [43] NODE_COLOR + WriteByte(node.GetColor()); + + // [44] PREVIOUS_PROP + WriteSigned32(node.GetPreviousIndex()); + // [48] NEXT_PROP + WriteSigned32(node.GetNextIndex()); + // [4c] CHILD_PROP + WriteSigned32(node.GetChildIndex()); + + // Fill empty block + SerializeFixedArray(PROPERTY_DFLT_NOTUSED, (PPTPOS_SECS1 - PPTPOS_UNUSED_EMPTY0)); + + //[64]...[70] + // SECONDS_1, DAYS_2, SECONDS_2, DAYS_2 + WriteSigned32(node.GetCreatedSecs()); + WriteSigned32(node.GetCreatedDays()); + WriteSigned32(node.GetModifiedDays()); + WriteSigned32(node.GetModifiedSecs()); + + // [74] START_BLOCK +#if OLE_DEBUG + fprintf(stderr, "START_BLOCK_1=%d\n", node.GetStartBlock() ); +#endif + WriteSigned32(node.GetStartBlock()); + + // [78] SIZE + if(node.GetType() == PTYPE_FILE) + WriteSigned32(node.GetSize()); + else + WriteSigned32(0); + + // A unused space: + WriteSigned32(PROPERTY_DFLT_NOTUSED); + + delete[] name_unicode; + name_unicode = NULL; + + return errcode; + +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: oledoc.cpp,v $ + * Revision 1.3 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/olefs.cpp b/uppdev/XLS/olefs.cpp new file mode 100644 index 000000000..1594c96aa --- /dev/null +++ b/uppdev/XLS/olefs.cpp @@ -0,0 +1,523 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/olefs.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include +#include +#include + +using namespace std; +using namespace xlslib_core; + +/* +*********************************** +COleFileSystem class Implementation +*********************************** +*/ + + + +COleFileSystem::COleFileSystem() + :m_RootEntry((signed32_t)0,string("Root Entry")), + m_nProperty_Count(0) +{ + + m_RootEntry.SetType(PTYPE_ROOT); + m_RootEntry.SetSize(0); + m_RootEntry.SetPreviousIndex( PLINK_EMPTY); + m_RootEntry.SetNextIndex( PLINK_EMPTY); + m_RootEntry.SetChildIndex( PLINK_EMPTY); + m_RootEntry.SetStartBlock( PBLOCK_END); + m_RootEntry.SetColor(PROPERTY_COLOR_NODE_BLACK); + m_RootEntry.SetDataPointer(NULL); + + + m_RootEntry.SetCreatedSecs(PPT_DFLT_SECS1); + m_RootEntry.SetCreatedDays(PPT_DFLT_DAYS1); + m_RootEntry.SetModifiedSecs(PPT_DFLT_SECS2); + m_RootEntry.SetModifiedDays(PPT_DFLT_DAYS2); + + + +} + +COleFileSystem::~COleFileSystem() +{ + +} + +/* +*********************************** +*********************************** +*/ + +int COleFileSystem::GetNode(string const &path, Tree_Level_Itor_t& node) +{ + + StringList_t path_list; + stringtok(path_list, path, "/"); + + int retval = SearchNode(&m_RootEntry, path_list, node); + + // Delete dinamically created strings of path_list + // anyway the list is deleted iside SearchNode... + for (StringListItor_t pl = path_list.begin(); pl != path_list.end(); pl++) + delete *pl; + + return retval; +} + +/* +*********************************** +*********************************** +*/ + +int COleFileSystem::SearchNode(COleProp* base_node, StringList_t& path_list, Tree_Level_Itor_t& node_level) +{ + int errcode = FS_INVALID_PATH; + + if(!((base_node->m_Child_List).empty())) + { + for (StringListItor_t node_name = path_list.begin(); node_name != path_list.end(); ++node_name) + for(node_level = (base_node->m_Child_List).begin(); node_level != (base_node->m_Child_List).end(); node_level++) + { + if (**node_name == (*node_level)->GetName()) + { + + delete path_list.front(); + path_list.pop_front(); // Remove the found element from path + if(path_list.empty()) // If it was the last element return it + { + + return FS_NO_ERRORS; + } + else + { // Recursively continue the search + return SearchNode(*node_level, path_list, node_level); + } + } + } + } + + return errcode; + + + +} + + +/* +*********************************** +*********************************** +*/ + +int COleFileSystem::AddDirectory(string const &dir_path) +{ + int errcode = NO_ERRORS; + StringList_t path_list; + + stringtok(path_list, dir_path, "/"); + errcode = AddNode(&m_RootEntry, path_list); + + // Delete dinamically created strings of path_list + for (StringListItor_t pl = path_list.begin(); pl != path_list.end(); pl++) + delete *pl; + + if(errcode == FS_NO_ERRORS) + { + Tree_Level_Itor_t newnode; + GetNode(dir_path, newnode); + (*newnode)->SetChildIndex(PLINK_EMPTY); + (*newnode)->SetType(PTYPE_DIRECTORY); + (*newnode)->SetSize(0); + (*newnode)->SetColor(PROPERTY_COLOR_NODE_BLACK); + (*newnode)->SetDataPointer(NULL); + + (*newnode)->SetCreatedSecs(PPT_DFLT_SECS1); + (*newnode)->SetCreatedDays(PPT_DFLT_DAYS1); + (*newnode)->SetModifiedSecs(PPT_DFLT_SECS2); + (*newnode)->SetModifiedDays(PPT_DFLT_DAYS2); + + } + + + + return errcode; +} + + +/* +*********************************** +*********************************** +*/ +#define MIN_DATA_SIZE (0x1000) + +// TODO: Change the DataStorage pass-argument + +int COleFileSystem::AddFile(string const &dir_path, CDataStorage* pdata) +{ + int errcode = NO_ERRORS; + StringList_t path_list; + + + // NOTE: Token analysis can be done inside of AddNode: + stringtok(path_list, dir_path, "/"); + errcode = AddNode(&m_RootEntry, path_list); + + // Delete dinamically created strings of path_list + for (StringListItor_t pl = path_list.begin(); pl != path_list.end(); pl++) + delete *pl; + + + if(errcode == FS_NO_ERRORS) + { + Tree_Level_Itor_t newnode; + GetNode(dir_path, newnode); + (*newnode)->SetType(PTYPE_FILE); + (*newnode)->SetChildIndex(PLINK_EMPTY); + + + // Calculate the trail data size needed to complete a BIG_BLOCK + unsigned32_t trail_size = (pdata->GetDataSize() % BIG_BLOCK_SIZE)? + (BIG_BLOCK_SIZE - (pdata->GetDataSize() % BIG_BLOCK_SIZE)):0; + + // This library won't use Small Blocks, so all data elements shall be >0x1000 + if ((trail_size + pdata->GetDataSize()) < MIN_DATA_SIZE) + { + trail_size = MIN_DATA_SIZE - pdata->GetDataSize(); + (*newnode)->SetSize(MIN_DATA_SIZE); + } + else + { + // The size stored in the node is the actual size of the data (not the filled-to-bigblock one) + (*newnode)->SetSize(pdata->GetDataSize() + trail_size); + } + + // create the trail data unit. + CUnit* ptraildata = new CUnit; + ptraildata->AddFixedDataArray(0x00, trail_size); + (*pdata) += ptraildata; + + (*newnode)->SetDataPointer(pdata); + + (*newnode)->SetColor(PROPERTY_COLOR_NODE_BLACK); + (*newnode)->SetCreatedSecs(PPT_DFLT_SECS1); + (*newnode)->SetCreatedDays(PPT_DFLT_DAYS1); + (*newnode)->SetModifiedSecs(PPT_DFLT_SECS2); + (*newnode)->SetModifiedDays(PPT_DFLT_DAYS2); + + + } + + + + return errcode; +} + +/* +*********************************** +*********************************** +*/ + +/* + +Some special adding-node cases: + +- The path to reach the node doesn't exist +- The the node already exists + +*/ + +int COleFileSystem::AddNode(COleProp* base_node, StringList_t& path_list) +{ + + int errcode; + + if(!(base_node->m_Child_List).empty()) + { + for(Tree_Level_Itor_t node_child = (base_node->m_Child_List).begin(); + node_child != (base_node->m_Child_List).end(); node_child++) + { + if((*node_child)->GetName() == **path_list.begin()) + { + delete path_list.front(); + path_list.pop_front(); // Remove the found element from path + return AddNode(*node_child, path_list); + } + } + } + //if the path element wasn't found, the program gets here + //... and we have two possible reasons: + // 1. The path isn't correct, so no node is created and an error msg have to be returned + // (one of the intermediate nodes is empty or doesn't exist: there are more than one path elements left) + // 2. The node is the new one we want to create. + + + // if the size of the path is 0, the node already existed + if(path_list.size() != 1) + { + if (path_list.size() == 0) + errcode = FS_NODE_ALREADY_EXISTS; + else + errcode = FS_INVALID_PATH; + } + else + { + unsigned8_t base_node_type = base_node->GetType(); + if(base_node_type == PTYPE_DIRECTORY || base_node_type == PTYPE_ROOT) + { + +#if 0 + COleProp newnode(++m_nProperty_Count, *path_list.begin()); + + bool was_firstborn = false; + + if((base_node->m_Child_List).empty()) //if this is the first child of the node... + { + base_node->SetChildIndex(m_nProperty_Count); // the new one is the child + newnode.SetPreviousIndex(PLINK_EMPTY); // there is no previous + was_firstborn = true;// mark for later + } + + // The next-index of the new node shall to point to nowhere + newnode.SetNextIndex(PLINK_EMPTY); + (base_node->m_Child_List).push_back(newnode); + + // Get the just added node + Tree_Level_Itor_t nodeadded = (base_node->m_Child_List).end(); + nodeadded--; + + // Get the previous to the just added node + Tree_Level_Itor_t prev_to_nodeadded = (base_node->m_Child_List).end(); + prev_to_nodeadded--;prev_to_nodeadded--; + + + if(!was_firstborn) + nodeadded->SetPreviousIndex(prev_to_nodeadded->GetIndex()); + + // Set the next-index of the previous node to point to the newone + prev_to_nodeadded->SetNextIndex(nodeadded->GetIndex()); + +#else +//////////// + COleProp* newnode = new COleProp(++m_nProperty_Count, **path_list.begin()); + size_t childnum = (base_node->m_Child_List).size(); + + if(!(base_node->m_Child_List).empty()) //if this is the first child of the node... + { + Tree_Level_Itor_t lastnode = (base_node->m_Child_List).end(); + lastnode--; + + if(1 == childnum) + { + base_node->SetChildIndex(newnode->GetIndex()); // The 2nd child is the entry always + newnode->SetPreviousIndex((*lastnode)->GetIndex()); // The previous is the only element of the list + } + else + { + (*lastnode)->SetNextIndex(newnode->GetIndex()); + newnode->SetPreviousIndex(PLINK_EMPTY); // there is no previous + } + newnode->SetNextIndex(PLINK_EMPTY); // there is no next + newnode->SetChildIndex(PLINK_EMPTY); // there is no child + + } + else + { + base_node->SetChildIndex(m_nProperty_Count); // the new one is the child + newnode->SetPreviousIndex(PLINK_EMPTY); // there is no previous + newnode->SetNextIndex(PLINK_EMPTY); // there is no next + newnode->SetChildIndex(PLINK_EMPTY); // there is no child + } + + + (base_node->m_Child_List).push_back(newnode); + +#endif + errcode = FS_NO_ERRORS; + } + else + { + errcode = FS_NODE_NOT_A_DIRECTORY; + } + } + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ + +void COleFileSystem::GetAllNodes(NodeList_t& node_list) +{ + + GetAllNodesList(node_list, &m_RootEntry); + SortList(node_list); + +} +/* +*********************************** +*********************************** +*/ + + +void COleFileSystem::GetAllNodesList(NodeList_t& node_list, COleProp* base_node) +{ + + if(!(base_node->m_Child_List).empty()) + { + for(Tree_Level_Itor_t child_node = (base_node->m_Child_List).begin(); + child_node != (base_node->m_Child_List).end(); child_node++ ) + { + GetAllNodesList(node_list, (*child_node)); + node_list.push_back((*child_node)); + } + + } + else + { + return; + } +} + + +/* +*********************************** +An horribly inefficient sorting routine.... +... until I find the way of using the list::sort() function so +I can specify the sorting criteria (for this case, a member variable +of the elements of the list. +*********************************** +*/ + +void COleFileSystem::SortList(NodeList_t& node_list) +{ + NodeList_t node_list_shadow = node_list; + + node_list.erase(node_list.begin(), node_list.end()); + + NodeList_Itor_t i; + int index = 1; + + + do{ + for(i = node_list_shadow.begin(); i != node_list_shadow.end(); i++) + { + if((*i)->GetIndex() == index) + { + node_list.push_back(*i); + node_list_shadow.erase(i); + index++; + break; + } + } + + }while(!node_list_shadow.empty()); +} + + +/* +*********************************** +*********************************** +*/ + +unsigned32_t COleFileSystem::GetTotalDataSize() +{ + + NodeList_t node_list; + GetAllNodes(node_list); + unsigned32_t total_size = 0; + + for(NodeList_Itor_t i = node_list.begin(); i != node_list.end(); i++) + { + if((*i)->GetType() == PTYPE_FILE) + total_size += (*i)->GetDataPointer()->GetDataSize(); + + } + + return total_size; + +} + + +/* +*********************************** +*********************************** +*/ + +unsigned32_t COleFileSystem::GetNumDataFiles() +{ + NodeList_t node_list; + GetAllNodes(node_list); + unsigned32_t total_files = 0; + + for(NodeList_Itor_t i = node_list.begin(); i != node_list.end(); i++) + { + if((*i)->GetType() == PTYPE_FILE) + total_files ++; + + } + + return total_files; + + + +} + +/* +*********************************** +*********************************** +*/ + +COleProp& COleFileSystem::GetRootEntry() +{ + return m_RootEntry; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: olefs.cpp,v $ + * Revision 1.3 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/oleprop.cpp b/uppdev/XLS/oleprop.cpp new file mode 100644 index 000000000..c4d882738 --- /dev/null +++ b/uppdev/XLS/oleprop.cpp @@ -0,0 +1,412 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/oledoc/oleprop.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +/* +*********************************** +COleProp class Implementation +*********************************** +*/ + +using namespace std; +using namespace xlslib_core; + + + +COleProp::COleProp() + : m_pData(NULL) +{ + +} + +/* +*********************************** +*********************************** +*/ + +COleProp::COleProp(signed32_t node_index, + string name, + CDataStorage* data) + : m_sName(name), m_pData(data), m_nIndex(node_index) +{ + +} + +COleProp::~COleProp() +{ + + for(Tree_Level_Itor_t chld = m_Child_List.begin(); chld != m_Child_List.end(); chld++) + delete *chld; + + +} + + + +/* +*********************************** +*********************************** +*/ + +int COleProp::Init(signed32_t node_index, + string name, + CDataStorage* data) +{ + int errcode = NO_ERRORS; + + SetName(name); + m_pData = data; + m_nIndex = node_index; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ + +int COleProp::SetName(string name) +{ + int errcode = NO_ERRORS; + + m_nNameSize = name.size() + 1; + m_sName = name; + + return errcode; +} + +/* +*********************************** +*********************************** +*/ + +string COleProp::GetName(void) +{ + return m_sName; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetIndex(signed32_t newindex) +{ + int errcode = NO_ERRORS; + + m_nIndex = newindex; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ + +signed32_t COleProp::GetIndex(void) +{ + return m_nIndex; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetType(unsigned8_t newtype) +{ + int errcode = NO_ERRORS; + + m_nPropType = newtype; + + return errcode; +} + +/* +*********************************** +*********************************** +*/ +unsigned8_t COleProp::GetType(void) +{ + return m_nPropType; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetColor(unsigned8_t newcolor) +{ + int errcode = NO_ERRORS; + + m_nNodeColor = newcolor; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ +unsigned8_t COleProp::GetColor(void) +{ + return m_nNodeColor; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetPreviousIndex(signed32_t prev) +{ + int errcode = NO_ERRORS; + + m_nPrevPropIndex = prev; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetPreviousIndex(void) +{ + return m_nPrevPropIndex; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetNextIndex(signed32_t next) +{ + int errcode = NO_ERRORS; + + m_nNextPropIndex = next; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetNextIndex(void) +{ + return m_nNextPropIndex; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetChildIndex(signed32_t child) +{ + int errcode = NO_ERRORS; + + m_nChildPropIndex = child; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetChildIndex(void) +{ + return m_nChildPropIndex; +} + +int COleProp::SetStartBlock(signed32_t sb) +{ + int errcode = NO_ERRORS; + + m_nStartBlock = sb; + + return errcode; + +} +signed32_t COleProp::GetStartBlock(void) +{ + return m_nStartBlock; +} + +/* +*********************************** +*********************************** +*/ +int COleProp::SetSize(signed32_t size) +{ + int errcode = NO_ERRORS; + + m_nSize = size; + + return errcode; + +} + +/* +*********************************** +*********************************** +*/ + +signed32_t COleProp::GetSize(void) +{ + return m_nSize; +} + +/* +*********************************** +*********************************** +*/ + + +void COleProp::SetDataPointer(CDataStorage* pdata) +{ + + m_pData = pdata; +} + +/* +*********************************** +*********************************** +*/ + +CDataStorage* COleProp::GetDataPointer(void) +{ + return m_pData; +} + + + + +/* +*********************************** +*********************************** +*/ +void COleProp::SetCreatedSecs(signed32_t secs1) +{ + m_nTSCreatedSeconds = secs1; +} +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetCreatedSecs(void) +{ + return m_nTSCreatedSeconds; +} + + +/* +*********************************** +*********************************** +*/ +void COleProp::SetCreatedDays(signed32_t days1) +{ + m_nTSCreatedDays = days1; +} + +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetCreatedDays(void) +{ + return m_nTSCreatedDays; +} + + +/* +*********************************** +*********************************** +*/ +void COleProp::SetModifiedSecs(signed32_t secs2) +{ + m_nTSModifiedSeconds = secs2; +} + +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetModifiedSecs(void) +{ + return m_nTSModifiedSeconds; +} + +/* +*********************************** +*********************************** +*/ + +void COleProp::SetModifiedDays(signed32_t days2) +{ + m_nTSModifiedDays = days2; +} + +/* +*********************************** +*********************************** +*/ +signed32_t COleProp::GetModifiedDays(void) +{ + + return m_nTSModifiedDays; +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: oleprop.cpp,v $ + * Revision 1.3 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:43 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/overnew.cpp b/uppdev/XLS/overnew.cpp new file mode 100644 index 000000000..2b4baa584 --- /dev/null +++ b/uppdev/XLS/overnew.cpp @@ -0,0 +1,93 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/overnew.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +/******************************************************************** + The new() operator is overloaded only for the PHP_EXTENSION version +********************************************************************/ +#if 0 + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#ifdef __cplusplus +} +#endif + +void* operator new(size_t sz) throw (std::bad_alloc) +{ + void* m = emalloc(sz); + if(!m) throw std::bad_alloc(); + return m; +} + +void operator delete(void* m) +{ + efree(m); +} + +void* operator new[](size_t sz) throw (std::bad_alloc) +{ + void* m = emalloc(sz); + if(!m) throw std::bad_alloc(); + return m; +} + +void operator delete[](void* m) +{ + efree(m); +} + +#endif + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: overnew.cpp,v $ + * Revision 1.3 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:32:05 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/overnew.h b/uppdev/XLS/overnew.h new file mode 100644 index 000000000..051584084 --- /dev/null +++ b/uppdev/XLS/overnew.h @@ -0,0 +1,71 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/overnew.h,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef OVERNEW_H +#define OVERNEW_H + +#include +#include + +/******************************************************************** + The new() operator is overloaded only for the PHP_EXTENSION version +********************************************************************/ +#if 0 + +#include +#include + +using namespace std; +void* operator new(size_t sz) throw (std::bad_alloc); +void operator delete(void* m); +void* operator new[](size_t sz) throw (std::bad_alloc); +void operator delete[](void* m); + + +#endif +#endif //OVERNEW_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: overnew.h,v $ + * Revision 1.3 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:32:05 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/range.cpp b/uppdev/XLS/range.cpp new file mode 100644 index 000000000..1aa3c536d --- /dev/null +++ b/uppdev/XLS/range.cpp @@ -0,0 +1,257 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/range.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + + +range::range(unsigned16_t row1, + unsigned16_t col1, + unsigned16_t row2, + unsigned16_t col2, + worksheet* pws, + bool atomic) + : m_Atomic(atomic), m_pWorkSheet(pws) +{ + first_row = row1; + last_row = row2; + first_col = col1; + last_col = col2; +} + + +range::~range() +{ +} + +void range::cellcolor(color_name_t color) +{ + unsigned16_t r,c; + for(r = first_row; r <= last_row; r++) + for(c = first_col; c <= last_col; c++) + { + cell_t* cell = m_pWorkSheet->FindCell(r,c); + cell->fillfgcolor(color); + cell->fillstyle(FILL_SOLID); + + } +} +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + xf_i interface implementation for range class + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#define SET_RANGE_FUNCTION(function, value) \ + { \ + uint16_t r,c; \ + for(r = first_row; r <= last_row; r++) \ + for(c = first_col; c <= last_col; c++) \ + { \ + cell_t* cell = m_pWorkSheet->FindCell(r,c); \ + cell->function(value); \ + } \ + } + +void range::font(font_t* fontidx) +{ + SET_RANGE_FUNCTION(font, fontidx); +/* + int r,c; + for(r = first_row; r <= last_row; r++) + for(c = first_col; c <= last_col; c++) + { + cell_t* cell = m_pWorkSheet->FindCell(r,c); + cell->font(fontidx); + } +*/ +} + +void range::borderstyle(border_side_t side, + border_style_t style, + color_name_t color) +{ + unsigned16_t r,c; + for(r = first_row; r <= last_row; r++) + for(c = first_col; c <= last_col; c++) + { + cell_t* cell = m_pWorkSheet->FindCell(r,c); + cell->borderstyle(side, style, color); + } + +} + +void range::format(format_number_t formatidx) +{ + SET_RANGE_FUNCTION(format,formatidx); +} + +void range::halign(halign_option_t ha_option) +{ + SET_RANGE_FUNCTION(halign,ha_option); +} + +void range::valign(valign_option_t va_option) +{ + SET_RANGE_FUNCTION(valign,va_option); +} +void range::indent(indent_option_t indent_option) +{ + SET_RANGE_FUNCTION(indent,indent_option); +} +void range::orientation(txtori_option_t ori_option) +{ + SET_RANGE_FUNCTION(orientation,ori_option); +} + +void range::fillfgcolor(color_name_t color) +{ + SET_RANGE_FUNCTION(fillfgcolor,color); +} + +void range::fillbgcolor(color_name_t color) +{ + SET_RANGE_FUNCTION(fillbgcolor,color); +} + +void range::fillstyle(fill_option_t fill) +{ + SET_RANGE_FUNCTION(fillstyle,fill); +} + +void range::locked(bool locked_opt) +{ + SET_RANGE_FUNCTION(locked,locked_opt); +} + +void range::hidden(bool hidden_opt) +{ + SET_RANGE_FUNCTION(hidden,hidden_opt); +} + +void range::wrap(bool wrap_opt) +{ + SET_RANGE_FUNCTION(wrap,wrap_opt); +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + font_i interface implementation for range class + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +void range::fontname(string fntname) +{ + SET_RANGE_FUNCTION(fontname,fntname); +} + +void range::fontheight(unsigned16_t fntheight) +{ + SET_RANGE_FUNCTION(fontheight,fntheight); +} + +void range::fontbold(boldness_option_t fntboldness) +{ +/* + int r,c; + for(r = first_row; r <= last_row; r++) + for(c = first_col; c <= last_col; c++) + { + cell_t* cell = m_pWorkSheet->FindCell(r,c); + cell->fontbold(fntboldness); + } +*/ + SET_RANGE_FUNCTION(fontbold,fntboldness); +} + +void range::fontunderline(underline_option_t fntunderline) +{ + SET_RANGE_FUNCTION(fontunderline,fntunderline); +} + +void range::fontscript(script_option_t fntscript) +{ + SET_RANGE_FUNCTION(fontscript,fntscript); +} + +void range::fontcolor(color_name_t fntcolor) +{ + SET_RANGE_FUNCTION(fontcolor,fntcolor); +} + +void range::fontattr(unsigned16_t attr) +{ + SET_RANGE_FUNCTION(fontattr,attr); +} + +void range::fontitalic(bool italic) +{ + SET_RANGE_FUNCTION(fontitalic,italic); +} + +void range::fontstrikeout(bool so) +{ + SET_RANGE_FUNCTION(fontstrikeout,so); +} + +void range::fontoutline(bool ol) +{ + SET_RANGE_FUNCTION(fontoutline,ol); +} + +void range::fontshadow(bool sh) +{ + SET_RANGE_FUNCTION(fontshadow,sh); +/* + { + int r,c; + for(r = first_row; r <= last_row; r++) + for(c = first_col; c <= last_col; c++) + { + cell_t* cell = m_pWorkSheet->FindCell(r,c); + cell->fontshadow(sh); + } + } +*/ +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: range.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:56 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/range.h b/uppdev/XLS/range.h new file mode 100644 index 000000000..fcd0def60 --- /dev/null +++ b/uppdev/XLS/range.h @@ -0,0 +1,112 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/range.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef RANGE_H +#define RANGE_H + +#include +#include + +#include +#include +#include +#include + +namespace xlslib_core +{ + class worksheet; + class range + : public xf_i, + public font_i, + private range_t + + { + public: + range(unsigned16_t row1, unsigned16_t col1, + unsigned16_t row2, unsigned16_t col2, + worksheet* pws, + bool atomic = false); + virtual ~range(); + + void cellcolor(color_name_t color); + + private: + bool m_Atomic; + worksheet* m_pWorkSheet; + + public: // xf_i interface declaration + void font(font_t* fontidx); + void format(format_number_t formatidx); + void halign(halign_option_t ha_option); + void valign(valign_option_t va_option); + void indent(indent_option_t indent_option); + void orientation(txtori_option_t ori_option); + void fillfgcolor(color_name_t color); + void fillbgcolor(color_name_t color); + void fillstyle(fill_option_t fill); + void locked(bool locked_opt); + void hidden(bool hidden_opt); + void wrap(bool wrap_opt); + void borderstyle(border_side_t side, + border_style_t style, + color_name_t color); + + public: // font_i interface declaration + void fontname(std::string fntname); + void fontheight(unsigned16_t fntheight); + void fontbold(boldness_option_t fntboldness); + void fontunderline(underline_option_t fntunderline); + void fontscript(script_option_t fntscript); + void fontcolor(color_name_t fntcolor); + void fontattr(unsigned16_t attr); + void fontitalic(bool italic); + void fontstrikeout(bool so); + void fontoutline(bool ol); + void fontshadow(bool sh); + }; +} + +#endif //RANGE_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: range.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + \ No newline at end of file diff --git a/uppdev/XLS/recdef.cpp b/uppdev/XLS/recdef.cpp new file mode 100644 index 000000000..81a9f74ab --- /dev/null +++ b/uppdev/XLS/recdef.cpp @@ -0,0 +1,485 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/recdef.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +****************************** +CBof class implementation +****************************** +*/ + +CBof::CBof(unsigned16_t boftype) +{ + SetRecordType(RECTYPE_BOF ); + + AddValue16(VERSION_BIFF); + AddValue16(boftype); + AddValue16(BOF_BUILD_DFLT); + AddValue16(BOF_YEAR_DFLT); + +#if VERSION_BIFF == VERSION_BIFF8 + AddValue32(0); //The file hystory flags are all set to zero + AddValue32(VERSION_BIFF); // The lowest BIFF version +#endif + + SetRecordLength(GetDataSize()-4); +} + +CBof::~CBof() +{} + +/* +****************************** +CEof class implementation +****************************** +*/ +CEof::CEof() +{ + SetRecordType(RECTYPE_EOF ); + SetRecordLength(GetDataSize()-4); +} + +CEof::~CEof() +{ +} + +/* +********************************** +CCodePage class implementation +********************************** +*/ + +CCodePage::CCodePage(unsigned16_t boftype) +{ + SetRecordType(RECTYPE_CODENAME); + + AddValue16(boftype); + + SetRecordLength(GetDataSize()-4); +} + +CCodePage::~CCodePage() +{} + +/* +********************************** +CWindow1 class implementation +********************************** +*/ +CWindow1::CWindow1() +{ + SetRecordType(RECTYPE_WINDOW1); + + // The data of this record is hardcoded, since for file creation + // this value takes a default (window dimensions and position). + + // NOTE: Doublecheck the previous statement!! + unsigned8_t recwin1[] = {0x40,0x02,0xfc,0x00,0xe0,0x37,0xe0,0x25, + 0x38,0x00,0x00,0x00,0x00,0x00,0x01,0x00, 0x58,0x02}; + + AddDataArray(recwin1, sizeof(recwin1)); + + SetRecordLength(GetDataSize()-4); +} + +CWindow1::~CWindow1() +{ +} + +/* +********************************** +CDateMode class implementation +********************************** +*/ + +CDateMode::CDateMode() +{ + SetRecordType(RECTYPE_R1904); + +#ifdef __APPLE__ + AddValue16(1); // 1904 +#else + AddValue16(0); // 1900 +#endif + SetRecordLength(GetDataSize()-4); +} + +CDateMode::~CDateMode() +{} + +/* +********************************** +CWindow2 class implementation +********************************** +*/ +CWindow2::CWindow2() +{ + SetRecordType(RECTYPE_WINDOW2); + + AddValue16(W2_DFLT_GRBIT); + AddValue16(W2_DFLT_TOPROW); + AddValue16(W2_DFLT_LEFTCOL); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue32(W2_DFLT_COLOR); +#else + AddValue16(0); // 0 == BLACK + AddValue16(0); + AddValue16(0); // zoom, default == 0 (W2_DFLT_ZOOMPBPREV ???) + AddValue16(0); // xoom, default == 0 (W2_DFLT_ZOOMNORMAL ???) + AddValue32(W2_DFLT_RESERVED); +#endif + + SetRecordLength(GetDataSize()-4); +} + +CWindow2::~CWindow2() +{ +} + +/* +********************************** +CDimension class implementation +********************************** +*/ +CDimension::CDimension(unsigned32_t minRow, unsigned32_t maxRow, unsigned32_t minCol, unsigned32_t maxCol) +{ + SetRecordType(RECTYPE_DIMENSIONS); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue16((unsigned26_t)minRow); + AddValue16((unsigned26_t)(maxRow+1)); +#else + AddValue32(minRow); + AddValue32(maxRow+1); +#endif + AddValue16(minCol); + AddValue16(maxCol+1); // zoom, default == 0 (W2_DFLT_ZOOMPBPREV ???) + AddValue16(W2_DFLT_RESERVED); + + SetRecordLength(GetDataSize()-4); +} + +CDimension::~CDimension() +{ +} + +/* +********************************** +********************************** +*/ +void CWindow2::SetSelected() +{ + unsigned16_t grbitval; + GetValue16From((signed16_t*)&grbitval, W2_OFFSET_GRBIT); + + grbitval |= W2_GRBITMASK_SELECTED; + + SetValueAt((signed16_t)grbitval, W2_OFFSET_GRBIT); + +} + +/* +********************************** +********************************** +*/ +void CWindow2::SetPaged() +{ + unsigned16_t grbitval; + GetValue16From((signed16_t*)&grbitval, W2_OFFSET_GRBIT); + + grbitval |= W2_GRBITMASK_PAGED; + + SetValueAt((signed16_t)grbitval, W2_OFFSET_GRBIT); + +} + +/* +********************************** +********************************** +*/ +void CWindow2::ClearSelected() +{ + unsigned16_t grbitval; + GetValue16From((signed16_t*)&grbitval, W2_OFFSET_GRBIT); + + grbitval &= (~W2_GRBITMASK_SELECTED); + + SetValueAt((signed16_t)grbitval, W2_OFFSET_GRBIT); + +} + +/* +********************************** +********************************** +*/ +void CWindow2::ClearPaged() +{ + unsigned16_t grbitval; + GetValue16From((signed16_t*)&grbitval, W2_OFFSET_GRBIT); + + grbitval &= (~W2_GRBITMASK_PAGED); + + SetValueAt((signed16_t)grbitval, W2_OFFSET_GRBIT); + +} + + +/* +********************************** +CPalette class implementation +********************************** +*/ +/* + CPalette::CPalette() + { + SetRecordType(RECTYPE_PALETTE); + + // The data of this record is hardcoded, since for file creation + // this value takes a default (Documentation says that if the BIFF + // file doesn't have a PALETTE record, it uses a default palette, but + // somehow if this record is removed Excel displays an error). + unsigned8_t palette[] = + { + 0x38,0x00,0x00,0x00, 0x00,0x00,0xff,0xff,0xff,0x00,0xff,0x00,0x00,0x00, + 0x00,0xff,0x00,0x00,0x00,0x00,0xff,0x00, 0xff,0xff,0x00,0x00,0xff,0x00,0xff,0x00, + 0x00,0xff,0xff,0x00,0x80,0x00,0x00,0x00, 0x00,0x80,0x00,0x00,0x00,0x00,0x80,0x00, + 0x80,0x80,0x00,0x00,0x80,0x00,0x80,0x00, 0x00,0x80,0x80,0x00,0xc0,0xc0,0xc0,0x00, + 0x80,0x80,0x80,0x00,0x99,0x99,0xff,0x00, 0x99,0x33,0x66,0x00,0xff,0xff,0xcc,0x00, + 0xcc,0xff,0xff,0x00,0x66,0x00,0x66,0x00, 0xff,0x80,0x80,0x00,0x00,0x66,0xcc,0x00, + 0xcc,0xcc,0xff,0x00,0x00,0x00,0x80,0x00, 0xff,0x00,0xff,0x00,0xff,0xff,0x00,0x00, + 0x00,0xff,0xff,0x00,0x80,0x00,0x80,0x00, 0x80,0x00,0x00,0x00,0x00,0x80,0x80,0x00, + 0x00,0x00,0xff,0x00,0x00,0xcc,0xff,0x00, 0xcc,0xff,0xff,0x00,0xcc,0xff,0xcc,0x00, + 0xff,0xff,0x99,0x00,0x99,0xcc,0xff,0x00, 0xff,0x99,0xcc,0x00,0xcc,0x99,0xff,0x00, + 0xe3,0xe3,0xe3,0x00,0x33,0x66,0xff,0x00, 0x33,0xcc,0xcc,0x00,0x99,0xcc,0x00,0x00, + 0xff,0xcc,0x00,0x00,0xff,0x99,0x00,0x00, 0xff,0x66,0x00,0x00,0x66,0x66,0x99,0x00, + 0x96,0x96,0x96,0x00,0x00,0x33,0x66,0x00, 0x33,0x99,0x66,0x00,0x00,0x33,0x00,0x00, + 0x33,0x33,0x00,0x00,0x99,0x33,0x00,0x00, 0x99,0x33,0x66,0x00,0x33,0x33,0x99,0x00, + 0x33,0x33,0x33,0x00 + }; + + + AddDataArray(palette, sizeof(palette)); + + SetRecordLength(GetDataSize()-4); + } + + CPalette::~CPalette() + { + } + +*/ +/* +****************************** +CStyle class implementation +****************************** +*/ +#define STYLE_BUILTIN_NORMAL ((unsigned8_t)0x00) +#define STYLE_BUILTIN_ROWLEVELN ((unsigned8_t)0x01) +#define STYLE_BUILTIN_COLLEVELN ((unsigned8_t)0x02) +#define STYLE_BUILTIN_COMMA ((unsigned8_t)0x03) +#define STYLE_BUILTIN_CURRENCY ((unsigned8_t)0x04) +#define STYLE_BUILTIN_PERCENT ((unsigned8_t)0x05) +#define STYLE_BUILTIN_COMMAT ((unsigned8_t)0x06) +#define STYLE_BUILTIN_CURRENCYT ((unsigned8_t)0x07) + +#define STYLE_BUILTIN_BIT ((unsigned16_t)0x8000) + + + +#define STYLE_LEVEL_DUMMY ((unsigned8_t)0x00) + +CStyle::CStyle(style_t* styledef) +{ + + // TODO: Implement user-defined styles. So far only built-in are used. + SetRecordType(RECTYPE_STYLE); + + AddValue16(styledef->xfindex|STYLE_BUILTIN_BIT); + AddValue8(styledef->builtintype); + AddValue8(STYLE_LEVEL_DUMMY); + + + SetRecordLength(GetDataSize()-4); +} + +CStyle::CStyle(unsigned16_t xfindex, unsigned8_t builtintype) +{ + // TODO: Implement user-defined styles. So far only built-in are used. + SetRecordType(RECTYPE_STYLE); + + AddValue16(xfindex|STYLE_BUILTIN_BIT); + AddValue8(builtintype); + AddValue8(STYLE_LEVEL_DUMMY); + + + SetRecordLength(GetDataSize()-4); + + +} + + +CStyle::~CStyle() +{ +} + + + +/* +****************************** +CBSheet class implementation +****************************** +*/ +CBSheet::CBSheet(unsigned32_t streampos, + unsigned16_t attributes, + string& sheetname) +{ + SetRecordType(RECTYPE_BOUNDSHEET); + AddValue32(streampos); + AddValue16(attributes); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue8((unsigned8_t)sheetname.size()); + AddDataArray((unsigned8_t*)sheetname.c_str(), sheetname.size()); +#endif +#if VERSION_BIFF == VERSION_BIFF8 + AddUnicodeStrlen((unsigned8_t)sheetname.size()); + AddUnicodeString((unsigned8_t* )sheetname.c_str(), sheetname.size()); +#endif + + SetRecordLength(GetDataSize()-4); +} +#if VERSION_BIFF == VERSION_BIFF8 +CBSheet::CBSheet(unsigned32_t streampos, + unsigned16_t attributes, + ustring& sheetname +#ifdef HAVE_ICONV + , string& iconv_code +#endif +) { + + SetRecordType(RECTYPE_BOUNDSHEET); + AddValue32(streampos); + AddValue16(attributes); + +#ifdef HAVE_ICONV + u16string u16sheetname; + + Conv32to16(iconv_code, sheetname, u16sheetname); +// size_t outSize, resultSize; +// size_t iconv (iconv_t cd, char **restrict inbuf, size_t *restrict inbytesleft, char **restrict outbuf, size_t *restrict outbytesleft); + AddUnicodeStrlen((unsigned8_t)u16sheetname.size()); + AddUnicodeString((unsigned16_t* )u16sheetname.c_str(), u16sheetname.size()); +#else + AddUnicodeStrlen((unsigned8_t)sheetname.size()); + AddUnicodeString((unsigned16_t* )sheetname.c_str(), sheetname.size()); +#endif + + SetRecordLength(GetDataSize()-4); +} +#endif + +CBSheet::CBSheet(boundsheet_t* bsheetdef) +{ + SetRecordType(RECTYPE_BOUNDSHEET); + AddValue32(bsheetdef->streampos); + + // Set the flags in the attribute variables + unsigned16_t attrflags = 0; + attrflags |= bsheetdef->worksheet? BSHEET_ATTR_WORKSHEET:0; + attrflags |= bsheetdef->ex4macro? BSHEET_ATTR_EX4MACRO:0; + attrflags |= bsheetdef->chart? BSHEET_ATTR_CHART:0; + attrflags |= bsheetdef->vbmodule? BSHEET_ATTR_VBMODULE:0; + attrflags |= bsheetdef->visible? BSHEET_ATTR_VISIBLE:0; + attrflags |= bsheetdef->hidden? BSHEET_ATTR_HIDDEN:0; + attrflags |= bsheetdef->veryhidden? BSHEET_ATTR_VERYHIDDEN:0; + + AddValue16(attrflags); + +#if VERSION_BIFF == VERSION_BIFF5 + AddValue8((unsigned8_t)bsheetdef->sheetname.size()); + AddDataArray((unsigned8_t*)((bsheetdef->sheetname).c_str()), (bsheetdef->sheetname).size()); +#endif +#if VERSION_BIFF == VERSION_BIFF8 + if(bsheetdef->asheetname.size()) { + AddUnicodeStrlen((unsigned8_t)bsheetdef->asheetname.size()); + AddUnicodeString((unsigned8_t*)((bsheetdef->asheetname).c_str()), (bsheetdef->asheetname).size()); + } else { +#ifdef HAVE_ICONV + u16string u16sheetname; + + Conv32to16(bsheetdef->iconv_code, bsheetdef->usheetname, u16sheetname); + + AddUnicodeStrlen((unsigned8_t)u16sheetname.size()); + AddUnicodeString((unsigned16_t* )u16sheetname.c_str(), u16sheetname.size()); +#else + AddUnicodeStrlen((unsigned8_t)bsheetdef->usheetname.size()); + AddUnicodeString((unsigned16_t*)(bsheetdef->usheetname.c_str()), (bsheetdef->usheetname).size()); +#endif + } +#endif + + SetRecordLength(GetDataSize()-4); +} + +CBSheet::~CBSheet() +{ +} + +/* +********************************** +********************************** +*/ + +void CBSheet::SetStreamPosition(unsigned32_t pos) +{ + SetValueAt((signed32_t)pos, BSHEET_OFFSET_POSITION); +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: recdef.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:48 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/recdef.h b/uppdev/XLS/recdef.h new file mode 100644 index 000000000..ddc568ab6 --- /dev/null +++ b/uppdev/XLS/recdef.h @@ -0,0 +1,325 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/recdef.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef RECDEF_H +#define RECDEF_H + +#include +#include +#include +#include + +namespace xlslib_core +{ + +/* +****************************** +CBof class declaration +****************************** +*/ +#define BOF_TYPE_WBGLOBALS ((unsigned16_t)0x0005) +#define BOF_TYPE_VBMODULE ((unsigned16_t)0x0006) +#define BOF_TYPE_WORKSHEET ((unsigned16_t)0x0010) +#define BOF_TYPE_CHART ((unsigned16_t)0x0020) +#define BOF_TYPE_EXCEL4_MACROSH ((unsigned16_t)0x0040) +#define BOF_TYPE_WSFILE ((unsigned16_t)0x0100) + +#define BOF_BUILD_DFLT ((unsigned16_t)0x1d5f) +#define BOF_YEAR_DFLT ((unsigned16_t)0x07cd) + +#define CODEPAGE_IBMPC ((unsigned16_t)0x01b5) +#define CODEPAGE_APPLE ((unsigned16_t)0x8000) +#define CODEPAGE_ANSI ((unsigned16_t)0x04e4) + +#define BOF_RECORD_SIZE (12) + + class CBof: public CRecord + { + protected: + + public: + + CBof(unsigned16_t boftype); + ~CBof(); + }; + +/* +****************************** +CEof class declaration +****************************** +*/ + class CEof: public CRecord + { + protected: + + public: + + CEof(); + ~CEof(); + }; + +/* +****************************** +CCodePage class declaration +****************************** +*/ + class CCodePage: public CRecord + { + protected: + + public: + + CCodePage(unsigned16_t boftype); + ~CCodePage(); + }; + + /* +****************************** +CWindow1 class declaration +****************************** +*/ + + class CWindow1: public CRecord + { + protected: + + public: + + CWindow1(); + ~CWindow1(); + }; + +/* +****************************** +CDateMode class declaration +****************************** +*/ + class CDateMode: public CRecord + { + protected: + + public: + + CDateMode(); + ~CDateMode(); + }; + + + +/* +****************************** +CWindow2 class declaration +****************************** +*/ + +#define W2_OFFSET_GRBIT ((unsigned32_t)4) +#define W2_OFFSET_TOPROW ((unsigned32_t)6) +#define W2_OFFSET_LEFTCOL ((unsigned32_t)8) +#define W2_OFFSET_COLOR ((unsigned32_t)10) +#define W2_OFFSET_ZOOMPREVIEW ((unsigned32_t)14) +#define W2_OFFSET_ZOOMNORMAL ((unsigned32_t)16) +#define W2_OFFSET_RESERVED ((unsigned32_t)18) + + +#define W2_DFLT_TOPROW ((unsigned16_t)0x0000) +#define W2_DFLT_LEFTCOL ((unsigned16_t)0x0000) +#define W2_DFLT_COLOR ((unsigned32_t)0x00000000) + // NOTE: Check a BIFF8 example to verify the units of the two following values +#define W2_DFLT_ZOOMPBPREV ((unsigned16_t)0x0100) +#define W2_DFLT_ZOOMNORMAL ((unsigned16_t)0x0100) +#define W2_DFLT_RESERVED ((unsigned32_t)0x00000000) + + // GRBIT mask-flags: +#define W2_GRBITMASK_FMLA ((unsigned16_t)0x0001) +#define W2_GRBITMASK_GRIDS ((unsigned16_t)0x0002) +#define W2_GRBITMASK_HROWCOL ((unsigned16_t)0x0004) +#define W2_GRBITMASK_FROZEN ((unsigned16_t)0x0008) +#define W2_GRBITMASK_ZEROS ((unsigned16_t)0x0010) +#define W2_GRBITMASK_DFLTHDRCOLOR ((unsigned16_t)0x0020) +#define W2_GRBITMASK_ARABIC ((unsigned16_t)0x0040) +#define W2_GRBITMASK_GUTS ((unsigned16_t)0x0080) +#define W2_GRBITMASK_FRZNOSPLIT ((unsigned16_t)0x0100) +#define W2_GRBITMASK_SELECTED ((unsigned16_t)0x0200) +#define W2_GRBITMASK_PAGED ((unsigned16_t)0x0400) +#define W2_GRBITMASK_SLV ((unsigned16_t)0x0800) +#define W2_GRBITMASK_RESERVED ((unsigned16_t)0xf000) + + // NOTE: Hardcoded from an excel example +#define W2_DFLT_GRBIT ((unsigned16_t)0x06b6) + /* + #define W2_DFLT_GRBIT ((unsigned16_t) \ + (W2_GRBITMASK_GRIDS|W2_GRBITMASK_HROWCOL|W2_GRBITMASK_DFLTHDRCOLOR)) + */ + class CWindow2: public CRecord + { + private: + + public: + + // TODO: Create a constructor that gets user-defined arguments that specify the appearence + // The following constructor stablishes default values. + CWindow2(); + ~CWindow2(); + + void SetSelected(); + void SetPaged(); + void ClearSelected(); + void ClearPaged(); + }; + +/* +****************************** +CDimension class declaration +****************************** +*/ + class CDimension: public CRecord + { + protected: + + public: + + CDimension(unsigned32_t minRow, unsigned32_t maxRow, unsigned32_t minCol, unsigned32_t maxCol); + ~CDimension(); + }; + + /* +****************************** +CStyle class declaration +****************************** +*/ + + typedef struct + { + unsigned16_t xfindex; + unsigned8_t builtintype; + + } style_t; + typedef std::list Style_List_t; + typedef Style_List_t::iterator Style_List_Itor_t; + + class CStyle: public CRecord + { + protected: + + public: + + CStyle(unsigned16_t xfindex, unsigned8_t builtintype); + CStyle(style_t* styledef); + ~CStyle(); + }; + + + /* +****************************** +CBSheet class declaration +****************************** +*/ + +#define BSHEET_OFFSET_POSITION ((unsigned32_t)4) +#define BSHEET_OFFSET_FLAGS ((unsigned32_t)8) +#define BSHEET_OFFSET_NAMELENGHT ((unsigned32_t)10) +#define BSHEET_OFFSET_B7NAME ((unsigned32_t)11) +#define BSHEET_OFFSET_B8NAME ((unsigned32_t)12) + +#define BSHEET_ATTR_WORKSHEET ((unsigned16_t)0x0000) +#define BSHEET_ATTR_EX4MACRO ((unsigned16_t)0x0001) +#define BSHEET_ATTR_CHART ((unsigned16_t)0x0002) +#define BSHEET_ATTR_VBMODULE ((unsigned16_t)0x0006) + +#define BSHEET_ATTR_VISIBLE ((unsigned16_t)0x0000) +#define BSHEET_ATTR_HIDDEN ((unsigned16_t)0x0100) +#define BSHEET_ATTR_VERYHIDDEN ((unsigned16_t)0x0200) + +// TODO - DFH - are strings leaked???? + typedef struct + { + unsigned32_t streampos; + std::string asheetname; +#if VERSION_BIFF == VERSION_BIFF8 + std::ustring usheetname; +#ifdef HAVE_ICONV + std::string iconv_code; +#endif +#endif + bool _free :1; + bool worksheet:1; + bool ex4macro:1; + bool chart:1; + bool vbmodule:1; + bool visible:1; + bool hidden:1; + bool veryhidden:1; + } boundsheet_t; + typedef std::list Boundsheet_List_t; + typedef Boundsheet_List_t::iterator Boundsheet_List_Itor_t; + + class CBSheet: public CRecord + { + private: + + public: + + CBSheet(unsigned32_t streampos, + unsigned16_t attributes, + std::string& sheetname); +#if VERSION_BIFF == VERSION_BIFF8 + CBSheet(unsigned32_t streampos, + unsigned16_t attributes, + std::ustring& sheetname +#ifdef HAVE_ICONV + , std::string& iconv_code +#endif + ); +#endif + CBSheet(boundsheet_t* bsheetdef); + + ~CBSheet(); + + void SetStreamPosition(unsigned32_t pos); + }; +} +#endif //RECDEF_H + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: recdef.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:57 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/record.cpp b/uppdev/XLS/record.cpp new file mode 100644 index 000000000..ab52538a8 --- /dev/null +++ b/uppdev/XLS/record.cpp @@ -0,0 +1,150 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/record.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +****************************** +CRecord class implementation +****************************** +*/ + + +CRecord::CRecord() + :m_Num(RECTYPE_NULL) + +{ + + // Initialize (and create) the space for record type + // and record length + const unsigned8_t array[] = {0,0,0,0} ; + AddDataArray(array, 4); + + + +} + +CRecord::~CRecord() +{ +} + +/* +****************************** +****************************** +*/ +void CRecord::SetRecordType(unsigned16_t rtype) +{ + SetValueAt((signed16_t)rtype, 0); + +} + + +/* +****************************** +****************************** +*/ + +unsigned16_t CRecord::GetRecordType() +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, 0); + + return value; +} + +/* +****************************** +****************************** +*/ +void CRecord::SetRecordLength(unsigned16_t rlength) +{ + SetValueAt((signed16_t)rlength, 2); + +} + + +/* +****************************** +****************************** +*/ + +unsigned16_t CRecord::GetRecordLength() +{ + unsigned16_t value; + GetValue16From((signed16_t*)&value, 2); + + return value; +} + + +/* +****************************** +****************************** +*/ + +unsigned8_t* CRecord::GetRecordDataBuffer() +{ + return GetBuffer() + 4; + +} + + +/* +****************************** +****************************** +*/ +unsigned32_t CRecord::GetRecordDataSize() +{ + return GetDataSize() - 4; +} + +/* +****************************** +****************************** +*/ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: record.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/record.h b/uppdev/XLS/record.h new file mode 100644 index 000000000..fd83e70dd --- /dev/null +++ b/uppdev/XLS/record.h @@ -0,0 +1,91 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/record.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef RECORD_H +#define RECORD_H + +#include +#include +#include +#include + +namespace xlslib_core +{ + +#define VERSION_BIFF5 0x0500 +#define VERSION_BIFF8 0x0600 +#define VERSION_BIFF VERSION_BIFF8 + + /* +****************************** +CRecord class declaration +****************************** +*/ + class CRecord: public CUnit + { + protected: + + unsigned16_t m_Num; + + public: + + CRecord(); + ~CRecord(); + + void SetRecordType(unsigned16_t rtype); + unsigned16_t GetRecordType(); + + void SetRecordLength(unsigned16_t); + unsigned16_t GetRecordLength(); + + unsigned8_t* GetRecordDataBuffer(); + unsigned32_t GetRecordDataSize(); + + + + }; +} +#endif //RECORD_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: record.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:54 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/rectypes.h b/uppdev/XLS/rectypes.h new file mode 100644 index 000000000..9e11fea28 --- /dev/null +++ b/uppdev/XLS/rectypes.h @@ -0,0 +1,758 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/rectypes.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef RECTYPES_H +#define RECTYPES_H + +/* + sed -e 's/\(^\([A-Z0-9]*\)\:.*$\)/\/\* \1 \*\/\n#define RECTYPE_\2 \\/' biff_records_alpha.txt | sed -e 's/^ \([A-F0-9]*\)\h$/ ((unsigned16_t)0x\1)/' >recordtypes.h +*/ + +#include +#include + +//#define MAX_RECORD_SIZE_BIFF57 (2000) +#define MAX_RECORD_SIZE_BIFF8 (8000) +#define MAX_RECORD_SIZE MAX_RECORD_SIZE_BIFF8 + +/* 1904: 1904 Date System */ +#define RECTYPE_NULL \ + ((unsigned16_t)0x00) + +/* 1904: 1904 Date System */ +#define RECTYPE_R1904 \ + ((unsigned16_t)0x22) + +/* ADDIN: Workbook Is an Add-in Macro */ +#define RECTYPE_ADDIN \ + ((unsigned16_t)0x87) + +/* ADDMENU: Menu Addition */ +#define RECTYPE_ADDMENU \ + ((unsigned16_t)0xC2) + +/* ARRAY: Array-Entered Formula */ +#define RECTYPE_ARRAY \ + ((unsigned16_t)0x221) + +/* AUTOFILTER: AutoFilter Data */ +#define RECTYPE_AUTOFILTER \ + ((unsigned16_t)0x9E) + +/* AUTOFILTERINFO: Drop-Down Arrow Count */ +#define RECTYPE_AUTOFILTERINFO \ + ((unsigned16_t)0x9D) + +/* BACKUP: Save Backup Version of the File */ +#define RECTYPE_BACKUP \ + ((unsigned16_t)0x40) + +/* BLANK: Cell Value, Blank Cell */ +#define RECTYPE_BLANK \ + ((unsigned16_t)0x201) + +/* BOF: Beginning of File */ +#define RECTYPE_BOF \ + ((unsigned16_t)0x809) + +/* BOOKBOOL: Workbook Option Flag */ +#define RECTYPE_BOOKBOOL \ + ((unsigned16_t)0xDA) + +/* BOOLERR: Cell Value, Boolean or Error */ +#define RECTYPE_BOOLERR \ + ((unsigned16_t)0x205) + +/* BOTTOMMARGIN: Bottom Margin Measurement */ +#define RECTYPE_BOTTOMMARGIN \ + ((unsigned16_t)0x29) + +/* BOUNDSHEET: Sheet Information */ +#define RECTYPE_BOUNDSHEET \ + ((unsigned16_t)0x85) + +/* CALCCOUNT: Iteration Count */ +#define RECTYPE_CALCCOUNT \ + ((unsigned16_t)0x0C) + +/* CALCMODE: Calculation Mode */ +#define RECTYPE_CALCMODE \ + ((unsigned16_t)0x0D) + +/* CF + : Conditional Formatting Conditions */ +#define RECTYPE_CF \ + ((unsigned16_t)0x1B1) + +/* CONDFMT: Conditional Formatting Range Information */ +#define RECTYPE_CONDFMT \ + ((unsigned16_t)0x1B0) + +/* CODENAME: VBE Object Name */ +#define RECTYPE_CODENAME \ + ((unsigned16_t)0x42) + +/* CODEPAGE: Default Code Page */ +#define RECTYPE_CODEPAGE \ + ((unsigned16_t)0x42) + +/* COLINFO: Column Formatting Information */ +#define RECTYPE_COLINFO \ + ((unsigned16_t)0x7D) + +/* CONTINUE: Continues Long Records */ +#define RECTYPE_CONTINUE \ + ((unsigned16_t)0x3C) + +/* COORDLIST: Polygon Object Vertex Coordinates */ +#define RECTYPE_COORDLIST \ + ((unsigned16_t)0xA9) + +/* COUNTRY: Default Country and WIN.INI Country */ +#define RECTYPE_COUNTRY \ + ((unsigned16_t)0x8C) + +/* CRN: Nonresident Operands */ +#define RECTYPE_CRN \ + ((unsigned16_t)0x5A) + +/* DBCELL: Stream Offsets */ +#define RECTYPE_DBCELL \ + ((unsigned16_t)0xD7) + +/* DCON: Data Consolidation Information */ +#define RECTYPE_DCON \ + ((unsigned16_t)0x50) + +/* DCONBIN: Data Consolidation Information */ +#define RECTYPE_DCONBIN \ + ((unsigned16_t)0x1B5) + +/* DCONNAME: Data Consolidation Named References */ +#define RECTYPE_DCONNAME \ + ((unsigned16_t)0x52) + +/* DCONREF: Data Consolidation References */ +#define RECTYPE_DCONREF \ + ((unsigned16_t)0x51) + +/* DEFAULTROWHEIGHT: Default Row Height */ +#define RECTYPE_DEFAULTROWHEIGHT \ + ((unsigned16_t)0x225) + +/* DEFCOLWIDTH: Default Width for Columns */ +#define RECTYPE_DEFCOLWIDTH \ + ((unsigned16_t)0x55) + +/* DELMENU: Menu Deletion */ +#define RECTYPE_DELMENU \ + ((unsigned16_t)0xC3) + +/* DELTA: Iteration Increment */ +#define RECTYPE_DELTA \ + ((unsigned16_t)0x10) + +/* DIMENSIONS: Cell Table Size */ +#define RECTYPE_DIMENSIONS \ + ((unsigned16_t)0x200) + +/* DOCROUTE: Routing Slip Information */ +#define RECTYPE_DOCROUTE \ + ((unsigned16_t)0xB8) + +/* DSF: Double Stream File */ +#define RECTYPE_DSF \ + ((unsigned16_t)0x161) + +/* DV: Data Validation Criteria */ +#define RECTYPE_DV \ + ((unsigned16_t)0x1BE) + +/* DVAL: Data Validation Information */ +#define RECTYPE_DVAL \ + ((unsigned16_t)0x1B2) + +/* EDG: Edition Globals */ +#define RECTYPE_EDG \ + ((unsigned16_t)0x88) + +/* EOF: End of File */ +#define RECTYPE_EOF \ + ((unsigned16_t)0x0A) + +/* EXTERNCOUNT: Number of External References */ +#define RECTYPE_EXTERNCOUNT \ + ((unsigned16_t)0x16) + +/* EXTERNNAME: Externally Referenced Name */ +#define RECTYPE_EXTERNNAME \ + ((unsigned16_t)0x223) + +/* EXTERNSHEET: External Reference */ +#define RECTYPE_EXTERNSHEET \ + ((unsigned16_t)0x17) + +/* EXTSST: Extended Shared String Table */ +#define RECTYPE_EXTSST \ + ((unsigned16_t)0xFF) + +/* FILEPASS: File Is Password-Protected */ +#define RECTYPE_FILEPASS \ + ((unsigned16_t)0x2F) + +/* FILESHARING: File-Sharing Information */ +#define RECTYPE_FILESHARING \ + ((unsigned16_t)0x5B) + +/* FILESHARING2: File-Sharing Information for Shared Lists */ +#define RECTYPE_FILESHARING2 \ + ((unsigned16_t)0x1A5) + +/* FILTERMODE: Sheet Contains Filtered List */ +#define RECTYPE_FILTERMODE \ + ((unsigned16_t)0x9B) + +/* FNGROUPCOUNT: Built-in Function Group Count */ +#define RECTYPE_FNGROUPCOUNT \ + ((unsigned16_t)0x9C) + +/* FNGROUPNAME: Function Group Name */ +#define RECTYPE_FNGROUPNAME \ + ((unsigned16_t)0x9A) + +/* FONT: Font Description */ +// NOTE: Changed temporarilly to 31h (the manual says is 231h) +#define RECTYPE_FONT \ + ((unsigned16_t)0x31) + +/* FOOTER: Print Footer on Each Page */ +#define RECTYPE_FOOTER \ + ((unsigned16_t)0x15) + +/* FORMAT: Number Format */ +#define RECTYPE_FORMAT \ + ((unsigned16_t)0x41E) + +/* FORMULA: Cell Formula */ +#define RECTYPE_FORMULA \ + ((unsigned16_t)0x406) + +/* GCW: Global Column-Width Flags */ +#define RECTYPE_GCW \ + ((unsigned16_t)0xAB) + +/* GRIDSET: State Change of Gridlines Option */ +#define RECTYPE_GRIDSET \ + ((unsigned16_t)0x82) + +/* GUTS: Size of Row and Column Gutters */ +#define RECTYPE_GUTS \ + ((unsigned16_t)0x80) + +/* HCENTER: Center Between Horizontal Margins */ +#define RECTYPE_HCENTER \ + ((unsigned16_t)0x83) + +/* HEADER: Print Header on Each Page */ +#define RECTYPE_HEADER \ + ((unsigned16_t)0x14) + +/* HIDEOBJ: Object Display Options */ +#define RECTYPE_HIDEOBJ \ + ((unsigned16_t)0x8D) + +/* HLINK: Hyperlink */ +#define RECTYPE_HLINK \ + ((unsigned16_t)0x1B8) + +/* HORIZONTALPAGEBREAKS: Explicit Row Page Breaks */ +#define RECTYPE_HORIZONTALPAGEBREAKS \ + ((unsigned16_t)0x1B) + +/* IMDATA: Image Data */ +#define RECTYPE_IMDATA \ + ((unsigned16_t)0x7F) + +/* INDEX: Index Record */ +#define RECTYPE_INDEX \ + ((unsigned16_t)0x20B) + +/* INTERFACEEND: End of User Interface Records */ +#define RECTYPE_INTERFACEEND \ + ((unsigned16_t)0xE2) + +/* INTERFACEHDR: Beginning of User Interface Records */ +#define RECTYPE_INTERFACEHDR \ + ((unsigned16_t)0xE1) + +/* ITERATION: Iteration Mode */ +#define RECTYPE_ITERATION \ + ((unsigned16_t)0x11) + +/* LABEL: Cell Value, String Constant */ +#define RECTYPE_LABEL \ + ((unsigned16_t)0x204) + +/* LABELSST: Cell Value, String Constant/SST */ +#define RECTYPE_LABELSST \ + ((unsigned16_t)0xFD) + +/* LEFTMARGIN: Left Margin Measurement */ +#define RECTYPE_LEFTMARGIN \ + ((unsigned16_t)0x26) + +/* LHNGRAPH: Named Graph Information */ +#define RECTYPE_LHNGRAPH \ + ((unsigned16_t)0x95) + +/* LHRECORD: .WK? File Conversion Information */ +#define RECTYPE_LHRECORD \ + ((unsigned16_t)0x94) + +/* LPR: Sheet Was Printed Using LINE.PRINT( */ +#define RECTYPE_LPR \ + ((unsigned16_t)0x98) + +/* MMS: ADDMENU/DELMENU Record Group Count */ +#define RECTYPE_MMS \ + ((unsigned16_t)0xC1) + +/* MSODRAWING: Microsoft Office Drawing */ +#define RECTYPE_MSODRAWING \ + ((unsigned16_t)0xEC) + +/* MSODRAWINGGROUP: Microsoft Office Drawing Group */ +#define RECTYPE_MSODRAWINGGROUP \ + ((unsigned16_t)0xEB) + +/* MSODRAWINGSELECTION: Microsoft Office Drawing Selection */ +#define RECTYPE_MSODRAWINGSELECTION \ + ((unsigned16_t)0xED) + +/* MULBLANK: Multiple Blank Cells */ +#define RECTYPE_MULBLANK \ + ((unsigned16_t)0xBE) + +/* MULRK: Multiple RK Cells */ +#define RECTYPE_MULRK \ + ((unsigned16_t)0xBD) + +/* NAME: Defined Name */ +#define RECTYPE_NAME \ + ((unsigned16_t)0x218) + +/* NOTE: Comment Associated with a Cell */ +#define RECTYPE_NOTE \ + ((unsigned16_t)0x1C) + +/* NUMBER: Cell Value, Floating-Point Number */ +#define RECTYPE_NUMBER \ + ((unsigned16_t)0x203) + +/* OBJ: Describes a Graphic Object */ +#define RECTYPE_OBJ \ + ((unsigned16_t)0x5D) + +/* OBJPROTECT: Objects Are Protected */ +#define RECTYPE_OBJPROTECT \ + ((unsigned16_t)0x63) + +/* OBPROJ: Visual Basic Project */ +#define RECTYPE_OBPROJ \ + ((unsigned16_t)0xD3) + +/* OLESIZE: Size of OLE Object */ +#define RECTYPE_OLESIZE \ + ((unsigned16_t)0xDE) + +/* PALETTE: Color Palette Definition */ +#define RECTYPE_PALETTE \ + ((unsigned16_t)0x92) + +/* PANE: Number of Panes and Their Position */ +#define RECTYPE_PANE \ + ((unsigned16_t)0x41) + +/* PARAMQRY: Query Parameters */ +#define RECTYPE_PARAMQRY \ + ((unsigned16_t)0xDC) + +/* PASSWORD: Protection Password */ +#define RECTYPE_PASSWORD \ + ((unsigned16_t)0x13) + +/* PLS: Environment-Specific Print Record */ +#define RECTYPE_PLS \ + ((unsigned16_t)0x4D) + +/* PRECISION: Precision */ +#define RECTYPE_PRECISION \ + ((unsigned16_t)0x0E) + +/* PRINTGRIDLINES: Print Gridlines Flag */ +#define RECTYPE_PRINTGRIDLINES \ + ((unsigned16_t)0x2B) + +/* PRINTHEADERS: Print Row/Column Labels */ +#define RECTYPE_PRINTHEADERS \ + ((unsigned16_t)0x2A) + +/* PROTECT: Protection Flag */ +#define RECTYPE_PROTECT \ + ((unsigned16_t)0x12) + +/* PROT4REV: Shared Workbook Protection Flag */ +#define RECTYPE_PROT4REV \ + ((unsigned16_t)0x1AF) + +/* QSI: External Data Range */ +#define RECTYPE_QSI \ + ((unsigned16_t)0x1AD) + +/* RECIPNAME: Recipient Name */ +#define RECTYPE_RECIPNAME \ + ((unsigned16_t)0xB9) + +/* REFMODE: Reference Mode */ +#define RECTYPE_REFMODE \ + ((unsigned16_t)0x0F) + +/* REFRESHALL: Refresh Flag */ +#define RECTYPE_REFRESHALL \ + ((unsigned16_t)0x1B7) + +/* RIGHTMARGIN: Right Margin Measurement */ +#define RECTYPE_RIGHTMARGIN \ + ((unsigned16_t)0x27) + +/* RK: Cell Value, RK Number */ +#define RECTYPE_RK \ + ((unsigned16_t)0x7E) + +/* ROW: Describes a Row */ +#define RECTYPE_ROW \ + ((unsigned16_t)0x208) + +/* RSTRING: Cell with Character Formatting */ +#define RECTYPE_RSTRING \ + ((unsigned16_t)0xD6) + +/* SAVERECALC: Recalculate Before Save */ +#define RECTYPE_SAVERECALC \ + ((unsigned16_t)0x5F) + +/* SCENARIO: Scenario Data */ +#define RECTYPE_SCENARIO \ + ((unsigned16_t)0xAF) + +/* SCENMAN: Scenario Output Data */ +#define RECTYPE_SCENMAN \ + ((unsigned16_t)0xAE) + +/* SCENPROTECT: Scenario Protection */ +#define RECTYPE_SCENPROTECT \ + ((unsigned16_t)0xDD) + +/* SCL: Window Zoom Magnification */ +#define RECTYPE_SCL \ + ((unsigned16_t)0xA0) + +/* SELECTION: Current Selection */ +#define RECTYPE_SELECTION \ + ((unsigned16_t)0x1D) + +/* SETUP: Page Setup */ +#define RECTYPE_SETUP \ + ((unsigned16_t)0xA1) + +/* SHRFMLA: Shared Formula */ +#define RECTYPE_SHRFMLA \ + ((unsigned16_t)0xBC) + +/* SORT: Sorting Options */ +#define RECTYPE_SORT \ + ((unsigned16_t)0x90) + +/* SOUND: Sound Note */ +#define RECTYPE_SOUND \ + ((unsigned16_t)0x96) + +/* SST: Shared String Table */ +#define RECTYPE_SST \ + ((unsigned16_t)0xFC) + +/* STANDARDWIDTH: Standard Column Width */ +#define RECTYPE_STANDARDWIDTH \ + ((unsigned16_t)0x99) + +/* STRING: String Value of a Formula */ +#define RECTYPE_STRING \ + ((unsigned16_t)0x207) + +/* STYLE: Style Information */ +#define RECTYPE_STYLE \ + ((unsigned16_t)0x293) + +/* SUB: Subscriber */ +#define RECTYPE_SUB \ + ((unsigned16_t)0x91) + +/* SUPBOOK: Supporting Workbook */ +#define RECTYPE_SUPBOOK \ + ((unsigned16_t)0x1AE) + +/* SXDB: PivotTable Cache Data */ +#define RECTYPE_SXDB \ + ((unsigned16_t)0xC6) + +/* SXDBEX: PivotTable Cache Data */ +#define RECTYPE_SXDBEX \ + ((unsigned16_t)0x122) + +/* SXDI: Data Item */ +#define RECTYPE_SXDI \ + ((unsigned16_t)0xC5) + +/* SXEX: PivotTable View Extended Information */ +#define RECTYPE_SXEX \ + ((unsigned16_t)0xF1) + +/* SXEXT: External Source Information */ +#define RECTYPE_SXEXT \ + ((unsigned16_t)0xDC) + +/* SXFDBTYPE: SQL Datatype Identifier */ +#define RECTYPE_SXFDBTYPE \ + ((unsigned16_t)0x1BB) + +/* SXFILT: PivotTable Rule Filter */ +#define RECTYPE_SXFILT \ + ((unsigned16_t)0xF2) + +/* SXFORMAT: PivotTable Format Record */ +#define RECTYPE_SXFORMAT \ + ((unsigned16_t)0xFB) + +/* SXFORMULA: PivotTable Formula Record */ +#define RECTYPE_SXFORMULA \ + ((unsigned16_t)0x103) + +/* SXFMLA: PivotTable Parsed Expression */ +#define RECTYPE_SXFMLA \ + ((unsigned16_t)0xF9) + +/* SXIDSTM: Stream ID */ +#define RECTYPE_SXIDSTM \ + ((unsigned16_t)0xD5) + +/* SXIVD: Row/Column Field IDs */ +#define RECTYPE_SXIVD \ + ((unsigned16_t)0xB4) + +/* SXLI: Line Item Array */ +#define RECTYPE_SXLI \ + ((unsigned16_t)0xB5) + +/* SXNAME: PivotTable Name */ +#define RECTYPE_SXNAME \ + ((unsigned16_t)0xF6) + +/* SXPAIR: PivotTable Name Pair */ +#define RECTYPE_SXPAIR \ + ((unsigned16_t)0xF8) + +/* SXPI: Page Item */ +#define RECTYPE_SXPI \ + ((unsigned16_t)0xB6) + +/* SXRULE: PivotTable Rule Data */ +#define RECTYPE_SXRULE \ + ((unsigned16_t)0xF0) + +/* SXSTRING: String */ +#define RECTYPE_SXSTRING \ + ((unsigned16_t)0xCD) + +/* SXSELECT: PivotTable Selection Information */ +#define RECTYPE_SXSELECT \ + ((unsigned16_t)0xF7) + +/* SXTBL: Multiple Consolidation Source Info */ +#define RECTYPE_SXTBL \ + ((unsigned16_t)0xD0) + +/* SXTBPG: Page Item Indexes */ +#define RECTYPE_SXTBPG \ + ((unsigned16_t)0xD2) + +/* SXTBRGIITM: Page Item Name Count */ +#define RECTYPE_SXTBRGIITM \ + ((unsigned16_t)0xD1) + +/* SXVD: View Fields */ +#define RECTYPE_SXVD \ + ((unsigned16_t)0xB1) + +/* SXVDEX: Extended PivotTable View Fields */ +#define RECTYPE_SXVDEX \ + ((unsigned16_t)0x100) + +/* SXVI: View Item */ +#define RECTYPE_SXVI \ + ((unsigned16_t)0xB2) + +/* SXVIEW: View Definition */ +#define RECTYPE_SXVIEW \ + ((unsigned16_t)0xB0) + +/* SXVS: View Source */ +#define RECTYPE_SXVS \ + ((unsigned16_t)0xE3) + +/* TABID: Sheet Tab Index Array */ +#define RECTYPE_TABID \ + ((unsigned16_t)0x13D) + +/* TABIDCONF: Sheet Tab ID of Conflict History */ +#define RECTYPE_TABIDCONF \ + ((unsigned16_t)0xEA) + +/* TABLE: Data Table */ +#define RECTYPE_TABLE \ + ((unsigned16_t)0x236) + +/* TEMPLATE: Workbook Is a Template */ +#define RECTYPE_TEMPLATE \ + ((unsigned16_t)0x60) + +/* TOPMARGIN: Top Margin Measurement */ +#define RECTYPE_TOPMARGIN \ + ((unsigned16_t)0x28) + +/* TXO: Text Object */ +#define RECTYPE_TXO \ + ((unsigned16_t)0x1B6) + +/* UDDESC: Description String for Chart Autoformat */ +#define RECTYPE_UDDESC \ + ((unsigned16_t)0xDF) + +/* UNCALCED: Recalculation Status */ +#define RECTYPE_UNCALCED \ + ((unsigned16_t)0x5E) + +/* USERBVIEW: Workbook Custom View Settings */ +#define RECTYPE_USERBVIEW \ + ((unsigned16_t)0x1A9) + +/* USERSVIEWBEGIN: Custom View Settings */ +#define RECTYPE_USERSVIEWBEGIN \ + ((unsigned16_t)0x1AA) + +/* USERSVIEWEND: End of Custom View Records */ +#define RECTYPE_USERSVIEWEND \ + ((unsigned16_t)0x1AB) + +/* USESELFS: Natural Language Formulas Flag */ +#define RECTYPE_USESELFS \ + ((unsigned16_t)0x160) + +/* VCENTER: Center Between Vertical Margins */ +#define RECTYPE_VCENTER \ + ((unsigned16_t)0x84) + +/* VERTICALPAGEBREAKS: Explicit Column Page Breaks */ +#define RECTYPE_VERTICALPAGEBREAKS \ + ((unsigned16_t)0x1A) + +/* WINDOW1: Window Information */ +#define RECTYPE_WINDOW1 \ + ((unsigned16_t)0x3D) + +/* WINDOW2: Sheet Window Information */ +#define RECTYPE_WINDOW2 \ + ((unsigned16_t)0x23E) + +/* WINDOWPROTECT: Windows Are Protected */ +#define RECTYPE_WINDOWPROTECT \ + ((unsigned16_t)0x19) + +/* WRITEACCESS: Write Access User Name */ +#define RECTYPE_WRITEACCESS \ + ((unsigned16_t)0x5C) + +/* WRITEPROT: Workbook Is Write-Protected */ +#define RECTYPE_WRITEPROT \ + ((unsigned16_t)0x86) + +/* WSBOOL: Additional Workspace Information */ +#define RECTYPE_WSBOOL \ + ((unsigned16_t)0x81) + +/* XCT: CRN Record Count */ +#define RECTYPE_XCT \ + ((unsigned16_t)0x59) + +/* XF: Extended Format */ +#define RECTYPE_XF \ + ((unsigned16_t)0xE0) + +/* XL5MODIFY: Flag for DSF */ +#define RECTYPE_XL5MODIFY \ + ((unsigned16_t)0x162) + +/* TOOLBARHDR: Not documented */ +#define RECTYPE_TOOLBARHDR \ + ((unsigned16_t)0xbf) + +/* TOOLBAREND: Not documented */ +#define RECTYPE_TOOLBAREND \ + ((unsigned16_t)0xc0) + +/* TOOLBAREND: Not documented */ +#define RECTYPE_MERGEDCELLS \ + ((unsigned16_t)0xe5) + +#endif //RECTYPES_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: rectypes.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:51 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/reference/xlslibRefGuide.pdf b/uppdev/XLS/reference/xlslibRefGuide.pdf new file mode 100644 index 000000000..7f74c5b49 Binary files /dev/null and b/uppdev/XLS/reference/xlslibRefGuide.pdf differ diff --git a/uppdev/XLS/reference/xlslibRefManual.xls b/uppdev/XLS/reference/xlslibRefManual.xls new file mode 100644 index 000000000..5a6d369ae Binary files /dev/null and b/uppdev/XLS/reference/xlslibRefManual.xls differ diff --git a/uppdev/XLS/row.cpp b/uppdev/XLS/row.cpp new file mode 100644 index 000000000..b3c90d1ba --- /dev/null +++ b/uppdev/XLS/row.cpp @@ -0,0 +1,201 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/row.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + +/* +****************************** +CRow class implementation +****************************** +*/ + + + +CRow::CRow(unsigned16_t rownum, + unsigned16_t firstcol, + unsigned16_t lastcol, + unsigned16_t rowheight) +{ + SetRecordType(RECTYPE_ROW); + AddValue16(rownum); + AddValue16(firstcol); + AddValue16((lastcol+1)); + AddValue16(rowheight); + + // A field used by MS for "optimizing" (?) the loading of a file. + // Doc says it shall be set to 0 if I'm creating a BIFF... + AddValue16(0); + // A reserved value: + AddValue16(0); + + // TODO: The following flag-word can be used for outline cells. Later. + // As a defaule the GhostDirty flag is is set, so the row has a default + // format (set by the index of byte 18). + if(rowheight == ROW_DFLT_HEIGHT) + { + AddValue16((unsigned16_t)(ROW_DFLT_GRBIT)); + } + else + { + AddValue16((unsigned16_t)(ROW_DFLT_GRBIT|ROW_GRBIT_UNSYNC)); + } + AddValue16((unsigned16_t)ROW_DFLT_IXFE); + + + SetRecordLength(GetDataSize()-4); +} + +// NOTE: row_t has not a height field +CRow::CRow(row_t& rowdef) +{ + SetRecordType(RECTYPE_ROW); + AddValue16(rowdef.rownum); + AddValue16(rowdef.firstcol); + AddValue16((rowdef.lastcol+1)); + AddValue16(ROW_DFLT_HEIGHT); + + // A field used by MS for "optimizing" (?) the loading of a file. + // Doc says it shall be set to 0 if I'm creating a BIFF... + AddValue16((unsigned16_t)0); + // A reserved value: + AddValue16((unsigned16_t)0); + + // TODO: The following flag-word can be used for outline cells. Later. + // As a defaule the GhostDirty flag is is set, so the row has a default + // format (set by the index of byte 18). + AddValue16((unsigned16_t)(ROW_DFLT_GRBIT|ROW_GRBIT_UNSYNC)); + AddValue16((unsigned16_t)ROW_DFLT_IXFE); + + + SetRecordLength(GetDataSize()-4); +} + + +CRow::~CRow() +{ +} + + +/* +****************************** +****************************** +*/ +void CRow::SetFirstCol(unsigned16_t firstcol) +{ + SetValueAt((signed16_t)firstcol, ROW_OFFSET_FIRSTCOL); +} + +/* +****************************** +****************************** +*/ +void CRow::SetLastCol(unsigned16_t lastcol) +{ + SetValueAt((signed16_t)lastcol, ROW_OFFSET_LASTCOL); +} + +/* +****************************** +****************************** +*/ +unsigned16_t CRow::GetFirstCol(void) +{ + + signed16_t firstcol; + GetValue16From(&firstcol,ROW_OFFSET_FIRSTCOL); + return (unsigned16_t)firstcol; + +} + +/* +****************************** +****************************** +*/ +unsigned16_t CRow::GetLastCol(void) +{ + signed16_t lastcol; + GetValue16From(&lastcol,ROW_OFFSET_LASTCOL); + return (unsigned16_t)lastcol; +} + + + + + +/* +****************************** +CDBCell class implementation +****************************** +*/ + +CDBCell::CDBCell(unsigned32_t startblock) +{ + + // The new initializated DBCell record points to nowhere and has no + // extra rows (the array of stream offsets is empty); + SetRecordType(RECTYPE_DBCELL); + AddValue32((unsigned32_t) startblock); + + + + SetRecordLength(GetDataSize()-4); +} + +CDBCell::~CDBCell() +{ +} + + +void CDBCell::AddRowOffset(unsigned16_t rowoffset) +{ + + AddValue16((unsigned16_t) rowoffset); + SetRecordLength(GetDataSize()-4); + +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: row.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:53 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/row.h b/uppdev/XLS/row.h new file mode 100644 index 000000000..cfddc3671 --- /dev/null +++ b/uppdev/XLS/row.h @@ -0,0 +1,179 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/row.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef ROW_H +#define ROW_H + +#include +#include +#include + +/* +****************************** +CRow class declaration +****************************** +*/ + +namespace xlslib_core +{ + +#define ROW_DFLT_HEIGHT ((unsigned16_t)0x0108) +#define ROW_DFLT_GRBIT ((unsigned16_t)0x0080) +#define ROW_GRBIT_UNSYNC ((unsigned16_t)0x0040) +#define ROW_DFLT_IXFE ((unsigned16_t)0x000f) +#define ROW_OFFSET_FIRSTCOL ((unsigned32_t)6) +#define ROW_OFFSET_LASTCOL ((unsigned32_t)8) +#define ROW_MASK_STDHEIGHT ((unsigned16_t)0x0108) +#define ROW_RECORD_SIZE (20) + + class rowheight_t + { + public: + rowheight_t() {}; + rowheight_t(unsigned16_t rownum, unsigned16_t rowheight) + : num(rownum), height(rowheight) {} + ~rowheight_t() {}; + + unsigned16_t GetRowNum() {return num;}; + void SetRowNum(unsigned16_t rownum) {num = rownum;}; + + unsigned16_t GetRowHeight() {return height;}; + void SetRowHeight(unsigned16_t rowheight) {height = rowheight;}; + + bool operator<(const rowheight_t& right) const{ + return (num < right.num); + }; + + bool operator>(const rowheight_t& right) const{ + return (num > right.num); + }; + + bool operator==(const rowheight_t& right) const{ + return (num == right.num); + }; + + bool operator!=(const rowheight_t& right) const{ + return (num != right.num); + }; + + + private: + unsigned16_t num; + unsigned16_t height; + }; + + struct rowheightsort + { + public: +bool operator()(rowheight_t* const &a, rowheight_t* const &b) const + { + return (a->GetRowNum() < b->GetRowNum()); + }; + }; + + typedef std::set RowHeight_List_t; + typedef RowHeight_List_t::iterator RowHeight_List_Itor_t; + + + + // NOTE: row_t has not a height field + typedef struct + { + unsigned16_t rownum; + unsigned16_t firstcol; + unsigned16_t lastcol; + }row_t; + typedef std::list Row_List_t; + typedef Row_List_t::iterator Row_List_Itor_t; + + + class CRow: public CRecord + { + private: + + public: + CRow(unsigned16_t rownum, + unsigned16_t firstcol, + unsigned16_t lastcol, + unsigned16_t rowheight = ROW_DFLT_HEIGHT); + CRow(row_t& rowdef); + + ~CRow(); + + void SetFirstCol(unsigned16_t firstrow); + void SetLastCol(unsigned16_t lastrow); + unsigned16_t GetFirstCol(void); + unsigned16_t GetLastCol(void); + + + + }; + + + /* +****************************** +CDBCell class declaration +****************************** +*/ + +#define DBC_DFLT_STARTBLOCK ((unsigned32_t)(0x00000000)) + + class CDBCell: public CRecord + { + private: + + public: + CDBCell(unsigned32_t startblock = DBC_DFLT_STARTBLOCK); + ~CDBCell(); + + void AddRowOffset(unsigned16_t rowoffset ); + + }; + + +} + +#endif //ROW_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: row.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/sheetrec.cpp b/uppdev/XLS/sheetrec.cpp new file mode 100644 index 000000000..26b39ec6a --- /dev/null +++ b/uppdev/XLS/sheetrec.cpp @@ -0,0 +1,1176 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/sheetrec.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +using namespace std; +using namespace xlslib_core; + + +/* + * LOCAL MODULE MACROS + */ + + +#if STORAGE_CELL==LIST_CONTAINER + +#define MARK_CELLS_UNSORTED() { \ + m_CellsSorted = false; \ + m_SizesCalculated = false; \ + m_RBSizes.clear(); \ +} + + +#elif STORAGE_CELL==SET_CONTAINER + +#define MARK_CELLS_UNSORTED() { \ + m_CellsSorted = false; \ + m_SizesCalculated = false; \ + m_RBSizes.clear(); \ +} + + +#endif + +#define MAX_ROWBLOCK_SIZE (32) + +#define RB_DBCELL_MINSIZE (unsigned8_t(8)) +#define RB_DBCELL_CELLSIZEOFFSET (unsigned8_t(2)) + + +using namespace std; + +/* +********************************************************************** +worksheet class implementation +********************************************************************** +*/ + + +worksheet::worksheet(CGlobalRecords* pglobalrec) + : m_DumpState(SHEET_INIT), m_pCurrentData(NULL), + m_Size(0), + m_CellsSorted(false), + m_SizesCalculated(false), + m_DumpRBState(RB_INIT), + m_DBCellOffset(0), + m_CurrentRowBlock(0) +{ + m_pGlobalRecords = pglobalrec; + + minRow = minCol = 0xFFFF; // UINT16_MAX + maxRow = maxCol = 0; +} +#ifdef HAVE_ICONV +worksheet::worksheet(CGlobalRecords* pglobalrec, string& code) + : m_DumpState(SHEET_INIT), m_pCurrentData(NULL), + m_Size(0), + m_CellsSorted(false), + m_SizesCalculated(false), + m_DumpRBState(RB_INIT), + m_DBCellOffset(0), + m_CurrentRowBlock(0) +{ + m_pGlobalRecords = pglobalrec; + + minRow = minCol = 0xFFFF; // UINT16_MAX + maxRow = maxCol = 0; + iconv_code = code; +} +#endif + + +worksheet::~worksheet() +{ + if(!m_RBSizes.empty()) + for(RBSize_List_Itor_t rbs = m_RBSizes.begin(); rbs != m_RBSizes.end(); rbs++) + delete *rbs; + + // Delete the dinamically created cell objects (pointers) + + if(!m_Cells.empty()) + { +// cout<<"worksheet::~worksheet(), this = "<AddDBCellOffset(dbcelloffset); + + // Update the offset for the next DBCELL's offset + rb_size_acc += dbcell_size; + } + + m_DumpState = SHEET_DIMENSION; // Change to the next state + + break; + } + + case SHEET_DIMENSION: + XTRACE("\tDIMENSION"); + + repeat = false; + + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CDimension(minRow, maxRow, minCol, maxCol)); + m_DumpState = SHEET_ROWBLOCKS; + break; + + case SHEET_ROWBLOCKS: + XTRACE("\tROWBLOCKS"); + if(GetNumRowBlocks()) + {// First check if the list of RBs is not empty... + + m_pCurrentData = RowBlocksDump(); + + if(m_pCurrentData == NULL) + { + + repeat = true; + m_DumpState = SHEET_MERGED; + + } + + } + else + {// if the list is empty, change the dump state. + repeat = true; + m_DumpState = SHEET_MERGED; + + } + + break; + case SHEET_MERGED: + + repeat = false; + XTRACE("\tMERGED"); + + if(!m_MergedRanges.empty()) + { + m_pCurrentData = (CUnit*)(new CMergedCells()); + ((CMergedCells*)m_pCurrentData)->SetNumRanges(m_MergedRanges.size()); + for(Range_List_Itor_t mr = m_MergedRanges.begin(); mr != m_MergedRanges.end(); mr++) + { + ((CMergedCells*)m_pCurrentData)->AddRange(*mr); + } + + } + else + { + repeat = true; + } + + m_DumpState = SHEET_COLINFO; + break; + + case SHEET_COLINFO: + repeat = false; + XTRACE("\tCOLINFO"); + + if(!m_Colinfos.empty()) + {// First check if the list of fonts is not empty... + + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CColInfo(*m_Current_Colinfo)); + + if(m_Current_Colinfo != (--m_Colinfos.end())) + {// if it was'nt the last font from the list, increment to get the next one + m_Current_Colinfo++; + } + else + {// if it was the last from the list, change the DumpState + m_DumpState = SHEET_WINDOW2; + m_Current_Colinfo = m_Colinfos.begin(); + } + } + else + {// if the list is empty, change the dump state. + m_DumpState = SHEET_WINDOW2; + //font = m_Fonts.begin(); + repeat = true; + } + break; + + case SHEET_WINDOW2: + XTRACE("\tWINDOW2"); + repeat = false; + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CWindow2()); + m_DumpState = SHEET_EOF; + + break; + + case SHEET_EOF: + XTRACE("\tEOF"); + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = (CUnit*)(new CEof()); + m_DumpState = SHEET_FINISH; + break; + + case SHEET_FINISH: + XTRACE("\tFINISH"); + //Delete_Pointer(m_pCurrentData); + m_pCurrentData = NULL; + m_DumpState = SHEET_INIT; + + break; + + + + } + + }while(repeat); + + return m_pCurrentData; +} + + +CUnit* worksheet::RowBlocksDump() +{ + bool repeat = false; + CUnit* rb_record = NULL; + + do + { + switch(m_DumpRBState) + { + case RB_INIT: + m_DumpRBState = RB_ROWS; + m_CurrentRowBlock = 0; + m_RowCounter = 0; + m_CurrentCell = m_Cells.begin(); + + // Initialize the row widths + + m_Current_RowHeight = m_RowHeights.begin(); + m_DumpRBState = RB_FIRST_ROW; + repeat = true; + + break; + case RB_FIRST_ROW: + repeat = true; + + if( m_Cells.empty() || m_CurrentCell != m_Cells.end()) + { + m_Starting_RBCell = m_CurrentCell; + m_CellCounter = 0; + m_DBCellOffset = 0; + m_CellOffsets.clear(); + + m_DumpRBState = RB_ROWS; + + } + else + { + m_DumpRBState = RB_FINISH; + + } + break; + + case RB_ROWS: + { + repeat = false; + + // Initialize first/last cols to impossible values + // that are appropriate for the following detection algorithm + unsigned16_t first_col = (unsigned16_t)(-1); + unsigned16_t last_col = 0; + unsigned16_t row_num = 0; + + // Get the row number for the current row + row_num = (*m_CurrentCell)->GetRow(); + + Cell_List_Itor_t this_cell, next_cell; + do + { + + // Determine the first/last column of the current row + if((*m_CurrentCell)->GetCol() > last_col) + last_col = (*m_CurrentCell)->GetCol(); + + if((*m_CurrentCell)->GetCol() < first_col) + first_col = (*m_CurrentCell)->GetCol(); + + + // To avoid dereference an empty iterator check if this is the only one cell + // in m_Cells list. + if(m_Cells.size() > 1) + { + m_CellCounter++; + + this_cell = m_CurrentCell; + next_cell = ++m_CurrentCell; + + // Break the while if there are no more cells + if(next_cell == m_Cells.end()) + break; + } + else + { + // Break the loop if this was the only cell. + + + if(!m_Cells.empty()) + + { + + m_CellCounter++; + + ++m_CurrentCell; + + } + + break; + } + + + + // The order in the following and-statement is important + }while( m_CurrentCell != (m_Cells.end()) && *(*this_cell) == *(*next_cell )); + + // Check if the current row is in the list of height-set + // rows. + if(m_Current_RowHeight != m_RowHeights.end()) + { + + if((*m_Current_RowHeight)->GetRowNum() == row_num) + { + + rb_record = (CUnit*) (new CRow(row_num, first_col, + last_col, + (*m_Current_RowHeight)->GetRowHeight()) ); + + m_Current_RowHeight++; + } + else + { + rb_record = (CUnit*) (new CRow(row_num, first_col, last_col) ); + } + } + else + { + rb_record = (CUnit*) (new CRow(row_num, first_col, last_col) ); + } + + + + m_DBCellOffset += ROW_RECORD_SIZE; + + // If the current row-block is full OR there are no more cells + if(++m_RowCounter >= MAX_ROWBLOCK_SIZE || m_CurrentCell == m_Cells.end()) + { + if (m_CurrentCell == (--m_Cells.end())) + m_CellCounter++; + m_RowCounter = 0; + m_DumpRBState = RB_FIRSTCELL; + } + + + break; + } + + case RB_FIRSTCELL: + rb_record = (*m_Starting_RBCell)->GetData(); + + // Update the offset to be used in the DBCell Record + m_DBCellOffset += rb_record->GetDataSize(); + + // The first cell of the rowblock has an offset that includes (among others) + // the rows size (without counting the first row) + m_CellOffsets.push_back(m_DBCellOffset -ROW_RECORD_SIZE); + + // Update the pointer (iterator) to the next cell + if(--m_CellCounter == 0) + {// The RowBlock's cells are done + m_DumpRBState = RB_DBCELL; + } + else + { + + m_Starting_RBCell++; + m_DumpRBState = RB_CELLS; + } + + + break; + + case RB_CELLS: + repeat = false; + + if(m_CellCounter == 0) + {// The RowBlock's cells are done + + + + m_DumpRBState = RB_DBCELL; + + repeat = true; + } + else + { + + + rb_record = (*m_Starting_RBCell)->GetData(); + + m_DBCellOffset += rb_record->GetDataSize(); + + m_CellOffsets.push_back(rb_record->GetDataSize()); + + + + m_CellCounter--; + + + + m_Starting_RBCell++; + } + + + + break; + + case RB_DBCELL: + { + + repeat = false; + + + rb_record = (CUnit*)(new CDBCell(m_DBCellOffset)); + + CellOffsets_List_Itor_t celloffset; + for(celloffset = m_CellOffsets.begin(); celloffset != m_CellOffsets.end(); celloffset++) + ((CDBCell*)rb_record)->AddRowOffset(*celloffset); + + if(m_CurrentCell == (--m_Cells.end()) ) + m_DumpRBState = RB_FINISH; + else + m_DumpRBState = RB_FIRST_ROW; + + break; + } + case RB_FINISH: + repeat = false; + rb_record = NULL; + m_DumpRBState = RB_INIT; + + + break; + + default: + break; + + } + + + }while(repeat); + + return rb_record; + +} +/* +*********************************** +*********************************** +*/ + +cell_t* worksheet::label(unsigned16_t row, unsigned16_t col, + string strlabel, xf_t* pxformat) +{ + label_t* label = new label_t(row, col, strlabel, pxformat); + AddCell((cell_t*)label); + + return (cell_t*)label; + + +} + +#if VERSION_BIFF == VERSION_BIFF8 +cell_t* worksheet::label(unsigned16_t row, unsigned16_t col, + ustring strlabel, xf_t* pxformat) +{ + label_t* label = new label_t(row, col, strlabel +#ifdef HAVE_ICONV + , iconv_code +#endif + , pxformat); + AddCell((cell_t*)label); + + return (cell_t*)label; + +} +#endif + + +cell_t* worksheet::number(unsigned16_t row, unsigned16_t col, + double numval, format_number_t fmtval, + xf_t* pxformat) +{ + number_t* number = new number_t(row, col, numval, pxformat); + AddCell((cell_t*)number); + number->format(fmtval); + return (cell_t*)number; + +} + +/* +*********************************** +*********************************** +*/ + +cell_t* worksheet::blank(unsigned16_t row, unsigned16_t col, xf_t* pxformat) +{ + blank_t* blank = new blank_t(row, col, pxformat); + AddCell((cell_t*)blank); + + return (cell_t*)blank; +} + + + +/* +*********************************** +*********************************** +*/ + +void worksheet::AddCell(cell_t* pcell) +{ + + Cell_List_Itor_t existing_cell; + + unsigned32_t row, col; + + row = pcell->GetRow(); + col = pcell->GetCol(); + + if(row < minRow) minRow = row; + if(row > maxRow) maxRow = row; + if(col < minCol) minCol = col; + if(col > maxCol) maxCol = col; + + // Pass a pointer to m_GlobalRecords, so the global records + // can be modified from the cell as needed + pcell->SetGlobalRecs(m_pGlobalRecords); + + SortCells(); + // lookup the cell + existing_cell = m_Cells.find(pcell); + + if(existing_cell != m_Cells.end()) + { + //Always overwrite + delete (*existing_cell); + m_Cells.erase(existing_cell); + m_Cells.insert(pcell); + MARK_CELLS_UNSORTED(); + } + else + { + m_Cells.insert(pcell); + MARK_CELLS_UNSORTED(); + } + +} + +cell_t* worksheet::FindCell(unsigned16_t row, unsigned16_t col) +{ + Cell_List_Itor_t existing_cell; + + cell_t* cell = new blank_t(row, col); + existing_cell = m_Cells.find(cell); + delete cell; + + // The find operation returns the end() itor + // if the cell wasn't found + if(existing_cell != m_Cells.end()) + return *existing_cell; + else + { + + return blank(row,col); + } +} +/* + void worksheet::AddCell(cell_t* pcell, bool overwrite) + { + + #if STORAGE_CELL == LIST_CONTAINER + m_Cells.push_back(pcell); + + #elif STORAGE_CELL == SET_CONTAINER + m_Cells.insert(pcell); + #endif + MARK_CELLS_UNSORTED(); + } +*/ +/* +*********************************** +*********************************** +*/ + + +unsigned32_t worksheet::GetSize() +{ + m_CurrentSizeCell = m_Cells.begin(); + unsigned32_t numrb = GetNumRowBlocks(); + unsigned16_t merged_size; + unsigned16_t colinfo_size; + + + // The size of the merged cells record (if any) has to be taken in count + if(!m_MergedRanges.empty()) + { + // [HEADER] + [NUMRANGESFIELD] + [RANGES] + merged_size = 4 + 2 + m_MergedRanges.size()*8; + } + else + { + merged_size = 0; + } + + // The size of the Colinfo records (if any) has to be taken in count + if(!m_Colinfos.empty()) + { + colinfo_size = m_Colinfos.size()*14; + } + else + { + colinfo_size = 0; + } + + + unsigned32_t size = BOF_SIZE + + RB_INDEX_MINSIZE + + 4*numrb + + merged_size + + colinfo_size + + WINDOW2_SIZE + + EOF_SIZE; + + for(unsigned32_t rb = 0; rb < numrb; rb++) + { + // Get sizes of next RowBlock + unsigned32_t rowandcell_size, dbcell_size; + GetRowBlockSizes( &rowandcell_size, &dbcell_size); + + // Update the offset accumulator and cerate the next DBCELL's offset + size += rowandcell_size; + size += dbcell_size; + } + + m_CurrentSizeCell = m_Cells.begin(); + + return size; +} + +/* +*********************************** +*********************************** +*/ + +bool worksheet::GetRowBlockSizes(unsigned32_t* rowandcell_size, + unsigned32_t* dbcell_size, + unsigned32_t* num_rows) +{ + + SortCells(); + + unsigned32_t row_counter = 0; + unsigned32_t cell_counter = 0; + + Cell_List_Itor_t beginning_cell = m_CurrentSizeCell; + + // Initialize the size values (since they work as accumulators) + *rowandcell_size = 0; + *dbcell_size = 0; + + + if(!m_SizesCalculated) + { + + // Check if there are no cells + if(!m_Cells.empty()) + { + // The first cell is inside a row that has to be counted + // row_counter = 1; + + do + { + cell_counter++; // There's at least one cell on each loop.. that's for sure! + + // Since the list of cells is sorted by rows, continuouslly equal cells (compared by row) + // conform one row... if the next one is different, increment the row counter + Cell_List_Itor_t this_cell = m_CurrentSizeCell; + Cell_List_Itor_t next_cell = ++ m_CurrentSizeCell; + + // To avoid dereferencing an empty iterator check if this is the only + // one cell in m_Cells list. + if( m_Cells.size()>1) + { + if( *(*this_cell) != *(*(next_cell)) ) + row_counter++; + } + else + { + // Break the loop if this was the only one cell in the list + // .. also set the only one row + cell_counter--; + m_CurrentSizeCell = (--m_Cells.end()); + break; + + } + + }while(row_counter < MAX_ROWBLOCK_SIZE && + m_CurrentSizeCell != (--m_Cells.end())); // Check also if the currentcell isn't the last one + + // If the cells run out before the row counter changes, the last row (and last cell) isn't counted + // in the previous control structre. + if(m_CurrentSizeCell == (--m_Cells.end())) + { + row_counter++; + cell_counter++; + } + + + if(num_rows != NULL) + *num_rows += row_counter; + // Get the size of the rows + *rowandcell_size += ROW_RECORD_SIZE*row_counter; + + // Get the size of the cells using the saved iterator pointing to the beginning of this block + for(unsigned32_t count_blockcells = 0; count_blockcells GetSize(); + beginning_cell++; + } + + // Now get the size of the DBCELL + *dbcell_size += RB_DBCELL_MINSIZE; + *dbcell_size += RB_DBCELL_CELLSIZEOFFSET*cell_counter; + + + // Check the size of the data int the DBCELL record (without the header) + // to take in count the overhead of the CONTINUE record (4bytes/CONTrec) + if((*dbcell_size-4) > MAX_RECORD_SIZE) + { + unsigned32_t cont_overhead = (*dbcell_size / MAX_RECORD_SIZE); + if(*dbcell_size % MAX_RECORD_SIZE) + cont_overhead++; + + *dbcell_size += (cont_overhead-1)*4; + + } + + + rowblocksize_t* rbsize = new rowblocksize_t; + + rbsize->rowandcell_size = *rowandcell_size; + rbsize->dbcell_size = *dbcell_size; + rbsize->rows_sofar = row_counter; + m_RBSizes.push_back(rbsize); + + // If it was the last block, reset the current-label pointer + if(m_CurrentSizeCell == (--m_Cells.end())) + { + m_CurrentSizeCell = m_Cells.begin(); + m_Current_RBSize = m_RBSizes.begin(); + m_SizesCalculated = true; + + return false; + } + + + } + + // If there are no cells in the sheet, return sizes = 0. + if(m_Cells.empty()) + return false; + + else + + return true; + + } + else + { + *rowandcell_size = (*m_Current_RBSize)->rowandcell_size; + *dbcell_size = (*m_Current_RBSize)->dbcell_size; + if(num_rows != NULL) + *num_rows += (*m_Current_RBSize)->rows_sofar; + + m_Current_RBSize++; + + // Resett the current RBSize + if(m_Current_RBSize == m_RBSizes.end()) + { + m_Current_RBSize = m_RBSizes.begin(); + return false; + } + } + return true; +} + + +/* +*********************************** +*********************************** +*/ + +void worksheet::GetFirstLastRows(unsigned32_t* first_row, unsigned32_t* last_row) +{ + + // First check that the m_Cells list is not empty, so we won't dereference + // empty anr iterator. + if(!m_Cells.empty()) + { + SortCells(); + + cell_t* pcell; + pcell = *(m_Cells.begin()); + *first_row = pcell->GetRow(); + + pcell = *(--m_Cells.end()); + *last_row = pcell->GetRow(); + + + } + else + { + // If there is no cells in the list the first/last rows + // are defaulted to zero. + *first_row = 0; + *last_row = 0; + } + +} + +/* +*********************************** +*********************************** +*/ + + +unsigned32_t worksheet::GetNumRowBlocks() +{ + + unsigned32_t numrb; + + // First check that the m_Cells list is not empty, so we won't dereference + // empty anr iterator. + + bool cont = false; + unsigned32_t num_rows = 0; + do + { + unsigned32_t dummy1, dummy2; + cont = GetRowBlockSizes(&dummy1, &dummy2, &num_rows); + }while(cont); +/* + Cell_List_t temp_cell_list = m_Cells; + temp_cell_list.sort(); + temp_cell_list.unique(); +*/ + + if(!m_Cells.empty()) + { + + numrb = num_rows/MAX_ROWBLOCK_SIZE; + if(num_rows%MAX_ROWBLOCK_SIZE) + numrb++; + } + else + { + // If the m_Cell list is empty, there are no rowblocks in the sheet. + numrb = 0; + } + + return numrb; +} + +/* +*********************************** +*********************************** +*/ + +void worksheet::merge(unsigned16_t first_row, unsigned16_t first_col, + unsigned16_t last_row, unsigned16_t last_col) +{ + range_t* newrange = new range_t; + + newrange->first_row = first_row; + newrange->last_row = last_row; + newrange->first_col = first_col; + newrange->last_col = last_col; + + m_MergedRanges.push_back(newrange); + + +} + +/* +*********************************** +*********************************** +*/ + +void worksheet::colwidth(unsigned16_t col, unsigned16_t width) +{ + colinfo_t* newci = new colinfo_t; + Colinfo_List_Itor_t existing_ci; + + newci->colfirst = col; + newci->collast = col; + newci->flags = 0x00; + newci->xformat = NULL; + newci->width = width*256; //sets column widths to 1/256 x width of "0" + + // m_Colinfos.push_back(newci); + existing_ci = m_Colinfos.find(newci); + + if(existing_ci != m_Colinfos.end()) + { + //Always overwrite + delete (*existing_ci); + m_Colinfos.erase(existing_ci); + m_Colinfos.insert(newci); + } + else + { + m_Colinfos.insert(newci); + } +} + + +/* +*********************************** +*********************************** +*/ + +void worksheet::rowheight(unsigned16_t row, unsigned16_t height) +{ + rowheight_t* newrh = new rowheight_t(row,height*20); + RowHeight_List_Itor_t existing_rh; + + //m_RowHeights.insert(newrh); + + existing_rh = m_RowHeights.find(newrh); + + if(existing_rh != m_RowHeights.end()) + { + //Always overwrite + delete (*existing_rh); + m_RowHeights.erase(existing_rh); + m_RowHeights.insert(newrh); + } + else + { + m_RowHeights.insert(newrh); + } + + + +} + + +range* worksheet::rangegroup(unsigned16_t row1, unsigned16_t col1, + unsigned16_t row2, unsigned16_t col2) +{ + + range* newrange = new range(row1, col1, row2, col2, this); + m_Ranges.push_back(newrange); + + return newrange; + +} + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: sheetrec.cpp,v $ + * Revision 1.3 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:04 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:51 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/sheetrec.h b/uppdev/XLS/sheetrec.h new file mode 100644 index 000000000..c4cca6ab7 --- /dev/null +++ b/uppdev/XLS/sheetrec.h @@ -0,0 +1,233 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/sheetrec.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifndef SHEETREC_H +#define SHEETREC_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace xlslib_core +{ + + /* +*********************************** +worksheet class declaration +*********************************** +*/ + + typedef enum + { + SHEET_INIT, + SHEET_BOF, + SHEET_INDEX, + SHEET_DIMENSION, + SHEET_ROWBLOCKS, + SHEET_MERGED, + SHEET_COLINFO, + SHEET_WINDOW2, + SHEET_EOF, + SHEET_FINISH + } SheetRecordDumpState_t; + + +#define BOF_SIZE ((unsigned8_t)12) +#define EOF_SIZE ((unsigned8_t)4) +#define WINDOW2_SIZE ((unsigned8_t)14) + + typedef struct + { + unsigned32_t rowandcell_size; + unsigned32_t dbcell_size; + unsigned32_t rows_sofar; + + } rowblocksize_t; + + typedef std::list RBSize_List_t; + typedef RBSize_List_t::iterator RBSize_List_Itor_t; + + typedef enum + { + RB_INIT, + RB_FIRST_ROW, + RB_ROWS, + RB_FIRSTCELL, + RB_CELLS, + RB_DBCELL, + RB_FINISH + + } DumpRowBlocksState_t; + + typedef std::list CellOffsets_List_t; + typedef CellOffsets_List_t::iterator CellOffsets_List_Itor_t; + + //class range; + class worksheet + + : public CBiffSection + + { + + private: + CGlobalRecords* m_pGlobalRecords; +#ifdef HAVE_ICONV + std::string iconv_code; +#endif + SheetRecordDumpState_t m_DumpState; + CUnit* m_pCurrentData; + // std::string m_Name; 10-1-08 not sure why here + + bool m_SizeCalculated; + size_t m_Size; + + Range_List_t m_MergedRanges; + + Colinfo_List_t m_Colinfos; + Colinfo_List_Itor_t m_Current_Colinfo; + + RowHeight_List_t m_RowHeights; + RowHeight_List_Itor_t m_Current_RowHeight; + + unsigned16_t minRow, minCol, maxRow, maxCol; + // Label related additions + + /* void AddLabel(unsigned16_t row, unsigned16_t col, + std::string& strlabel, unsigned16_t& xformat); + */ + + private: + Cell_List_t m_Cells; + Cell_List_Itor_t m_CurrentCell; // Init this one in the INIT state + Cell_List_Itor_t m_CurrentSizeCell; // Init this one in the INIT state + bool m_CellsSorted; + + RangeObj_List_t m_Ranges; + + RBSize_List_t m_RBSizes; + RBSize_List_Itor_t m_Current_RBSize; + bool m_SizesCalculated; + + DumpRowBlocksState_t m_DumpRBState; + unsigned8_t m_RowCounter; + unsigned32_t m_CellCounter; + unsigned32_t m_DBCellOffset; + CellOffsets_List_t m_CellOffsets; + + unsigned32_t m_CurrentRowBlock; + Cell_List_Itor_t m_Starting_RBCell; + + void GetFirstLastRows(unsigned32_t* first_row, unsigned32_t* last_row); + unsigned32_t GetNumRowBlocks(); + bool GetRowBlockSizes(unsigned32_t* rowandcell_size, + unsigned32_t* dbcell_size, + unsigned32_t* num_rows = NULL); + CUnit* RowBlocksDump(); + + void AddCell(cell_t* pcell); + + void SortCells(); + + public: + + worksheet(CGlobalRecords* pglobalrec); +#if HAVE_ICONV + worksheet(CGlobalRecords* pglobalrec, std::string& code); +#endif + ~worksheet(); + + // The offset defines the amount + // of data form the beginning of the BIFF records to the first + + CUnit* DumpData(unsigned32_t offset); + unsigned32_t GetSize(); + cell_t* FindCell(unsigned16_t row, unsigned16_t col); + + // Cell operations + void merge(unsigned16_t first_row, unsigned16_t first_col, + unsigned16_t last_row, unsigned16_t last_col); + void colwidth(unsigned16_t col, unsigned16_t width); + void rowheight(unsigned16_t row, unsigned16_t height); + // Ranges + range* rangegroup(unsigned16_t row1, unsigned16_t col1, + unsigned16_t row2, unsigned16_t col2); + + // Cells + cell_t* label(unsigned16_t row, unsigned16_t col, + std::string strlabel, xf_t* pxformat = NULL); + +#if VERSION_BIFF == VERSION_BIFF8 + cell_t* label(unsigned16_t row, unsigned16_t col, + std::ustring strlabel, xf_t* pxformat = NULL); +#endif + cell_t* blank(unsigned16_t row, unsigned16_t col, + xf_t* pxformat = NULL); + + cell_t* number(unsigned16_t row, unsigned16_t col, + double numval, format_number_t fmtval, + xf_t* pxformat = NULL); + }; + + typedef std::vector Sheets_Vector_t; + typedef Sheets_Vector_t::iterator Sheets_Vector_Itor_t; + +} + +#endif // SHEETREC_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: sheetrec.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:44 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + diff --git a/uppdev/XLS/stringtok.h b/uppdev/XLS/stringtok.h new file mode 100644 index 000000000..b94ec7217 --- /dev/null +++ b/uppdev/XLS/stringtok.h @@ -0,0 +1,148 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/stringtok.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * stringtok.h -- Breaks a string into tokens. This is an example for lib3. + * + * Template function looks like this: + * + * template + * void stringtok (Container &l, + * string const &s, + * char const * const ws = " \t\n"); + * + * A nondestructive version of strtok() that handles its own memory and can + * be broken up by any character(s). Does all the work at once rather than + * in an invocation loop like strtok() requires. + * + * Container is any type that supports push_back(a_string), although using + * list and deque are indicated due to their O(1) push_back. + * (I prefer deque<> because op[]/at() is available as well.) The first + * parameter references an existing Container. + * + * s is the string to be tokenized. From the parameter declaration, it can + * be seen that s is not affected. Since references-to-const may refer to + * temporaries, you could use stringtok(some_container, readline("")) when + * using the GNU readline library. + * + * The final parameter is an array of characters that serve as whitespace. + * Whitespace characters default to one or more of tab, space, and newline, + * in any combination. + * + * 'l' need not be empty on entry. On return, 'l' will have the token + * strings appended. + * + * + * [Example: + * list ls; + * stringtok (ls, " this \t is\t\n a test "); + * for (list::const_iterator i = ls.begin(); + * i != ls.end(); ++i) + * { + * cerr << ':' << (*i) << ":\n"; + * } + * + * would print + * :this: + * :is: + * :a: + * :test: + * -end example] + * + * pedwards@jaj.com May 1999 + */ + +#include +#include // for strchr + +#include +#include + +/***************************************************************** + * This is the only part of the implementation that I don't like. + * It can probably be improved upon by the reader... + */ +namespace { + inline bool + isws (char c, char const * const wstr) + { + return (strchr(wstr,c) != NULL); + } +} + +/***************************************************************** + * Simplistic and quite Standard, but a bit slow. This should be + * templatized on basic_string instead, or on a more generic StringT + * that just happens to support ::size_type, .substr(), and so on. + * I had hoped that "whitespace" would be a trait, but it isn't, so + * the user must supply it. Enh, this lets them break up strings on + * different things easier than traits would anyhow. + */ +template +void +stringtok (Container &l, std::string const &s, char const * const ws = " \t\n") +{ + const std::string::size_type S = s.size(); + std::string::size_type i = 0; + + while (i < S) { + // eat leading whitespace + while ((i < S) && (isws(s[i],ws))) ++i; + if (i == S) return; // nothing left but WS + + // find end of word + std::string::size_type j = i+1; + while ((j < S) && (!isws(s[j],ws))) ++j; + + // add word + std::string* substr = new std::string; + *substr = s.substr(i,j-i); + l.push_back(substr); + + // set up for next loop + i = j+1; + } +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: stringtok.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:32:05 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/summinfo.cpp b/uppdev/XLS/summinfo.cpp new file mode 100644 index 000000000..086a56a00 --- /dev/null +++ b/uppdev/XLS/summinfo.cpp @@ -0,0 +1,88 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/summinfo.cpp,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#include + +#include // Temporarilly used to add data for summary info + +using namespace std; +using namespace xlslib_core; + +/* +********************************************************************** +CSummaryInfo class implementation +********************************************************************** +*/ + + +CSummaryInfo::CSummaryInfo() +{ + XTRACE("WRITE_SUMMARY"); + + CUnit* ptraildata = new CUnit; + ptraildata->AddDataArray(CSummaryInfo::summ_info_data, sizeof(CSummaryInfo::summ_info_data)); + (*this) += ptraildata; +} + +CSummaryInfo::~CSummaryInfo() +{ + + +} + + +/* +*********************************** +*********************************** +*/ + +CUnit* CSummaryInfo::DumpData(void) +{ + XTRACE("\tCSummaryInfo::DumpData"); + return (CUnit*)this; + +} + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: summinfo.cpp,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:57 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/summinfo.h b/uppdev/XLS/summinfo.h new file mode 100644 index 000000000..29027650f --- /dev/null +++ b/uppdev/XLS/summinfo.h @@ -0,0 +1,82 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/summinfo.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + + +#ifndef SUMMARYINFO_H +#define SUMMARYINFO_H + +#include +#include +#include + + +namespace xlslib_core +{ + + /* +******************************** +CSummaryInfo class declaration +******************************** +*/ + + + class CSummaryInfo: public CDataStorage + { + private: + static const unsigned8_t summ_info_data[]; + + protected: + + public: + CSummaryInfo(); + ~CSummaryInfo(); + + CUnit* DumpData(); + + }; + +} +#endif //SUMMARYINFO_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: summinfo.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/systype.h b/uppdev/XLS/systype.h new file mode 100644 index 000000000..9ece447a6 --- /dev/null +++ b/uppdev/XLS/systype.h @@ -0,0 +1,282 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/systype.h,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef SYSTYPE_H +#define SYSTYPE_H + +#if defined(_MSC_VER) && defined(WIN32) +#pragma warning(disable: 4786) // Long debug information related to STL +#pragma warning(disable: 4290) // C++ Exception Specification ignored +#endif + +//# define PHPEXT_TSRMLS_C tsrm_ls +//# define PHPEXT_TSRMLS_D void ***tsrm_ls + +// Global includes +#include +#include +#include +#include +#include // DFH 10-2-08 +#include +#include +#include +#include + +#define INLINE inline + +//#define NULL ((void*)(0)) + +#define NO_ERRORS 0 +#define FILE_ERROR -1 +#define GENERAL_ERROR ((signed8_t)-100) + +#define PTYPE_DIRECTORY ((unsigned8_t)(0x01)) +#define PTYPE_FILE ((unsigned8_t)(0x02)) +#define PTYPE_ROOT ((unsigned8_t)(0x05)) + +#define PCOLOR_BLACK ((unsigned8_t)(0x01)) +#define PCOLOR_RED ((unsigned8_t)(0x00)) + +#define PLINK_EMPTY ((signed32_t)(-1)) +#define PBLOCK_END ((signed32_t)(-2)) + + +#if USE_ALLOCATOR==ALLOCATOR_STL +#define XLSLIB_DFLT_ALLOCATOR + +#elif USE_ALLOCATOR==ALLOCATOR_BTI +#include "bti_thread_alloc.h" +#define XLSLIB_DFLT_ALLOCATOR ,bti::thr_alloc + +#else +# error ERROR: Invalid allocator option +#endif + +#ifdef uint32_t // if we have this one we will have all the others too + +typedef unsigned char unsigned8_t; +typedef unsigned short int unsigned16_t; +typedef unsigned int unsigned32_t; + +typedef char signed8_t; +typedef short int signed16_t; +typedef int signed32_t; + +#else + +typedef uint8_t unsigned8_t; +typedef uint16_t unsigned16_t; +typedef uint32_t unsigned32_t; + +typedef int8_t signed8_t; +typedef int16_t signed16_t; +typedef int32_t signed32_t; + +#endif + +#if defined(_MSC_VER) && defined(WIN32) + +typedef wchar_t uchar_t; +#define ustring wstring +//typedef wstring ustring; + +#elif defined(__FRAMEWORK__) // For Mac-OSX + +#undef HAVE_ICONV + +#if ! defined(unichar) +typedef uint16_t unichar; +#endif + +typedef unichar uchar_t; +//typedef std::basic_string ustring; +#define ustring basic_string + + +#else + +typedef wchar_t uchar_t; +#define ustring wstring +typedef std::basic_string u16string; + +#endif + + +#if defined(_MSC_VER) && defined(WIN32) + +typedef __int64 unsigned64_t; + +#else // not windows + +#ifdef _UINT64_T + +typedef uint64_t unsigned64_t; + +#else + +typedef unsigned long long unsigned64_t; + +#endif + +#endif + +typedef std::list StringList_t; +typedef StringList_t::const_iterator StringListItor_t; + +// Macros +# define MASK_BYTE0 0x00000000000000ff +# define MASK_BYTE1 0x000000000000ff00 +# define MASK_BYTE2 0x0000000000ff0000 +# define MASK_BYTE3 0x00000000ff000000 + +#if defined(_MSC_VER) && defined(WIN32) + +# define MASK_BYTE4 0x000000ff00000000 +# define MASK_BYTE5 0x0000ff0000000000 +# define MASK_BYTE6 0x00ff000000000000 +# define MASK_BYTE7 0xff00000000000000 + +#else + +# define MASK_BYTE4 (unsigned64_t)0x000000ff00000000LL +# define MASK_BYTE5 (unsigned64_t)0x0000ff0000000000LL +# define MASK_BYTE6 (unsigned64_t)0x00ff000000000000LL +# define MASK_BYTE7 (unsigned64_t)0xff00000000000000LL + +#endif + +#define BYTE_0(num) (unsigned8_t) (num & MASK_BYTE0) +#define BYTE_1(num) (unsigned8_t)((num & MASK_BYTE1)>>0x08) +#define BYTE_2(num) (unsigned8_t)((num & MASK_BYTE2)>>0x10) +#define BYTE_3(num) (unsigned8_t)((num & MASK_BYTE3)>>0x18) + +#define BYTE_4(num) (unsigned8_t)((num & MASK_BYTE4)>>0x20) +#define BYTE_5(num) (unsigned8_t)((num & MASK_BYTE5)>>0x28) +#define BYTE_6(num) (unsigned8_t)((num & MASK_BYTE6)>>0x30) +#define BYTE_7(num) (unsigned8_t)((num & MASK_BYTE7)>>0x38) + + + +#define PROPERTY_DFLT_NOTUSED ((unsigned8_t)(0x00)) +#define PROPERTY_MAX_NAME_LENGTH ((unsigned8_t)(32)) + +#define PROPERTY_TYPE_DIR ((unsigned8_t)(0x01)) +#define PROPERTY_TYPE_FILE ((unsigned8_t)(0x02)) +#define PROPERTY_TYPE_ROOT ((unsigned8_t)(0x05)) + +#define PROPERTY_COLOR_NODE_RED ((unsigned8_t)(0x00)) +#define PROPERTY_COLOR_NODE_BLACK ((unsigned8_t)(0x01)) +#define PROPERTY_LINK_EMPTY ((signed32_t)(-1)) + +#define PPTPOS_NAME ((unsigned8_t)(0x00)) +#define PPTPOS_NAMELENGTH ((unsigned8_t)(0x40)) +#define PPTPOS_TYPE ((unsigned8_t)(0x42)) +#define PPTPOS_NODECOLOR ((unsigned8_t)(0x43)) +#define PPTPOS_PREVIOUS ((unsigned8_t)(0x44)) +#define PPTPOS_NEXT ((unsigned8_t)(0x48)) +#define PPTPOS_CHILD ((unsigned8_t)(0x4C)) +#define PPTPOS_UNUSED_EMPTY0 ((unsigned8_t)(0x50)) + + +#define PPTPOS_SECS1 ((unsigned32_t)(0x64)) +#define PPTPOS_SECS2 ((unsigned32_t)(0x68)) +#define PPTPOS_DAYS1 ((unsigned32_t)(0x6c)) +#define PPTPOS_DAYS2 ((unsigned32_t)(0x70)) + +#define PPTPOS_STARTBLOCK ((unsigned8_t)(0x74)) +#define PPTPOS_SIZE ((unsigned8_t)(0x78)) + + +#define PPT_DFLT_SECS1 ((signed32_t)(0)) +#define PPT_DFLT_SECS2 ((signed32_t)(0)) +#define PPT_DFLT_DAYS1 ((signed32_t)(0)) +#define PPT_DFLT_DAYS2 ((signed32_t)(0)) + + +// More macros + +/* +**************************************** +**************************************** +*/ +#define Delete_Pointer(pt) { \ + if(pt != NULL) \ + { \ + delete pt; \ + pt = NULL; \ + } \ +} + + +/* +**************************************** +**************************************** +*/ +#ifdef __DEBUG__ +#define XTRACE(str) { \ + cout<<"DEBUG: "<. + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/timespan.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:53 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef TIMESPAN_H +#define TIMESPAN_H + +#include +#include + +#include +#include + +class CCpuClockTimespan +{ + enum + { INVALID_VALUE = -1, }; + + public: + CCpuClockTimespan() + : m_clockStart( INVALID_VALUE), + m_nUsedClockTicks( INVALID_VALUE) + {} + ~CCpuClockTimespan() + {} + + void StartClock() + { + // the clock is already started !!! + // stop it first !!! + assert( m_clockStart == (clock_t)INVALID_VALUE); + m_nUsedClockTicks = (clock_t)INVALID_VALUE; + m_clockStart = clock(); + } + + void StopClock() + { + const clock_t clockStop = clock(); + + // start the clock first !!! + assert( m_clockStart != (clock_t)INVALID_VALUE); + m_nUsedClockTicks = clockStop - m_clockStart; + + // after this, we can start it again !!! + m_clockStart = INVALID_VALUE; + } + + unsigned long GetUsedMilliseconds() const + { + const int MILLISECONDS_PER_SECOND = 1000; + + // the clock was never started, + // or it's started, but it has not been stopped yet + assert( m_nUsedClockTicks != (clock_t)INVALID_VALUE); + + double nSeconds = ( ( double)m_nUsedClockTicks) / CLOCKS_PER_SEC; + + const unsigned long nMilliseconds = (unsigned long)(nSeconds * MILLISECONDS_PER_SECOND); + + return nMilliseconds; + } + + private: + + // when did we Start to measure + // clock time? + clock_t m_clockStart; + + // the used clock ticks, from Start to Stop + clock_t m_nUsedClockTicks; +}; + +#endif //TIMESPAN_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: timespan.h,v $ + * Revision 1.2 2008/10/25 18:39:53 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:32:05 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/tostr.h b/uppdev/XLS/tostr.h new file mode 100644 index 000000000..af52967bd --- /dev/null +++ b/uppdev/XLS/tostr.h @@ -0,0 +1,171 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/tostr.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 19:08:52 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#ifndef TOSTR_H +#define TOSTR_H + +#include +#include +#include + +#include + +// forward declaration +struct str_stream; + +// ... helper - allow explicit conversion to string +class as_string {}; +inline std::ostream & operator<< ( std::ostream & streamOut, const as_string &) +{ + return streamOut; +} + +namespace Private +{ + // what should we return when calling write_to_stream ? + template< class type> + struct return_from_write_to_stream + { + typedef const str_stream & return_type; + }; + + template<> + struct return_from_write_to_stream< as_string> + { + typedef std::string return_type; + }; + + // forward declaration + template< class type> + inline typename return_from_write_to_stream< type>::return_type + write_to_stream ( const str_stream & streamOut, const type & value); +} + + +// forward declaration +template< class type> +inline typename Private::return_from_write_to_stream< type>::return_type operator<< ( const str_stream & streamOut, const type & value); + +// str_stream - allow stream usage, and then conversion to string +struct str_stream +{ + // default construction + str_stream(){} + + // allow to_string like usage + template< class type> + str_stream( const type & value) + { + *this << value; + } + + std::stringstream & underlying_stream() const + { return m_streamOut; } + + operator std::string() const + { + return m_streamOut.str(); + } + + private: + mutable std::stringstream m_streamOut; + +#ifndef NDEBUG + public: + void recalculate_string() const + { m_string = m_streamOut.str(); } + private: + mutable std::string m_string; +#endif + +}; + +namespace Private +{ + template< class type> + inline typename return_from_write_to_stream< type>::return_type + write_to_stream ( const str_stream & streamOut, const type & value) + { + streamOut.underlying_stream() << value; +#ifndef NDEBUG + streamOut.recalculate_string(); +#endif + return streamOut; + } +} + +template< class type> +inline typename Private::return_from_write_to_stream< type>::return_type operator<< ( const str_stream & streamOut, const type & value) +{ + return Private::write_to_stream( streamOut, value) ; +} + + +// allow function IO manipulators +inline const str_stream & operator<< ( const str_stream & streamOut, std::ios_base & (*func)( std::ios_base&) ) +{ + func( streamOut.underlying_stream()); + return streamOut; +} + +inline const str_stream & operator<< ( const str_stream & streamOut, std::basic_ios< char> & (*func)( std::basic_ios< char> &) ) +{ + func( streamOut.underlying_stream()); + return streamOut; +} + +inline const str_stream & operator<< ( const str_stream & streamOut, std::ostream & (*func)( std::ostream &) ) +{ + func( streamOut.underlying_stream()); + return streamOut; +} + + + +#endif //TOSTR_H +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: tostr.h,v $ + * Revision 1.2 2008/10/25 19:08:52 dhoerl + * Updated header + * + * Revision 1.1.1.1 2004/08/27 16:31:54 darioglz + * Initial Import. + * + * Revision 1.2 2004/01/29 03:18:55 dgonzalez + * + Using the config.h file + * + * Revision 1.1 2003/12/02 18:15:06 dgonzalez + * + Initial version. Added to handle signatures of objects + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/unit.cpp b/uppdev/XLS/unit.cpp new file mode 100644 index 000000000..6b73777f7 --- /dev/null +++ b/uppdev/XLS/unit.cpp @@ -0,0 +1,662 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/unit.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include +#include + +using namespace std; +using namespace xlslib_core; + +/* +********************************************************************************* +********************************************************************************* +CUnit class implementation +********************************************************************************* +********************************************************************************* +*/ + +// Default constructor +CUnit::CUnit() : m_nSize(0), m_pData(0), m_nDataSize(0) + //, m_ShadowUnit(false) +{ + +} + +// Default destructor +CUnit::~CUnit ( ) +{ + if(m_pData /*&& !m_ShadowUnit*/) + { + delete[] m_pData; + } + +} +/************************************************ + ************************************************/ + +const unsigned8_t CUnit::DefaultInflateSize = 10; + +/************************************************ + ************************************************/ + +signed8_t CUnit::SetAt(unsigned8_t newval, unsigned32_t index) +{ + signed8_t errcode = NO_ERRORS; + + if(m_pData != NULL) + { + if (index < m_nDataSize) + m_pData[index] = newval; + else + errcode = ERR_INVALID_INDEX; + } else { + errcode = ERR_DATASTORAGE_EMPTY; + } + + return errcode; +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::AddValue16(unsigned16_t newval) +{ + signed8_t errcode = NO_ERRORS; + + if(AddValue8(BYTE_0(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_1(newval))) errcode = GENERAL_ERROR; + + return errcode; + +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::AddValue32(unsigned32_t newval) +{ + signed8_t errcode = NO_ERRORS; + + if(AddValue8(BYTE_0(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_1(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_2(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_3(newval))) errcode = GENERAL_ERROR; + + return errcode; + +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::AddValue64(unsigned64_t newval) +{ + signed8_t errcode = NO_ERRORS; + + if(AddValue8(BYTE_0(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_1(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_2(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_3(newval))) errcode = GENERAL_ERROR; + + if(AddValue8(BYTE_4(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_5(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_6(newval))) errcode = GENERAL_ERROR; + if(AddValue8(BYTE_7(newval))) errcode = GENERAL_ERROR; + + return errcode; + +} + + +/************************************************ + ************************************************/ + +signed8_t CUnit::SetValueAt(signed16_t newval, unsigned32_t index) +{ + signed8_t errcode = NO_ERRORS; + + if(SetAt(BYTE_0(newval), index )) errcode = GENERAL_ERROR; + if(SetAt(BYTE_1(newval), index+1)) errcode = GENERAL_ERROR; + + return errcode; +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::SetValueAt(signed32_t newval, unsigned32_t index) +{ + signed8_t errcode = NO_ERRORS; + + if(SetAt(BYTE_0(newval), index )) errcode = GENERAL_ERROR; + if(SetAt(BYTE_1(newval), index+1)) errcode = GENERAL_ERROR; + if(SetAt(BYTE_2(newval), index+2)) errcode = GENERAL_ERROR; + if(SetAt(BYTE_3(newval), index+3)) errcode = GENERAL_ERROR; + + return errcode; +} + + +/************************************************ + ************************************************/ + +signed8_t CUnit::GetValue16From(signed16_t* val, unsigned32_t index) +{ + signed8_t errcode = NO_ERRORS; + + *val = (signed16_t)(operator[](index) + + operator[](index+1)*0x0100); + + return errcode; +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::GetValue32From(signed32_t* val, unsigned32_t index) +{ + signed8_t errcode = NO_ERRORS; + + *val = (signed16_t)(operator[](index) *0x0000001 + + operator[](index+1)*0x0000100 + + operator[](index+2)*0x0010000 + + operator[](index+2)*0x1000000 ); + return errcode; +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::GetAt(signed8_t* data, unsigned32_t index) +{ + signed8_t errcode = NO_ERRORS; + + if(m_pData != NULL) + { + if (index < m_nDataSize) + { + *data = m_pData[index]; + } else { + errcode = ERR_INVALID_INDEX; + } + } else { + errcode = ERR_DATASTORAGE_EMPTY; + } + + return errcode; + +} +/************************************************ + ************************************************/ +/* + signed8_t CUnit::GetData(unsigned8_t** ppdata, unsigned32_t from, unsigned32_t to ) + { + signed8_t errcode = NO_ERRORS; + + // Simply make the external pointer point to the local storage data + *ppdata = m_pData; + + return errcode; + } +*/ +/************************************************ + ************************************************/ +signed8_t CUnit::AddDataArray (const unsigned8_t* newdata, size_t size) +{ + + signed8_t errcode = NO_ERRORS; + size_t spaceleft = m_nSize - m_nDataSize; + + if(spaceleft < size) // allocate more space if new tobeadded array won't fit + { + Inflate(size-spaceleft+1); + } + + if(newdata != NULL) + { + for(unsigned32_t i=0; i m_nDataSize) m_nDataSize = index+1; + else if(index==m_nDataSize) m_nDataSize++; + m_pData[index++] = newdata[i]; + */ + // The following code truncates the array if it exceeds DataSize + if(index==m_nDataSize) break; + + m_pData[index++] = newdata[i]; + } + } else { + //No data to add. Do nothing + } + + return errcode; +} + +/************************************************ + ************************************************/ + +signed8_t CUnit::AddValue8(unsigned8_t newdata) +{ + + if(m_nDataSize >= m_nSize) + { + Inflate(); + } + + m_pData[m_nDataSize++] = newdata; + + return NO_ERRORS; + +} + +#if VERSION_BIFF == VERSION_BIFF8 +#ifdef HAVE_ICONV +void CUnit::Conv32to16(string& iconv_code, ustring& str1, u16string& str2) +{ + size_t resultSize, inbytesleft, outbytesleft; + const wchar_t *inbuf; + iconv_t cd; + unsigned16_t *outbuf, *origOutbuf; + static unsigned16_t convFail[] = { 'i', 'c', 'o', 'n', 'v', ' ', 'f', 'a', 'i', 'l', 'e', 'd', '!' }; + + cd = iconv_open("UCS-2-INTERNAL", "wchar_t"); + // no need to test return code as we ALREADY did this when setting iconv_code in workbook + + inbytesleft = str1.size() * sizeof(uchar_t); + outbytesleft = inbytesleft * 4 * sizeof(unsigned16_t); // Unicode expansion 4 to 2 ??? + + inbuf = str1.c_str(); + origOutbuf = (unsigned16_t *)calloc(outbytesleft, 1); + outbuf = origOutbuf; + + resultSize = iconv(cd, (char **)&inbuf, &inbytesleft, (char **)&outbuf, &outbytesleft); + iconv_close(cd); + + if(resultSize == (size_t)-1) { + str2 = convFail; + } else { + str2.assign(origOutbuf, outbuf - origOutbuf); + } + return; +} +#endif + +// for cases where we save a single byte +signed8_t CUnit::AddUnicodeStrlen(unsigned8_t newdata) +{ + return AddValue8(newdata); +} +// for cases where we save a single byte +signed8_t CUnit::AddUnicodeStrlen(unsigned16_t newdata) +{ + return AddValue16(newdata); +} +signed8_t CUnit::AddUnicodeString (const unsigned8_t* newdata, unsigned16_t size) +{ + unsigned16_t strSize = 1 + size; + + signed8_t errcode = NO_ERRORS; + size_t spaceleft = m_nSize - m_nDataSize; + + if(spaceleft < strSize) // allocate more space if new tobeadded array won't fit + { + Inflate((size_t)(strSize-spaceleft+1)); + } + + m_pData[m_nDataSize++] = 0x00; // character compression + + if(newdata != NULL) + { + for(unsigned16_t i=0; i> 8) & 0xFF; + } + } else { + //No data to add. Do nothing + } + + return errcode; +} +#endif + +/************************************************ + ************************************************/ + +signed8_t CUnit::Inflate(size_t increase) +{ + signed8_t errcode = NO_ERRORS; + + if (increase == 0) + increase = CUnit::DefaultInflateSize; + + // Create the new storage with increased size + // and initialize it to 0. + unsigned8_t* temp_storage = new unsigned8_t[m_nSize + increase]; + + if(temp_storage != NULL) + { + + memset(temp_storage, 0, (m_nSize+increase)*(sizeof(unsigned8_t))); + // Copy data to the new storage + memcpy(temp_storage, m_pData, m_nSize*sizeof(unsigned8_t)); + + // Update the size + m_nSize += increase; + + if (m_pData != NULL) + delete []m_pData; + + m_pData = temp_storage; + + errcode = ERR_UNNABLE_TOALLOCATE_MEMORY; + } else { + // No errors... errcode already clean + } + + return errcode; +} + +/************************************************ + ************************************************/ + +unsigned8_t& CUnit::operator[] ( const unsigned32_t index ) +{ + if(index >= m_nDataSize) + return m_pData[m_nDataSize]; + return m_pData[index]; + +} +/************************************************ + ************************************************/ + +CUnit& CUnit::operator= (CUnit& newvalue ) +{ + if(&newvalue != this) + Init(newvalue.GetBuffer(), newvalue.GetSize(), newvalue.GetDataSize()); + + return *this; + +} + +/************************************************ + ************************************************/ + +CUnit& CUnit::operator+= ( CUnit& from ) +{ + + if(&from != this) + Append(from); + else + { + CUnit shadow; + shadow = from; + Append(shadow); + } + return *this; +} + +/************************************************ + ************************************************/ + +CUnit& CUnit::operator+= ( unsigned8_t from ) +{ + + AddValue8(from); + + return *this; +} + + +/************************************************ + ************************************************/ + +signed8_t CUnit::Init (unsigned8_t* data, const size_t size, const unsigned32_t datasz) +{ + + m_nSize = size; + m_nDataSize = datasz; + + m_pData = new unsigned8_t[m_nSize]; + + if(data) + { + memset(m_pData, 0, m_nSize*sizeof(unsigned8_t)); + // Copy data to the new storage + memcpy(m_pData, data, m_nSize*sizeof(unsigned8_t)); + } + + return NO_ERRORS; +} + + +/************************************************ + ************************************************/ + +signed8_t CUnit::Append (CUnit& newunit) +{ + + if(AddDataArray(newunit.GetBuffer(), newunit.GetDataSize()) == NO_ERRORS) + return NO_ERRORS; + else + return GENERAL_ERROR; +} + +/************************************************ + ************************************************/ +signed8_t CUnit::InitFill (unsigned8_t data, unsigned32_t size) +{ + if(m_pData) + delete[] m_pData; + + m_pData = new unsigned8_t[size]; + + if(m_pData) + { + memset(m_pData, data, size*sizeof(unsigned8_t)); + m_nSize = m_nDataSize = size; + + return NO_ERRORS; + } else { + return GENERAL_ERROR; + } + +} + +/************************************************ + ************************************************/ + +size_t CUnit::GetSize (void) +{ + return m_nSize; +} + +/************************************************ + ************************************************/ + +unsigned32_t CUnit::GetDataSize (void) +{ + return m_nDataSize; +} + +/************************************************ + ************************************************/ + +unsigned8_t* CUnit::GetBuffer (void) +{ + return m_pData; +} + + +/************************************************ + ************************************************/ +/* + void CUnit::SetShadow(bool shadowval) + { + m_ShadowUnit = shadowval; + + + } +*/ + +/************************************************ + ************************************************/ +/* + void CUnit::CopyShadowUnit(unsigned8_t* data, unsigned32_t size) + { + m_Size = m_DataSize = size; + m_pData = data; + + SetShadow(true); + + + + } +*/ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: unit.cpp,v $ + * Revision 1.3 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:21 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:53 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/unit.h b/uppdev/XLS/unit.h new file mode 100644 index 000000000..7a67b2d52 --- /dev/null +++ b/uppdev/XLS/unit.h @@ -0,0 +1,140 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/unit.h,v $ + * $Revision: 1.2 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef UNIT_H +#define UNIT_H + +#include +#include + +namespace xlslib_core +{ + + +#define UNIT_MAX_SIZE (0xFFFF) + + // Error codes +#define ERR_DATASTORAGE_EMPTY (-2) +#define ERR_INVALID_INDEX (-3) +#define ERR_UNNABLE_TOALLOCATE_MEMORY (-3) + + //Block definitions +#define BIG_BLOCK_SIZE (0x200) +#define SMALL_BLOCK_SIZE (0x040) +#define PROP_BLOCK_SIZE (0x080) + + class CUnit { + // Attributes + protected: + size_t m_nSize; // Size of data stored + unsigned8_t* m_pData; // Data storage + unsigned32_t m_nDataSize; // Next empty space + // bool m_ShadowUnit; + + // Static attributes + static const unsigned8_t DefaultInflateSize; + + // Operations + public: + CUnit(); + virtual ~CUnit(); + + virtual unsigned8_t& operator[](const unsigned32_t index); + virtual CUnit& operator=(CUnit& newvalue); + virtual CUnit& operator+=(CUnit& from); + virtual CUnit& operator+= ( unsigned8_t from ); + + virtual size_t GetSize (void); + virtual unsigned32_t GetDataSize (void); + unsigned8_t* GetBuffer (void); + signed8_t Init (unsigned8_t* data, + const size_t size, + const unsigned32_t datasz); + + signed8_t AddDataArray (const unsigned8_t* newdata, size_t size); + signed8_t AddFixedDataArray (const unsigned8_t value, size_t size); + +#if VERSION_BIFF == VERSION_BIFF8 +#ifdef HAVE_ICONV + void Conv32to16(std::string& iconv_code, std::ustring& str1, u16string& str2); +#endif + // DFH - to convert ascii string to unicode strings for BIFF8 + signed8_t AddUnicodeStrlen(unsigned8_t newdata); + signed8_t AddUnicodeStrlen(unsigned16_t newdata); + signed8_t AddUnicodeString (const unsigned8_t* newdata, unsigned16_t size); + signed8_t AddUnicodeString (const unsigned16_t* newdata, unsigned16_t size); +#endif + /* + void SetShadow(bool shadowval); + void CopyShadowUnit(unsigned8_t* data, unsigned32_t size); + */ + protected: + + signed8_t Append (CUnit& newunit); + signed8_t SetAt(unsigned8_t newval, unsigned32_t index);// Modify specific position + + signed8_t AddValue16(unsigned16_t newval); + signed8_t AddValue32(unsigned32_t newval); + signed8_t AddValue64(unsigned64_t newval); + + signed8_t SetValueAt(signed16_t newval, unsigned32_t index); + signed8_t SetValueAt(signed32_t newval, unsigned32_t index); + + signed8_t GetValue16From(signed16_t* val, unsigned32_t index); + signed8_t GetValue32From(signed32_t* val, unsigned32_t index); + + signed8_t SetArrayAt (const unsigned8_t* newdata, size_t size, unsigned32_t index); + signed8_t GetAt(signed8_t* data, unsigned32_t index);// Get specific data from storage + // signed8_t GetData(unsigned8_t** data, unsigned32_t from, unsigned32_t to ); + + signed8_t RemoveTrailData (unsigned32_t remove_size); + signed8_t AddValue8(unsigned8_t newdata); + signed8_t InitFill (unsigned8_t data, unsigned32_t size); + signed8_t Inflate(size_t increase = 0); + + }; + +} +#endif // UNIT_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: unit.h,v $ + * Revision 1.2 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.1.1.1 2004/08/27 16:31:46 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + diff --git a/uppdev/XLS/workbook.cpp b/uppdev/XLS/workbook.cpp new file mode 100644 index 000000000..dfa41fbb0 --- /dev/null +++ b/uppdev/XLS/workbook.cpp @@ -0,0 +1,560 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2004 Yeico S. A. de C. V. + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/workbook.cpp,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#include + +#ifdef HAVE_ICONV +#include +#endif + +using namespace std; +using namespace xlslib_core; + +#define CHANGE_DUMPSTATE(state) { \ + m_PreviousDumpState = m_DumpState; \ + m_DumpState = state; \ +} + +/* +********************************************************************** +workbook class implementation +********************************************************************** +*/ + +workbook::workbook() + : m_DumpState(WB_INIT), + m_PreviousDumpState(WB_FINISH), + m_pCurrentData(NULL), + m_pContinueRecord(NULL), + dump_not_started(true), + globalrec_size(0), + current_sheet(0), + offset(0) +{ +#ifdef XLS_PHP + write_fptr = NULL; + m_Disposition = STK_ATTACHMENT; +#endif +#ifdef HAVE_ICONV + iconv_code = "wchar_t"; +#endif +} + +#ifdef XLS_PHP +workbook::workbook(write_fptr_t w_fptr) + : m_DumpState(WB_INIT), + m_PreviousDumpState(WB_FINISH), + m_pCurrentData(NULL), + m_pContinueRecord(NULL), + dump_not_started(true), + globalrec_size(0), + current_sheet(0), + offset(0) +{ + write_fptr = w_fptr; + m_Disposition = STK_ATTACHMENT; +} +#endif + +workbook::~workbook() +{ + if(!m_Sheets.empty()) + { + for(unsigned32_t i = 0; iSetName(name); + + return(m_GlobalRecords.AddFont(newfont)); +} + +/* +*********************************** +*********************************** +*/ +format_t* workbook::format(string formatstr) +{ + format_t* newformat = new format_t(0x0000, formatstr); + + return(m_GlobalRecords.AddFormat(newformat)); +} + +xf_t* workbook::xformat(void) +{ + xf_t* newxf = new xf_t; + newxf->MarkUsed(); + + return(m_GlobalRecords.AddXFormat(newxf)); +} + +xf_t* workbook::xformat(font_t* font) +{ + xf_t* newxf = new xf_t; + newxf->MarkUsed(); + newxf->SetFont(font); + + return(m_GlobalRecords.AddXFormat(newxf)); +} + +/* +*********************************** +*********************************** +*/ +#define SETWORKBOOK5() \ + CDataStorage biffdata; \ + CUnit* precorddata; \ + bool keep = true; \ + do { \ + precorddata = DumpData(); \ + \ + if(precorddata != NULL) \ + biffdata += precorddata; \ + else \ + keep = false; \ + }while(keep); \ + \ + AddFile("/Book",&biffdata); \ + string name; \ + name = (char)0x05; \ + name += "SummaryInformation"; \ + AddFile(name, &m_SummaryInfo); \ + name = (char)0x05; \ + name += "DocumentSummaryInformation"; \ + AddFile(name, &m_DocSummaryInfo); + +#define SETWORKBOOK8() \ + CDataStorage biffdata; \ + CUnit* precorddata; \ + bool keep = true; \ + do { \ + precorddata = DumpData(); \ + \ + if(precorddata != NULL) \ + biffdata += precorddata; \ + else \ + keep = false; \ + } while(keep); \ + \ + AddFile("/Workbook",&biffdata); \ + string name; \ + name = (char)0x05; \ + name += "SummaryInformation"; \ + AddFile(name, &m_SummaryInfo); \ + name = (char)0x05; \ + name += "DocumentSummaryInformation"; \ + AddFile(name, &m_DocSummaryInfo); + +#ifdef XLS_PHP +/****************************** + * This function has to be called before any output to the php-string + * (this includes any non-php-script text in the source file or + * zend_printf call) because it makes use of headers() php-function, + * which has to be called before any of those kind of output. + * If this restraint isn't followed, the html-header won't be modified + * and the binary data will be displayed in the browser (in the best of + * cases). + * This can also be avoided using buffering in the PHP environment + * See chapter LXXVIII. "Output Control Functions" of the PHP manual. + ******************************/ +void workbook::Stroke(string filename) +{ + SetStroke(); + +#if VERSION_BIFF == VERSION_BIFF5 + SETWORKBOOK5(); +#else // VERSION_BIFF8 + SETWORKBOOK8(); +#endif + DumpOleFile(); +} + +void workbook::Disposition(Stroke_Disposition_t disp) +{ + m_Disposition = disp; +} +#endif + + +int workbook::Dump(string filename) +{ + int errors; + + if(m_Sheets.empty()) { + return GENERAL_ERROR; + } + +#ifdef XLS_PHP + UnSetStroke(); +#endif + + errors = Open(filename); + if(errors == NO_ERRORS) { +#if VERSION_BIFF == VERSION_BIFF5 + SETWORKBOOK5(); +#else // VERSION_BIFF8 + SETWORKBOOK8(); +#endif + errors = DumpOleFile(); + Close(); + } + return errors; +} + +/* +*********************************** +*********************************** +*/ + +CUnit* workbook::DumpData(void) +{ + + bool repeat = false; + XTRACE("\nworkbook::DumpData"); + + do + { + switch(m_DumpState) + { + case WB_INIT: + + dump_not_started = true; + globalrec_size = 0; + current_sheet = 0; + offset = 0; + + CHANGE_DUMPSTATE(WB_GLOBALRECORDS); + + repeat = true; + break; + + case WB_GLOBALRECORDS: + + XTRACE("\tGLOBALRECORDS"); + + repeat = false; + + if(dump_not_started) + { // the following code is executed only if this is the first pas to the first dump-state + // Basically, streampositions of BoundingSheet records are initialized. + dump_not_started = false; + + globalrec_size = m_GlobalRecords.GetSize(); + offset = globalrec_size; + + unsigned32_t offset_from_globalrecs = 0; + + if(!m_Sheets.empty()) + { + + Boundsheet_List_Itor_t bs = m_GlobalRecords.GetFirstBoundSheet(); + + for(unsigned16_t i = 0; i < m_Sheets.size(); i++) + { + + (*bs) -> streampos = globalrec_size + offset_from_globalrecs; + m_GlobalRecords.GetBoundingSheets(bs); + offset_from_globalrecs += m_Sheets[i]->GetSize(); + } + } + else + { + //Nothing else to do. + } + + + //TODO: Add other EOF/BOF blocks here + } + + m_pCurrentData = m_GlobalRecords.DumpData(); + if(m_pCurrentData == NULL) + { + if(!m_Sheets.empty()) + { + // get in advance the first record of the first sheet + //m_pCurrentData = m_Sheets[0].DumpData(globalrec_size); + repeat = true; + CHANGE_DUMPSTATE(WB_SHEETS); + } + else + { + // Nothing else to do. Branch to the FINISH state + m_pCurrentData = NULL; + + CHANGE_DUMPSTATE(WB_FINISH); + } + } + else + { + // Do nothing. Continue in this state. + } + + break; + + case WB_SHEETS: + { + + XTRACE("\tSHEETS"); + + repeat = false; + // If I got here, there's at least one sheet which has already + // sent the first record block of data. + //m_GlobalRecords.GetSize(); + + m_pCurrentData = m_Sheets[current_sheet]->DumpData(offset); + + if(m_pCurrentData == NULL) + { + if((unsigned16_t)(current_sheet+1) < m_Sheets.size()) + { + // Update the offset for the next sheet + offset += m_Sheets[current_sheet]->GetSize(); + current_sheet++; + + // ... and get the first record of the next sheet. + // m_pCurrentData = m_Sheets[current_sheet].DumpData(offset); + repeat = true; + } + else + { + // I'm done with all the sheets + // Nothing else to do. Branch to the FINISH state + CHANGE_DUMPSTATE(WB_FINISH); + + repeat = true; + } + } + + + break; + } + case WB_FINISH: + XTRACE("\tFINISH"); + + repeat = false; + m_pCurrentData = NULL; + + CHANGE_DUMPSTATE(WB_INIT); + + break; + + case WB_CONTINUE_REC: + XTRACE("\tCONTINUE-REC"); + + repeat = false; + + if(m_ContinueIndex == 0) + { + //Create a new data unit containing the max data size + m_pContinueRecord = (CUnit*)(new CRecord()); + + // The real size of the record is the size of the buffer minus the + // size of the header record + + ((CUnit*)(m_pContinueRecord))->AddDataArray(((CRecord*)m_pCurrentData)->GetRecordDataBuffer(),MAX_RECORD_SIZE); + ((CRecord*)(m_pContinueRecord))->SetRecordType(((CRecord*)m_pCurrentData)->GetRecordType()); + ((CRecord*)(m_pContinueRecord))->SetRecordLength(MAX_RECORD_SIZE); + +// m_pContinueRecord->SetValueAt(MAX_RECORD_SIZE-4,2); + m_ContinueIndex++; + + return m_pContinueRecord; + } + else + { + //Delete_Pointer(m_pContinueRecord); + + // Get a pointer to the next chunk of data + unsigned8_t* pdata = (((CRecord*)m_pCurrentData)->GetRecordDataBuffer()) + m_ContinueIndex*MAX_RECORD_SIZE; + + // Get the size of the chunk of data (that is the MAX_REC_SIZE except by the last one) + unsigned32_t csize = 0; + if(( ((CRecord*)m_pCurrentData)->GetRecordDataSize()/MAX_RECORD_SIZE) > (m_ContinueIndex)) + { + csize = MAX_RECORD_SIZE; + m_ContinueIndex++; + + m_pContinueRecord =(CUnit*) ( new CContinue(pdata, csize)); + + return m_pContinueRecord; + } + else + { + unsigned32_t data_size = ((CRecord*)m_pCurrentData)->GetRecordDataSize(); + + csize = (data_size - (m_ContinueIndex) * MAX_RECORD_SIZE); + + // Restore the previous state (*Don't use the macro*) + m_DumpState = m_PreviousDumpState; + m_PreviousDumpState = WB_CONTINUE_REC; + + m_ContinueIndex = 0; + + if(csize) + { + m_pContinueRecord = (CUnit*) new CContinue(pdata, csize); + Delete_Pointer(m_pCurrentData); + return m_pContinueRecord; + } + else + { + Delete_Pointer(m_pCurrentData); + repeat = true; + } + } + } + + break; + + default: + XTRACE("\tDEFAULT"); + break; + } + + if(m_pCurrentData != NULL) + if(((CRecord*)m_pCurrentData)->GetRecordDataSize() >= MAX_RECORD_SIZE && m_DumpState != WB_CONTINUE_REC) + { + + // Save the current dump satate and change to the CONTINUE Record state + CHANGE_DUMPSTATE(WB_CONTINUE_REC); + + m_ContinueIndex = 0; + + repeat = true; + } + } while(repeat); + + return m_pCurrentData; +} + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: workbook.cpp,v $ + * Revision 1.3 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:21 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:49 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ diff --git a/uppdev/XLS/workbook.h b/uppdev/XLS/workbook.h new file mode 100644 index 000000000..510ceb355 --- /dev/null +++ b/uppdev/XLS/workbook.h @@ -0,0 +1,148 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * $Source: /cvsroot/xlslib/xlslib/src/xlslib/workbook.h,v $ + * $Revision: 1.3 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:39:54 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +#ifndef WORKBOOK_H +#define WORKBOOK_H + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace xlslib_core +{ + + typedef enum + { + WB_INIT, + WB_GLOBALRECORDS, + WB_SHEETS, + WB_CONTINUE_REC, + WB_FINISH + } WorkbookDumpState_t; + + +#ifdef XLS_PHP + typedef enum + { + STK_INLINE=0, + STK_ATTACHMENT + } Stroke_Disposition_t; +#endif + class workbook + :public COleDoc + { + + private: + CSummaryInfo m_SummaryInfo; + CDocSummaryInfo m_DocSummaryInfo; + + CGlobalRecords m_GlobalRecords; + Sheets_Vector_t m_Sheets; + WorkbookDumpState_t m_DumpState; + WorkbookDumpState_t m_PreviousDumpState; + + CUnit* m_pCurrentData; + + // Continue record variables: + CUnit* m_pContinueRecord; + unsigned16_t m_ContinueIndex; + +#ifdef HAVE_ICONV + std::string iconv_code; +#endif + protected: + + public: + workbook(); +#ifdef XLS_PHP + workbook(write_fptr_t w_fptr); +#endif + ~workbook(); + + worksheet* sheet(std::string sheetname); +#if VERSION_BIFF == VERSION_BIFF8 + worksheet* sheet(std::ustring sheetname); +#endif + worksheet* GetSheet(unsigned16_t sheetnum); + + font_t* font(std::string name); + format_t* format(std::string formatstr); + + xf_t* xformat(void); + xf_t* xformat(font_t* font); + +#ifdef HAVE_ICONV + int iconvInType(const char *inType); +#endif + + CUnit* DumpData(void); // oledoc use + + int Dump(std::string filename); + +#ifdef XLS_PHP + void Disposition(Stroke_Disposition_t disp); + void Stroke(std::string filename); + Stroke_Disposition_t m_Disposition; +#endif + + private: + bool dump_not_started; + unsigned32_t globalrec_size; + unsigned16_t current_sheet; + unsigned32_t offset; + }; + +} +#endif //WORKBOOK_H + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * $Log: workbook.h,v $ + * Revision 1.3 2008/10/25 18:39:54 dhoerl + * 2008 + * + * Revision 1.2 2004/09/01 00:47:21 darioglz + * + Modified to gain independence of target + * + * Revision 1.1.1.1 2004/08/27 16:31:44 darioglz + * Initial Import. + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + diff --git a/uppdev/XLS/xlslib.h b/uppdev/XLS/xlslib.h new file mode 100644 index 000000000..95c112059 --- /dev/null +++ b/uppdev/XLS/xlslib.h @@ -0,0 +1,392 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * This file is part of xlslib -- A multiplatform, C/C++ library + * for dynamic generation of Excel(TM) files. + * + * xlslib is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * xlslib is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with xlslib. If not, see . + * + * Copyright 2008 David Hoerl + * + * $Source: /cvsroot/xlslib/xlslib/src/common/xlslib.h,v $ + * $Revision: 1.1 $ + * $Author: dhoerl $ + * $Date: 2008/10/25 18:44:32 $ + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * + * File description: + * + * all include file for users + * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + + +#ifdef __cplusplus + +#include + +#define EXTERN_TYPE extern "C" + +using namespace xlslib_core; + +#else // "C" + +#define EXTERN_TYPE extern + + +typedef uintptr_t write_fptr_t; + +typedef unsigned char unsigned8_t; +typedef unsigned short int unsigned16_t; +typedef unsigned uint32_t unsigned32_t; + +#if defined(_MSC_VER) && defined(WIN32) +typedef __int64 unsigned64_t; +#else +//typedef long long unsigned int unsigned64_t; +typedef uint64_t unsigned64_t; +#endif +typedef char signed8_t; +typedef short int signed16_t; +typedef int32_t signed32_t; + +typedef enum +{ + FMT_GENERAL = 0, + FMT_NUMBER1, + FMT_NUMBER2, + FMT_NUMBER3, + FMT_NUMBER4, + FMT_CURRENCY1, + FMT_CURRENCY2, + FMT_CURRENCY3, + FMT_CURRENCY4, + FMT_PERCENT1, + FMT_PERCENT2, + FMT_SCIENTIFIC1, + FMT_FRACTION1, + FMT_FRACTION2, + FMT_DATE1, + FMT_DATE2, + FMT_DATE3, + FMT_DATE4, + FMT_HOUR1, + FMT_HOUR2, + FMT_HOUR3, + FMT_HOUR4, + FMT_HOURDATE, + FMT_NUMBER5, + FMT_NUMBER6, + FMT_NUMBER7, + FMT_NUMBER8, + FMT_ACCOUNTING1, + FMT_ACCOUNTING2, + FMT_ACCOUNTING3, + FMT_ACCOUNTING4, + FMT_HOUR5, + FMT_HOUR6, + FMT_HOUR7, + FMT_SCIENTIFIC2, + FMT_TEXT +} format_number_t; + +typedef enum +{ + HALIGN_GENERAL = 0, + HALIGN_LEFT, + HALIGN_CENTER, + HALIGN_RIGHT, + HALIGN_FILL, + HALIGN_JUSTIFY, + HALIGN_CENTERACCROSS +} halign_option_t; + +typedef enum +{ + VALIGN_TOP = 0, + VALIGN_CENTER, + VALIGN_BOTTOM, + VALIGN_JUSTIFY +} valign_option_t; + +typedef enum +{ + ORI_NONE = 0, + ORI_TOPBOTTOMTXT, + ORI_90NOCLOCKTXT, + ORI_90CLOCKTXT +} txtori_option_t; + +typedef enum +{ + COLOR_BLACK, + COLOR_DARK_RED, + COLOR_RED, + COLOR_FUCSIA, + COLOR_COMBINED01, + COLOR_COMBINED02, + COLOR_COMBINED03, + COLOR_COMBINED04, + COLOR_COMBINED05, + COLOR_COMBINED06, + COLOR_OLIVE, + COLOR_DARK_YELLOW, + COLOR_COMBINED07, + COLOR_YELLOW, + COLOR_LIGHT_YELLOW, + COLOR_DARK_GREEN, + COLOR_GREEN, + COLOR_COMBINED08, + COLOR_LIVING_GREEN, + COLOR_LIGHT_GREEN, + COLOR_COMBINED09, + COLOR_BLUE_GREEN, + COLOR_AQUAMARINA, + COLOR_TURQOISE, + COLOR_COMBINED10, + COLOR_DARK_BLUE, + COLOR_BLUE, + COLOR_LIGHT_BLUE, + COLOR_SKY_BLUE, + COLOR_COMBINED11, + COLOR_INDIGO, + COLOR_BLUE_GRAY, + COLOR_VIOLET, + COLOR_PLUM, + COLOR_LAVANDER, + COLOR_COMBINED12, + COLOR_GRAY50, + COLOR_GRAY40, + COLOR_GRAY25, + COLOR_WHITE +} color_name_t; + +typedef enum +{ + FILL_NONE = 0, + FILL_SOLID, + FILL_ATEN75, + FILL_ATEN50, + FILL_ATEN25, + FILL_ATEN12, + FILL_ATEN06, + FILL_HORIZ_LIN, + FILL_VERTICAL_LIN, + FILL_DIAG, + FILL_INV_DIAG, + FILL_INTER_DIAG, + FILL_DIAG_THICK_INTER, + FILL_HORIZ_LINES_THIN, + FILL_VERTICAL_LINES_THIN, + FILL_DIAG_THIN, + FILL_INV_DIAG_THIN, + FILL_HORIZ_INT_THIN, + FILL_HORIZ_INTER_THICK +} fill_option_t; + +typedef enum +{ + BORDER_NONE = 0, + BORDER_THIN, + BORDER_MEDIUM, + BORDER_DASHED, + BORDER_DOTTED, + BORDER_THICK, + BORDER_DOUBLE, + BORDER_HAIR +} border_style_t; + +typedef enum +{ + BORDER_BOTTOM = 0, + BORDER_TOP, + BORDER_LEFT, + BORDER_RIGHT +} border_side_t; + +typedef enum +{ + BOLDNESS_BOLD = 0, + BOLDNESS_HALF, + BOLDNESS_NORMAL, + BOLDNESS_DOUBLE +} boldness_option_t; + +typedef enum +{ + SCRIPT_NONE = 0, + SCRIPT_SUPER, + SCRIPT_SUB + +} script_option_t; + +typedef enum +{ + + UNDERLINE_NONE = 0, + UNDERLINE_SINGLE, + UNDERLINE_DOUBLE, + UNDERLINE_SINGLEACC, + UNDERLINE_DOUBLEACC + +} underline_option_t; + +typedef enum +{ + BOLDNESS_BOLD = 0, + BOLDNESS_HALF, + BOLDNESS_NORMAL, + BOLDNESS_DOUBLE +} boldness_option_t; +typedef enum +{ + SCRIPT_NONE = 0, + SCRIPT_SUPER, + SCRIPT_SUB +} script_option_t; +typedef enum +{ + UNDERLINE_NONE = 0, + UNDERLINE_SINGLE, + UNDERLINE_DOUBLE, + UNDERLINE_SINGLEACC, + UNDERLINE_DOUBLEACC +} underline_option_t; + +typedef struct _workbook workbook; +typedef struct _worksheet worksheet; +typedef struct _font_t font_t; +typedef struct _format_t format_t; +typedef struct _cell_t cell_t; +typedef struct _xf_t xf_t; +typedef struct _range range; + +#ifndef bool +typedef int bool; +#endif + +#endif + +// Workbook +EXTERN_TYPE workbook *newWorkbook(void); +#ifdef XLS_PHP +EXTERN_TYPE workbook *newWorkbook_w_fptr(write_fptr_t w_fptr); +#endif +EXTERN_TYPE void deleteWorkbook(workbook *w); +EXTERN_TYPE worksheet *callWorkbookSheet(workbook *w, char *sheetname); +#if VERSION_BIFF == VERSION_BIFF8 +EXTERN_TYPE worksheet *callWorkbookSheetW(workbook *w, uchar_t *sheetname); +#endif +EXTERN_TYPE worksheet *callWorkbookGetSheet(workbook *w, unsigned16_t sheetnum); +EXTERN_TYPE font_t *callWorkbookFont(workbook *w, char *name); +EXTERN_TYPE xf_t *callWorkbookxFormat(workbook *w); +EXTERN_TYPE xf_t *callWorkbookxFormatFont(workbook *w, font_t *font); +EXTERN_TYPE int callWorkbookDump(workbook *w, char *filename); +#ifdef XLS_PHP +EXTERN_TYPE void callWorkbookDisposition(workbook *w, Stroke_Disposition_t disp); +EXTERN_TYPE void callWorkbookStroke(workbook *w, char *filename); +#endif +// Worksheet +EXTERN_TYPE cell_t *callWorksheetFindCell(worksheet *w, unsigned16_t row, unsigned16_t col); +EXTERN_TYPE void callWorksheetMerge(worksheet *w, unsigned16_t first_row, unsigned16_t first_col, unsigned16_t last_row, unsigned16_t last_col); +EXTERN_TYPE void callWorksheetColwidth(worksheet *w, unsigned16_t col, unsigned16_t width); +EXTERN_TYPE void callWorksheetRowheight(worksheet *w, unsigned16_t row, unsigned16_t height); +EXTERN_TYPE range *callWorksheetRangegroup(worksheet *w, unsigned16_t row1, unsigned16_t col1, unsigned16_t row2, unsigned16_t col2); +EXTERN_TYPE cell_t *callWorksheetLabel(worksheet *w, unsigned16_t row, unsigned16_t col, char *strlabel, xf_t *pxformat); +#if VERSION_BIFF == VERSION_BIFF8 +EXTERN_TYPE cell_t *callWorksheetLabelW(worksheet *w, unsigned16_t row, unsigned16_t col, uchar_t *strlabel, xf_t *pxformat); +#endif +EXTERN_TYPE cell_t *callWorksheetBlank(worksheet *w, unsigned16_t row, unsigned16_t col, xf_t *pxformat); +EXTERN_TYPE cell_t *callWorksheetNumber(worksheet *w, unsigned16_t row, unsigned16_t col, double numval, format_number_t fmtval, xf_t *pxformat); +// cell: xfi +EXTERN_TYPE void callCellFont(cell_t *c, font_t *fontidx); +EXTERN_TYPE void callCellFormat(cell_t *c, format_number_t formatidx); +EXTERN_TYPE void callCellHalign(cell_t *c, halign_option_t ha_option); +EXTERN_TYPE void callCellValign(cell_t *c, valign_option_t va_option); +EXTERN_TYPE void callCellOrientation(cell_t *c, txtori_option_t ori_option); +EXTERN_TYPE void callCellFillfgcolor(cell_t *c, color_name_t color); +EXTERN_TYPE void callCellFillbgcolor(cell_t *c, color_name_t color); +EXTERN_TYPE void callCellFillstyle(cell_t *c, fill_option_t fill); +EXTERN_TYPE void callCellLocked(cell_t *c, bool locked_opt); +EXTERN_TYPE void callCellHidden(cell_t *c, bool hidden_opt); +EXTERN_TYPE void callCellWrap(cell_t *c, bool wrap_opt); +EXTERN_TYPE void callCellBorderstyle(cell_t *c, border_side_t side, border_style_t style, color_name_t color); +EXTERN_TYPE void callCellFontname(cell_t *c, char *fntname); +// cell: font +EXTERN_TYPE void callCellFontheight(cell_t *c, unsigned16_t fntheight); +EXTERN_TYPE void callCellFontbold(cell_t *c, boldness_option_t fntboldness); +EXTERN_TYPE void callCellFontunderline(cell_t *c, underline_option_t fntunderline); +EXTERN_TYPE void callCellFontscript(cell_t *c, script_option_t fntscript); +EXTERN_TYPE void callCellFontcolor(cell_t *c, color_name_t fntcolor); +EXTERN_TYPE void callCellFontattr(cell_t *c, unsigned16_t attr); +EXTERN_TYPE void callCellFontitalic(cell_t *c, bool italic); +EXTERN_TYPE void callCellFontstrikeout(cell_t *c, bool so); +EXTERN_TYPE void callCellFontoutline(cell_t *c, bool ol); +EXTERN_TYPE void callCellFontshadow(cell_t *c, bool sh); +EXTERN_TYPE unsigned16_t callCellGetRow(cell_t *c); +EXTERN_TYPE unsigned16_t callCellGetCol(cell_t *c); +EXTERN_TYPE unsigned16_t callCellGetXFIndex(cell_t *c); +EXTERN_TYPE void callCellSetXF(cell_t *c, xf_t *pxfval); +// range +EXTERN_TYPE void callRangeCellcolor(range *r, color_name_t color); +// xformat +EXTERN_TYPE void callXformatSetFont(xf_t *x, font_t* fontidx); +EXTERN_TYPE unsigned16_t callXformatGetFontIndex(xf_t *x); +EXTERN_TYPE font_t* callXformatGetFont(xf_t *x); +EXTERN_TYPE void callXformatSetFormat(xf_t *x, format_number_t formatidx); +EXTERN_TYPE unsigned16_t callXformatGetFormatIndex(xf_t *x); +EXTERN_TYPE format_number_t callXformatGetFormat(xf_t *x); +EXTERN_TYPE void callXformatSetHAlign(xf_t *x, halign_option_t ha_option); +EXTERN_TYPE unsigned8_t callXformatGetHAlign(xf_t *x); +EXTERN_TYPE void callXformatSetVAlign(xf_t *x, valign_option_t va_option); +EXTERN_TYPE unsigned8_t callXformatGetVAlign(xf_t *x); +EXTERN_TYPE void callXformatSetTxtOrientation(xf_t *x, txtori_option_t ori_option); +EXTERN_TYPE unsigned8_t callXformatGetTxtOrientation(xf_t *x); +EXTERN_TYPE void callXformatSetFillFGColor(xf_t *x, color_name_t color); +EXTERN_TYPE unsigned8_t callXformatGetFillFGColor(xf_t *x); +EXTERN_TYPE void callXformatSetFillBGColor(xf_t *x, color_name_t color); +EXTERN_TYPE unsigned8_t callXformatGetFillBGColor(xf_t *x); +EXTERN_TYPE void callXformatSetFillStyle(xf_t *x, fill_option_t fill); +EXTERN_TYPE unsigned8_t callXformatGetFillStyle(xf_t *x); +EXTERN_TYPE void callXformatSetLocked(xf_t *x, bool locked_opt); +EXTERN_TYPE bool callXformatIsLocked(xf_t *x); +EXTERN_TYPE void callXformatSetHidden(xf_t *x, bool hidden_opt); +EXTERN_TYPE bool callXformatIsHidden(xf_t *x); +EXTERN_TYPE void callXformatSetWrap(xf_t *x, bool wrap_opt); +EXTERN_TYPE bool callXformatIsWrap(xf_t *x); +EXTERN_TYPE void callXformatSetCellMode(xf_t *x, bool cellmode); +EXTERN_TYPE bool callXformatIsCell(xf_t *x); +EXTERN_TYPE void callXformatSetBorderStyle(xf_t *x, border_side_t side, border_style_t style, color_name_t color); +EXTERN_TYPE unsigned8_t callXformatGetBorderStyle(xf_t *x, border_side_t side); +EXTERN_TYPE unsigned8_t callXformatGetBorderColor(xf_t *x, border_side_t side); +EXTERN_TYPE unsigned32_t callXformatGetSignature(xf_t *x); +// Font +EXTERN_TYPE void callFontSetName(font_t *f, char *name); +EXTERN_TYPE char *callFontGetName(font_t *f, char *name); +EXTERN_TYPE void callFontSetHeight(font_t *f, unsigned16_t fntheight); +EXTERN_TYPE unsigned16_t callFontGetHeight(font_t *f); +EXTERN_TYPE void callFontSetBoldStyle(font_t *f, boldness_option_t fntboldness); +EXTERN_TYPE unsigned16_t callFontGetBoldStyle(font_t *f); +EXTERN_TYPE void callFontSetUnderlineStyle(font_t *f, underline_option_t fntunderline); +EXTERN_TYPE unsigned8_t callFontGetUnderlineStyle(font_t *f); +EXTERN_TYPE void callFontSetScriptStyle(font_t *f, script_option_t fntscript); +EXTERN_TYPE unsigned16_t callFontGetScriptStyle(font_t *f); +EXTERN_TYPE void callFontSetColor(font_t *f, color_name_t fntcolor); +EXTERN_TYPE unsigned16_t callFontGetColor(font_t *f); +EXTERN_TYPE void callFontSetItalic(font_t *f, bool italic); +EXTERN_TYPE void callFontSetStrikeout(font_t *f, bool so); +EXTERN_TYPE void callFontSetAttributes(font_t *f, unsigned16_t attr); +EXTERN_TYPE unsigned16_t callFontGetAttributes(font_t *f); +EXTERN_TYPE void callFontSetOutline(font_t *f, bool ol); +EXTERN_TYPE void callFontSetShadow(font_t *f, bool sh);