diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-06 15:44:27 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-06 16:07:09 +0000 |
commit | e36dae401fc8963c9a92cb2c11d9b650b943c6d3 (patch) | |
tree | d6b01b3bd1520a386826a28191a7c4928df4a674 | |
parent | ee2d0d06445b44c3a69b9b0cdd1b474063fed521 (diff) |
implement toggling off removeable master elements with direct delete
i.e. selecting footers/headers/slidenumber/datetime previes placeholders in
master page view and pressing delete will toggle those master elements off.
Change-Id: I91f745703e43cbb4fdd037da4eab7c8f6bf9fbf5
-rw-r--r-- | sd/source/ui/view/drviewse.cxx | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx index f9b0be31cd56..331b62b305de 100644 --- a/sd/source/ui/view/drviewse.cxx +++ b/sd/source/ui/view/drviewse.cxx @@ -626,17 +626,53 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq) void DrawViewShell::FuDeleteSelectedObjects() { - if ( mpDrawView->IsPresObjSelected(false, true, false, true) ) + bool bConsumed = false; + + //if any placeholders are selected + if (mpDrawView->IsPresObjSelected(false, true, false, false)) + { + //If there are placeholders in the list which can be toggled + //off in edit->master->master elements then do that here, + std::vector<SdrObject*> aPresMarksToRemove; + const SdrMarkList& rMarkList = mpDrawView->GetMarkedObjectList(); + for (size_t i=0; i < rMarkList.GetMarkCount(); ++i) + { + SdrObject* pObj = rMarkList.GetMark(i)->GetMarkedSdrObj(); + SdPage* pPage = (SdPage*)pObj->GetPage(); + PresObjKind eKind = pPage->GetPresObjKind(pObj); + if (eKind == PRESOBJ_FOOTER || eKind == PRESOBJ_HEADER || + eKind == PRESOBJ_DATETIME || eKind == PRESOBJ_SLIDENUMBER) + { + aPresMarksToRemove.push_back(pObj); + } + } + + for (SdrObject* pObj : aPresMarksToRemove) + { + //Unmark object + mpDrawView->MarkObj(pObj, mpDrawView->GetSdrPageView(), true); + SdPage* pPage = (SdPage*)pObj->GetPage(); + //remove placeholder from master page + pPage->DestroyDefaultPresObj(pPage->GetPresObjKind(pObj)); + } + + bConsumed = true; + } + + // placeholders which cannot be deleted selected + if (mpDrawView->IsPresObjSelected(false, true, false, true)) { ::sd::Window* pWindow = GetActiveWindow(); InfoBox(pWindow, SD_RESSTR(STR_ACTION_NOTPOSSIBLE) ).Execute(); + bConsumed = true; } - else + + if (!bConsumed) { ::vcl::KeyCode aKCode(KEY_DELETE); KeyEvent aKEvt( 0, aKCode); - bool bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt ); + bConsumed = mpDrawView && mpDrawView->getSmartTags().KeyInput( aKEvt ); if( !bConsumed && HasCurrentFunction() ) bConsumed = GetCurrentFunction()->KeyInput(aKEvt); |