36 #include <com/sun/star/i18n/XCharacterClassification.hpp>
46 return ( pNonLayoutParent
63 pResult = pNonLayoutParent;
78 const TabPage* pTempTabPage = pTabControl->GetTabPage(pTabControl->GetCurPageId());
86 return const_cast<TabPage*
>(pTempTabPage);
99 pParent != pNewParent; pParent = pNewParent);
106 if (pWindow && pParent->
GetType() == WindowType::TABCONTROL)
120 if (pWindow->
GetType() == WindowType::TABCONTROL)
129 pFoundWindow = pWindow;
137 pNextWindow = pWindow;
153 sal_uInt16
n2 = nIndex;
163 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,
523 if (
GetType() == WindowType::RADIOBUTTON )
525 if ( !static_cast<RadioButton*>(
this)->IsChecked() )
526 static_cast<RadioButton*>(
this)->ImplCallClick(
true, nFlags );
535 if (
GetType() == WindowType::CHECKBOX )
536 static_cast<CheckBox*
>(
this)->ImplCheck();
539 static_cast<PushButton*
>(
this)->SetPressed(
true );
540 static_cast<PushButton*
>(
this)->SetPressed(
false );
548 if (
GetType() == WindowType::RADIOBUTTON )
550 if ( !static_cast<RadioButton*>(
this)->IsChecked() )
551 static_cast<RadioButton*>(
this)->ImplCallClick(
true, nFlags );
564 bool isSuitableDestination(
vcl::Window const *pWindow)
570 (pWindow->
GetType() != WindowType::WINDOW &&
571 pWindow->
GetType() != WindowType::WORKWINDOW && pWindow->
GetType() != WindowType::CONTROL)
577 std::vector<VclPtr<RadioButton> >::iterator aI(aStart);
579 if (aStart != rGroup.end())
582 aI = std::find_if(aI, rGroup.end(), isSuitableDestination);
583 if (aI != rGroup.end())
589 aI = std::find_if(rGroup.begin(), aStart, isSuitableDestination);
599 bool nextInGroup(
RadioButton *pSourceWindow,
bool bBackward)
603 if (aGroup.size() < 2)
607 std::reverse(aGroup.begin(), aGroup.end());
611 assert(aStart != aGroup.end());
613 return focusNextInGroup(aStart, aGroup);
622 sal_uInt16 nKeyCode = aKeyCode.
GetCode();
628 sal_uInt16 iButtonStart;
631 sal_uInt16 nFormStart;
642 nIndex, nFormStart, nFormEnd );
648 pTempWindow = pSWindow;
652 if ( pTempWindow ==
this )
656 while ( pTempWindow );
658 pButtonWindow =
nullptr;
664 iButtonStart = iButton;
665 while ( pButtonWindow )
672 if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
673 pButtonWindow =
nullptr;
680 sal_uInt16 nNewIndex;
693 pTempWindow =
ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
694 while ( pTempWindow && (pTempWindow != pSWindow) )
701 if ( nNewIndex > iStart )
706 if ( nNewIndex < iStart )
715 pTempWindow =
ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
717 if ( (i <= iStart) || (i > nFormEnd) )
718 pTempWindow =
nullptr;
722 if ( pTempWindow && (pTempWindow == pSWindow) )
740 iButtonStart = iButton;
741 while ( pButtonWindow )
743 if ( pButtonWindow->
GetType() == WindowType::CANCELBUTTON )
747 if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
748 pButtonWindow =
nullptr;
753 if (
mpWindowImpl->mpDlgCtrlDownWindow.get() != pButtonWindow )
761 else if ( bKeyInput )
768 sal_uInt16 nNewIndex;
780 while ( pTempWindow )
788 if ( iTemp <= nIndex )
789 pFormFirstWindow = pPrevFirstFormFirstWindow;
790 pPrevFirstFormFirstWindow = pTempWindow;
794 if ( (iTemp > nIndex) && !pFormFirstWindow )
795 pFormFirstWindow = pTempWindow;
797 pLastFormFirstWindow = pTempWindow;
802 pTempWindow =
nullptr;
807 if ( !pFormFirstWindow )
810 pFormFirstWindow = pLastFormFirstWindow;
812 pFormFirstWindow = pFirstFormFirstWindow;
815 sal_uInt16 nFoundFormStart = 0;
816 sal_uInt16 nFoundFormEnd = 0;
817 sal_uInt16 nTempIndex = 0;
819 nFoundFormStart, nFoundFormEnd ) )
821 nTempIndex = nFoundFormStart;
823 if ( pFormFirstWindow )
853 if ( pWindow == pSWindow )
887 if (pSWindow->
GetType() == WindowType::RADIOBUTTON)
888 return nextInGroup(static_cast<RadioButton*>(pSWindow),
true);
901 if (isSuitableDestination(pWindow))
903 if ( pWindow != pSWindow )
908 if ( nStyle & WB_GROUP )
918 if (pSWindow->
GetType() == WindowType::RADIOBUTTON)
919 return nextInGroup(static_cast<RadioButton*>(pSWindow),
false);
932 if (isSuitableDestination(pWindow))
960 if (isSuitableDestination(pButtonWindow))
970 static_cast<PushButton*
>(pButtonWindow)->SetPressed(
true );
973 else if (
mpWindowImpl->mpDlgCtrlDownWindow.get() == pButtonWindow )
976 static_cast<PushButton*
>(pButtonWindow)->SetPressed(
false );
977 static_cast<PushButton*
>(pButtonWindow)->Click();
993 while ( pDlgCtrlParent &&
1007 sal_uInt16 nFormStart;
1008 sal_uInt16 nFormEnd;
1013 while ( pDlgCtrlParent &&
1023 nIndex, nFormStart, nFormEnd );
1028 if ( pWindow && (pWindow != pSWindow) )
1039 sal_uInt16 nFormStart;
1040 sal_uInt16 nFormEnd;
1057 pOldDefButton = pPushButton;
1059 pNewDefButton = pPushButton;
1061 pNewDefButton = pPushButton;
1065 if ( !i || (i > nFormEnd) )
1074 pNewDefButton =
nullptr;
1076 (i < nFormStart) || (i > nFormEnd) )
1077 pNewDefButton =
nullptr;
1080 if ( pOldDefButton != pNewDefButton )
1082 if ( pOldDefButton )
1084 if ( pNewDefButton )
1103 sal_uInt16 nFormStart;
1104 sal_uInt16 nFormEnd;
1123 sal_uInt16
nCode = 0;
1124 if( nAccel >=
'a' && nAccel <=
'z' )
1125 nCode =
KEY_A + (nAccel-
'a');
1126 else if( nAccel >=
'A' && nAccel <=
'Z' )
1127 nCode =
KEY_A + (nAccel-
'A');
1128 else if( nAccel >=
'0' && nAccel <=
'9' )
1129 nCode =
KEY_0 + (nAccel-
'0');
1130 else if( nAccel ==
'.' )
1132 else if( nAccel ==
'-' )
1134 vcl::KeyCode aKeyCode( nCode,
false,
false,
true,
false );
1135 aKeyEvent =
KeyEvent( nAccel, aKeyCode );
1148 nPos = rStr.indexOf(
'~', nPos );
1149 if( nPos != -1 && nPos < rStr.getLength() )
1150 nChar = rStr[ ++nPos ];
1153 }
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)
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
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
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