#ifndef _WORKSHT_WORKSHEET_HPP_ #define _WORKSHT_WORKSHEET_HPP_ #ifndef _COMMON_ARRAY_HPP_ #include #endif #ifndef _COMMON_SMARTPOINTER_HPP_ #include #endif #ifndef _COMMON_ASSERT_HPP_ #include #endif #ifndef _WORKSHT_RECORD_HPP_ #include #endif #ifndef _WORKSHT_LABEL_HPP_ #include #endif #ifndef _WORKSHT_NUMBER_HPP_ #include #endif #ifndef _WORKSHT_INTEGER_HPP_ #include #endif #ifndef _FILEIO_FILEIO_HPP_ #include #endif class Worksheet { public: typedef Array > ColumnData; Worksheet(void); virtual ~Worksheet(); ColumnData &operator[](UINT index); UINT rows(void)const; UINT cols(void)const; void setDimensions(UINT rows,UINT cols); bool setAt(int row,int col,SmartPointer &record); bool setAt(int row,int col,const String &strLabel); bool setAt(int row,int col,WORD value); BOOL open(const String &strPathFileName); BOOL save(const String &strPathFileName); BOOL saveText(const String &strPathFileName); BOOL isOkay(void)const; protected: virtual void processEvents(void); private: enum{MaxColumn=16384}; Worksheet(const Worksheet &someWorksheet); Worksheet &operator=(const Worksheet &someWorksheet); BOOL operator==(const Worksheet &someWorksheet); Array mMatrix; Record mLotusRecord; UINT mRows; UINT mCols; }; inline Worksheet::Worksheet(void) : mRows(0), mCols(0) { } inline Worksheet::Worksheet(const Worksheet &someWorksheet) { // private implmentation *this=someWorksheet; } inline Worksheet::~Worksheet() { } inline Worksheet &Worksheet::operator=(const Worksheet &/*someWorksheet*/) { // private implementation return *this; } inline BOOL Worksheet::operator==(const Worksheet &/*someWorksheet*/) { // private implementation return FALSE; } inline Worksheet::ColumnData &Worksheet::operator[](UINT index) { assert(index &record) { if(row>=rows()||col>=cols())return false; record.disposition(PointerDisposition::Assume); (mMatrix[row])[col]=record; (mMatrix[row])[col].disposition(PointerDisposition::Delete); return true; } inline bool Worksheet::setAt(int row,int col,const String &strLabel) { SmartPointer label=new Label(row,col,strLabel); setAt(row,col,label); return true; } inline bool Worksheet::setAt(int row,int col,WORD value) { if(row>=rows()||col>=cols())return false; SmartPointer integer=new Integer(row,col,value); integer.disposition(PointerDisposition::Assume); (mMatrix[row])[col]=integer; (mMatrix[row])[col].disposition(PointerDisposition::Delete); return true; } inline BOOL Worksheet::isOkay(void)const { return (rows()&&cols()); } #endif