diff options
author | Armin Le Grand (Allotropia) <Armin.Le.Grand@me.com> | 2022-02-25 18:46:23 +0100 |
---|---|---|
committer | Armin Le Grand <Armin.Le.Grand@me.com> | 2022-03-02 11:55:07 +0100 |
commit | e8a004d54dc939b257b2851a78c324269e2a3973 (patch) | |
tree | 132dd9adb1d398442d1d83a934367aa1ce3b81c6 /sd | |
parent | 9f7cbc3a5358620f94fd175dbd494e6d5c01f3de (diff) |
Advanced Diagram support: Disable enter Diagram (Groups)
Groups which are in Diagram mode should not be entered, to
do so disable at UI and - for security reasons - also at
the executing mehod.
Groups in Diagram mode can still be UnGrouped (which will
remove the Diagram status & data)
Adapted testRegenerateDiagram() to directly act on the
model data to test the same as before. Using triggering
of UI events to enter the diagram group object needs
reorganization, but model op's will always be possible
Change-Id: I199f3821c2a8308a6f015997ce9eaef87623c46a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130541
Tested-by: Jenkins
Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/qa/unit/tiledrendering/tiledrendering.cxx | 31 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsj.cxx | 9 |
2 files changed, 14 insertions, 26 deletions
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index 56487deb5c76..5fabb1fe3038 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -2581,31 +2581,12 @@ void SdTiledRenderingTest::testRegenerateDiagram() SdPage* pActualPage = pXImpressDocument->GetDocShell()->GetViewShell()->GetActualPage(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(4), pActualPage->GetObj(0)->GetSubList()->GetObjCount()); - // select diagram - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); - Scheduler::ProcessEventsToIdle(); - - // enter group - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::F3); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::F3); - Scheduler::ProcessEventsToIdle(); - - // select shape and delete - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::DELETE); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::DELETE); - Scheduler::ProcessEventsToIdle(); - - // exit group - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, awt::Key::TAB); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, KEY_MOD1 | awt::Key::F3); - pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYUP, 0, KEY_MOD1 | awt::Key::F3); - Scheduler::ProcessEventsToIdle(); + // For new Diagram funcionality entering group using UI is not allowed as long + // as the group shape is a diagram. Do the same as before done by triggering UI + // events directly in the model + // Remove and free top-left entry (Box showing "A") + SdrObject* pTopLeftRemoved = pActualPage->GetObj(0)->GetSubList()->RemoveObject(1); + SdrObject::Free(pTopLeftRemoved); // select diagram pXImpressDocument->postKeyEvent(LOK_KEYEVENT_KEYINPUT, 0, awt::Key::TAB); diff --git a/sd/source/ui/view/drviewsj.cxx b/sd/source/ui/view/drviewsj.cxx index 9f9a52012c3d..40dd8dca8214 100644 --- a/sd/source/ui/view/drviewsj.cxx +++ b/sd/source/ui/view/drviewsj.cxx @@ -132,12 +132,19 @@ void DrawViewShell::GetMenuStateSel( SfxItemSet &rSet ) /* If it is not a group object or 3D object, we disable "enter group". */ - if( !( ( dynamic_cast< const SdrObjGroup *>( pObj ) != nullptr && nInv == SdrInventor::Default ) || + const auto* pIsGroup(dynamic_cast<const SdrObjGroup*>(pObj)); + if( !( ( pIsGroup != nullptr && nInv == SdrInventor::Default ) || ( dynamic_cast< const E3dScene* >(pObj) != nullptr ) ) ) { rSet.DisableItem( SID_ENTER_GROUP ); } + // Don't allow enter Diagrams + if(nullptr != pIsGroup && pIsGroup->isDiagram()) + { + rSet.DisableItem( SID_ENTER_GROUP ); + } + // If it is not a group object, we disable "ungroup" if(dynamic_cast< const SdrObjGroup *>( pObj ) == nullptr || nInv != SdrInventor::Default) { |