DocumentObject: add allowDuplicateLabel/onBeforeChangeLabel()

These two APIs allow an object to control its own labeling rules.
The previous auto re-labeling for uniqueness logic is moved from
ObjectLabelObserver (resides in Application.cpp) to PropertyString.

DocumentObject::allowDuplicateLabel() is used to inform PropertyString
that the object allows duplicate label regardless of application
setting. onBeforeChangeLabel() is called before actual label change to
give object a chance to override the new label.
This commit is contained in:
Zheng, Lei
2019-08-17 14:52:09 +02:00
committed by wmayer
parent 34ed8a8e00
commit 161ad0578a
6 changed files with 190 additions and 123 deletions
+4
View File
@@ -834,3 +834,7 @@ PyObject *DocumentObjectPy::adjustRelativeLinks(PyObject *args) {
PyObject_IsTrue(recursive)?&visited:nullptr)));
}PY_CATCH
}
Py::String DocumentObjectPy::getOldLabel() const {
return Py::String(getDocumentObjectPtr()->getOldLabel());
}