summaryrefslogtreecommitdiff
path: root/vcl/source/window/dialog.cxx
diff options
context:
space:
mode:
authorKatarina Behrens <Katarina.Behrens@cib.de>2016-01-19 23:07:47 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-29 13:29:21 +0000
commit2cbd9dffe76068c71c9de3f6525ce68d949085c3 (patch)
tree33be2e5fc8ed75272571b69f356e5f43b159d284 /vcl/source/window/dialog.cxx
parent04fdf5bb667f8425228fa5df69236a4728808ab2 (diff)
tdf#95587: Make rectangle control within tab pages work again
Since commit 74407aef94b6d8dfdd6, tab pages|controls are considered to be container widgets (thus, search for the nearest non-layout parent will never find a tab page parent, breaking rectangle control in many dialogs). I've no idea how many other functions' behaviour this changes in an unexpected way, so I've reverted that bit. That however means implementing slightly different approach to tdf#92630 in dialogs (for a tab dialog, find current tab page and go through its children) Change-Id: I3ff5ac13f04b1c5c799c7a1a3769108927809f31 Reviewed-on: https://gerrit.libreoffice.org/21615 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit 39471da6e4d016c52c6cdf6553d7418416a160f4) Reviewed-on: https://gerrit.libreoffice.org/21668 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl/source/window/dialog.cxx')
-rw-r--r--vcl/source/window/dialog.cxx34
1 files changed, 27 insertions, 7 deletions
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 1793afdf524f..8b70c2ee8001 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -42,6 +42,8 @@
#include <vcl/button.hxx>
#include <vcl/mnemonic.hxx>
#include <vcl/dialog.hxx>
+#include <vcl/tabctrl.hxx>
+#include <vcl/tabpage.hxx>
#include <vcl/decoview.hxx>
#include <vcl/msgbox.hxx>
#include <vcl/unowrap.hxx>
@@ -236,6 +238,16 @@ void ImplWindowAutoMnemonic( vcl::Window* pWindow )
}
}
+void ImplHandleControlAccelerator( vcl::Window* pWindow, bool bShow )
+{
+ Control *pControl = dynamic_cast<Control*>(pWindow->ImplGetWindow());
+ if (pControl && pControl->GetText().indexOf('~') != -1)
+ {
+ pControl->SetShowAccelerator( bShow );
+ pControl->Invalidate(InvalidateFlags::Update);
+ }
+}
+
static VclButtonBox* getActionArea(Dialog *pDialog)
{
VclButtonBox *pButtonBox = nullptr;
@@ -590,19 +602,27 @@ bool Dialog::ImplHandleCmdEvent( const CommandEvent& rCEvent )
if (rCEvent.GetCommand() == CommandEventId::ModKeyChange)
{
const CommandModKeyData *pCData = rCEvent.GetModKeyData ();
+ bool bShowAccel = pCData && pCData->IsMod2();
Window *pGetChild = firstLogicalChildOfParent(this);
while (pGetChild)
{
- Control *pControl = dynamic_cast<Control*>(pGetChild->ImplGetWindow());
- if (pControl && pControl->GetText().indexOf('~') != -1)
+ if ( pGetChild->GetType() == WINDOW_TABCONTROL )
{
- if (pCData && pCData->IsMod2())
- pControl->SetShowAccelerator(true);
- else
- pControl->SetShowAccelerator(false);
- pControl->Invalidate(InvalidateFlags::Update);
+ // find currently shown tab page
+ TabControl* pTabControl = static_cast<TabControl*>( pGetChild );
+ TabPage* pTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
+ vcl::Window* pTabPageChild = firstLogicalChildOfParent( pTabPage );
+
+ // and go through its children
+ while ( pTabPageChild )
+ {
+ ImplHandleControlAccelerator(pTabPageChild, bShowAccel);
+ pTabPageChild = nextLogicalChildOfParent(pTabPage, pTabPageChild);
+ }
}
+
+ ImplHandleControlAccelerator( pGetChild, bShowAccel );
pGetChild = nextLogicalChildOfParent(this, pGetChild);
}
return true;