[Libreoffice-commits] core.git: cui/source include/vcl vcl/inc vcl/source
Ras-al-Ghul
dipankar1995 at gmail.com
Tue Jan 19 10:37:04 PST 2016
cui/source/dialogs/hangulhanjadlg.cxx | 4 ++--
include/vcl/floatwin.hxx | 2 +-
include/vcl/menu.hxx | 5 +----
include/vcl/window.hxx | 4 ++--
vcl/inc/svdata.hxx | 7 +------
vcl/source/window/floatwin.cxx | 10 +++++-----
vcl/source/window/menu.cxx | 29 +++++++++++------------------
vcl/source/window/menubarwindow.cxx | 22 ++++++++++------------
vcl/source/window/menubarwindow.hxx | 6 +++---
vcl/source/window/menufloatingwindow.cxx | 21 +++++++++------------
vcl/source/window/menufloatingwindow.hxx | 8 ++++----
vcl/source/window/window2.cxx | 20 +++++++-------------
12 files changed, 56 insertions(+), 82 deletions(-)
New commits:
commit 9c09d4d0d36076d39926eeaf7774171df3b55e52
Author: Ras-al-Ghul <dipankar1995 at gmail.com>
Date: Thu Jan 14 01:38:03 2016 +0530
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 at collabora.com>
Tested-by: Michael Meeks <michael.meeks at collabora.com>
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: jan iversen <jani at documentfoundation.org>
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index 8ebe2f4..0be8100 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -825,9 +825,9 @@ namespace svx
// give the focus to the new def button temporarily - VCL is somewhat peculiar
// in recognizing a new default button
- sal_uInt32 nSaveFocusId = Window::SaveFocus();
+ VclPtr<vcl::Window> xSaveFocusId = Window::SaveFocus();
pNewDefButton->GrabFocus();
- Window::EndSaveFocus( nSaveFocusId );
+ Window::EndSaveFocus( xSaveFocusId );
}
}
diff --git a/include/vcl/floatwin.hxx b/include/vcl/floatwin.hxx
index d999e65..61d724b 100644
--- a/include/vcl/floatwin.hxx
+++ b/include/vcl/floatwin.hxx
@@ -134,7 +134,7 @@ public:
SAL_DLLPRIVATE static Point ImplCalcPos( vcl::Window* pWindow,
const Rectangle& rRect, FloatWinPopupFlags nFlags,
sal_uInt16& rArrangeIndex );
- SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE, sal_uLong nFocusId = 0 );
+ SAL_DLLPRIVATE void ImplEndPopupMode( FloatWinPopupEndFlags nFlags = FloatWinPopupEndFlags::NONE, VclPtr<vcl::Window> xFocusId = nullptr );
SAL_DLLPRIVATE Rectangle& ImplGetItemEdgeClipRect();
SAL_DLLPRIVATE bool ImplIsInPrivatePopupMode() const { return mbInPopupMode; }
virtual void doDeferredInit(WinBits nBits) override;
diff --git a/include/vcl/menu.hxx b/include/vcl/menu.hxx
index d5eec40..7e6b244 100644
--- a/include/vcl/menu.hxx
+++ b/include/vcl/menu.hxx
@@ -207,9 +207,6 @@ protected:
/// Close the 'pStartedFrom' menu window.
virtual void ClosePopup(Menu* pMenu) = 0;
- /// Deactivate the MenuBarWindow.
- virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId);
-
/// Forward the KeyInput call to the MenuBar.
virtual void MenuBarKeyInput(const KeyEvent& rEvent);
@@ -451,7 +448,7 @@ public:
virtual void ClosePopup(Menu* pMenu) override;
/// Deactivate the MenuBarWindow.
- virtual sal_uLong DeactivateMenuBar(sal_uLong nFocusId) override;
+ virtual void DeactivateMenuBar(VclPtr<vcl::Window>& xFocusId);
/// Forward the KeyInput call to the MenuBar.
virtual void MenuBarKeyInput(const KeyEvent& rEvent) override;
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 6b383bd..e757170 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -1142,8 +1142,8 @@ public:
bool IsCompoundControl() const;
- static sal_uIntPtr SaveFocus();
- static bool EndSaveFocus( sal_uIntPtr nSaveId, bool bRestore = true );
+ static VclPtr<vcl::Window> SaveFocus();
+ static bool EndSaveFocus( const VclPtr<vcl::Window>& xFocusWin, bool bRestore = true );
void CaptureMouse();
void ReleaseMouse();
diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx
index 7f6090b..285d847 100644
--- a/vcl/inc/svdata.hxx
+++ b/vcl/inc/svdata.hxx
@@ -406,11 +406,6 @@ private:
};
-struct ImplFocusDelData : public ImplDelData
-{
- VclPtr<vcl::Window> mpFocusWin;
-};
-
struct ImplSVEvent
{
void* mpData;
@@ -423,4 +418,4 @@ struct ImplSVEvent
#endif // INCLUDED_VCL_INC_SVDATA_HXX
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index b5c038c..8b075c7 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 c29ffda..01b4241 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 3209314..aa9c355 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 f59ddea..592f962 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 371aefe..60c52b9 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 6fe08e4..8545fb0 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 d1f0d99..50f448d 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;
}
}
More information about the Libreoffice-commits
mailing list