filters
workbook.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "workbook.h"
00021 #include "sheet.h"
00022 #include "excel.h"
00023
00024 #include <iostream>
00025 #include <vector>
00026
00027 using namespace Swinder;
00028
00029 class Workbook::Private
00030 {
00031 public:
00032 std::vector<Sheet*> sheets;
00033 bool autoCalc;
00034 bool passwordProtected;
00035 };
00036
00037 Workbook::Workbook()
00038 {
00039 d = new Workbook::Private();
00040 d->autoCalc = true;
00041 d->passwordProtected = false;
00042 }
00043
00044 Workbook::~Workbook()
00045 {
00046 clear();
00047 delete d;
00048 }
00049
00050 void Workbook::clear()
00051 {
00052
00053 for( unsigned i=0; i<sheetCount(); i++ )
00054 {
00055 Sheet* s = sheet( i );
00056 delete s;
00057 }
00058 d->sheets.clear();
00059 }
00060
00061 bool Workbook::load( const char* filename )
00062 {
00063 ExcelReader* reader = new ExcelReader;
00064 bool result = reader->load( this, filename );
00065 delete reader;
00066 return result;
00067 }
00068
00069 void Workbook::appendSheet( Sheet* sheet )
00070 {
00071 d->sheets.push_back( sheet );
00072 }
00073
00074 unsigned Workbook::sheetCount() const
00075 {
00076 return d->sheets.size();
00077 }
00078
00079 Sheet* Workbook::sheet( unsigned index )
00080 {
00081 if( index >= sheetCount() ) return (Sheet*)0;
00082 return d->sheets[index];
00083 }
00084
00085 bool Workbook::autoCalc() const
00086 {
00087 return d->autoCalc;
00088 }
00089
00090 void Workbook::setAutoCalc( bool a )
00091 {
00092 d->autoCalc = a;
00093 }
00094
00095 bool Workbook::isPasswordProtected() const
00096 {
00097 return d->passwordProtected;
00098 }
00099
00100 void Workbook::setPasswordProtected( bool p )
00101 {
00102 d->passwordProtected = p;
00103 }
00104
00105
00106
00107
|