diff options
author | Ras-al-Ghul <dipankar1995@gmail.com> | 2016-01-14 01:38:03 +0530 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2016-01-19 18:36:35 +0000 |
commit | 9c09d4d0d36076d39926eeaf7774171df3b55e52 (patch) | |
tree | a8cd978ada41ad32793a258e67566dc89859f439 /vcl/source | |
parent | 85b46f51928dc17cda1bc974bca9159de9221b4d (diff) |
tdf#96888 - Kill internal vcl dog-tags ...
Modifications done as per CR
Change-Id: I0b57f5c32fc217929d71411ca5176e3cab3f6e73
Reviewed-on: https://gerrit.libreoffice.org/21457
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Michael Meeks <michael.meeks@collabora.com>
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/window/floatwin.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/menu.cxx | 29 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.cxx | 22 | ||||
-rw-r--r-- | vcl/source/window/menubarwindow.hxx | 6 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.cxx | 21 | ||||
-rw-r--r-- | vcl/source/window/menufloatingwindow.hxx | 8 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 20 |
7 files changed, 49 insertions, 67 deletions
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index b5c038ccdb53..8b075c7a740f 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -756,7 +756,7 @@ void FloatingWindow::StartPopupMode( ToolBox* pBox, FloatWinPopupFlags nFlags ) StartPopupMode( aRect, nFlags ); } -void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, sal_uLong nFocusId ) +void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, VclPtr<vcl::Window> xFocusId ) { if ( !mbInPopupMode ) return; @@ -782,8 +782,8 @@ void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, sal_uLong n Show( false, ShowFlags::NoFocusChange ); // maybe pass focus on to a suitable FloatingWindow - if ( nFocusId ) - Window::EndSaveFocus( nFocusId ); + if ( xFocusId != nullptr ) + Window::EndSaveFocus( xFocusId ); else if ( pSVData->maWinData.mpFocusWin && pSVData->maWinData.mpFirstFloat && ImplIsWindowOrChild( pSVData->maWinData.mpFocusWin ) ) pSVData->maWinData.mpFirstFloat->GrabFocus(); @@ -792,8 +792,8 @@ void FloatingWindow::ImplEndPopupMode( FloatWinPopupEndFlags nFlags, sal_uLong n else { mbPopupModeTearOff = true; - if ( nFocusId ) - Window::EndSaveFocus( nFocusId, false ); + if ( xFocusId != nullptr ) + Window::EndSaveFocus( xFocusId, false ); } EnableSaveBackground( mbOldSaveBackMode ); diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx index c29ffda0b521..01b4241be1af 100644 --- a/vcl/source/window/menu.cxx +++ b/vcl/source/window/menu.cxx @@ -2309,11 +2309,6 @@ bool Menu::HasValidEntries( bool bCheckPopups ) return bValidEntries; } -sal_uLong Menu::DeactivateMenuBar(sal_uLong nFocusId) -{ - return nFocusId; -} - void Menu::MenuBarKeyInput(const KeyEvent&) { } @@ -2516,17 +2511,15 @@ void MenuBar::ClosePopup(Menu *pMenu) pMenuWin->PopupClosed(pMenu); } -sal_uLong MenuBar::DeactivateMenuBar(sal_uLong nFocusId) +void MenuBar::DeactivateMenuBar(VclPtr<vcl::Window>& xFocusId) { MenuBarWindow* pMenuWin = getMenuBarWindow(); - nFocusId = pMenuWin ? pMenuWin->GetFocusId() : 0; - if (nFocusId) + xFocusId = pMenuWin ? pMenuWin->GetFocusId() : nullptr; + if (xFocusId != nullptr) { - pMenuWin->SetFocusId(0); + pMenuWin->SetFocusId(nullptr); ImplGetSVData()->maWinData.mbNoDeactivate = false; } - - return nFocusId; } void MenuBar::MenuBarKeyInput(const KeyEvent& rEvent) @@ -2945,12 +2938,12 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const Rectangl nSelectedId = 0; bCanceled = false; - sal_uLong nFocusId = 0; + VclPtr<vcl::Window> xFocusId; bool bRealExecute = false; if ( !pStartedFrom ) { pSVData->maWinData.mbNoDeactivate = true; - nFocusId = Window::SaveFocus(); + xFocusId = Window::SaveFocus(); bRealExecute = true; } else @@ -3074,7 +3067,7 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const Rectangl aSz.Height() = ImplCalcHeight( nEntries ); } - pWin->SetFocusId( nFocusId ); + pWin->SetFocusId( xFocusId ); pWin->SetOutputSizePixel( aSz ); // #102158# menus must never grab the focus, otherwise // they will be closed immediately @@ -3143,13 +3136,13 @@ sal_uInt16 PopupMenu::ImplExecute( const VclPtr<vcl::Window>& pW, const Rectangl // Restore focus (could already have been // restored in Select) - nFocusId = pWin->GetFocusId(); - if ( nFocusId ) + xFocusId = pWin->GetFocusId(); + if ( xFocusId != nullptr ) { - pWin->SetFocusId( 0 ); + pWin->SetFocusId( nullptr ); pSVData->maWinData.mbNoDeactivate = false; } - pWin->ImplEndPopupMode( FloatWinPopupEndFlags::NONE, nFocusId ); + pWin->ImplEndPopupMode( FloatWinPopupEndFlags::NONE, xFocusId ); if ( nSelectedId ) // then clean up .. ( otherwise done by TH ) { diff --git a/vcl/source/window/menubarwindow.cxx b/vcl/source/window/menubarwindow.cxx index 32093142d5b6..aa9c355f9b2b 100644 --- a/vcl/source/window/menubarwindow.cxx +++ b/vcl/source/window/menubarwindow.cxx @@ -126,11 +126,9 @@ MenuBarWindow::MenuBarWindow( vcl::Window* pParent ) : SetType(WINDOW_MENUBARWINDOW); pMenu = nullptr; pActivePopup = nullptr; - nSaveFocusId = 0; nHighlightedItem = ITEMPOS_INVALID; nRolloveredItem = ITEMPOS_INVALID; mbAutoPopup = true; - nSaveFocusId = 0; bIgnoreFirstMove = true; bStayActive = false; SetMBWHideAccel(true); @@ -462,15 +460,15 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b // #105406# avoid saving the focus when we already have the focus bool bNoSaveFocus = (this == ImplGetSVData()->maWinData.mpFocusWin.get() ); - if( nSaveFocusId ) + if( xSaveFocusId != nullptr ) { if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) { // we didn't clean up last time - Window::EndSaveFocus( nSaveFocusId, false ); // clean up - nSaveFocusId = 0; + Window::EndSaveFocus( xSaveFocusId, false ); // clean up + xSaveFocusId = nullptr; if( !bNoSaveFocus ) - nSaveFocusId = Window::SaveFocus(); // only save focus when initially activated + xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated } else { ; // do nothing: we 're activated again from taskpanelist, focus was already saved @@ -479,7 +477,7 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b else { if( !bNoSaveFocus ) - nSaveFocusId = Window::SaveFocus(); // only save focus when initially activated + xSaveFocusId = Window::SaveFocus(); // only save focus when initially activated } } else @@ -497,11 +495,11 @@ void MenuBarWindow::ChangeHighlightItem( sal_uInt16 n, bool bSelectEntry, bool b ImplGetSVData()->maWinData.mbNoDeactivate = false; if( !ImplGetSVData()->maWinData.mbNoSaveFocus ) { - sal_uLong nTempFocusId = nSaveFocusId; - nSaveFocusId = 0; - Window::EndSaveFocus( nTempFocusId, bAllowRestoreFocus ); + VclPtr<vcl::Window> xTempFocusId = xSaveFocusId; + xSaveFocusId = nullptr; + Window::EndSaveFocus( xTempFocusId, bAllowRestoreFocus ); // #105406# restore focus to document if we could not save focus before - if( bDefaultToDocument && !nTempFocusId && bAllowRestoreFocus ) + if( bDefaultToDocument && xTempFocusId == nullptr && bAllowRestoreFocus ) GrabFocusToDocument(); } } @@ -739,7 +737,7 @@ bool MenuBarWindow::HandleKeyEvent( const KeyEvent& rKEvent, bool bFromMenu ) else { ChangeHighlightItem( ITEMPOS_INVALID, false ); - nSaveFocusId = 0; + xSaveFocusId = nullptr; } bDone = true; } diff --git a/vcl/source/window/menubarwindow.hxx b/vcl/source/window/menubarwindow.hxx index f59ddeac772e..592f962047ba 100644 --- a/vcl/source/window/menubarwindow.hxx +++ b/vcl/source/window/menubarwindow.hxx @@ -78,7 +78,7 @@ private: PopupMenu* pActivePopup; sal_uInt16 nHighlightedItem; sal_uInt16 nRolloveredItem; - sal_uLong nSaveFocusId; + VclPtr<vcl::Window> xSaveFocusId; bool mbAutoPopup; bool bIgnoreFirstMove; bool bStayActive; @@ -127,8 +127,8 @@ public: virtual void Resize() override; virtual void RequestHelp( const HelpEvent& rHEvt ) override; - void SetFocusId(sal_uLong nId) { nSaveFocusId = nId; } - sal_uLong GetFocusId() const { return nSaveFocusId; } + void SetFocusId(const VclPtr<vcl::Window>& xId) { xSaveFocusId = xId; } + VclPtr<vcl::Window> GetFocusId() const { return xSaveFocusId; } void SetMenu(MenuBar* pMenu); void SetHeight(long nHeight); diff --git a/vcl/source/window/menufloatingwindow.cxx b/vcl/source/window/menufloatingwindow.cxx index 371aefe4d884..60c52b9e1cb6 100644 --- a/vcl/source/window/menufloatingwindow.cxx +++ b/vcl/source/window/menufloatingwindow.cxx @@ -32,7 +32,6 @@ MenuFloatingWindow::MenuFloatingWindow( Menu* pMen, vcl::Window* pParent, WinBit mpWindowImpl->mbMenuFloatingWindow= true; pMenu = pMen; pActivePopup = nullptr; - nSaveFocusId = 0; bInExecute = false; bScrollMenu = false; nHighlightedItem = ITEMPOS_INVALID; @@ -397,21 +396,21 @@ void MenuFloatingWindow::Execute() pSVData->maAppData.mpActivePopupMenu = nullptr; } -void MenuFloatingWindow::StopExecute( sal_uLong nFocusId ) +void MenuFloatingWindow::StopExecute( VclPtr<vcl::Window> xFocusId ) { // restore focus // (could have been restored in Select) - if ( nSaveFocusId ) + if ( xSaveFocusId != nullptr ) { - Window::EndSaveFocus( nFocusId, false ); - nFocusId = nSaveFocusId; - if ( nFocusId ) + Window::EndSaveFocus( xFocusId, false ); + xFocusId = xSaveFocusId; + if ( xFocusId != nullptr ) { - nSaveFocusId = 0; + xSaveFocusId = nullptr; ImplGetSVData()->maWinData.mbNoDeactivate = false; } } - ImplEndPopupMode( FloatWinPopupEndFlags::NONE, nFocusId ); + ImplEndPopupMode( FloatWinPopupEndFlags::NONE, xFocusId ); aHighlightChangedTimer.Stop(); bInExecute = false; @@ -456,9 +455,7 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly ) void MenuFloatingWindow::EndExecute() { Menu* pStart = pMenu ? pMenu->ImplGetStartMenu() : nullptr; - sal_uLong nFocusId = 0; - if (pStart) - nFocusId = pStart->DeactivateMenuBar(nFocusId); + VclPtr<vcl::Window> xFocusId; // if started elsewhere, cleanup there as well MenuFloatingWindow* pCleanUpFrom = this; @@ -475,7 +472,7 @@ void MenuFloatingWindow::EndExecute() Menu* pM = pMenu; sal_uInt16 nItem = nHighlightedItem; - pCleanUpFrom->StopExecute( nFocusId ); + pCleanUpFrom->StopExecute( xFocusId ); if ( nItem != ITEMPOS_INVALID && pM ) { diff --git a/vcl/source/window/menufloatingwindow.hxx b/vcl/source/window/menufloatingwindow.hxx index 6fe08e4f8572..8545fb061a97 100644 --- a/vcl/source/window/menufloatingwindow.hxx +++ b/vcl/source/window/menufloatingwindow.hxx @@ -41,7 +41,7 @@ private: Timer aHighlightChangedTimer; Timer aSubmenuCloseTimer; Timer aScrollTimer; - sal_uLong nSaveFocusId; + VclPtr<vcl::Window> xSaveFocusId; sal_uInt16 nHighlightedItem; // highlighted/selected Item sal_uInt16 nMBDownPos; sal_uInt16 nScrollerHeight; @@ -100,15 +100,15 @@ public: virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; - void SetFocusId( sal_uLong nId ) { nSaveFocusId = nId; } - sal_uLong GetFocusId() const { return nSaveFocusId; } + void SetFocusId( const VclPtr<vcl::Window>& xId ) { xSaveFocusId = xId; } + VclPtr<vcl::Window> GetFocusId() const { return xSaveFocusId; } void EnableScrollMenu( bool b ); bool IsScrollMenu() const { return bScrollMenu; } sal_uInt16 GetScrollerHeight() const { return nScrollerHeight; } void Execute(); - void StopExecute( sal_uLong nFocusId = 0 ); + void StopExecute( VclPtr<vcl::Window> xFocusId = nullptr ); void EndExecute(); void EndExecute( sal_uInt16 nSelectId ); diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index d1f0d9948ab0..50f448dc485b 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -404,37 +404,31 @@ void Window::EndAutoScroll() } } -sal_uIntPtr Window::SaveFocus() +VclPtr<vcl::Window> Window::SaveFocus() { ImplSVData* pSVData = ImplGetSVData(); if ( pSVData->maWinData.mpFocusWin ) { - ImplFocusDelData* pDelData = new ImplFocusDelData; - pSVData->maWinData.mpFocusWin->ImplAddDel( pDelData ); - pDelData->mpFocusWin = pSVData->maWinData.mpFocusWin; - return reinterpret_cast<sal_uIntPtr>(pDelData); + return pSVData->maWinData.mpFocusWin; } else - return 0; + return nullptr; } -bool Window::EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore ) +bool Window::EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore ) { - if ( !nSaveId ) + if ( xFocusWin == nullptr ) return false; else { bool bOK = true; - ImplFocusDelData* pDelData = reinterpret_cast<ImplFocusDelData*>(nSaveId); - if ( !pDelData->IsDead() ) + if ( !xFocusWin->IsDisposed() ) { - pDelData->mpFocusWin->ImplRemoveDel( pDelData ); if ( bRestore ) - pDelData->mpFocusWin->GrabFocus(); + xFocusWin->GrabFocus(); } else bOK = !bRestore; - delete pDelData; return bOK; } } |