COOPY » Guide
version 0.6.5
|
00001 #include <coopy/FoldedSheet.h> 00002 00003 using namespace std; 00004 using namespace coopy::fold; 00005 using namespace coopy::store; 00006 00007 void FoldedCell::clear() { 00008 if (sheet!=NULL) { 00009 sheet->removeReference(); 00010 if (sheet->getReferenceCount()==0) { 00011 delete sheet; 00012 } 00013 } 00014 sheet = NULL; 00015 datum.text = ""; 00016 datum.escaped = true; 00017 } 00018 00019 FoldedSheet *FoldedCell::getOrCreateSheet() { 00020 if (sheet!=NULL) return sheet; 00021 sheet = new FoldedSheet; 00022 sheet->addReference(); 00023 return sheet; 00024 } 00025 00026 SheetCell FoldedSheet::cellSummary(int x, int y) const { 00027 const FoldedCell& c = cell(x,y); 00028 if (!c.sheet) return c.datum; 00029 string result = "("; 00030 SheetStyle style; 00031 style.setEol("; "); 00032 style.setEolAtEof(false); 00033 result += c.sheet->encode(style); 00034 result += ")"; 00035 return SheetCell(result,false); 00036 } 00037