37 #include <com/sun/star/i18n/XCharacterClassification.hpp>
47 return ( pNonLayoutParent
64 pResult = pNonLayoutParent;
74 assert(pWindow->
GetType() == WindowType::TABCONTROL);
79 const TabPage* pTempTabPage = pTabControl->GetTabPage(pTabControl->GetCurPageId());
87 return const_cast<TabPage*
>(pTempTabPage);
100 pParent != pNewParent; pParent = pNewParent);
107 if (pWindow && pParent->
GetType() == WindowType::TABCONTROL)
121 if (pWindow->
GetType() == WindowType::TABCONTROL)
130 pFoundWindow = pWindow;
138 pNextWindow = pWindow;
142 assert(!pFoundWindow || (pFoundWindow == pFoundWindow->
ImplGetWindow()));
154 sal_uInt16
n2 = nIndex;
164 if ( (nIndex < n2) && n )
206 sal_uInt16 nFormStart, sal_uInt16 nFormEnd,
209 SAL_WARN_IF( (nIndex < nFormStart) || (nIndex > nFormEnd),
"vcl",
210 "Window::ImplGetDlgWindow() - nIndex not in Form" );
215 sal_uInt16 nStartIndex;
222 if ( i > nFormStart )
231 if ( WindowType::TOOLBOX == pWindow->
GetType() )
240 while ( i != nIndex );
255 if ( (i > nFormEnd) || (i < nFormStart) )
262 if (i <= nFormEnd && pWindow)
265 sal_uInt16 nStartIndex2 = i;
266 sal_uInt16 nOldIndex = i+1;
272 if ( WindowType::TOOLBOX == pWindow->
GetType() )
286 if ( (i > nFormEnd) || (i < nFormStart) )
291 while (i != nStartIndex && i != nStartIndex2 && pWindow);
293 if ( (i == nStartIndex2) && pWindow &&
303 if ( pWindow->
GetType() == WindowType::TABCONTROL )
308 if ( pWindow->
IsChild( pNextWindow ) )
309 pWindow = pNextWindow;
328 sal_uInt16& rFormStart, sal_uInt16& rFormEnd )
334 sal_uInt16 nSecond_i = 0;
335 sal_uInt16 nFormStart = 0;
336 sal_uInt16 nSecondFormStart = 0;
342 if( pWindow ==
nullptr )
355 pSecondWindow = pSWindow;
357 nSecondFormStart = nFormStart;
358 if ( pSWindow == pWindow )
370 if ( !pSecondWindow )
374 pSWindow = pSecondWindow;
376 nFormStart = nSecondFormStart;
382 rFormStart = nFormStart;
385 sal_Int32 nIteration = 0;
397 if ( pTempWindow && pTempWindow == pFirstChildWindow )
404 if ( nIteration >= 2 )
407 SAL_WARN(
"vcl",
"It seems to be an endless loop!" );
413 while ( pTempWindow );
420 sal_uInt16 nFormStart, sal_uInt16 nFormEnd,
bool bCheckEnable )
422 SAL_WARN_IF( (rIndex < nFormStart) || (rIndex > nFormEnd),
"vcl",
423 "Window::ImplFindAccelWindow() - rIndex not in Form" );
426 sal_uInt16 nStart = rIndex;
427 sal_uInt16
i = rIndex;
430 uno::Reference<i18n::XCharacterClassification>
const& xCharClass(
ImplGetCharClass());
433 cCharCode = xCharClass->toUpper( OUString(cCharCode), 0, 1, rLocale )[0];
442 sal_Int32
nPos = aStr.indexOf(
'~' );
445 cCompareChar = aStr[nPos+1];
446 cCompareChar = xCharClass->toUpper( OUString(cCompareChar), 0, 1, rLocale )[0];
447 if ( cCompareChar == cCharCode )
449 if (pWindow->
GetType() == WindowType::FIXEDTEXT)
454 "vcl.a11y",
"label missing mnemonic_widget?");
456 return pMnemonicWidget;
460 if ( (pWindow->
GetType() == WindowType::FIXEDTEXT) ||
461 (pWindow->
GetType() == WindowType::FIXEDLINE) ||
462 (pWindow->
GetType() == WindowType::GROUPBOX) )
467 nPos = aStr.indexOf(
'~', nPos+1 );
476 sal_uInt16 nChildIndex;
477 sal_uInt16 nChildFormStart;
478 sal_uInt16 nChildFormEnd;
482 nChildIndex, nChildFormStart, nChildFormEnd );
484 nChildFormStart, nChildFormEnd,
525 if (
GetType() == WindowType::RADIOBUTTON )
527 if (bUniqueMnemonic && !static_cast<RadioButton*>(
this)->IsChecked())
528 static_cast<RadioButton*
>(
this)->ImplCallClick(
true, nFlags );
537 if (
GetType() == WindowType::CHECKBOX )
538 static_cast<CheckBox*
>(
this)->ImplCheck();
541 static_cast<PushButton*
>(
this)->SetPressed(
true );
542 static_cast<PushButton*
>(
this)->SetPressed(
false );
550 if (
GetType() == WindowType::RADIOBUTTON )
552 if ( !static_cast<RadioButton*>(
this)->IsChecked() )
553 static_cast<RadioButton*>(
this)->ImplCallClick(
true, nFlags );
566 bool isSuitableDestination(
vcl::Window const *pWindow)
572 (pWindow->
GetType() != WindowType::WINDOW &&
573 pWindow->
GetType() != WindowType::WORKWINDOW && pWindow->
GetType() != WindowType::CONTROL)
579 std::vector<VclPtr<RadioButton> >::iterator aI(aStart);
581 if (aStart != rGroup.end())
584 aI = std::find_if(aI, rGroup.end(), isSuitableDestination);
585 if (aI != rGroup.end())
591 aI = std::find_if(rGroup.begin(), aStart, isSuitableDestination);
601 bool nextInGroup(
RadioButton *pSourceWindow,
bool bBackward)
605 if (aGroup.size() < 2)
609 std::reverse(aGroup.begin(), aGroup.end());
613 assert(aStart != aGroup.end());
615 return focusNextInGroup(aStart, aGroup);
624 sal_uInt16 nKeyCode = aKeyCode.
GetCode();
630 sal_uInt16 iButtonStart;
633 sal_uInt16 nFormStart;
644 nIndex, nFormStart, nFormEnd );
650 pTempWindow = pSWindow;
654 if ( pTempWindow ==
this )
658 while ( pTempWindow );
660 pButtonWindow =
nullptr;
666 iButtonStart = iButton;
667 while ( pButtonWindow )
674 if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
675 pButtonWindow =
nullptr;
682 sal_uInt16 nNewIndex;
695 pTempWindow =
ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
696 while ( pTempWindow && (pTempWindow != pSWindow) )
703 if ( nNewIndex > iStart )
708 if ( nNewIndex < iStart )
717 pTempWindow =
ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
719 if ( (i <= iStart) || (i > nFormEnd) )
720 pTempWindow =
nullptr;
724 if ( pTempWindow && (pTempWindow == pSWindow) )
742 iButtonStart = iButton;
743 while ( pButtonWindow )
745 if ( pButtonWindow->
GetType() == WindowType::CANCELBUTTON )
749 if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
750 pButtonWindow =
nullptr;
755 if (
mpWindowImpl->mpDlgCtrlDownWindow.get() != pButtonWindow )
763 else if ( bKeyInput )
770 sal_uInt16 nNewIndex;
782 while ( pTempWindow )
790 if ( iTemp <= nIndex )
791 pFormFirstWindow = pPrevFirstFormFirstWindow;
792 pPrevFirstFormFirstWindow = pTempWindow;
796 if ( (iTemp > nIndex) && !pFormFirstWindow )
797 pFormFirstWindow = pTempWindow;
799 pLastFormFirstWindow = pTempWindow;
804 pTempWindow =
nullptr;
809 if ( !pFormFirstWindow )
812 pFormFirstWindow = pLastFormFirstWindow;
814 pFormFirstWindow = pFirstFormFirstWindow;
817 sal_uInt16 nFoundFormStart = 0;
818 sal_uInt16 nFoundFormEnd = 0;
819 sal_uInt16 nTempIndex = 0;
821 nFoundFormStart, nFoundFormEnd ) )
823 nTempIndex = nFoundFormStart;
825 if ( pFormFirstWindow )
855 if ( pWindow == pSWindow )
889 if (pSWindow->
GetType() == WindowType::RADIOBUTTON)
890 return nextInGroup(static_cast<RadioButton*>(pSWindow),
true);
903 if (isSuitableDestination(pWindow))
905 if ( pWindow != pSWindow )
910 if ( nStyle & WB_GROUP )
920 if (pSWindow->
GetType() == WindowType::RADIOBUTTON)
921 return nextInGroup(static_cast<RadioButton*>(pSWindow),
false);
934 if (isSuitableDestination(pWindow))
962 if (isSuitableDestination(pButtonWindow))
972 static_cast<PushButton*
>(pButtonWindow)->SetPressed(
true );
975 else if (
mpWindowImpl->mpDlgCtrlDownWindow.get() == pButtonWindow )
978 static_cast<PushButton*
>(pButtonWindow)->SetPressed(
false );
979 static_cast<PushButton*
>(pButtonWindow)->Click();
995 while ( pDlgCtrlParent &&
1009 sal_uInt16 nFormStart;
1010 sal_uInt16 nFormEnd;
1015 while ( pDlgCtrlParent &&
1025 nIndex, nFormStart, nFormEnd );
1030 if ( pWindow && (pWindow != pSWindow) )
1041 sal_uInt16 nFormStart;
1042 sal_uInt16 nFormEnd;
1059 pOldDefButton = pPushButton;
1061 pNewDefButton = pPushButton;
1063 pNewDefButton = pPushButton;
1067 if ( !i || (i > nFormEnd) )
1076 pNewDefButton =
nullptr;
1078 (i < nFormStart) || (i > nFormEnd) )
1079 pNewDefButton =
nullptr;
1082 if ( pOldDefButton != pNewDefButton )
1084 if ( pOldDefButton )
1086 if ( pNewDefButton )
1105 sal_uInt16 nFormStart;
1106 sal_uInt16 nFormEnd;
1125 sal_uInt16
nCode = 0;
1126 if( nAccel >=
'a' && nAccel <=
'z' )
1127 nCode =
KEY_A + (nAccel-
'a');
1128 else if( nAccel >=
'A' && nAccel <=
'Z' )
1129 nCode =
KEY_A + (nAccel-
'A');
1130 else if( nAccel >=
'0' && nAccel <=
'9' )
1131 nCode =
KEY_0 + (nAccel-
'0');
1132 else if( nAccel ==
'.' )
1134 else if( nAccel ==
'-' )
1136 vcl::KeyCode aKeyCode( nCode,
false,
false,
true,
false );
1137 aKeyEvent =
KeyEvent( nAccel, aKeyCode );
1150 nPos = rStr.indexOf(
'~', nPos );
1151 if( nPos != -1 && nPos < rStr.getLength() )
1152 nChar = rStr[ ++nPos ];
1155 }
while( nChar ==
'~' );
bool IsInputEnabled() const
vcl::Window * ImplGetWindow() const
if this is a proxy return the client, otherwise itself
bool isVisibleInLayout(const vcl::Window *pWindow)
vcl::Window * lastLogicalChildOfParent(const vcl::Window *pTopLevel)
bool ImplCallPreNotify(NotifyEvent &rEvt)
static vcl::Window * ImplGetNextWindow(vcl::Window *pParent, sal_uInt16 n, sal_uInt16 &nIndex, bool bTestEnable)
SAL_DLLPRIVATE void CompatLoseFocus()
const LanguageTag & GetUILanguageTag() const
WinBits const WB_NODIALOGCONTROL
static void ImplDlgCtrlUpdateDefButton(vcl::Window *pParent, vcl::Window *pFocusWindow, bool bGetFocus)
static const AllSettings & GetSettings()
Gets the application's settings.
constexpr sal_uInt16 KEY_A
constexpr sal_uInt16 KEY_0
SAL_DLLPRIVATE void ImplGrabFocus(GetFocusFlags nFlags)
sal_uInt16 GetCode() const
KeyEvent GetActivationKey() const
bool HasChildPathFocus(bool bSystemWindow=false) const
constexpr sal_uInt16 KEY_UP
const css::lang::Locale & getLocale(bool bResolveSystem=true) const
DialogControlFlags GetDialogControlFlags() const
SAL_DLLPRIVATE bool ImplIsOverlapWindow() const
SAL_DLLPRIVATE vcl::Window * ImplFindDlgCtrlWindow(vcl::Window *pWindow)
static bool lcl_ToolBoxTabStop(Window *pWindow)
WinBits const WB_DEFBUTTON
SAL_DLLPRIVATE void CompatGetFocus()
vcl::Window * nextLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
virtual OUString GetText() const
SAL_DLLPRIVATE void ImplControlFocus(GetFocusFlags nFlags=GetFocusFlags::NONE)
SAL_DLLPRIVATE vcl::Window * ImplGetDlgWindow(sal_uInt16 n, GetDlgWindowType nType, sal_uInt16 nStart=0, sal_uInt16 nEnd=0xFFFF, sal_uInt16 *pIndex=nullptr)
bool isContainerWindow(const vcl::Window &rWindow)
static bool ImplHasIndirectTabParent(vcl::Window *pWindow)
vcl::Window * firstLogicalChildOfParent(const vcl::Window *pTopLevel)
constexpr sal_uInt16 KEY_DOWN
vcl::Window * ImplGetChildWindow(vcl::Window *pParent, sal_uInt16 n, sal_uInt16 &nIndex, bool bTestEnable)
WinBits const WB_DIALOGCONTROL
SAL_DLLPRIVATE void ImplDlgCtrlFocusChanged(vcl::Window *pWindow, bool bGetFocus)
bool IsChild(const vcl::Window *pWindow) const
SAL_DLLPRIVATE bool ImplDlgCtrl(const KeyEvent &rKEvt, bool bKeyInput)
bool isEnabledInLayout(const vcl::Window *pWindow)
static vcl::Window * ImplGetTopParentOfTabHierarchy(vcl::Window *pParent)
WinBits const WB_CHILDDLGCTRL
std::unique_ptr< WindowImpl > mpWindowImpl
SAL_DLLPRIVATE vcl::Window * ImplGetParent() const
SAL_DLLPRIVATE bool ImplIsPushButton() const
vcl::Window * ImplFindAccelWindow(vcl::Window *pParent, sal_uInt16 &rIndex, sal_Unicode cCharCode, sal_uInt16 nFormStart, sal_uInt16 nFormEnd, bool bCheckEnable)
vcl::Window * GetParent() const
constexpr sal_uInt16 KEY_RETURN
vcl::Window * GetWindow(GetWindowType nType) const
constexpr sal_uInt16 KEY_RIGHT
SAL_DLLPRIVATE void ImplDlgCtrlNextWindow()
SAL_DLLPRIVATE bool ImplHasDlgCtrl() const
const vcl::KeyCode & GetKeyCode() const
static vcl::Window * GetFocusWindow()
Get the currently focused window.
vcl::Window * ImplFindDlgCtrlWindow(vcl::Window *pParent, vcl::Window *pWindow, sal_uInt16 &rIndex, sal_uInt16 &rFormStart, sal_uInt16 &rFormEnd)
constexpr sal_uInt16 KEY_SUBTRACT
uno::Reference< i18n::XCharacterClassification > const & ImplGetCharClass()
vcl::Window * prevLogicalChildOfParent(const vcl::Window *pTopLevel, const vcl::Window *pChild)
#define SAL_WARN_IF(condition, area, stream)
constexpr sal_uInt16 KEY_ESCAPE
bool IsDialogControlStart() const
sal_Unicode getAccel(const OUString &rStr)
sal_Unicode GetCharCode() const
static vcl::Window * ImplGetSubChildWindow(vcl::Window *pParent, sal_uInt16 n, sal_uInt16 &nIndex)
vcl::Window * get_mnemonic_widget() const
SAL_DLLPRIVATE bool ImplIsWindowOrChild(const vcl::Window *pWindow, bool bSystemWindow=false) const
vcl::Window * getNonLayoutParent(vcl::Window *pWindow)
constexpr sal_uInt16 KEY_POINT
WindowType GetType() const
#define SAL_WARN(area, stream)
static vcl::Window * ImplGetCurTabWindow(const vcl::Window *pWindow)
constexpr sal_uInt16 KEY_LEFT
vcl::Window * GetAccessibleRelationLabeledBy() const
void SetMnemonicActivateHdl(const Link< vcl::Window &, bool > &rLink)
constexpr sal_uInt16 KEY_TAB