COOPY » Guide
version 0.6.5
|
00001 #ifndef COOPY_SOCIALCALCSHEET 00002 #define COOPY_SOCIALCALCSHEET 00003 00004 #include <coopy/DataSheet.h> 00005 #include <coopy/JsWrap.h> 00006 #include <coopy/SparseSheet.h> 00007 00008 namespace coopy { 00009 namespace store { 00010 namespace socialcalc { 00011 class SocialCalcSheet; 00012 } 00013 } 00014 } 00015 00016 class coopy::store::socialcalc::SocialCalcSheet : public DataSheet { 00017 private: 00018 coopy::js::JsWrap js; 00019 jsval *jssheet; 00020 int id; 00021 int w, h; 00022 SparseStringSheet cache; 00023 SparseByteSheet cacheFlag; 00024 public: 00025 SocialCalcSheet() { 00026 jssheet = 0/*NULL*/; 00027 w = h = 0; 00028 id = -1; 00029 } 00030 00031 virtual ~SocialCalcSheet() { 00032 reset(); 00033 } 00034 00035 static bool jsSetup(coopy::js::JsWrap& j); 00036 00037 bool select() const; 00038 00039 bool reset(); 00040 00041 bool setup(); 00042 00043 virtual int width() const { return w; } 00044 virtual int height() const { return h; } 00045 00046 virtual std::string cellString(int x, int y) const; 00047 00048 virtual std::string cellString(int x, int y, bool& escaped) const; 00049 00050 virtual bool cellString(int x, int y, const std::string& str) { 00051 return cellString(x,y,str,false); 00052 } 00053 00054 virtual bool cellString(int x, int y, const std::string& str, bool escaped); 00055 00056 virtual ColumnRef moveColumn(const ColumnRef& src, const ColumnRef& base); 00057 00058 virtual bool deleteColumn(const ColumnRef& column); 00059 00060 virtual ColumnRef insertColumn(const ColumnRef& base); 00061 00062 virtual ColumnRef insertColumn(const ColumnRef& base, const ColumnInfo& kind); 00063 00064 virtual bool modifyColumn(const ColumnRef& base, const ColumnInfo& kind); 00065 00066 virtual RowRef insertRow(const RowRef& base); 00067 00068 virtual bool deleteRow(const RowRef& src); 00069 00070 virtual bool deleteRows(const RowRef& first, const RowRef& last); 00071 00072 virtual RowRef moveRow(const RowRef& src, const RowRef& base); 00073 00074 virtual bool hasDimension() const { 00075 return false; 00076 } 00077 00078 virtual bool forceWidth(int width) { 00079 w = width; 00080 return true; 00081 } 00082 00083 bool fromCsvString(const std::string& str); 00084 bool fromSocialCalcString(const std::string& str); 00085 std::string toSocialCalcString(const Property& config); 00086 00087 bool updateSize(); 00088 00089 //virtual Poly<Appearance> getCellAppearance(int x, int y); 00090 //virtual Poly<Appearance> getRowAppearance(int y); 00091 //virtual Poly<Appearance> getColAppearance(int x); 00092 }; 00093 00094 #endif