summaryrefslogtreecommitdiff
path: root/vcl/source/window/dlgctrl.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/window/dlgctrl.cxx')
-rw-r--r--vcl/source/window/dlgctrl.cxx319
1 files changed, 193 insertions, 126 deletions
diff --git a/vcl/source/window/dlgctrl.cxx b/vcl/source/window/dlgctrl.cxx
index a1e8d3219d33..ce7b6dca8119 100644
--- a/vcl/source/window/dlgctrl.cxx
+++ b/vcl/source/window/dlgctrl.cxx
@@ -45,7 +45,7 @@ using namespace ::com::sun::star;
// =======================================================================
-static BOOL ImplHasIndirectTabParent( Window* pWindow )
+static sal_Bool ImplHasIndirectTabParent( Window* pWindow )
{
// The window has inderect tab parent if it is included in tab hierarchy
// of the indirect parent window
@@ -75,7 +75,7 @@ static Window* ImplGetTopParentOfTabHierarchy( Window* pParent )
// -----------------------------------------------------------------------
-static Window* ImplGetSubChildWindow( Window* pParent, USHORT n, USHORT& nIndex )
+static Window* ImplGetSubChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex )
{
Window* pTabPage = NULL;
Window* pFoundWindow = NULL;
@@ -151,7 +151,7 @@ static Window* ImplGetSubChildWindow( Window* pParent, USHORT n, USHORT& nIndex
// -----------------------------------------------------------------------
-static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BOOL bTestEnable )
+static Window* ImplGetChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, sal_Bool bTestEnable )
{
pParent = ImplGetTopParentOfTabHierarchy( pParent );
@@ -159,7 +159,7 @@ static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BO
Window* pWindow = ImplGetSubChildWindow( pParent, n, nIndex );
if ( bTestEnable )
{
- USHORT n2 = nIndex;
+ sal_uInt16 n2 = nIndex;
while ( pWindow && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) )
{
n2 = nIndex+1;
@@ -185,7 +185,7 @@ static Window* ImplGetChildWindow( Window* pParent, USHORT n, USHORT& nIndex, BO
// -----------------------------------------------------------------------
-static Window* ImplGetNextWindow( Window* pParent, USHORT n, USHORT& nIndex, BOOL bTestEnable )
+static Window* ImplGetNextWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, sal_Bool bTestEnable )
{
Window* pWindow = ImplGetChildWindow( pParent, n+1, nIndex, bTestEnable );
if ( n == nIndex )
@@ -198,17 +198,17 @@ static Window* ImplGetNextWindow( Window* pParent, USHORT n, USHORT& nIndex, BOO
// -----------------------------------------------------------------------
-Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType,
- USHORT nFormStart, USHORT nFormEnd,
- USHORT* pIndex )
+Window* Window::ImplGetDlgWindow( sal_uInt16 nIndex, sal_uInt16 nType,
+ sal_uInt16 nFormStart, sal_uInt16 nFormEnd,
+ sal_uInt16* pIndex )
{
DBG_ASSERT( (nIndex >= nFormStart) && (nIndex <= nFormEnd),
"Window::ImplGetDlgWindow() - nIndex not in Form" );
Window* pWindow = NULL;
- USHORT i;
- USHORT nTemp;
- USHORT nStartIndex;
+ sal_uInt16 i;
+ sal_uInt16 nTemp;
+ sal_uInt16 nStartIndex;
if ( nType == DLGWINDOW_PREV )
{
@@ -219,7 +219,7 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType,
i--;
else
i = nFormEnd;
- pWindow = ImplGetChildWindow( this, i, nTemp, TRUE );
+ pWindow = ImplGetChildWindow( this, i, nTemp, sal_True );
if ( !pWindow )
break;
if ( (i == nTemp) && (pWindow->GetStyle() & WB_TABSTOP) )
@@ -239,19 +239,19 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType,
{
if ( i < nFormEnd )
{
- pWindow = ImplGetNextWindow( this, i, i, TRUE );
+ pWindow = ImplGetNextWindow( this, i, i, sal_True );
if ( (i > nFormEnd) || (i < nFormStart) )
- pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE );
+ pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True );
}
else
- pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE );
+ pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True );
}
if ( i <= nFormEnd )
{
// 2ten Index mitfuehren, falls alle Controls disablte
- USHORT nStartIndex2 = i;
- USHORT nOldIndex = i+1;
+ sal_uInt16 nStartIndex2 = i;
+ sal_uInt16 nOldIndex = i+1;
do
{
@@ -264,9 +264,9 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType,
}
nOldIndex = i;
if ( (i > nFormEnd) || (i < nFormStart) )
- pWindow = ImplGetChildWindow( this, nFormStart, i, TRUE );
+ pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True );
else
- pWindow = ImplGetNextWindow( this, i, i, TRUE );
+ pWindow = ImplGetNextWindow( this, i, i, sal_True );
}
while ( (i != nStartIndex) && (i != nStartIndex2) );
@@ -304,20 +304,20 @@ Window* Window::ImplGetDlgWindow( USHORT nIndex, USHORT nType,
// -----------------------------------------------------------------------
-static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT& rIndex,
- USHORT& rFormStart, USHORT& rFormEnd )
+static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, sal_uInt16& rIndex,
+ sal_uInt16& rFormStart, sal_uInt16& rFormEnd )
{
Window* pSWindow;
Window* pSecondWindow = NULL;
Window* pTempWindow = NULL;
- USHORT i;
- USHORT nSecond_i = 0;
- USHORT nFormStart = 0;
- USHORT nSecondFormStart = 0;
- USHORT nFormEnd;
+ sal_uInt16 i;
+ sal_uInt16 nSecond_i = 0;
+ sal_uInt16 nFormStart = 0;
+ sal_uInt16 nSecondFormStart = 0;
+ sal_uInt16 nFormEnd;
// Focus-Fenster in der Child-Liste suchen
- Window* pFirstChildWindow = pSWindow = ImplGetChildWindow( pParent, 0, i, FALSE );
+ Window* pFirstChildWindow = pSWindow = ImplGetChildWindow( pParent, 0, i, sal_False );
if( pWindow == NULL )
pWindow = pSWindow;
@@ -340,7 +340,7 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT&
break;
}
- pSWindow = ImplGetNextWindow( pParent, i, i, FALSE );
+ pSWindow = ImplGetNextWindow( pParent, i, i, sal_False );
if ( !i )
pSWindow = NULL;
}
@@ -370,7 +370,7 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT&
do
{
nFormEnd = i;
- pTempWindow = ImplGetNextWindow( pParent, i, i, FALSE );
+ pTempWindow = ImplGetNextWindow( pParent, i, i, sal_False );
// the DialogControlStart mark is only accepted for the direct children
if ( !i
@@ -388,7 +388,7 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT&
if ( nIteration >= 2 )
{
// this is an unexpected scenario
- DBG_ASSERT( FALSE, "It seems to be an endless loop!" );
+ DBG_ASSERT( sal_False, "It seems to be an endless loop!" );
rFormStart = 0;
break;
}
@@ -402,16 +402,16 @@ static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, USHORT&
// -----------------------------------------------------------------------
-static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode cCharCode,
- USHORT nFormStart, USHORT nFormEnd, BOOL bCheckEnable = TRUE )
+static Window* ImplFindAccelWindow( Window* pParent, sal_uInt16& rIndex, xub_Unicode cCharCode,
+ sal_uInt16 nFormStart, sal_uInt16 nFormEnd, sal_Bool bCheckEnable = sal_True )
{
DBG_ASSERT( (rIndex >= nFormStart) && (rIndex <= nFormEnd),
"Window::ImplFindAccelWindow() - rIndex not in Form" );
xub_Unicode cCompareChar;
- USHORT nStart = rIndex;
- USHORT i = rIndex;
- int bSearch = TRUE;
+ sal_uInt16 nStart = rIndex;
+ sal_uInt16 i = rIndex;
+ int bSearch = sal_True;
Window* pWindow;
// MT: Where can we keep the CharClass?!
@@ -423,13 +423,13 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode
cCharCode = xCharClass->toUpper( String(cCharCode), 0, 1, rLocale )[0];
if ( i < nFormEnd )
- pWindow = ImplGetNextWindow( pParent, i, i, TRUE );
+ pWindow = ImplGetNextWindow( pParent, i, i, sal_True );
else
- pWindow = ImplGetChildWindow( pParent, nFormStart, i, TRUE );
+ pWindow = ImplGetChildWindow( pParent, nFormStart, i, sal_True );
while( bSearch && pWindow )
{
const XubString aStr = pWindow->GetText();
- USHORT nPos = aStr.Search( '~' );
+ sal_uInt16 nPos = aStr.Search( '~' );
while ( nPos != STRING_NOTFOUND )
{
cCompareChar = aStr.GetChar( nPos+1 );
@@ -453,9 +453,9 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode
// children checked for accelerators
if( (pWindow->GetStyle() & WB_CHILDDLGCTRL) != 0 )
{
- USHORT nChildIndex;
- USHORT nChildFormStart;
- USHORT nChildFormEnd;
+ sal_uInt16 nChildIndex;
+ sal_uInt16 nChildFormStart;
+ sal_uInt16 nChildFormEnd;
// get form start and end
::ImplFindDlgCtrlWindow( pWindow, NULL,
@@ -485,14 +485,14 @@ static Window* ImplFindAccelWindow( Window* pParent, USHORT& rIndex, xub_Unicode
// -----------------------------------------------------------------------
-void Window::ImplControlFocus( USHORT nFlags )
+void Window::ImplControlFocus( sal_uInt16 nFlags )
{
if ( nFlags & GETFOCUS_MNEMONIC )
{
if ( GetType() == WINDOW_RADIOBUTTON )
{
if ( !((RadioButton*)this)->IsChecked() )
- ((RadioButton*)this)->ImplCallClick( TRUE, nFlags );
+ ((RadioButton*)this)->ImplCallClick( sal_True, nFlags );
else
ImplGrabFocus( nFlags );
}
@@ -505,8 +505,8 @@ void Window::ImplControlFocus( USHORT nFlags )
((CheckBox*)this)->ImplCheck();
else if ( mpWindowImpl->mbPushButton )
{
- ((PushButton*)this)->SetPressed( TRUE );
- ((PushButton*)this)->SetPressed( FALSE );
+ ((PushButton*)this)->SetPressed( sal_True );
+ ((PushButton*)this)->SetPressed( sal_False );
((PushButton*)this)->Click();
}
}
@@ -517,7 +517,7 @@ void Window::ImplControlFocus( USHORT nFlags )
if ( GetType() == WINDOW_RADIOBUTTON )
{
if ( !((RadioButton*)this)->IsChecked() )
- ((RadioButton*)this)->ImplCallClick( TRUE, nFlags );
+ ((RadioButton*)this)->ImplCallClick( sal_True, nFlags );
else
ImplGrabFocus( nFlags );
}
@@ -528,32 +528,32 @@ void Window::ImplControlFocus( USHORT nFlags )
// -----------------------------------------------------------------------
-BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
+sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput )
{
KeyCode aKeyCode = rKEvt.GetKeyCode();
- USHORT nKeyCode = aKeyCode.GetCode();
+ sal_uInt16 nKeyCode = aKeyCode.GetCode();
Window* pSWindow;
Window* pTempWindow;
Window* pButtonWindow;
- USHORT i;
- USHORT iButton;
- USHORT iButtonStart;
- USHORT iTemp;
- USHORT nIndex;
- USHORT nFormStart;
- USHORT nFormEnd;
- USHORT nDlgCtrlFlags;
+ sal_uInt16 i;
+ sal_uInt16 iButton;
+ sal_uInt16 iButtonStart;
+ sal_uInt16 iTemp;
+ sal_uInt16 nIndex;
+ sal_uInt16 nFormStart;
+ sal_uInt16 nFormEnd;
+ sal_uInt16 nDlgCtrlFlags;
// Ohne Focus-Window koennen wir auch keine Steuerung uebernehmen
Window* pFocusWindow = Application::GetFocusWindow();
if ( !pFocusWindow || !ImplIsWindowOrChild( pFocusWindow ) )
- return FALSE;
+ return sal_False;
// Focus-Fenster in der Child-Liste suchen
pSWindow = ::ImplFindDlgCtrlWindow( this, pFocusWindow,
nIndex, nFormStart, nFormEnd );
if ( !pSWindow )
- return FALSE;
+ return sal_False;
i = nIndex;
nDlgCtrlFlags = 0;
@@ -572,7 +572,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
if ( nKeyCode == KEY_RETURN )
{
// Wir suchen zuerst nach einem DefPushButton/CancelButton
- pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, TRUE );
+ pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, sal_True );
iButtonStart = iButton;
while ( pButtonWindow )
{
@@ -580,17 +580,17 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
pButtonWindow->mpWindowImpl->mbPushButton )
break;
- pButtonWindow = ImplGetNextWindow( this, iButton, iButton, TRUE );
+ pButtonWindow = ImplGetNextWindow( this, iButton, iButton, sal_True );
if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
pButtonWindow = NULL;
}
if ( bKeyInput && !pButtonWindow && (nDlgCtrlFlags & WINDOW_DLGCTRL_RETURN) )
{
- USHORT nType;
- USHORT nGetFocusFlags = GETFOCUS_TAB;
- USHORT nNewIndex;
- USHORT iStart;
+ sal_uInt16 nType;
+ sal_uInt16 nGetFocusFlags = GETFOCUS_TAB;
+ sal_uInt16 nNewIndex;
+ sal_uInt16 iStart;
if ( aKeyCode.IsShift() )
{
nType = DLGWINDOW_PREV;
@@ -619,7 +619,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
nGetFocusFlags |= GETFOCUS_AROUND;
}
pTempWindow->ImplControlFocus( nGetFocusFlags );
- return TRUE;
+ return sal_True;
}
else
{
@@ -641,21 +641,21 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
if ( !ImplCallPreNotify( aNEvt2 ) )
pSWindow->GetFocus();
pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
- return TRUE;
+ return sal_True;
}
}
}
else if ( nKeyCode == KEY_ESCAPE )
{
// Wir suchen zuerst nach einem DefPushButton/CancelButton
- pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, TRUE );
+ pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, sal_True );
iButtonStart = iButton;
while ( pButtonWindow )
{
if ( pButtonWindow->GetType() == WINDOW_CANCELBUTTON )
break;
- pButtonWindow = ImplGetNextWindow( this, iButton, iButton, TRUE );
+ pButtonWindow = ImplGetNextWindow( this, iButton, iButton, sal_True );
if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
pButtonWindow = NULL;
}
@@ -664,9 +664,9 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
{
if ( mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow )
{
- ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( FALSE );
+ ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False );
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
- return TRUE;
+ return sal_True;
}
}
}
@@ -677,10 +677,10 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
// keine Alt-Taste abfangen, wegen Windows
if ( !aKeyCode.IsMod2() )
{
- USHORT nType;
- USHORT nGetFocusFlags = GETFOCUS_TAB;
- USHORT nNewIndex;
- BOOL bFormular = FALSE;
+ sal_uInt16 nType;
+ sal_uInt16 nGetFocusFlags = GETFOCUS_TAB;
+ sal_uInt16 nNewIndex;
+ sal_Bool bFormular = sal_False;
// Bei Ctrl-Tab erstmal testen, ob zwischen Formularen
// gesprungen werden soll
@@ -689,7 +689,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
// Gruppe suchen
Window* pFormularFirstWindow = NULL;
Window* pLastFormularFirstWindow = NULL;
- pTempWindow = ImplGetChildWindow( this, 0, iTemp, FALSE );
+ pTempWindow = ImplGetChildWindow( this, 0, iTemp, sal_False );
Window* pPrevFirstFormularFirstWindow = NULL;
Window* pFirstFormularFirstWindow = pTempWindow;
while ( pTempWindow )
@@ -697,7 +697,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
if ( pTempWindow->ImplGetWindow()->IsDialogControlStart() )
{
if ( iTemp != 0 )
- bFormular = TRUE;
+ bFormular = sal_True;
if ( aKeyCode.IsShift() )
{
if ( iTemp <= nIndex )
@@ -712,7 +712,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
pLastFormularFirstWindow = pTempWindow;
}
- pTempWindow = ImplGetNextWindow( this, iTemp, iTemp, FALSE );
+ pTempWindow = ImplGetNextWindow( this, iTemp, iTemp, sal_False );
if ( !iTemp )
pTempWindow = NULL;
}
@@ -727,9 +727,9 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
pFormularFirstWindow = pFirstFormularFirstWindow;
}
- USHORT nFoundFormStart = 0;
- USHORT nFoundFormEnd = 0;
- USHORT nTempIndex = 0;
+ sal_uInt16 nFoundFormStart = 0;
+ sal_uInt16 nFoundFormEnd = 0;
+ sal_uInt16 nTempIndex = 0;
if ( ::ImplFindDlgCtrlWindow( this, pFormularFirstWindow, nTempIndex,
nFoundFormStart, nFoundFormEnd ) )
{
@@ -738,7 +738,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
if ( pFormularFirstWindow )
{
pFormularFirstWindow->ImplControlFocus();
- return TRUE;
+ return sal_True;
}
}
}
@@ -774,7 +774,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
if ( !ImplCallPreNotify( aNEvt2 ) )
pSWindow->GetFocus();
pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
- return TRUE;
+ return sal_True;
}
else if ( pWindow )
{
@@ -790,7 +790,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
nGetFocusFlags |= GETFOCUS_AROUND;
}
pWindow->ImplControlFocus( nGetFocusFlags );
- return TRUE;
+ return sal_True;
}
}
}
@@ -813,7 +813,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
{
if ( pWindow != pSWindow )
pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
- return TRUE;
+ return sal_True;
}
if ( nStyle & WB_GROUP )
@@ -840,7 +840,7 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
{
pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
- return TRUE;
+ return sal_True;
}
pWindow = pWindow->GetWindow( WINDOW_NEXT );
@@ -854,11 +854,11 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
pSWindow = ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd );
if ( pSWindow )
{
- USHORT nGetFocusFlags = GETFOCUS_MNEMONIC;
+ sal_uInt16 nGetFocusFlags = GETFOCUS_MNEMONIC;
if ( pSWindow == ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ) )
nGetFocusFlags |= GETFOCUS_UNIQUEMNEMONIC;
pSWindow->ImplControlFocus( nGetFocusFlags );
- return TRUE;
+ return sal_True;
}
}
}
@@ -870,30 +870,30 @@ BOOL Window::ImplDlgCtrl( const KeyEvent& rKEvt, BOOL bKeyInput )
{
if ( mpWindowImpl->mpDlgCtrlDownWindow && (mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow) )
{
- ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( FALSE );
+ ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False );
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
}
- ((PushButton*)pButtonWindow)->SetPressed( TRUE );
+ ((PushButton*)pButtonWindow)->SetPressed( sal_True );
mpWindowImpl->mpDlgCtrlDownWindow = pButtonWindow;
}
else if ( mpWindowImpl->mpDlgCtrlDownWindow == pButtonWindow )
{
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
- ((PushButton*)pButtonWindow)->SetPressed( FALSE );
+ ((PushButton*)pButtonWindow)->SetPressed( sal_False );
((PushButton*)pButtonWindow)->Click();
}
- return TRUE;
+ return sal_True;
}
- return FALSE;
+ return sal_False;
}
// -----------------------------------------------------------------------
// checks if this window has dialog control
-BOOL Window::ImplHasDlgCtrl()
+sal_Bool Window::ImplHasDlgCtrl()
{
Window* pDlgCtrlParent;
@@ -905,9 +905,9 @@ BOOL Window::ImplHasDlgCtrl()
pDlgCtrlParent = pDlgCtrlParent->ImplGetParent();
if ( !pDlgCtrlParent || ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
- return FALSE;
+ return sal_False;
else
- return TRUE;
+ return sal_True;
}
void Window::ImplDlgCtrlNextWindow()
@@ -915,9 +915,9 @@ void Window::ImplDlgCtrlNextWindow()
Window* pDlgCtrlParent;
Window* pDlgCtrl;
Window* pSWindow;
- USHORT nIndex;
- USHORT nFormStart;
- USHORT nFormEnd;
+ sal_uInt16 nIndex;
+ sal_uInt16 nFormStart;
+ sal_uInt16 nFormEnd;
// lookup window for dialog control
pDlgCtrl = this;
@@ -944,14 +944,14 @@ if ( !pDlgCtrlParent || (GetStyle() & WB_NODIALOGCONTROL) || ((pDlgCtrlParent->G
// -----------------------------------------------------------------------
static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow,
- BOOL bGetFocus )
+ sal_Bool bGetFocus )
{
PushButton* pOldDefButton = NULL;
PushButton* pNewDefButton = NULL;
Window* pSWindow;
- USHORT i;
- USHORT nFormStart;
- USHORT nFormEnd;
+ sal_uInt16 i;
+ sal_uInt16 nFormStart;
+ sal_uInt16 nFormEnd;
// Formular suchen
pSWindow = ::ImplFindDlgCtrlWindow( pParent, pFocusWindow, i, nFormStart, nFormEnd );
@@ -961,7 +961,7 @@ static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow,
nFormEnd = 0xFFFF;
}
- pSWindow = ImplGetChildWindow( pParent, nFormStart, i, FALSE );
+ pSWindow = ImplGetChildWindow( pParent, nFormStart, i, sal_False );
while ( pSWindow )
{
if ( pSWindow->ImplIsPushButton() )
@@ -975,14 +975,14 @@ static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow,
pNewDefButton = pPushButton;
}
- pSWindow = ImplGetNextWindow( pParent, i, i, FALSE );
+ pSWindow = ImplGetNextWindow( pParent, i, i, sal_False );
if ( !i || (i > nFormEnd) )
pSWindow = NULL;
}
if ( !bGetFocus )
{
- USHORT nDummy;
+ sal_uInt16 nDummy;
Window* pNewFocusWindow = Application::GetFocusWindow();
if ( !pNewFocusWindow || !pParent->ImplIsWindowOrChild( pNewFocusWindow ) )
pNewDefButton = NULL;
@@ -994,19 +994,19 @@ static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow,
if ( pOldDefButton != pNewDefButton )
{
if ( pOldDefButton )
- pOldDefButton->ImplSetDefButton( FALSE );
+ pOldDefButton->ImplSetDefButton( sal_False );
if ( pNewDefButton )
- pNewDefButton->ImplSetDefButton( TRUE );
+ pNewDefButton->ImplSetDefButton( sal_True );
}
}
// -----------------------------------------------------------------------
-void Window::ImplDlgCtrlFocusChanged( Window* pWindow, BOOL bGetFocus )
+void Window::ImplDlgCtrlFocusChanged( Window* pWindow, sal_Bool bGetFocus )
{
if ( mpWindowImpl->mpDlgCtrlDownWindow && !bGetFocus )
{
- ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( FALSE );
+ ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False );
mpWindowImpl->mpDlgCtrlDownWindow = NULL;
}
@@ -1017,9 +1017,9 @@ void Window::ImplDlgCtrlFocusChanged( Window* pWindow, BOOL bGetFocus )
Window* Window::ImplFindDlgCtrlWindow( Window* pWindow )
{
- USHORT nIndex;
- USHORT nFormStart;
- USHORT nFormEnd;
+ sal_uInt16 nIndex;
+ sal_uInt16 nFormStart;
+ sal_uInt16 nFormEnd;
// Focus-Fenster in der Child-Liste suchen und zurueckgeben
return ::ImplFindDlgCtrlWindow( this, pWindow, nIndex, nFormStart, nFormEnd );
@@ -1045,7 +1045,7 @@ Window* Window::GetParentLabeledBy( const Window* ) const
static sal_Unicode getAccel( const String& rStr )
{
sal_Unicode nChar = 0;
- USHORT nPos = 0;
+ sal_uInt16 nPos = 0;
do
{
nPos = rStr.Search( '~', nPos );
@@ -1067,10 +1067,10 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
{
// #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text.
// See tools/options/print for example.
- BOOL bThisIsAGroupControl = (nMyType == WINDOW_GROUPBOX) || (nMyType == WINDOW_FIXEDLINE);
+ sal_Bool bThisIsAGroupControl = (nMyType == WINDOW_GROUPBOX) || (nMyType == WINDOW_FIXEDLINE);
Window* pSWindow = NULL;
// get index, form start and form end
- USHORT nIndex=0, nFormStart=0, nFormEnd=0;
+ sal_uInt16 nIndex=0, nFormStart=0, nFormEnd=0;
pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
pLabel,
nIndex,
@@ -1084,7 +1084,7 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
nAccel,
nFormStart,
nFormEnd,
- FALSE );
+ sal_False );
}
else
{
@@ -1096,7 +1096,7 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
pSWindow = ::ImplGetChildWindow( pFrameWindow,
nIndex,
nIndex,
- FALSE );
+ sal_False );
if( pSWindow && pSWindow->IsVisible() && ! (pSWindow->GetStyle() & WB_NOLABEL) )
{
WindowType nType = pSWindow->GetType();
@@ -1119,11 +1119,15 @@ static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window
return pWindow;
}
-Window* Window::GetLabelFor() const
+Window* Window::GetAccessibleRelationLabelFor() const
{
if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
return NULL;
+ if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow )
+ return mpWindowImpl->mpAccessibleInfos->pLabelForWindow;
+
+
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
@@ -1161,7 +1165,7 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo
// is directly before the control
// get form start and form end and index of this control
- USHORT nIndex, nFormStart, nFormEnd;
+ sal_uInt16 nIndex, nFormStart, nFormEnd;
Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
pLabeled,
nIndex,
@@ -1176,13 +1180,13 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo
{
nFormStart = nIndex-1;
}
- for( USHORT nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- )
+ for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- )
{
- USHORT nFoundIndex = 0;
+ sal_uInt16 nFoundIndex = 0;
pSWindow = ::ImplGetChildWindow( pFrameWindow,
nSearchIndex,
nFoundIndex,
- FALSE );
+ sal_False );
if( pSWindow && pSWindow->IsVisible() && !(pSWindow->GetStyle() & WB_NOLABEL) )
{
WindowType nType = pSWindow->GetType();
@@ -1204,11 +1208,14 @@ static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Windo
return pWindow;
}
-Window* Window::GetLabeledBy() const
+Window* Window::GetAccessibleRelationLabeledBy() const
{
if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
return NULL;
+ if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow )
+ return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
+
Window* pWindow = NULL;
Window* pFrameWindow = ImplGetFrameWindow();
@@ -1237,6 +1244,62 @@ Window* Window::GetLabeledBy() const
return pWindow;
}
+Window* Window::GetAccessibleRelationMemberOf() const
+{
+ Window* pWindow = NULL;
+ Window* pFrameWindow = GetParent();
+ if ( !pFrameWindow )
+ {
+ pFrameWindow = ImplGetFrameWindow();
+ }
+ // if( ! ( GetType() == WINDOW_FIXEDTEXT ||
+ if( !( GetType() == WINDOW_FIXEDLINE ||
+ GetType() == WINDOW_GROUPBOX ) )
+ {
+ // search for a control that makes member of this window
+ // it is considered the last fixed line or group box
+ // that comes before this control; with the exception of push buttons
+ // which are labeled only if the fixed line or group box
+ // is directly before the control
+ // get form start and form end and index of this control
+ sal_uInt16 nIndex, nFormStart, nFormEnd;
+ Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
+ const_cast<Window*>(this),
+ nIndex,
+ nFormStart,
+ nFormEnd );
+ if( pSWindow && nIndex != nFormStart )
+ {
+ if( GetType() == WINDOW_PUSHBUTTON ||
+ GetType() == WINDOW_HELPBUTTON ||
+ GetType() == WINDOW_OKBUTTON ||
+ GetType() == WINDOW_CANCELBUTTON )
+ {
+ nFormStart = nIndex-1;
+ }
+ for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- )
+ {
+ sal_uInt16 nFoundIndex = 0;
+ pSWindow = ::ImplGetChildWindow( pFrameWindow,
+ nSearchIndex,
+ nFoundIndex,
+ sal_False );
+ if( pSWindow && pSWindow->IsVisible() &&
+ ( pSWindow->GetType() == WINDOW_FIXEDLINE ||
+ pSWindow->GetType() == WINDOW_GROUPBOX ) )
+ {
+ pWindow = pSWindow;
+ break;
+ }
+ if( nFoundIndex > nSearchIndex || nSearchIndex == 0 )
+ break;
+ }
+ }
+ }
+ return pWindow;
+}
+//-----IAccessibility2 Implementation 2009
+
// -----------------------------------------------------------------------
KeyEvent Window::GetActivationKey() const
@@ -1246,20 +1309,24 @@ KeyEvent Window::GetActivationKey() const
sal_Unicode nAccel = getAccel( GetText() );
if( ! nAccel )
{
- Window* pWindow = GetLabeledBy();
+ Window* pWindow = GetAccessibleRelationLabeledBy();
if( pWindow )
nAccel = getAccel( pWindow->GetText() );
}
if( nAccel )
{
- USHORT nCode = 0;
+ sal_uInt16 nCode = 0;
if( nAccel >= 'a' && nAccel <= 'z' )
nCode = KEY_A + (nAccel-'a');
else if( nAccel >= 'A' && nAccel <= 'Z' )
nCode = KEY_A + (nAccel-'A');
else if( nAccel >= '0' && nAccel <= '9' )
nCode = KEY_0 + (nAccel-'0');
- KeyCode aKeyCode( nCode, FALSE, FALSE, TRUE, FALSE );
+ else if( nAccel == '.' )
+ nCode = KEY_POINT;
+ else if( nAccel == '-' )
+ nCode = KEY_SUBTRACT;
+ KeyCode aKeyCode( nCode, sal_False, sal_False, sal_True, sal_False );
aKeyEvent = KeyEvent( nAccel, aKeyCode );
}
return aKeyEvent;