diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp index 7df1ca66af..db7642969e 100644 --- a/src/Mod/Spreadsheet/App/Cell.cpp +++ b/src/Mod/Spreadsheet/App/Cell.cpp @@ -88,6 +88,7 @@ Cell::Cell(const CellAddress &_address, PropertySheet *_owner) , foregroundColor(0, 0, 0, 1) , backgroundColor(1, 1, 1, 0) , displayUnit() + , alias() , computedUnit() , rowSpan(1) , colSpan(1) @@ -96,14 +97,9 @@ Cell::Cell(const CellAddress &_address, PropertySheet *_owner) assert(address.isValid()); } -/** - * Destroy a CellContent object. - * - */ - -Cell::Cell(const Cell &other) +Cell::Cell(PropertySheet *_owner, const Cell &other) : address(other.address) - , owner(other.owner) + , owner(_owner) , used(other.used) , expression(other.expression ? other.expression->copy() : 0) , alignment(other.alignment) @@ -111,32 +107,40 @@ Cell::Cell(const Cell &other) , foregroundColor(other.foregroundColor) , backgroundColor(other.backgroundColor) , displayUnit(other.displayUnit) + , alias(other.alias) , computedUnit(other.computedUnit) , rowSpan(other.rowSpan) , colSpan(other.colSpan) { + setUsed(MARK_SET, false); } Cell &Cell::operator =(const Cell &rhs) { PropertySheet::AtomicPropertyChange signaller(*owner); - used = 0; address = rhs.address; - owner = rhs.owner; setExpression(rhs.expression ? rhs.expression->copy() : 0); - setStyle(rhs.style); setAlignment(rhs.alignment); - setForeground(rhs.foregroundColor); + setStyle(rhs.style); setBackground(rhs.backgroundColor); + setForeground(rhs.foregroundColor); setDisplayUnit(rhs.displayUnit.stringRep); setComputedUnit(rhs.computedUnit); + setAlias(rhs.alias); setSpans(rhs.rowSpan, rhs.colSpan); + setUsed(MARK_SET, false); + return *this; } +/** + * Destroy a CellContent object. + * + */ + Cell::~Cell() { if (expression) diff --git a/src/Mod/Spreadsheet/App/Cell.h b/src/Mod/Spreadsheet/App/Cell.h index 84b2000277..0f23c8ce73 100644 --- a/src/Mod/Spreadsheet/App/Cell.h +++ b/src/Mod/Spreadsheet/App/Cell.h @@ -47,12 +47,13 @@ class PropertySheet; class DisplayUnit; class SpreadsheetExport Cell { - +private: + Cell(const Cell & other); public: Cell(const App::CellAddress & _address, PropertySheet * _owner); - Cell(const Cell & other); + Cell(PropertySheet * _owner, const Cell & other); Cell& operator=( const Cell& rhs ); diff --git a/src/Mod/Spreadsheet/App/PropertySheet.cpp b/src/Mod/Spreadsheet/App/PropertySheet.cpp index 893d466918..7f09078664 100644 --- a/src/Mod/Spreadsheet/App/PropertySheet.cpp +++ b/src/Mod/Spreadsheet/App/PropertySheet.cpp @@ -212,13 +212,20 @@ PropertySheet::PropertySheet(const PropertySheet &other) , mergedCells(other.mergedCells) , owner(other.owner) , propertyNameToCellMap(other.propertyNameToCellMap) + , cellToPropertyNameMap(other.cellToPropertyNameMap) , documentObjectToCellMap(other.documentObjectToCellMap) + , cellToDocumentObjectMap(other.cellToDocumentObjectMap) + , docDeps(other.docDeps) + , documentObjectName(other.documentObjectName) + , documentName(other.documentName) + , aliasProp(other.aliasProp) + , revAliasProp(other.revAliasProp) { std::map::const_iterator i = other.data.begin(); /* Copy cells */ while (i != other.data.end()) { - data[i->first] = new Cell(*i->second); + data[i->first] = new Cell(this, *i->second); ++i; } } @@ -256,7 +263,7 @@ void PropertySheet::Paste(const Property &from) recomputeDependencies(ifrom->first); } else { - data[ifrom->first] = new Cell(*(ifrom->second)); // Doesn't exist, copy using Cell's copy constructor + data[ifrom->first] = new Cell(this, *(ifrom->second)); // Doesn't exist, copy using Cell's copy constructor } /* Set dirty */ diff --git a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp index 10c349e1bc..8b04280b9b 100644 --- a/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp +++ b/src/Mod/Spreadsheet/Gui/SpreadsheetView.cpp @@ -130,14 +130,14 @@ bool SheetView::onMsg(const char *pMsg, const char **ppReturn) getGuiDocument()->undo(1); App::Document* doc = getAppDocument(); if (doc) - doc->recomputeFeature(sheet); + doc->recompute(); return true; } else if(strcmp("Redo",pMsg) == 0 ) { getGuiDocument()->redo(1); App::Document* doc = getAppDocument(); if (doc) - doc->recomputeFeature(sheet); + doc->recompute(); return true; } else if (strcmp("Save",pMsg) == 0) {