diff options
author | Noel Grandin <noel@peralex.com> | 2015-05-27 13:47:57 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-05-28 12:47:05 +0200 |
commit | 4c93c30c79ae885d488a8a04d383fe5308a1d520 (patch) | |
tree | c0309401c718c0459dd1a0035bcbddd113d655b8 | |
parent | 46a985feca255abbebf826be6103ee8cc7f2cde1 (diff) |
convert GETFOCUS constants to scoped enum
Change-Id: I7c324bb6358be28c119592850eb7607479279f09
26 files changed, 100 insertions, 89 deletions
diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index fd4bcab3471c..9487c9a8aab4 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -1024,7 +1024,7 @@ IMPL_LINK(ColorConfigCtrl_Impl, ControlFocusHdl, Control*, pCtrl) long aCtrlPosY = pCtrl->GetPosPixel().Y(); unsigned const nWinHeight = m_pScrollWindow->GetSizePixel().Height(); unsigned const nEntryHeight = m_pScrollWindow->GetEntryHeight(); - if (0 != (GETFOCUS_TAB & pCtrl->GetGetFocusFlags()) && + if ((GetFocusFlags::Tab & pCtrl->GetGetFocusFlags()) && (aCtrlPosY < 0 || nWinHeight < aCtrlPosY + nEntryHeight) ) { long nThumbPos = m_pVScroll->GetThumbPos(); diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 2e4bac86f2ee..27c249549251 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -667,7 +667,7 @@ namespace svt sal_uInt16 nColumnId ) const SAL_OVERRIDE; using Control::ImplInitSettings; SVT_DLLPRIVATE void ImplInitSettings( bool bFont, bool bForeground, bool bBackground ); - SVT_DLLPRIVATE void DetermineFocus( const sal_uInt16 _nGetFocusFlags = 0); + SVT_DLLPRIVATE void DetermineFocus( const GetFocusFlags _nGetFocusFlags = GetFocusFlags::NONE); static inline void HideAndDisable(CellControllerRef& rController); inline void EnableAndShow() const; diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index 183b2b1ba6b2..b34ed2e0668e 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -317,7 +317,7 @@ protected: SAL_DLLPRIVATE void ImplLoadRes( const ResId& rResId ); public: - SAL_DLLPRIVATE void ImplCallClick( bool bGrabFocus = false, sal_uInt16 nFocusFlags = 0 ); + SAL_DLLPRIVATE void ImplCallClick( bool bGrabFocus = false, GetFocusFlags nFocusFlags = GetFocusFlags::NONE ); SAL_DLLPRIVATE void ImplSetMinimumNWFSize(); protected: diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx index 8caf63f1c390..c3be2c647e6a 100644 --- a/include/vcl/window.hxx +++ b/include/vcl/window.hxx @@ -325,16 +325,25 @@ enum class StateChangedType : sal_uInt16 }; // GetFocusFlags -#define GETFOCUS_TAB ((sal_uInt16)0x0001) -#define GETFOCUS_CURSOR ((sal_uInt16)0x0002) -#define GETFOCUS_MNEMONIC ((sal_uInt16)0x0004) -#define GETFOCUS_F6 ((sal_uInt16)0x0008) -#define GETFOCUS_FORWARD ((sal_uInt16)0x0010) -#define GETFOCUS_BACKWARD ((sal_uInt16)0x0020) -#define GETFOCUS_AROUND ((sal_uInt16)0x0040) -#define GETFOCUS_UNIQUEMNEMONIC ((sal_uInt16)0x0100) -#define GETFOCUS_INIT ((sal_uInt16)0x0200) -#define GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL ((sal_uInt16)0x0400) +// must match constants in css:awt::FocusChangeReason +enum class GetFocusFlags +{ + NONE = 0x0000, + Tab = 0x0001, + Cursor = 0x0002, + Mnemonic = 0x0004, + F6 = 0x0008, + Forward = 0x0010, + Backward = 0x0020, + Around = 0x0040, + UniqueMnemonic = 0x0100, + Init = 0x0200, + FloatWinPopupModeEndCancel = 0x0400, +}; +namespace o3tl +{ + template<> struct typed_flags<GetFocusFlags> : is_typed_flags<GetFocusFlags, 0x077f> {}; +} // Flags for Draw() @@ -563,8 +572,8 @@ public: SAL_DLLPRIVATE Point ImplFrameToOutput( const Point& rPos ); - SAL_DLLPRIVATE void ImplGrabFocus( sal_uInt16 nFlags ); - SAL_DLLPRIVATE void ImplGrabFocusToDocument( sal_uInt16 nFlags ); + SAL_DLLPRIVATE void ImplGrabFocus( GetFocusFlags nFlags ); + SAL_DLLPRIVATE void ImplGrabFocusToDocument( GetFocusFlags nFlags ); SAL_DLLPRIVATE void ImplInvertFocus( const Rectangle& rRect ); SAL_DLLPRIVATE PointerStyle ImplGetMousePointer() const; @@ -578,7 +587,7 @@ public: SAL_DLLPRIVATE void ImplDeleteOverlapBackground(); - SAL_DLLPRIVATE void ImplControlFocus( sal_uInt16 nFlags = 0 ); + SAL_DLLPRIVATE void ImplControlFocus( GetFocusFlags nFlags = GetFocusFlags::NONE ); SAL_DLLPRIVATE void ImplMirrorFramePos( Point &pt ) const; @@ -1134,7 +1143,7 @@ public: bool HasChildPathFocus( bool bSystemWindow = false ) const; bool IsActive() const; bool HasActiveChildFrame(); - sal_uInt16 GetGetFocusFlags() const; + GetFocusFlags GetGetFocusFlags() const; void GrabFocusToDocument(); /** diff --git a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx index c3927578c4cf..376e28d39ad9 100644 --- a/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx +++ b/sc/source/ui/dbgui/PivotLayoutTreeListBase.cxx @@ -128,7 +128,7 @@ void ScPivotLayoutTreeListBase::GetFocus() { SvTreeListBox::GetFocus(); - if( GetGetFocusFlags() & GETFOCUS_MNEMONIC ) + if( GetGetFocusFlags() & GetFocusFlags::Mnemonic ) { SvTreeListEntry* pEntry = mpParent->mpPreviouslyFocusedListBox->GetCurEntry(); if (pEntry) diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index d58f8562baa8..6e156eb71884 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -463,10 +463,10 @@ bool BackingWindow::Notify( NotifyEvent& rNEvt ) void BackingWindow::GetFocus() { - sal_uInt16 nFlags = GetParent()->GetGetFocusFlags(); - if( nFlags & GETFOCUS_F6 ) + GetFocusFlags nFlags = GetParent()->GetGetFocusFlags(); + if( nFlags & GetFocusFlags::F6 ) { - if( nFlags & GETFOCUS_FORWARD ) // F6 + if( nFlags & GetFocusFlags::Forward ) // F6 { mpOpenButton->GrabFocus(); return; diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 56155ddce018..3764de7a0ad2 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -47,10 +47,10 @@ namespace svt namespace { - sal_uInt16 getRealGetFocusFlags( vcl::Window* _pWindow ) + GetFocusFlags getRealGetFocusFlags( vcl::Window* _pWindow ) { - sal_uInt16 nFlags = 0; - while ( _pWindow && !nFlags ) + GetFocusFlags nFlags = GetFocusFlags::NONE; + while ( _pWindow && nFlags == GetFocusFlags::NONE ) { nFlags = _pWindow->GetGetFocusFlags( ); _pWindow = _pWindow->GetParent(); @@ -228,7 +228,7 @@ namespace svt void EditBrowseBox::LoseFocus() { BrowseBox::LoseFocus(); - DetermineFocus( 0 ); + DetermineFocus( GetFocusFlags::NONE ); } @@ -747,7 +747,7 @@ namespace svt break; case MouseNotifyEvent::LOSEFOCUS: - DetermineFocus( 0 ); + DetermineFocus( GetFocusFlags::NONE ); break; default: diff --git a/svtools/source/brwbox/editbrowsebox2.cxx b/svtools/source/brwbox/editbrowsebox2.cxx index e3c6d3444a49..8a659ee6d06f 100644 --- a/svtools/source/brwbox/editbrowsebox2.cxx +++ b/svtools/source/brwbox/editbrowsebox2.cxx @@ -133,7 +133,7 @@ void EditBrowseBox::GrabTableFocus() aController->GetWindow().GrabFocus(); } -void EditBrowseBox::DetermineFocus( const sal_uInt16 _nGetFocusFlags ) +void EditBrowseBox::DetermineFocus( const GetFocusFlags _nGetFocusFlags ) { bool bFocus = false; for (vcl::Window* pWindow = Application::GetFocusWindow(); @@ -148,7 +148,7 @@ void EditBrowseBox::DetermineFocus( const sal_uInt16 _nGetFocusFlags ) if ( GetBrowserFlags( ) & EditBrowseBoxFlags::SMART_TAB_TRAVEL ) { if ( bHasFocus // we got the focus - && ( _nGetFocusFlags & GETFOCUS_TAB ) // using the TAB key + && ( _nGetFocusFlags & GetFocusFlags::Tab ) // using the TAB key ) { long nRows = GetRowCount(); @@ -156,7 +156,7 @@ void EditBrowseBox::DetermineFocus( const sal_uInt16 _nGetFocusFlags ) if ( ( nRows > 0 ) && ( nCols > 0 ) ) { - if ( _nGetFocusFlags & GETFOCUS_FORWARD ) + if ( _nGetFocusFlags & GetFocusFlags::Forward ) { if ( GetColumnId( 0 ) != HandleColumnId ) { @@ -168,7 +168,7 @@ void EditBrowseBox::DetermineFocus( const sal_uInt16 _nGetFocusFlags ) GoToRowColumnId( 0, GetColumnId( 1 ) ); } } - else if ( _nGetFocusFlags & GETFOCUS_BACKWARD ) + else if ( _nGetFocusFlags & GetFocusFlags::Backward ) { GoToRowColumnId( nRows - 1, GetColumnId( nCols -1 ) ); } diff --git a/svx/source/accessibility/AccessibleFrameSelector.cxx b/svx/source/accessibility/AccessibleFrameSelector.cxx index 40c175fb3976..2227951f752c 100644 --- a/svx/source/accessibility/AccessibleFrameSelector.cxx +++ b/svx/source/accessibility/AccessibleFrameSelector.cxx @@ -465,20 +465,20 @@ void AccFrameSelector::NotifyFocusListeners(bool bGetFocus) aEvent.FocusFlags = 0; if(bGetFocus) { - sal_uInt16 nFocusFlags = mpFrameSel->GetGetFocusFlags(); - if(nFocusFlags&GETFOCUS_TAB) + GetFocusFlags nFocusFlags = mpFrameSel->GetGetFocusFlags(); + if(nFocusFlags & GetFocusFlags::Tab) aEvent.FocusFlags |= AwtFocusChangeReason::TAB; - if(nFocusFlags&GETFOCUS_CURSOR) + if(nFocusFlags & GetFocusFlags::Cursor) aEvent.FocusFlags |= AwtFocusChangeReason::CURSOR; - if(nFocusFlags&GETFOCUS_MNEMONIC) + if(nFocusFlags & GetFocusFlags::Mnemonic) aEvent.FocusFlags |= AwtFocusChangeReason::MNEMONIC; - if(nFocusFlags&GETFOCUS_FORWARD) + if(nFocusFlags & GetFocusFlags::Forward) aEvent.FocusFlags |= AwtFocusChangeReason::FORWARD; - if(nFocusFlags&GETFOCUS_BACKWARD) + if(nFocusFlags & GetFocusFlags::Backward) aEvent.FocusFlags |= AwtFocusChangeReason::BACKWARD; - if(nFocusFlags&GETFOCUS_AROUND) + if(nFocusFlags & GetFocusFlags::Around) aEvent.FocusFlags |= AwtFocusChangeReason::AROUND; - if(nFocusFlags&GETFOCUS_UNIQUEMNEMONIC) + if(nFocusFlags & GetFocusFlags::UniqueMnemonic) aEvent.FocusFlags |= AwtFocusChangeReason::UNIQUEMNEMONIC; } aEvent.Temporary = sal_False; diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 27763ce1a67f..3ea3c5479efd 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -3441,7 +3441,7 @@ void FmXGridCell::onWindowEvent( const sal_uIntPtr _nEventId, const vcl::Window& awt::FocusEvent aEvent; aEvent.Source = *this; - aEvent.FocusFlags = _rWindow.GetGetFocusFlags(); + aEvent.FocusFlags = static_cast<sal_Int16>(_rWindow.GetGetFocusFlags()); aEvent.Temporary = sal_False; if ( bFocusGained ) diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index 7e9046d2008d..4486925cd87b 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -272,7 +272,7 @@ IMPL_LINK(SwAddressControl_Impl, ScrollHdl_Impl, ScrollBar*, pScroll) IMPL_LINK(SwAddressControl_Impl, GotFocusHdl_Impl, Edit*, pEdit) { - if(0 != (GETFOCUS_TAB & pEdit->GetGetFocusFlags())) + if(GetFocusFlags::Tab & pEdit->GetGetFocusFlags()) { Rectangle aRect(pEdit->GetPosPixel(), pEdit->GetSizePixel()); MakeVisible(aRect); diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index 5a04751c036f..91dd1106011e 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -1151,7 +1151,7 @@ IMPL_LINK(SwAssignFieldsControl, MatchHdl_Impl, ListBox*, pBox) IMPL_LINK(SwAssignFieldsControl, GotFocusHdl_Impl, ListBox*, pBox) { - if(0 != (GETFOCUS_TAB & pBox->GetGetFocusFlags())) + if(GetFocusFlags::Tab & pBox->GetGetFocusFlags()) { sal_Int32 nIndex = 0; for(auto aLBIter = m_aMatches.begin(); aLBIter != m_aMatches.end(); ++aLBIter, ++nIndex) diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 4dcb18ded161..0324d6fe2f7e 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -3576,7 +3576,7 @@ IMPL_LINK(SwTokenWindow, TbxFocusBtnHdl, SwTOXButton*, pBtn ) void SwTokenWindow::GetFocus() { - if(GETFOCUS_TAB & GetGetFocusFlags()) + if(GetFocusFlags::Tab & GetGetFocusFlags()) { if (!aControlList.empty()) { diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 5962c95a5647..b14817387387 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -1835,7 +1835,8 @@ void VCLXToolkit::callFocusListeners(::VclSimpleEvent const * pEvent, xNext = pFocus->GetComponentInterface(true); css::awt::FocusEvent aAwtEvent( static_cast< css::awt::XWindow * >(pWindow->GetWindowPeer()), - pWindow->GetGetFocusFlags(), xNext, false); + static_cast<sal_Int16>(pWindow->GetGetFocusFlags()), + xNext, false); for (::sal_Int32 i = 0; i < aListeners.getLength(); ++i) { css::uno::Reference< css::awt::XFocusListener > xListener( diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index f293581c4109..bf49bbe97e1f 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -582,7 +582,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { ::com::sun::star::awt::FocusEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags(); + aEvent.FocusFlags = static_cast<sal_Int16>(rVclWindowEvent.GetWindow()->GetGetFocusFlags()); aEvent.Temporary = sal_False; mpImpl->getFocusListeners().focusGained( aEvent ); } @@ -604,7 +604,7 @@ void VCLXWindow::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent ) { ::com::sun::star::awt::FocusEvent aEvent; aEvent.Source = (::cppu::OWeakObject*)this; - aEvent.FocusFlags = rVclWindowEvent.GetWindow()->GetGetFocusFlags(); + aEvent.FocusFlags = static_cast<sal_Int16>(rVclWindowEvent.GetWindow()->GetGetFocusFlags()); aEvent.Temporary = sal_False; vcl::Window* pNext = Application::GetFocusWindow(); diff --git a/vcl/inc/window.h b/vcl/inc/window.h index bcb6f062d42c..1b6cc55d96cc 100644 --- a/vcl/inc/window.h +++ b/vcl/inc/window.h @@ -60,6 +60,7 @@ enum class MouseEventModifiers; enum class MouseNotifyEvent; enum class ActivateModeFlags; enum class DialogControlFlags; +enum class GetFocusFlags; namespace com { namespace sun { namespace star { @@ -274,7 +275,7 @@ public: ControlPart mnNativeBackground; sal_uInt16 mnWaitCount; sal_uInt16 mnPaintFlags; - sal_uInt16 mnGetFocusFlags; + GetFocusFlags mnGetFocusFlags; sal_uInt16 mnParentClipMode; ActivateModeFlags mnActivateMode; DialogControlFlags mnDlgCtrlFlags; diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 2ee5d5e13f65..9998c2292e03 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2264,7 +2264,7 @@ void RadioButton::ImplUncheckAllOther() } } -void RadioButton::ImplCallClick( bool bGrabFocus, sal_uInt16 nFocusFlags ) +void RadioButton::ImplCallClick( bool bGrabFocus, GetFocusFlags nFocusFlags ) { mbStateChanged = !mbChecked; mbChecked = true; diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 6ff15da2302e..e83ae507aa7d 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -1901,7 +1901,7 @@ void Edit::GetFocus() SelectionOptions nSelOptions = GetSettings().GetStyleSettings().GetSelectionOptions(); if ( !( GetStyle() & (WB_NOHIDESELECTION|WB_READONLY) ) - && ( GetGetFocusFlags() & (GETFOCUS_INIT|GETFOCUS_TAB|GETFOCUS_CURSOR|GETFOCUS_MNEMONIC) ) ) + && ( GetGetFocusFlags() & (GetFocusFlags::Init|GetFocusFlags::Tab|GetFocusFlags::Cursor|GetFocusFlags::Mnemonic) ) ) { if ( nSelOptions & SelectionOptions::ShowFirst ) { diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index fc3cad5cb4e6..76b9e391e6a4 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -646,7 +646,7 @@ void TabControl::ImplChangeTabPage( sal_uInt16 nId, sal_uInt16 nOldId ) sal_uInt16 n = 0; vcl::Window* pFirstChild = pPage->ImplGetDlgWindow( n, GetDlgWindowType::First ); if ( pFirstChild ) - pFirstChild->ImplControlFocus( GETFOCUS_INIT ); + pFirstChild->ImplControlFocus( GetFocusFlags::Init ); else GrabFocus(); } diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx index a58c625cd442..f4250be4de59 100644 --- a/vcl/source/window/dialog.cxx +++ b/vcl/source/window/dialog.cxx @@ -1084,7 +1084,7 @@ void Dialog::GrabFocusToFirstControl() pFocusControl = ImplGetDlgWindow( n, GetDlgWindowType::First ); } if ( pFocusControl ) - pFocusControl->ImplControlFocus( GETFOCUS_INIT ); + pFocusControl->ImplControlFocus( GetFocusFlags::Init ); } void Dialog::GetDrawWindowBorder( sal_Int32& rLeftBorder, sal_Int32& rTopBorder, sal_Int32& rRightBorder, sal_Int32& rBottomBorder ) const diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx index ece10d9c145f..5cd07062cfa5 100644 --- a/vcl/source/window/dlgctrl.cxx +++ b/vcl/source/window/dlgctrl.cxx @@ -474,9 +474,9 @@ vcl::Window* ImplFindAccelWindow( vcl::Window* pParent, sal_uInt16& rIndex, sal_ namespace vcl { -void Window::ImplControlFocus( sal_uInt16 nFlags ) +void Window::ImplControlFocus( GetFocusFlags nFlags ) { - if ( nFlags & GETFOCUS_MNEMONIC ) + if ( nFlags & GetFocusFlags::Mnemonic ) { if ( GetType() == WINDOW_RADIOBUTTON ) { @@ -488,7 +488,7 @@ void Window::ImplControlFocus( sal_uInt16 nFlags ) else { ImplGrabFocus( nFlags ); - if ( nFlags & GETFOCUS_UNIQUEMNEMONIC ) + if ( nFlags & GetFocusFlags::UniqueMnemonic ) { if ( GetType() == WINDOW_CHECKBOX ) static_cast<CheckBox*>(this)->ImplCheck(); @@ -543,7 +543,7 @@ namespace if (isSuitableDestination(pWindow)) { - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_FORWARD ); + pWindow->ImplControlFocus( GetFocusFlags::Cursor | GetFocusFlags::Forward ); return true; } } @@ -554,7 +554,7 @@ namespace if (isSuitableDestination(pWindow)) { - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_FORWARD ); + pWindow->ImplControlFocus( GetFocusFlags::Cursor | GetFocusFlags::Forward ); return true; } } @@ -642,18 +642,18 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if ( bKeyInput && !pButtonWindow && (nDlgCtrlFlags & DialogControlFlags::Return) ) { GetDlgWindowType nType; - sal_uInt16 nGetFocusFlags = GETFOCUS_TAB; + GetFocusFlags nGetFocusFlags = GetFocusFlags::Tab; sal_uInt16 nNewIndex; sal_uInt16 iStart; if ( aKeyCode.IsShift() ) { nType = GetDlgWindowType::Prev; - nGetFocusFlags |= GETFOCUS_BACKWARD; + nGetFocusFlags |= GetFocusFlags::Backward; } else { nType = GetDlgWindowType::Next; - nGetFocusFlags |= GETFOCUS_FORWARD; + nGetFocusFlags |= GetFocusFlags::Forward; } iStart = i; pTempWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex ); @@ -665,12 +665,12 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if ( nType == GetDlgWindowType::Prev ) { if ( nNewIndex > iStart ) - nGetFocusFlags |= GETFOCUS_AROUND; + nGetFocusFlags |= GetFocusFlags::Around; } else { if ( nNewIndex < iStart ) - nGetFocusFlags |= GETFOCUS_AROUND; + nGetFocusFlags |= GetFocusFlags::Around; } pTempWindow->ImplControlFocus( nGetFocusFlags ); return true; @@ -690,11 +690,11 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) NotifyEvent aNEvt1( MouseNotifyEvent::LOSEFOCUS, pSWindow ); if ( !ImplCallPreNotify( aNEvt1 ) ) pSWindow->CompatLoseFocus(); - pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND; + pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GetFocusFlags::Around; NotifyEvent aNEvt2( MouseNotifyEvent::GETFOCUS, pSWindow ); if ( !ImplCallPreNotify( aNEvt2 ) ) pSWindow->CompatGetFocus(); - pSWindow->mpWindowImpl->mnGetFocusFlags = 0; + pSWindow->mpWindowImpl->mnGetFocusFlags = GetFocusFlags::NONE; return true; } } @@ -732,7 +732,7 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if ( !aKeyCode.IsMod2() ) { GetDlgWindowType nType; - sal_uInt16 nGetFocusFlags = GETFOCUS_TAB; + GetFocusFlags nGetFocusFlags = GetFocusFlags::Tab; sal_uInt16 nNewIndex; bool bFormular = false; @@ -807,12 +807,12 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if ( aKeyCode.IsShift() ) { nType = GetDlgWindowType::Prev; - nGetFocusFlags |= GETFOCUS_BACKWARD; + nGetFocusFlags |= GetFocusFlags::Backward; } else { nType = GetDlgWindowType::Next; - nGetFocusFlags |= GETFOCUS_FORWARD; + nGetFocusFlags |= GetFocusFlags::Forward; } vcl::Window* pWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex ); // if this is the same window, simulate a Get/LoseFocus, @@ -822,11 +822,11 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) NotifyEvent aNEvt1( MouseNotifyEvent::LOSEFOCUS, pSWindow ); if ( !ImplCallPreNotify( aNEvt1 ) ) pSWindow->CompatLoseFocus(); - pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND; + pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GetFocusFlags::Around; NotifyEvent aNEvt2( MouseNotifyEvent::GETFOCUS, pSWindow ); if ( !ImplCallPreNotify( aNEvt2 ) ) pSWindow->CompatGetFocus(); - pSWindow->mpWindowImpl->mnGetFocusFlags = 0; + pSWindow->mpWindowImpl->mnGetFocusFlags = GetFocusFlags::NONE; return true; } else if ( pWindow ) @@ -835,12 +835,12 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if ( nType == GetDlgWindowType::Prev ) { if ( nNewIndex > i ) - nGetFocusFlags |= GETFOCUS_AROUND; + nGetFocusFlags |= GetFocusFlags::Around; } else { if ( nNewIndex < i ) - nGetFocusFlags |= GETFOCUS_AROUND; + nGetFocusFlags |= GetFocusFlags::Around; } pWindow->ImplControlFocus( nGetFocusFlags ); return true; @@ -868,7 +868,7 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if (isSuitableDestination(pWindow)) { if ( pWindow != pSWindow ) - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); + pWindow->ImplControlFocus( GetFocusFlags::Cursor | GetFocusFlags::Backward ); return true; } @@ -898,7 +898,7 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) if (isSuitableDestination(pWindow)) { - pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD ); + pWindow->ImplControlFocus( GetFocusFlags::Cursor | GetFocusFlags::Backward ); return true; } @@ -914,9 +914,9 @@ bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, bool bKeyInput ) pSWindow = ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ); if ( pSWindow ) { - sal_uInt16 nGetFocusFlags = GETFOCUS_MNEMONIC; + GetFocusFlags nGetFocusFlags = GetFocusFlags::Mnemonic; if ( pSWindow == ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ) ) - nGetFocusFlags |= GETFOCUS_UNIQUEMNEMONIC; + nGetFocusFlags |= GetFocusFlags::UniqueMnemonic; pSWindow->ImplControlFocus( nGetFocusFlags ); return true; } diff --git a/vcl/source/window/mouse.cxx b/vcl/source/window/mouse.cxx index 1167ac4ef2d7..9114ac093ab1 100644 --- a/vcl/source/window/mouse.cxx +++ b/vcl/source/window/mouse.cxx @@ -195,7 +195,7 @@ static bool IsWindowFocused(const WindowImpl& rWinImpl) return false; } -void Window::ImplGrabFocus( sal_uInt16 nFlags ) +void Window::ImplGrabFocus( GetFocusFlags nFlags ) { // #143570# no focus for destructing windows if( !mpWindowImpl || mpWindowImpl->mbInDispose ) @@ -381,7 +381,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags ) if( pOldFocusWindow && ! aOldFocusDel.IsDead() && ( pOldFocusWindow->GetDialogControlFlags() & DialogControlFlags::FloatWinPopupModeEndCancel ) ) - mpWindowImpl->mnGetFocusFlags |= GETFOCUS_FLOATWIN_POPUPMODEEND_CANCEL; + mpWindowImpl->mnGetFocusFlags |= GetFocusFlags::FloatWinPopupModeEndCancel; NotifyEvent aNEvt( MouseNotifyEvent::GETFOCUS, this ); if ( !ImplCallPreNotify( aNEvt ) && !aDogTag.IsDead() ) CompatGetFocus(); @@ -389,7 +389,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags ) ImplCallActivateListeners( (pOldFocusWindow && ! aOldFocusDel.IsDead()) ? pOldFocusWindow : NULL ); if( !aDogTag.IsDead() ) { - mpWindowImpl->mnGetFocusFlags = 0; + mpWindowImpl->mnGetFocusFlags = GetFocusFlags::NONE; mpWindowImpl->mbInFocusHdl = false; } } @@ -399,7 +399,7 @@ void Window::ImplGrabFocus( sal_uInt16 nFlags ) } } -void Window::ImplGrabFocusToDocument( sal_uInt16 nFlags ) +void Window::ImplGrabFocusToDocument( GetFocusFlags nFlags ) { vcl::Window *pWin = this; while( pWin ) diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 46aa4e117121..9b4767e59430 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -80,7 +80,7 @@ static void ImplTaskPaneListGrabFocus( vcl::Window *pWindow, bool bForward ) // that can deal with the focus if( pWindow->ImplIsFloatingWindow() && pWindow->GetWindow( GetWindowType::FirstChild ) ) pWindow = pWindow->GetWindow( GetWindowType::FirstChild ); - pWindow->ImplGrabFocus( GETFOCUS_F6 | (bForward ? GETFOCUS_FORWARD : GETFOCUS_BACKWARD)); + pWindow->ImplGrabFocus( GetFocusFlags::F6 | (bForward ? GetFocusFlags::Forward : GetFocusFlags::Backward)); } TaskPaneList::TaskPaneList() @@ -178,7 +178,7 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent) // Ctrl-F6 goes directly to the document if( !pWin->IsDialog() && aKeyCode.IsMod1() && !aKeyCode.IsShift() ) { - pWin->ImplGrabFocusToDocument( GETFOCUS_F6 ); + pWin->ImplGrabFocusToDocument( GetFocusFlags::F6 ); return true; } @@ -204,7 +204,7 @@ bool TaskPaneList::HandleKeyEvent(const KeyEvent& rKeyEvent) // we did not find another taskpane, so // put focus back into document - pWin->ImplGrabFocusToDocument( GETFOCUS_F6 | (bForward ? GETFOCUS_FORWARD : GETFOCUS_BACKWARD)); + pWin->ImplGrabFocusToDocument( GetFocusFlags::F6 | (bForward ? GetFocusFlags::Forward : GetFocusFlags::Backward)); } return true; diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx index 59bf3473775b..53ef7fa7494f 100644 --- a/vcl/source/window/toolbox.cxx +++ b/vcl/source/window/toolbox.cxx @@ -4379,7 +4379,7 @@ bool ToolBox::Notify( NotifyEvent& rNEvt ) ImplChangeHighlight( ImplGetItem( mnLastFocusItemId ) ); mnLastFocusItemId = 0; } - else if( (GetGetFocusFlags() & (GETFOCUS_BACKWARD|GETFOCUS_TAB) ) == (GETFOCUS_BACKWARD|GETFOCUS_TAB)) + else if( (GetGetFocusFlags() & (GetFocusFlags::Backward|GetFocusFlags::Tab) ) == (GetFocusFlags::Backward|GetFocusFlags::Tab)) // Shift-TAB was pressed in the parent ImplChangeHighlightUpDn( false ); else @@ -4993,7 +4993,7 @@ bool ToolBox::ImplActivateItem( vcl::KeyCode aKeyCode ) { ImplHideFocus(); mbChangingHighlight = true; // avoid focus change due to loss of focus - pToolItem->mpWindow->ImplControlFocus( GETFOCUS_TAB ); + pToolItem->mpWindow->ImplControlFocus( GetFocusFlags::Tab ); mbChangingHighlight = false; } else @@ -5249,7 +5249,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) vcl::Window *pFocusWindow = Application::GetFocusWindow(); ImplHideFocus(); mbChangingHighlight = true; // avoid focus change due to loss of focus - pItem->mpWindow->ImplControlFocus( GETFOCUS_TAB ); + pItem->mpWindow->ImplControlFocus( GetFocusFlags::Tab ); mbChangingHighlight = false; if( pFocusWindow != Application::GetFocusWindow() ) Application::GetFocusWindow()->KeyInput( rKEvt ); @@ -5275,7 +5275,7 @@ void ToolBox::KeyInput( const KeyEvent& rKEvt ) sal_uInt16 n = 0; vcl::Window *pFocusControl = pParent->ImplGetDlgWindow( n, GetDlgWindowType::First ); if ( pFocusControl && pFocusControl != this ) - pFocusControl->ImplControlFocus( GETFOCUS_INIT ); + pFocusControl->ImplControlFocus( GetFocusFlags::Init ); } mnKeyModifier = 0; @@ -5354,7 +5354,7 @@ sal_uInt16 ToolBox::ImplFindItemPos( const ImplToolItem* pItem, const std::vecto void ToolBox::ChangeHighlight( sal_uInt16 nPos ) { if ( nPos < GetItemCount() ) { - ImplGrabFocus( 0 ); + ImplGrabFocus( GetFocusFlags::NONE ); ImplChangeHighlight ( ImplGetItem ( GetItemId ( (sal_uInt16) nPos ) ), false ); } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index c93e6c0f6ea6..a26e42e259f7 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -643,7 +643,7 @@ WindowImpl::WindowImpl( WindowType nType ) mnExtendedStyle = 0; // extended style (init in ImplInitWindow) mnPrevExtendedStyle = 0; // prevstyle (set in SetExtendedStyle) mnType = nType; // type - mnGetFocusFlags = 0; // Flags fuer GetFocus()-Aufruf + mnGetFocusFlags = GetFocusFlags::NONE; // Flags fuer GetFocus()-Aufruf mnWaitCount = 0; // Wait-Count (>1 == Warte-MousePointer) mnPaintFlags = 0; // Flags for ImplCallPaint mnParentClipMode = 0; // Flags for Parent-ClipChildren-Mode @@ -3127,7 +3127,7 @@ void Window::SetUpdateMode( bool bUpdate ) void Window::GrabFocus() { - ImplGrabFocus( 0 ); + ImplGrabFocus( GetFocusFlags::NONE ); } bool Window::HasFocus() const @@ -3137,7 +3137,7 @@ bool Window::HasFocus() const void Window::GrabFocusToDocument() { - ImplGrabFocusToDocument(0); + ImplGrabFocusToDocument(GetFocusFlags::NONE); } void Window::SetFakeFocus( bool bFocus ) diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 99fd9ce19e09..7b2974ebcdad 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -1330,7 +1330,7 @@ bool Window::IsActive() const return mpWindowImpl->mbActive; } -sal_uInt16 Window::GetGetFocusFlags() const +GetFocusFlags Window::GetGetFocusFlags() const { return mpWindowImpl->mnGetFocusFlags; } |