Spreadsheet: Override DocumentObject::renameObjectIdentifiers() to get better renaming support.

This commit is contained in:
Eivind Kvedalen 2016-02-08 21:03:24 +01:00 committed by wmayer
parent 810135fad4
commit 1802d94a1a
4 changed files with 20 additions and 0 deletions

View File

@ -41,6 +41,7 @@
#include "SpreadsheetExpression.h"
#include "Utils.h"
#include <PropertySheetPy.h>
#include <App/ExpressionVisitors.h>
using namespace App;
using namespace Base;
@ -1160,6 +1161,14 @@ void PropertySheet::renamedDocument(const App::Document * doc)
}
}
void PropertySheet::renameObjectIdentifiers(const std::map<App::ObjectIdentifier, App::ObjectIdentifier> &paths)
{
RenameObjectIdentifierExpressionVisitor<PropertySheet> v(*this, paths, *this);
for (std::map<CellAddress, Cell*>::iterator it = data.begin(); it != data.end(); ++it)
it->second->visit(v);
}
void PropertySheet::deletedDocumentObject(const App::DocumentObject *docObj)
{
docDeps.erase(const_cast<App::DocumentObject*>(docObj));

View File

@ -141,6 +141,8 @@ public:
void renamedDocument(const App::Document *doc);
void renameObjectIdentifiers(const std::map<App::ObjectIdentifier, App::ObjectIdentifier> &paths);
void deletedDocumentObject(const App::DocumentObject *docObj);
void documentSet();

View File

@ -1312,6 +1312,13 @@ void Sheet::observeDocument(Document * document)
}
}
void Sheet::renameObjectIdentifiers(const std::map<ObjectIdentifier, ObjectIdentifier> &paths)
{
DocumentObject::renameObjectIdentifiers(paths);
cells.renameObjectIdentifiers(paths);
}
TYPESYSTEM_SOURCE(Spreadsheet::PropertySpreadsheetQuantity, App::PropertyQuantity);
Property *PropertySpreadsheetQuantity::Copy() const

View File

@ -227,6 +227,8 @@ public:
void observeDocument(App::Document *document);
virtual void renameObjectIdentifiers(const std::map<App::ObjectIdentifier, App::ObjectIdentifier> & paths);
protected:
void providesTo(CellAddress address, std::set<CellAddress> & result) const;