| 419 | } |
| 420 | |
| 421 | void DrawPage::unsetupObject() |
| 422 | { |
| 423 | nowUnsetting = true; |
| 424 | |
| 425 | // Remove the Page's views & template from document |
| 426 | App::Document* doc = getDocument(); |
| 427 | std::string docName = doc->getName(); |
| 428 | std::string pageName = getNameInDocument(); |
| 429 | |
| 430 | try { |
| 431 | for (auto& v : Views.getValues()) { |
| 432 | //NOTE: the order of objects in Page.Views does not reflect the object hierarchy |
| 433 | // this means that a ProjGroup could be deleted before its child ProjGroupItems. |
| 434 | // this causes problems when removing objects from document |
| 435 | if (v->isAttachedToDocument()) { |
| 436 | std::string viewName = v->getNameInDocument(); |
| 437 | Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")", |
| 438 | docName.c_str(), viewName.c_str()); |
| 439 | } |
| 440 | } |
| 441 | std::vector<App::DocumentObject*> emptyViews;//probably superfluous |
| 442 | Views.setValues(emptyViews); |
| 443 | } |
| 444 | catch (...) { |
| 445 | Base::Console().warning("DP::unsetupObject - %s - error while deleting children\n", |
| 446 | getNameInDocument()); |
| 447 | } |
| 448 | |
| 449 | App::DocumentObject* tmp = Template.getValue(); |
| 450 | if (tmp) { |
| 451 | std::string templateName = Template.getValue()->getNameInDocument(); |
| 452 | Base::Interpreter().runStringArg("App.getDocument(\"%s\").removeObject(\"%s\")", |
| 453 | docName.c_str(), templateName.c_str()); |
| 454 | } |
| 455 | Template.setValue(nullptr); |
| 456 | } |
| 457 | |
| 458 | int DrawPage::getNextBalloonIndex(void) |
| 459 | { |
nothing calls this directly
no test coverage detected