LCOV - code coverage report
Current view: top level - vcl/source/window - dlgctrl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 246 585 42.1 %
Date: 2012-08-25 Functions: 18 23 78.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 258 947 27.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <tools/debug.hxx>
      31                 :            : 
      32                 :            : #include <svdata.hxx>
      33                 :            : #include <window.h>
      34                 :            : 
      35                 :            : #include <vcl/event.hxx>
      36                 :            : #include <vcl/svapp.hxx>
      37                 :            : #include <vcl/tabpage.hxx>
      38                 :            : #include <vcl/tabctrl.hxx>
      39                 :            : #include <vcl/tabdlg.hxx>
      40                 :            : #include <vcl/button.hxx>
      41                 :            : 
      42                 :            : #include <vcl/unohelp.hxx>
      43                 :            : #include <com/sun/star/i18n/XCharacterClassification.hpp>
      44                 :            : 
      45                 :            : using namespace ::com::sun::star;
      46                 :            : 
      47                 :            : // =======================================================================
      48                 :            : 
      49                 :      10739 : static sal_Bool ImplHasIndirectTabParent( Window* pWindow )
      50                 :            : {
      51                 :            :     // The window has inderect tab parent if it is included in tab hierarchy
      52                 :            :     // of the indirect parent window
      53                 :            : 
      54                 :      10739 :     return ( pWindow && pWindow->GetParent()
      55   [ +  -  +  - ]:      21478 :           && ( pWindow->GetParent()->ImplGetWindow()->GetStyle() & WB_CHILDDLGCTRL ) );
                 [ -  + ]
      56                 :            : }
      57                 :            : 
      58                 :            : // -----------------------------------------------------------------------
      59                 :            : 
      60                 :      30711 : static Window* ImplGetTopParentOfTabHierarchy( Window* pParent )
      61                 :            : {
      62                 :            :     // The method allows to find the most close parent containing all the
      63                 :            :     // window from the current tab-hierarchy
      64                 :            :     // The direct parent should be provided as a parameter here
      65                 :            : 
      66                 :      30711 :     Window* pResult = pParent;
      67                 :            : 
      68         [ +  - ]:      30711 :     if ( pResult )
      69                 :            :     {
      70 [ +  + ][ +  + ]:      33627 :         while ( pResult->GetParent() && ( pResult->ImplGetWindow()->GetStyle() & WB_CHILDDLGCTRL ) )
                 [ +  + ]
      71                 :       2916 :             pResult = pResult->GetParent();
      72                 :            :     }
      73                 :            : 
      74                 :      30711 :     return pResult;
      75                 :            : }
      76                 :            : 
      77                 :            : // -----------------------------------------------------------------------
      78                 :            : 
      79                 :      86409 : static Window* ImplGetSubChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex )
      80                 :            : {
      81                 :      86409 :     Window*     pTabPage = NULL;
      82                 :      86409 :     Window*     pFoundWindow = NULL;
      83                 :            : 
      84                 :      86409 :     Window*     pWindow = pParent->GetWindow( WINDOW_FIRSTCHILD );
      85                 :      86409 :     Window*     pNextWindow = pWindow;
      86         [ +  + ]:     221886 :     while ( pWindow )
      87                 :            :     {
      88                 :     203363 :         pWindow = pWindow->ImplGetWindow();
      89                 :            : 
      90                 :            :         // Unsichtbare und disablte Fenster werden uebersprungen
      91 [ +  + ][ +  + ]:     203363 :         if ( pTabPage || pWindow->IsVisible() )
                 [ +  - ]
      92                 :            :         {
      93                 :            :             // Wenn das letzte Control ein TabControl war, wird von
      94                 :            :             // diesem die TabPage genommen
      95         [ -  + ]:     187225 :             if ( pTabPage )
      96                 :            :             {
      97                 :          0 :                 pFoundWindow = ImplGetSubChildWindow( pTabPage, n, nIndex );
      98                 :          0 :                 pTabPage = NULL;
      99                 :            :             }
     100                 :            :             else
     101                 :            :             {
     102                 :     187225 :                 pFoundWindow = pWindow;
     103                 :            : 
     104                 :            :                 // Bei einem TabControl sich die aktuelle TabPage merken,
     105                 :            :                 // damit diese dann genommen wird
     106         [ -  + ]:     187225 :                 if ( pWindow->GetType() == WINDOW_TABCONTROL )
     107                 :            :                 {
     108                 :          0 :                     TabControl* pTabControl = ((TabControl*)pWindow);
     109                 :            :                     // Feststellen, ob TabPage Child vom TabControl ist
     110                 :            :                     // und auch noch existiert (deshalb durch Vergleich,
     111                 :            :                     // indem alle ChildFenster getestet werden). Denn es
     112                 :            :                     // kann sein, das TabPages schon in einem Dialog-Dtor
     113                 :            :                     // zerstoert wurden, obwohl das TabControl noch
     114                 :            :                     // existiert.
     115                 :          0 :                     TabPage* pTempTabPage = pTabControl->GetTabPage( pTabControl->GetCurPageId() );
     116         [ #  # ]:          0 :                     if ( pTempTabPage )
     117                 :            :                     {
     118                 :          0 :                         Window* pTempWindow = pTabControl->GetWindow( WINDOW_FIRSTCHILD );
     119         [ #  # ]:          0 :                         while ( pTempWindow )
     120                 :            :                         {
     121         [ #  # ]:          0 :                             if ( pTempWindow->ImplGetWindow() == pTempTabPage )
     122                 :            :                             {
     123                 :          0 :                                 pTabPage = pTempTabPage;
     124                 :          0 :                                 break;
     125                 :            :                             }
     126                 :          0 :                             pTempWindow = pTempWindow->GetWindow( WINDOW_NEXT );
     127                 :            :                         }
     128                 :            :                     }
     129                 :            :                 }
     130   [ +  +  -  + ]:     318768 :                 else if ( ( pWindow->GetStyle() & WB_DIALOGCONTROL )
                 [ +  + ]
     131                 :     131543 :                        || ( pWindow->GetStyle() & WB_CHILDDLGCTRL ) )
     132                 :      55682 :                     pFoundWindow = ImplGetSubChildWindow( pWindow, n, nIndex );
     133                 :            :             }
     134                 :            : 
     135         [ +  + ]:     187225 :             if ( n == nIndex )
     136                 :      67886 :                 return pFoundWindow;
     137                 :     119339 :             nIndex++;
     138                 :            :         }
     139                 :            : 
     140         [ -  + ]:     135477 :         if ( pTabPage )
     141                 :          0 :             pWindow = pTabPage;
     142                 :            :         else
     143                 :            :         {
     144                 :     135477 :             pWindow = pNextWindow->GetWindow( WINDOW_NEXT );
     145                 :     135477 :             pNextWindow = pWindow;
     146                 :            :         }
     147                 :            :     }
     148                 :            : 
     149                 :      18523 :     nIndex--;
     150                 :      86409 :     return pFoundWindow;
     151                 :            : }
     152                 :            : 
     153                 :            : // -----------------------------------------------------------------------
     154                 :            : 
     155                 :      30711 : static Window* ImplGetChildWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, sal_Bool bTestEnable )
     156                 :            : {
     157                 :      30711 :     pParent = ImplGetTopParentOfTabHierarchy( pParent );
     158                 :            : 
     159                 :      30711 :     nIndex = 0;
     160                 :      30711 :     Window* pWindow = ImplGetSubChildWindow( pParent, n, nIndex );
     161         [ +  + ]:      30711 :     if ( bTestEnable )
     162                 :            :     {
     163                 :        861 :         sal_uInt16 n2 = nIndex;
     164 [ +  + ][ +  + ]:        873 :         while ( pWindow && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) )
         [ -  + ][ +  + ]
     165                 :            :         {
     166                 :         14 :             n2 = nIndex+1;
     167                 :         14 :             nIndex = 0;
     168                 :         14 :             pWindow = ImplGetSubChildWindow( pParent, n2, nIndex );
     169         [ +  + ]:         14 :             if ( nIndex < n2 )
     170                 :          2 :                 break;
     171                 :            :         }
     172                 :            : 
     173 [ +  + ][ +  - ]:        861 :         if ( (nIndex < n2) && n )
     174                 :            :         {
     175   [ +  -  +  -  :          6 :             do
           -  + ][ -  + ]
                 [ +  - ]
     176                 :            :             {
     177                 :          2 :                 n--;
     178                 :          2 :                 nIndex = 0;
     179                 :          2 :                 pWindow = ImplGetSubChildWindow( pParent, n, nIndex );
     180                 :            :             }
     181                 :          4 :             while ( pWindow && n && (!pWindow->IsEnabled() || !pWindow->IsInputEnabled()) );
     182                 :            :         }
     183                 :            :     }
     184                 :      30711 :     return pWindow;
     185                 :            : }
     186                 :            : 
     187                 :            : // -----------------------------------------------------------------------
     188                 :            : 
     189                 :      19306 : static Window* ImplGetNextWindow( Window* pParent, sal_uInt16 n, sal_uInt16& nIndex, sal_Bool bTestEnable )
     190                 :            : {
     191                 :      19306 :     Window* pWindow = ImplGetChildWindow( pParent, n+1, nIndex, bTestEnable );
     192         [ +  + ]:      19306 :     if ( n == nIndex )
     193                 :            :     {
     194                 :       2623 :         n = 0;
     195                 :       2623 :         pWindow = ImplGetChildWindow( pParent, n, nIndex, bTestEnable );
     196                 :            :     }
     197                 :      19306 :     return pWindow;
     198                 :            : }
     199                 :            : 
     200                 :            : // -----------------------------------------------------------------------
     201                 :            : 
     202                 :        148 : Window* Window::ImplGetDlgWindow( sal_uInt16 nIndex, sal_uInt16 nType,
     203                 :            :                                   sal_uInt16 nFormStart, sal_uInt16 nFormEnd,
     204                 :            :                                   sal_uInt16* pIndex )
     205                 :            : {
     206                 :            :     DBG_ASSERT( (nIndex >= nFormStart) && (nIndex <= nFormEnd),
     207                 :            :                 "Window::ImplGetDlgWindow() - nIndex not in Form" );
     208                 :            : 
     209                 :        148 :     Window* pWindow = NULL;
     210                 :            :     sal_uInt16  i;
     211                 :            :     sal_uInt16  nTemp;
     212                 :            :     sal_uInt16  nStartIndex;
     213                 :            : 
     214         [ -  + ]:        148 :     if ( nType == DLGWINDOW_PREV )
     215                 :            :     {
     216                 :          0 :         i = nIndex;
     217         [ #  # ]:          0 :         do
     218                 :            :         {
     219         [ #  # ]:          0 :             if ( i > nFormStart )
     220                 :          0 :                 i--;
     221                 :            :             else
     222                 :          0 :                 i = nFormEnd;
     223         [ #  # ]:          0 :             pWindow = ImplGetChildWindow( this, i, nTemp, sal_True );
     224         [ #  # ]:          0 :             if ( !pWindow )
     225                 :          0 :                 break;
     226 [ #  # ][ #  # ]:          0 :             if ( (i == nTemp) && (pWindow->GetStyle() & WB_TABSTOP) )
         [ #  # ][ #  # ]
     227                 :          0 :                 break;
     228                 :            :         }
     229                 :            :         while ( i != nIndex );
     230                 :            :     }
     231                 :            :     else
     232                 :            :     {
     233                 :        148 :         i = nIndex;
     234         [ +  - ]:        148 :         pWindow = ImplGetChildWindow( this, i, i, (nType == DLGWINDOW_FIRST) );
     235         [ +  + ]:        148 :         if ( pWindow )
     236                 :            :         {
     237                 :        138 :             nStartIndex = i;
     238                 :            : 
     239         [ +  + ]:        138 :             if ( nType == DLGWINDOW_NEXT )
     240                 :            :             {
     241         [ +  - ]:          2 :                 if ( i < nFormEnd )
     242                 :            :                 {
     243         [ +  - ]:          2 :                     pWindow = ImplGetNextWindow( this, i, i, sal_True );
     244 [ +  - ][ -  + ]:          2 :                     if ( (i > nFormEnd) || (i < nFormStart) )
     245         [ #  # ]:          0 :                         pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True );
     246                 :            :                 }
     247                 :            :                 else
     248         [ #  # ]:          0 :                     pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True );
     249                 :            :             }
     250                 :            : 
     251         [ +  - ]:        138 :             if ( i <= nFormEnd )
     252                 :            :             {
     253                 :            :                 // 2ten Index mitfuehren, falls alle Controls disablte
     254                 :        138 :                 sal_uInt16 nStartIndex2 = i;
     255                 :        138 :                 sal_uInt16 nOldIndex = i+1;
     256                 :            : 
     257 [ +  + ][ +  - ]:        609 :                 do
                 [ +  + ]
     258                 :            :                 {
     259 [ +  - ][ +  + ]:        643 :                     if ( pWindow->GetStyle() & WB_TABSTOP )
     260                 :         34 :                         break;
     261         [ -  + ]:        609 :                     if( i == nOldIndex ) // only disabled controls ?
     262                 :            :                     {
     263                 :          0 :                         i = nStartIndex2;
     264                 :          0 :                         break;
     265                 :            :                     }
     266                 :        609 :                     nOldIndex = i;
     267 [ +  - ][ -  + ]:        609 :                     if ( (i > nFormEnd) || (i < nFormStart) )
     268         [ #  # ]:          0 :                         pWindow = ImplGetChildWindow( this, nFormStart, i, sal_True );
     269                 :            :                     else
     270         [ +  - ]:        609 :                         pWindow = ImplGetNextWindow( this, i, i, sal_True );
     271                 :            :                 }
     272                 :            :                 while ( (i != nStartIndex) && (i != nStartIndex2) );
     273                 :            : 
     274 [ +  + ][ +  + ]:        274 :                 if ( (i == nStartIndex2) &&
         [ -  + ][ +  + ]
     275 [ +  - ][ +  - ]:        136 :                      (!(pWindow->GetStyle() & WB_TABSTOP) || !pWindow->IsEnabled()) )
     276                 :        102 :                     i = nStartIndex;
     277                 :            :             }
     278                 :            :         }
     279                 :            : 
     280         [ +  + ]:        148 :         if ( nType == DLGWINDOW_FIRST )
     281                 :            :         {
     282         [ +  + ]:        146 :             if ( pWindow )
     283                 :            :             {
     284 [ +  - ][ -  + ]:        136 :                 if ( pWindow->GetType() == WINDOW_TABCONTROL )
     285                 :            :                 {
     286         [ #  # ]:          0 :                     Window* pNextWindow = ImplGetDlgWindow( i, DLGWINDOW_NEXT );
     287         [ #  # ]:          0 :                     if ( pNextWindow )
     288                 :            :                     {
     289 [ #  # ][ #  # ]:          0 :                         if ( pWindow->IsChild( pNextWindow ) )
     290                 :          0 :                             pWindow = pNextWindow;
     291                 :            :                     }
     292                 :            :                 }
     293                 :            : 
     294 [ +  - ][ +  + ]:        136 :                 if ( !(pWindow->GetStyle() & WB_TABSTOP) )
     295                 :        102 :                     pWindow = NULL;
     296                 :            :             }
     297                 :            :         }
     298                 :            :     }
     299                 :            : 
     300         [ -  + ]:        148 :     if ( pIndex )
     301                 :          0 :         *pIndex = i;
     302                 :            : 
     303                 :        148 :     return pWindow;
     304                 :            : }
     305                 :            : 
     306                 :            : // -----------------------------------------------------------------------
     307                 :            : 
     308                 :       4524 : static Window* ImplFindDlgCtrlWindow( Window* pParent, Window* pWindow, sal_uInt16& rIndex,
     309                 :            :                                       sal_uInt16& rFormStart, sal_uInt16& rFormEnd )
     310                 :            : {
     311                 :            :     Window* pSWindow;
     312                 :       4524 :     Window* pSecondWindow = NULL;
     313                 :       4524 :     Window* pTempWindow = NULL;
     314                 :            :     sal_uInt16  i;
     315                 :       4524 :     sal_uInt16  nSecond_i = 0;
     316                 :       4524 :     sal_uInt16  nFormStart = 0;
     317                 :       4524 :     sal_uInt16  nSecondFormStart = 0;
     318                 :            :     sal_uInt16  nFormEnd;
     319                 :            : 
     320                 :            :     // Focus-Fenster in der Child-Liste suchen
     321         [ +  - ]:       4524 :     Window* pFirstChildWindow = pSWindow = ImplGetChildWindow( pParent, 0, i, sal_False );
     322                 :            : 
     323         [ -  + ]:       4524 :     if( pWindow == NULL )
     324                 :          0 :         pWindow = pSWindow;
     325                 :            : 
     326         [ +  + ]:      12777 :     while ( pSWindow )
     327                 :            :     {
     328                 :            :         // the DialogControlStart mark is only accepted for the direct children
     329 [ +  - ][ +  - ]:      17718 :         if ( !ImplHasIndirectTabParent( pSWindow )
         [ -  + ][ -  + ]
     330 [ +  - ][ +  - ]:       8859 :           && pSWindow->ImplGetWindow()->IsDialogControlStart() )
     331                 :          0 :             nFormStart = i;
     332                 :            : 
     333                 :            :         // SecondWindow wegen zusammengesetzten Controls wie
     334                 :            :         // ComboBoxen und Feldern
     335 [ +  - ][ +  + ]:       8859 :         if ( pSWindow->ImplIsWindowOrChild( pWindow ) )
     336                 :            :         {
     337                 :        682 :             pSecondWindow = pSWindow;
     338                 :        682 :             nSecond_i = i;
     339                 :        682 :             nSecondFormStart = nFormStart;
     340         [ +  + ]:        682 :             if ( pSWindow == pWindow )
     341                 :        606 :                 break;
     342                 :            :         }
     343                 :            : 
     344         [ +  - ]:       8253 :         pSWindow = ImplGetNextWindow( pParent, i, i, sal_False );
     345         [ +  + ]:       8253 :         if ( !i )
     346                 :        823 :             pSWindow = NULL;
     347                 :            :     }
     348                 :            : 
     349         [ +  + ]:       4524 :     if ( !pSWindow )
     350                 :            :     {
     351                 :            :         // Fenster nicht gefunden, dann koennen wir auch keine
     352                 :            :         // Steuerung uebernehmen
     353         [ +  + ]:       3918 :         if ( !pSecondWindow )
     354                 :       3842 :             return NULL;
     355                 :            :         else
     356                 :            :         {
     357                 :         76 :             pSWindow = pSecondWindow;
     358                 :         76 :             i = nSecond_i;
     359                 :         76 :             nFormStart = nSecondFormStart;
     360                 :            :         }
     361                 :            :     }
     362                 :            : 
     363                 :            :     // Start-Daten setzen
     364                 :        682 :     rIndex = i;
     365                 :        682 :     rFormStart = nFormStart;
     366                 :            : 
     367                 :            :     // Formularende suchen
     368                 :        682 :     nFormEnd = nFormStart;
     369                 :        682 :     pTempWindow = pSWindow;
     370                 :        682 :     sal_Int32 nIteration = 0;
     371         [ +  - ]:       1880 :     do
     372                 :            :     {
     373                 :       2562 :         nFormEnd = i;
     374         [ +  - ]:       2562 :         pTempWindow = ImplGetNextWindow( pParent, i, i, sal_False );
     375                 :            : 
     376                 :            :         // the DialogControlStart mark is only accepted for the direct children
     377 [ +  + ][ +  - ]:       6322 :         if ( !i
         [ +  - ][ -  + ]
                 [ +  + ]
     378         [ +  - ]:       1880 :           || ( pTempWindow && !ImplHasIndirectTabParent( pTempWindow )
     379 [ +  - ][ +  - ]:       1880 :                && pTempWindow->ImplGetWindow()->IsDialogControlStart() ) )
     380                 :        682 :             break;
     381                 :            : 
     382 [ +  - ][ -  + ]:       1880 :         if ( pTempWindow && pTempWindow == pFirstChildWindow )
     383                 :            :         {
     384                 :            :             // It is possible to go through the begin of hierarchy once
     385                 :            :             // while looking for DialogControlStart mark.
     386                 :            :             // If it happens second time, it looks like an endless loop,
     387                 :            :             // that should be impossible, but just for the case...
     388                 :          0 :             nIteration++;
     389         [ #  # ]:          0 :             if ( nIteration >= 2 )
     390                 :            :             {
     391                 :            :                 // this is an unexpected scenario
     392                 :            :                 DBG_ASSERT( sal_False, "It seems to be an endless loop!" );
     393                 :          0 :                 rFormStart = 0;
     394                 :          0 :                 break;
     395                 :            :             }
     396                 :            :         }
     397                 :            :     }
     398                 :            :     while ( pTempWindow );
     399                 :        682 :     rFormEnd = nFormEnd;
     400                 :            : 
     401                 :       4524 :     return pSWindow;
     402                 :            : }
     403                 :            : 
     404                 :            : // -----------------------------------------------------------------------
     405                 :            : 
     406                 :          0 : static Window* ImplFindAccelWindow( Window* pParent, sal_uInt16& rIndex, xub_Unicode cCharCode,
     407                 :            :                                     sal_uInt16 nFormStart, sal_uInt16 nFormEnd, sal_Bool bCheckEnable = sal_True )
     408                 :            : {
     409                 :            :     DBG_ASSERT( (rIndex >= nFormStart) && (rIndex <= nFormEnd),
     410                 :            :                 "Window::ImplFindAccelWindow() - rIndex not in Form" );
     411                 :            : 
     412                 :            :     xub_Unicode cCompareChar;
     413                 :          0 :     sal_uInt16  nStart = rIndex;
     414                 :          0 :     sal_uInt16  i = rIndex;
     415                 :          0 :     int     bSearch = sal_True;
     416                 :            :     Window* pWindow;
     417                 :            : 
     418                 :            :     // MT: Where can we keep the CharClass?!
     419 [ #  # ][ #  # ]:          0 :     static uno::Reference< i18n::XCharacterClassification > xCharClass;
     420         [ #  # ]:          0 :     if ( !xCharClass.is() )
     421 [ #  # ][ #  # ]:          0 :         xCharClass = vcl::unohelper::CreateCharacterClassification();
     422                 :            : 
     423 [ #  # ][ #  # ]:          0 :     const ::com::sun::star::lang::Locale& rLocale = Application::GetSettings().GetUILocale();
     424 [ #  # ][ #  # ]:          0 :     cCharCode = xCharClass->toUpper( rtl::OUString(cCharCode), 0, 1, rLocale )[0];
     425                 :            : 
     426         [ #  # ]:          0 :     if ( i < nFormEnd )
     427         [ #  # ]:          0 :         pWindow = ImplGetNextWindow( pParent, i, i, sal_True );
     428                 :            :     else
     429         [ #  # ]:          0 :         pWindow = ImplGetChildWindow( pParent, nFormStart, i, sal_True );
     430 [ #  # ][ #  # ]:          0 :     while( bSearch && pWindow )
                 [ #  # ]
     431                 :            :     {
     432         [ #  # ]:          0 :         const XubString aStr = pWindow->GetText();
     433         [ #  # ]:          0 :         sal_uInt16 nPos = aStr.Search( '~' );
     434         [ #  # ]:          0 :         while ( nPos != STRING_NOTFOUND )
     435                 :            :         {
     436                 :          0 :             cCompareChar = aStr.GetChar( nPos+1 );
     437 [ #  # ][ #  # ]:          0 :             cCompareChar = xCharClass->toUpper( rtl::OUString(cCompareChar), 0, 1, rLocale )[0];
     438         [ #  # ]:          0 :             if ( cCompareChar == cCharCode )
     439                 :            :             {
     440                 :            :                 // Bei Static-Controls auf das naechste Controlm weiterschalten
     441 [ #  # ][ #  # ]:          0 :                 if ( (pWindow->GetType() == WINDOW_FIXEDTEXT)   ||
         [ #  # ][ #  # ]
                 [ #  # ]
     442         [ #  # ]:          0 :                      (pWindow->GetType() == WINDOW_FIXEDLINE)   ||
     443         [ #  # ]:          0 :                      (pWindow->GetType() == WINDOW_GROUPBOX) )
     444         [ #  # ]:          0 :                     pWindow = pParent->ImplGetDlgWindow( i, DLGWINDOW_NEXT );
     445                 :          0 :                 rIndex = i;
     446                 :          0 :                 return pWindow;
     447                 :            :             }
     448         [ #  # ]:          0 :             nPos = aStr.Search( '~', nPos+1 );
     449                 :            :         }
     450                 :            : 
     451                 :            :         // #i93011# it would have made sense to have this really recursive
     452                 :            :         // right from the start. However this would cause unpredictable side effects now
     453                 :            :         // so instead we have a style bit for some child windows, that want their
     454                 :            :         // children checked for accelerators
     455 [ #  # ][ #  # ]:          0 :         if( (pWindow->GetStyle() & WB_CHILDDLGCTRL) != 0 )
     456                 :            :         {
     457                 :            :             sal_uInt16  nChildIndex;
     458                 :            :             sal_uInt16  nChildFormStart;
     459                 :            :             sal_uInt16  nChildFormEnd;
     460                 :            : 
     461                 :            :             // get form start and end
     462                 :            :             ::ImplFindDlgCtrlWindow( pWindow, NULL,
     463         [ #  # ]:          0 :                                      nChildIndex, nChildFormStart, nChildFormEnd );
     464                 :            :             Window* pAccelWin = ImplFindAccelWindow( pWindow, nChildIndex, cCharCode,
     465                 :            :                                                      nChildFormStart, nChildFormEnd,
     466         [ #  # ]:          0 :                                                      bCheckEnable );
     467         [ #  # ]:          0 :             if( pAccelWin )
     468                 :          0 :                 return pAccelWin;
     469                 :            :         }
     470                 :            : 
     471         [ #  # ]:          0 :         if ( i == nStart )
     472                 :            :             break;
     473                 :            : 
     474         [ #  # ]:          0 :         if ( i < nFormEnd )
     475                 :            :         {
     476         [ #  # ]:          0 :             pWindow = ImplGetNextWindow( pParent, i, i, bCheckEnable );
     477         [ #  # ]:          0 :             if( ! pWindow )
     478         [ #  # ]:          0 :                 pWindow = ImplGetChildWindow( pParent, nFormStart, i, bCheckEnable );
     479                 :            :         }
     480                 :            :         else
     481         [ #  # ]:          0 :             pWindow = ImplGetChildWindow( pParent, nFormStart, i, bCheckEnable );
     482         [ #  # ]:          0 :     }
              [ #  #  # ]
     483                 :            : 
     484                 :          0 :     return NULL;
     485                 :            : }
     486                 :            : 
     487                 :            : // -----------------------------------------------------------------------
     488                 :            : 
     489                 :         34 : void Window::ImplControlFocus( sal_uInt16 nFlags )
     490                 :            : {
     491         [ -  + ]:         34 :     if ( nFlags & GETFOCUS_MNEMONIC )
     492                 :            :     {
     493         [ #  # ]:          0 :         if ( GetType() == WINDOW_RADIOBUTTON )
     494                 :            :         {
     495         [ #  # ]:          0 :             if ( !((RadioButton*)this)->IsChecked() )
     496                 :          0 :                 ((RadioButton*)this)->ImplCallClick( sal_True, nFlags );
     497                 :            :             else
     498                 :          0 :                 ImplGrabFocus( nFlags );
     499                 :            :         }
     500                 :            :         else
     501                 :            :         {
     502                 :          0 :             ImplGrabFocus( nFlags );
     503         [ #  # ]:          0 :             if ( nFlags & GETFOCUS_UNIQUEMNEMONIC )
     504                 :            :             {
     505         [ #  # ]:          0 :                 if ( GetType() == WINDOW_CHECKBOX )
     506                 :          0 :                     ((CheckBox*)this)->ImplCheck();
     507         [ #  # ]:          0 :                 else if ( mpWindowImpl->mbPushButton )
     508                 :            :                 {
     509                 :          0 :                     ((PushButton*)this)->SetPressed( sal_True );
     510                 :          0 :                     ((PushButton*)this)->SetPressed( sal_False );
     511                 :          0 :                     ((PushButton*)this)->Click();
     512                 :            :                 }
     513                 :            :             }
     514                 :            :         }
     515                 :            :     }
     516                 :            :     else
     517                 :            :     {
     518         [ -  + ]:         34 :         if ( GetType() == WINDOW_RADIOBUTTON )
     519                 :            :         {
     520         [ #  # ]:          0 :             if ( !((RadioButton*)this)->IsChecked() )
     521                 :          0 :                 ((RadioButton*)this)->ImplCallClick( sal_True, nFlags );
     522                 :            :             else
     523                 :          0 :                 ImplGrabFocus( nFlags );
     524                 :            :         }
     525                 :            :         else
     526                 :         34 :             ImplGrabFocus( nFlags );
     527                 :            :     }
     528                 :         34 : }
     529                 :            : 
     530                 :            : // -----------------------------------------------------------------------
     531                 :            : 
     532                 :          0 : sal_Bool Window::ImplDlgCtrl( const KeyEvent& rKEvt, sal_Bool bKeyInput )
     533                 :            : {
     534                 :          0 :     KeyCode aKeyCode = rKEvt.GetKeyCode();
     535                 :          0 :     sal_uInt16  nKeyCode = aKeyCode.GetCode();
     536                 :            :     Window* pSWindow;
     537                 :            :     Window* pTempWindow;
     538                 :            :     Window* pButtonWindow;
     539                 :            :     sal_uInt16  i;
     540                 :            :     sal_uInt16  iButton;
     541                 :            :     sal_uInt16  iButtonStart;
     542                 :            :     sal_uInt16  iTemp;
     543                 :            :     sal_uInt16  nIndex;
     544                 :            :     sal_uInt16  nFormStart;
     545                 :            :     sal_uInt16  nFormEnd;
     546                 :            :     sal_uInt16  nDlgCtrlFlags;
     547                 :            : 
     548                 :            :     // Ohne Focus-Window koennen wir auch keine Steuerung uebernehmen
     549         [ #  # ]:          0 :     Window* pFocusWindow = Application::GetFocusWindow();
     550 [ #  # ][ #  # ]:          0 :     if ( !pFocusWindow || !ImplIsWindowOrChild( pFocusWindow ) )
         [ #  # ][ #  # ]
     551                 :          0 :         return sal_False;
     552                 :            : 
     553                 :            :     // Focus-Fenster in der Child-Liste suchen
     554                 :            :     pSWindow = ::ImplFindDlgCtrlWindow( this, pFocusWindow,
     555         [ #  # ]:          0 :                                         nIndex, nFormStart, nFormEnd );
     556         [ #  # ]:          0 :     if ( !pSWindow )
     557                 :          0 :         return sal_False;
     558                 :          0 :     i = nIndex;
     559                 :            : 
     560                 :          0 :     nDlgCtrlFlags = 0;
     561                 :          0 :     pTempWindow = pSWindow;
     562         [ #  # ]:          0 :     do
     563                 :            :     {
     564         [ #  # ]:          0 :         nDlgCtrlFlags |= pTempWindow->GetDialogControlFlags();
     565         [ #  # ]:          0 :         if ( pTempWindow == this )
     566                 :          0 :             break;
     567         [ #  # ]:          0 :         pTempWindow = pTempWindow->ImplGetParent();
     568                 :            :     }
     569                 :            :     while ( pTempWindow );
     570                 :            : 
     571                 :          0 :     pButtonWindow = NULL;
     572                 :            : 
     573         [ #  # ]:          0 :     if ( nKeyCode == KEY_RETURN )
     574                 :            :     {
     575                 :            :         // Wir suchen zuerst nach einem DefPushButton/CancelButton
     576         [ #  # ]:          0 :         pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, sal_True );
     577                 :          0 :         iButtonStart = iButton;
     578         [ #  # ]:          0 :         while ( pButtonWindow )
     579                 :            :         {
     580 [ #  # ][ #  # ]:          0 :             if ( (pButtonWindow->GetStyle() & WB_DEFBUTTON) &&
         [ #  # ][ #  # ]
     581                 :            :                  pButtonWindow->mpWindowImpl->mbPushButton )
     582                 :          0 :                 break;
     583                 :            : 
     584         [ #  # ]:          0 :             pButtonWindow = ImplGetNextWindow( this, iButton, iButton, sal_True );
     585 [ #  # ][ #  # ]:          0 :             if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
     586                 :          0 :                 pButtonWindow = NULL;
     587                 :            :         }
     588                 :            : 
     589 [ #  # ][ #  # ]:          0 :         if ( bKeyInput && !pButtonWindow && (nDlgCtrlFlags & WINDOW_DLGCTRL_RETURN) )
                 [ #  # ]
     590                 :            :         {
     591                 :            :             sal_uInt16  nType;
     592                 :          0 :             sal_uInt16  nGetFocusFlags = GETFOCUS_TAB;
     593                 :            :             sal_uInt16  nNewIndex;
     594                 :            :             sal_uInt16  iStart;
     595         [ #  # ]:          0 :             if ( aKeyCode.IsShift() )
     596                 :            :             {
     597                 :          0 :                 nType = DLGWINDOW_PREV;
     598                 :          0 :                 nGetFocusFlags |= GETFOCUS_BACKWARD;
     599                 :            :             }
     600                 :            :             else
     601                 :            :             {
     602                 :          0 :                 nType = DLGWINDOW_NEXT;
     603                 :          0 :                 nGetFocusFlags |= GETFOCUS_FORWARD;
     604                 :            :             }
     605                 :          0 :             iStart = i;
     606         [ #  # ]:          0 :             pTempWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
     607 [ #  # ][ #  # ]:          0 :             while ( pTempWindow && (pTempWindow != pSWindow) )
                 [ #  # ]
     608                 :            :             {
     609         [ #  # ]:          0 :                 if ( !pTempWindow->mpWindowImpl->mbPushButton )
     610                 :            :                 {
     611                 :            :                     // Around-Flag ermitteln
     612         [ #  # ]:          0 :                     if ( nType == DLGWINDOW_PREV )
     613                 :            :                     {
     614         [ #  # ]:          0 :                         if ( nNewIndex > iStart )
     615                 :          0 :                             nGetFocusFlags |= GETFOCUS_AROUND;
     616                 :            :                     }
     617                 :            :                     else
     618                 :            :                     {
     619         [ #  # ]:          0 :                         if ( nNewIndex < iStart )
     620                 :          0 :                             nGetFocusFlags |= GETFOCUS_AROUND;
     621                 :            :                     }
     622         [ #  # ]:          0 :                     pTempWindow->ImplControlFocus( nGetFocusFlags );
     623                 :          0 :                     return sal_True;
     624                 :            :                 }
     625                 :            :                 else
     626                 :            :                 {
     627                 :          0 :                     i = nNewIndex;
     628         [ #  # ]:          0 :                     pTempWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
     629                 :            :                 }
     630 [ #  # ][ #  # ]:          0 :                 if ( (i <= iStart) || (i > nFormEnd) )
     631                 :          0 :                     pTempWindow = NULL;
     632                 :            :             }
     633                 :            :             // Wenn es das gleiche Fenster ist, ein Get/LoseFocus
     634                 :            :             // simulieren, falls AROUND ausgewertet wird
     635 [ #  # ][ #  # ]:          0 :             if ( pTempWindow && (pTempWindow == pSWindow) )
     636                 :            :             {
     637         [ #  # ]:          0 :                 NotifyEvent aNEvt1( EVENT_LOSEFOCUS, pSWindow );
     638 [ #  # ][ #  # ]:          0 :                 if ( !ImplCallPreNotify( aNEvt1 ) )
     639         [ #  # ]:          0 :                     pSWindow->LoseFocus();
     640                 :          0 :                 pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
     641         [ #  # ]:          0 :                 NotifyEvent aNEvt2( EVENT_GETFOCUS, pSWindow );
     642 [ #  # ][ #  # ]:          0 :                 if ( !ImplCallPreNotify( aNEvt2 ) )
     643         [ #  # ]:          0 :                     pSWindow->GetFocus();
     644                 :          0 :                 pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
     645                 :          0 :                 return sal_True;
     646                 :            :             }
     647                 :            :         }
     648                 :            :     }
     649         [ #  # ]:          0 :     else if ( nKeyCode == KEY_ESCAPE )
     650                 :            :     {
     651                 :            :         // Wir suchen zuerst nach einem DefPushButton/CancelButton
     652         [ #  # ]:          0 :         pButtonWindow = ImplGetChildWindow( this, nFormStart, iButton, sal_True );
     653                 :          0 :         iButtonStart = iButton;
     654         [ #  # ]:          0 :         while ( pButtonWindow )
     655                 :            :         {
     656 [ #  # ][ #  # ]:          0 :             if ( pButtonWindow->GetType() == WINDOW_CANCELBUTTON )
     657                 :          0 :                 break;
     658                 :            : 
     659         [ #  # ]:          0 :             pButtonWindow = ImplGetNextWindow( this, iButton, iButton, sal_True );
     660 [ #  # ][ #  # ]:          0 :             if ( (iButton <= iButtonStart) || (iButton > nFormEnd) )
     661                 :          0 :                 pButtonWindow = NULL;
     662                 :            :         }
     663                 :            : 
     664 [ #  # ][ #  # ]:          0 :         if ( bKeyInput && mpWindowImpl->mpDlgCtrlDownWindow )
     665                 :            :         {
     666         [ #  # ]:          0 :             if ( mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow )
     667                 :            :             {
     668         [ #  # ]:          0 :                 ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False );
     669                 :          0 :                 mpWindowImpl->mpDlgCtrlDownWindow = NULL;
     670                 :          0 :                 return sal_True;
     671                 :            :             }
     672                 :            :         }
     673                 :            :     }
     674         [ #  # ]:          0 :     else if ( bKeyInput )
     675                 :            :     {
     676         [ #  # ]:          0 :         if ( nKeyCode == KEY_TAB )
     677                 :            :         {
     678                 :            :             // keine Alt-Taste abfangen, wegen Windows
     679         [ #  # ]:          0 :             if ( !aKeyCode.IsMod2() )
     680                 :            :             {
     681                 :            :                 sal_uInt16  nType;
     682                 :          0 :                 sal_uInt16  nGetFocusFlags = GETFOCUS_TAB;
     683                 :            :                 sal_uInt16  nNewIndex;
     684                 :          0 :                 sal_Bool    bFormular = sal_False;
     685                 :            : 
     686                 :            :                 // Bei Ctrl-Tab erstmal testen, ob zwischen Formularen
     687                 :            :                 // gesprungen werden soll
     688         [ #  # ]:          0 :                 if ( aKeyCode.IsMod1() )
     689                 :            :                 {
     690                 :            :                     // Gruppe suchen
     691                 :          0 :                     Window* pFormularFirstWindow = NULL;
     692                 :          0 :                     Window* pLastFormularFirstWindow = NULL;
     693         [ #  # ]:          0 :                     pTempWindow = ImplGetChildWindow( this, 0, iTemp, sal_False );
     694                 :          0 :                     Window* pPrevFirstFormularFirstWindow = NULL;
     695                 :          0 :                     Window* pFirstFormularFirstWindow = pTempWindow;
     696         [ #  # ]:          0 :                     while ( pTempWindow )
     697                 :            :                     {
     698 [ #  # ][ #  # ]:          0 :                         if ( pTempWindow->ImplGetWindow()->IsDialogControlStart() )
                 [ #  # ]
     699                 :            :                         {
     700         [ #  # ]:          0 :                             if ( iTemp != 0 )
     701                 :          0 :                                 bFormular = sal_True;
     702         [ #  # ]:          0 :                             if ( aKeyCode.IsShift() )
     703                 :            :                             {
     704         [ #  # ]:          0 :                                 if ( iTemp <= nIndex )
     705                 :          0 :                                     pFormularFirstWindow = pPrevFirstFormularFirstWindow;
     706                 :          0 :                                 pPrevFirstFormularFirstWindow = pTempWindow;
     707                 :            :                             }
     708                 :            :                             else
     709                 :            :                             {
     710 [ #  # ][ #  # ]:          0 :                                 if ( (iTemp > nIndex) && !pFormularFirstWindow )
     711                 :          0 :                                     pFormularFirstWindow = pTempWindow;
     712                 :            :                             }
     713                 :          0 :                             pLastFormularFirstWindow = pTempWindow;
     714                 :            :                         }
     715                 :            : 
     716         [ #  # ]:          0 :                         pTempWindow = ImplGetNextWindow( this, iTemp, iTemp, sal_False );
     717         [ #  # ]:          0 :                         if ( !iTemp )
     718                 :          0 :                             pTempWindow = NULL;
     719                 :            :                     }
     720                 :            : 
     721         [ #  # ]:          0 :                     if ( bFormular )
     722                 :            :                     {
     723         [ #  # ]:          0 :                         if ( !pFormularFirstWindow )
     724                 :            :                         {
     725         [ #  # ]:          0 :                             if ( aKeyCode.IsShift() )
     726                 :          0 :                                 pFormularFirstWindow = pLastFormularFirstWindow;
     727                 :            :                             else
     728                 :          0 :                                 pFormularFirstWindow = pFirstFormularFirstWindow;
     729                 :            :                         }
     730                 :            : 
     731                 :          0 :                         sal_uInt16 nFoundFormStart = 0;
     732                 :          0 :                         sal_uInt16 nFoundFormEnd = 0;
     733                 :          0 :                         sal_uInt16 nTempIndex = 0;
     734         [ #  # ]:          0 :                         if ( ::ImplFindDlgCtrlWindow( this, pFormularFirstWindow, nTempIndex,
     735         [ #  # ]:          0 :                                                       nFoundFormStart, nFoundFormEnd ) )
     736                 :            :                         {
     737                 :          0 :                             nTempIndex = nFoundFormStart;
     738         [ #  # ]:          0 :                             pFormularFirstWindow = ImplGetDlgWindow( nTempIndex, DLGWINDOW_FIRST, nFoundFormStart, nFoundFormEnd );
     739         [ #  # ]:          0 :                             if ( pFormularFirstWindow )
     740                 :            :                             {
     741         [ #  # ]:          0 :                                 pFormularFirstWindow->ImplControlFocus();
     742                 :          0 :                                 return sal_True;
     743                 :            :                             }
     744                 :            :                         }
     745                 :            :                     }
     746                 :            :                 }
     747                 :            : 
     748         [ #  # ]:          0 :                 if ( !bFormular )
     749                 :            :                 {
     750                 :            :                     // Only use Ctrl-TAB if it was allowed for the whole
     751                 :            :                     // dialog or for the current control (#103667#)
     752 [ #  # ][ #  # ]:          0 :                     if ( !aKeyCode.IsMod1() || (nDlgCtrlFlags & WINDOW_DLGCTRL_MOD1TAB) ||
         [ #  # ][ #  # ]
     753         [ #  # ]:          0 :                         ( pSWindow->GetStyle() & WINDOW_DLGCTRL_MOD1TAB) )
     754                 :            :                     {
     755         [ #  # ]:          0 :                         if ( aKeyCode.IsShift() )
     756                 :            :                         {
     757                 :          0 :                             nType = DLGWINDOW_PREV;
     758                 :          0 :                             nGetFocusFlags |= GETFOCUS_BACKWARD;
     759                 :            :                         }
     760                 :            :                         else
     761                 :            :                         {
     762                 :          0 :                             nType = DLGWINDOW_NEXT;
     763                 :          0 :                             nGetFocusFlags |= GETFOCUS_FORWARD;
     764                 :            :                         }
     765         [ #  # ]:          0 :                         Window* pWindow = ImplGetDlgWindow( i, nType, nFormStart, nFormEnd, &nNewIndex );
     766                 :            :                         // Wenn es das gleiche Fenster ist, ein Get/LoseFocus
     767                 :            :                         // simulieren, falls AROUND ausgewertet wird
     768         [ #  # ]:          0 :                         if ( pWindow == pSWindow )
     769                 :            :                         {
     770         [ #  # ]:          0 :                             NotifyEvent aNEvt1( EVENT_LOSEFOCUS, pSWindow );
     771 [ #  # ][ #  # ]:          0 :                             if ( !ImplCallPreNotify( aNEvt1 ) )
     772         [ #  # ]:          0 :                                 pSWindow->LoseFocus();
     773                 :          0 :                             pSWindow->mpWindowImpl->mnGetFocusFlags = nGetFocusFlags | GETFOCUS_AROUND;
     774         [ #  # ]:          0 :                             NotifyEvent aNEvt2( EVENT_GETFOCUS, pSWindow );
     775 [ #  # ][ #  # ]:          0 :                             if ( !ImplCallPreNotify( aNEvt2 ) )
     776         [ #  # ]:          0 :                                 pSWindow->GetFocus();
     777                 :          0 :                             pSWindow->mpWindowImpl->mnGetFocusFlags = 0;
     778                 :          0 :                             return sal_True;
     779                 :            :                         }
     780         [ #  # ]:          0 :                         else if ( pWindow )
     781                 :            :                         {
     782                 :            :                             // Around-Flag ermitteln
     783         [ #  # ]:          0 :                             if ( nType == DLGWINDOW_PREV )
     784                 :            :                             {
     785         [ #  # ]:          0 :                                 if ( nNewIndex > i )
     786                 :          0 :                                     nGetFocusFlags |= GETFOCUS_AROUND;
     787                 :            :                             }
     788                 :            :                             else
     789                 :            :                             {
     790         [ #  # ]:          0 :                                 if ( nNewIndex < i )
     791                 :          0 :                                     nGetFocusFlags |= GETFOCUS_AROUND;
     792                 :            :                             }
     793         [ #  # ]:          0 :                             pWindow->ImplControlFocus( nGetFocusFlags );
     794                 :          0 :                             return sal_True;
     795                 :            :                         }
     796                 :            :                     }
     797                 :            :                 }
     798                 :            :             }
     799                 :            :         }
     800 [ #  # ][ #  # ]:          0 :         else if ( (nKeyCode == KEY_LEFT) || (nKeyCode == KEY_UP) )
     801                 :            :         {
     802                 :          0 :             Window* pWindow = pSWindow;
     803         [ #  # ]:          0 :             WinBits nStyle = pSWindow->GetStyle();
     804         [ #  # ]:          0 :             if ( !(nStyle & WB_GROUP) )
     805                 :            :             {
     806         [ #  # ]:          0 :                 pWindow = pWindow->GetWindow( WINDOW_PREV );
     807         [ #  # ]:          0 :                 while ( pWindow )
     808                 :            :                 {
     809         [ #  # ]:          0 :                     pWindow = pWindow->ImplGetWindow();
     810                 :            : 
     811         [ #  # ]:          0 :                     nStyle = pWindow->GetStyle();
     812                 :            : 
     813 [ #  # ][ #  # ]:          0 :                     if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     814                 :            :                     {
     815         [ #  # ]:          0 :                         if ( pWindow != pSWindow )
     816         [ #  # ]:          0 :                             pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
     817                 :          0 :                         return sal_True;
     818                 :            :                     }
     819                 :            : 
     820         [ #  # ]:          0 :                     if ( nStyle & WB_GROUP )
     821                 :          0 :                         break;
     822                 :            : 
     823         [ #  # ]:          0 :                     pWindow = pWindow->GetWindow( WINDOW_PREV );
     824                 :            :                 }
     825                 :          0 :             }
     826                 :            :         }
     827 [ #  # ][ #  # ]:          0 :         else if ( (nKeyCode == KEY_RIGHT) || (nKeyCode == KEY_DOWN) )
     828                 :            :         {
     829                 :            :             Window* pWindow;
     830                 :            :             WinBits nStyle;
     831         [ #  # ]:          0 :             pWindow = pSWindow->GetWindow( WINDOW_NEXT );
     832         [ #  # ]:          0 :             while ( pWindow )
     833                 :            :             {
     834         [ #  # ]:          0 :                 pWindow = pWindow->ImplGetWindow();
     835                 :            : 
     836         [ #  # ]:          0 :                 nStyle = pWindow->GetStyle();
     837                 :            : 
     838         [ #  # ]:          0 :                 if ( nStyle & WB_GROUP )
     839                 :          0 :                     break;
     840                 :            : 
     841 [ #  # ][ #  # ]:          0 :                 if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     842                 :            :                 {
     843         [ #  # ]:          0 :                     pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
     844                 :          0 :                     return sal_True;
     845                 :            :                 }
     846                 :            : 
     847         [ #  # ]:          0 :                 pWindow = pWindow->GetWindow( WINDOW_NEXT );
     848                 :          0 :             }
     849                 :            :         }
     850                 :            :         else
     851                 :            :         {
     852                 :          0 :             xub_Unicode c = rKEvt.GetCharCode();
     853         [ #  # ]:          0 :             if ( c )
     854                 :            :             {
     855         [ #  # ]:          0 :                 pSWindow = ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd );
     856         [ #  # ]:          0 :                 if ( pSWindow )
     857                 :            :                 {
     858                 :          0 :                     sal_uInt16 nGetFocusFlags = GETFOCUS_MNEMONIC;
     859 [ #  # ][ #  # ]:          0 :                     if ( pSWindow == ::ImplFindAccelWindow( this, i, c, nFormStart, nFormEnd ) )
     860                 :          0 :                         nGetFocusFlags |= GETFOCUS_UNIQUEMNEMONIC;
     861         [ #  # ]:          0 :                     pSWindow->ImplControlFocus( nGetFocusFlags );
     862                 :          0 :                     return sal_True;
     863                 :            :                 }
     864                 :            :             }
     865                 :            :         }
     866                 :            :     }
     867                 :            : 
     868 [ #  # ][ #  # ]:          0 :     if ( pButtonWindow && pButtonWindow->IsVisible() && pButtonWindow->IsEnabled() && pButtonWindow->IsInputEnabled() )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     869                 :            :     {
     870         [ #  # ]:          0 :         if ( bKeyInput )
     871                 :            :         {
     872 [ #  # ][ #  # ]:          0 :             if ( mpWindowImpl->mpDlgCtrlDownWindow && (mpWindowImpl->mpDlgCtrlDownWindow != pButtonWindow) )
     873                 :            :             {
     874         [ #  # ]:          0 :                 ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False );
     875                 :          0 :                 mpWindowImpl->mpDlgCtrlDownWindow = NULL;
     876                 :            :             }
     877                 :            : 
     878         [ #  # ]:          0 :             ((PushButton*)pButtonWindow)->SetPressed( sal_True );
     879                 :          0 :             mpWindowImpl->mpDlgCtrlDownWindow = pButtonWindow;
     880                 :            :         }
     881         [ #  # ]:          0 :         else if ( mpWindowImpl->mpDlgCtrlDownWindow == pButtonWindow )
     882                 :            :         {
     883                 :          0 :             mpWindowImpl->mpDlgCtrlDownWindow = NULL;
     884         [ #  # ]:          0 :             ((PushButton*)pButtonWindow)->SetPressed( sal_False );
     885         [ #  # ]:          0 :             ((PushButton*)pButtonWindow)->Click();
     886                 :            :         }
     887                 :            : 
     888                 :          0 :         return sal_True;
     889                 :            :     }
     890                 :            : 
     891                 :          0 :     return sal_False;
     892                 :            : }
     893                 :            : 
     894                 :            : // -----------------------------------------------------------------------
     895                 :            : 
     896                 :            : // checks if this window has dialog control
     897                 :          0 : sal_Bool Window::ImplHasDlgCtrl()
     898                 :            : {
     899                 :            :     Window* pDlgCtrlParent;
     900                 :            : 
     901                 :            :     // lookup window for dialog control
     902                 :          0 :     pDlgCtrlParent = ImplGetParent();
     903   [ #  #  #  #  :          0 :     while ( pDlgCtrlParent &&
           #  # ][ #  # ]
     904                 :          0 :             !pDlgCtrlParent->ImplIsOverlapWindow() &&
     905                 :          0 :             ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
     906                 :          0 :         pDlgCtrlParent = pDlgCtrlParent->ImplGetParent();
     907                 :            : 
     908 [ #  # ][ #  # ]:          0 :     if ( !pDlgCtrlParent || ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
                 [ #  # ]
     909                 :          0 :         return sal_False;
     910                 :            :     else
     911                 :          0 :         return sal_True;
     912                 :            : }
     913                 :            : 
     914                 :        110 : void Window::ImplDlgCtrlNextWindow()
     915                 :            : {
     916                 :            :     Window* pDlgCtrlParent;
     917                 :            :     Window* pDlgCtrl;
     918                 :            :     Window* pSWindow;
     919                 :            :     sal_uInt16  nIndex;
     920                 :            :     sal_uInt16  nFormStart;
     921                 :            :     sal_uInt16  nFormEnd;
     922                 :            : 
     923                 :            :     // lookup window for dialog control
     924                 :        110 :     pDlgCtrl = this;
     925         [ +  - ]:        110 :     pDlgCtrlParent = ImplGetParent();
     926 [ +  - ][ +  + ]:       1524 :     while ( pDlgCtrlParent &&
         [ +  + ][ +  + ]
     927         [ +  - ]:        544 :             !pDlgCtrlParent->ImplIsOverlapWindow() &&
     928         [ +  - ]:        436 :             ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
     929         [ +  - ]:        434 :         pDlgCtrlParent = pDlgCtrlParent->ImplGetParent();
     930                 :            : 
     931 [ +  - ][ +  - ]:        110 : if ( !pDlgCtrlParent || (GetStyle() & WB_NODIALOGCONTROL) || ((pDlgCtrlParent->GetStyle() & (WB_DIALOGCONTROL | WB_NODIALOGCONTROL)) != WB_DIALOGCONTROL) )
         [ +  - ][ +  - ]
         [ +  + ][ +  + ]
     932                 :            :         return;
     933                 :            : 
     934                 :            :     // lookup window in child list
     935                 :            :     pSWindow = ::ImplFindDlgCtrlWindow( pDlgCtrlParent, pDlgCtrl,
     936         [ +  - ]:          2 :                                         nIndex, nFormStart, nFormEnd );
     937         [ +  - ]:          2 :     if ( !pSWindow )
     938                 :            :         return;
     939                 :            : 
     940         [ +  - ]:          2 :     Window* pWindow = pDlgCtrlParent->ImplGetDlgWindow( nIndex, DLGWINDOW_NEXT, nFormStart, nFormEnd );
     941 [ +  - ][ -  + ]:          2 :     if ( pWindow && (pWindow != pSWindow) )
     942         [ #  # ]:        110 :         pWindow->ImplControlFocus();
     943                 :            : }
     944                 :            : 
     945                 :            : // -----------------------------------------------------------------------
     946                 :            : 
     947                 :       4008 : static void ImplDlgCtrlUpdateDefButton( Window* pParent, Window* pFocusWindow,
     948                 :            :                                         sal_Bool bGetFocus )
     949                 :            : {
     950                 :       4008 :     PushButton* pOldDefButton   = NULL;
     951                 :       4008 :     PushButton* pNewDefButton   = NULL;
     952                 :            :     Window*     pSWindow;
     953                 :            :     sal_uInt16      i;
     954                 :            :     sal_uInt16      nFormStart;
     955                 :            :     sal_uInt16      nFormEnd;
     956                 :            : 
     957                 :            :     // Formular suchen
     958         [ +  - ]:       4008 :     pSWindow = ::ImplFindDlgCtrlWindow( pParent, pFocusWindow, i, nFormStart, nFormEnd );
     959         [ +  + ]:       4008 :     if ( !pSWindow )
     960                 :            :     {
     961                 :       3686 :         nFormStart = 0;
     962                 :       3686 :         nFormEnd = 0xFFFF;
     963                 :            :     }
     964                 :            : 
     965         [ +  - ]:       4008 :     pSWindow = ImplGetChildWindow( pParent, nFormStart, i, sal_False );
     966         [ +  + ]:      11888 :     while ( pSWindow )
     967                 :            :     {
     968 [ +  - ][ +  + ]:       7880 :         if ( pSWindow->ImplIsPushButton() )
     969                 :            :         {
     970                 :         78 :             PushButton* pPushButton = (PushButton*)pSWindow;
     971 [ +  - ][ +  + ]:         78 :             if ( pPushButton->ImplIsDefButton() )
     972                 :          8 :                 pOldDefButton = pPushButton;
     973 [ +  - ][ +  + ]:         78 :             if ( pPushButton->HasChildPathFocus() )
     974                 :          8 :                 pNewDefButton = pPushButton;
     975 [ +  + ][ +  - ]:         70 :             else if ( !pNewDefButton && (pPushButton->GetStyle() & WB_DEFBUTTON) )
         [ -  + ][ -  + ]
     976                 :          0 :                 pNewDefButton = pPushButton;
     977                 :            :         }
     978                 :            : 
     979         [ +  - ]:       7880 :         pSWindow = ImplGetNextWindow( pParent, i, i, sal_False );
     980 [ +  + ][ -  + ]:       7880 :         if ( !i || (i > nFormEnd) )
     981                 :       1014 :             pSWindow = NULL;
     982                 :            :     }
     983                 :            : 
     984         [ +  + ]:       4008 :     if ( !bGetFocus )
     985                 :            :     {
     986                 :            :         sal_uInt16 nDummy;
     987         [ +  - ]:       1907 :         Window* pNewFocusWindow = Application::GetFocusWindow();
     988 [ +  + ][ +  - ]:       1907 :         if ( !pNewFocusWindow || !pParent->ImplIsWindowOrChild( pNewFocusWindow ) )
         [ +  + ][ +  + ]
     989                 :       1509 :             pNewDefButton = NULL;
     990 [ +  - ][ +  + ]:        398 :         else if ( !::ImplFindDlgCtrlWindow( pParent, pNewFocusWindow, i, nDummy, nDummy ) ||
         [ +  - ][ -  + ]
                 [ +  + ]
     991                 :            :                   (i < nFormStart) || (i > nFormEnd) )
     992                 :       1907 :             pNewDefButton = NULL;
     993                 :            :     }
     994                 :            : 
     995         [ +  + ]:       4008 :     if ( pOldDefButton != pNewDefButton )
     996                 :            :     {
     997         [ +  + ]:         12 :         if ( pOldDefButton )
     998         [ +  - ]:          6 :             pOldDefButton->ImplSetDefButton( sal_False );
     999         [ +  + ]:         12 :         if ( pNewDefButton )
    1000         [ +  - ]:          6 :             pNewDefButton->ImplSetDefButton( sal_True );
    1001                 :            :     }
    1002                 :       4008 : }
    1003                 :            : 
    1004                 :            : // -----------------------------------------------------------------------
    1005                 :            : 
    1006                 :       4008 : void Window::ImplDlgCtrlFocusChanged( Window* pWindow, sal_Bool bGetFocus )
    1007                 :            : {
    1008 [ -  + ][ #  # ]:       4008 :     if ( mpWindowImpl->mpDlgCtrlDownWindow && !bGetFocus )
    1009                 :            :     {
    1010                 :          0 :         ((PushButton*)mpWindowImpl->mpDlgCtrlDownWindow)->SetPressed( sal_False );
    1011                 :          0 :         mpWindowImpl->mpDlgCtrlDownWindow = NULL;
    1012                 :            :     }
    1013                 :            : 
    1014                 :       4008 :     ImplDlgCtrlUpdateDefButton( this, pWindow, bGetFocus );
    1015                 :       4008 : }
    1016                 :            : 
    1017                 :            : // -----------------------------------------------------------------------
    1018                 :            : 
    1019                 :          0 : Window* Window::ImplFindDlgCtrlWindow( Window* pWindow )
    1020                 :            : {
    1021                 :            :     sal_uInt16  nIndex;
    1022                 :            :     sal_uInt16  nFormStart;
    1023                 :            :     sal_uInt16  nFormEnd;
    1024                 :            : 
    1025                 :            :     // Focus-Fenster in der Child-Liste suchen und zurueckgeben
    1026         [ #  # ]:          0 :     return ::ImplFindDlgCtrlWindow( this, pWindow, nIndex, nFormStart, nFormEnd );
    1027                 :            : }
    1028                 :            : 
    1029                 :            : 
    1030                 :            : // -----------------------------------------------------------------------
    1031                 :            : 
    1032                 :          2 : Window* Window::GetParentLabelFor( const Window* ) const
    1033                 :            : {
    1034                 :          2 :     return NULL;
    1035                 :            : }
    1036                 :            : 
    1037                 :            : // -----------------------------------------------------------------------
    1038                 :            : 
    1039                 :         56 : Window* Window::GetParentLabeledBy( const Window* ) const
    1040                 :            : {
    1041                 :         56 :     return NULL;
    1042                 :            : }
    1043                 :            : 
    1044                 :            : // -----------------------------------------------------------------------
    1045                 :            : 
    1046                 :          2 : static sal_Unicode getAccel( const String& rStr )
    1047                 :            : {
    1048                 :          2 :     sal_Unicode nChar = 0;
    1049                 :          2 :     sal_uInt16 nPos = 0;
    1050         [ -  + ]:          2 :     do
    1051                 :            :     {
    1052                 :          2 :         nPos = rStr.Search( '~', nPos );
    1053 [ #  # ][ -  + ]:          2 :         if( nPos != STRING_NOTFOUND && nPos < rStr.Len() )
                 [ -  + ]
    1054                 :          0 :             nChar = rStr.GetChar( ++nPos );
    1055                 :            :         else
    1056                 :          2 :             nChar = 0;
    1057                 :            :     } while( nChar == '~' );
    1058                 :          2 :     return nChar;
    1059                 :            : }
    1060                 :            : 
    1061                 :          4 : static Window* ImplGetLabelFor( Window* pFrameWindow, WindowType nMyType, Window* pLabel, sal_Unicode nAccel )
    1062                 :            : {
    1063                 :          4 :     Window* pWindow = NULL;
    1064                 :            : 
    1065 [ -  + ][ #  # ]:          4 :     if( nMyType == WINDOW_FIXEDTEXT     ||
                 [ #  # ]
    1066                 :            :         nMyType == WINDOW_FIXEDLINE     ||
    1067                 :            :         nMyType == WINDOW_GROUPBOX )
    1068                 :            :     {
    1069                 :            :         // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text.
    1070                 :            :         // See tools/options/print for example.
    1071 [ +  - ][ -  + ]:          4 :         sal_Bool bThisIsAGroupControl = (nMyType == WINDOW_GROUPBOX) || (nMyType == WINDOW_FIXEDLINE);
    1072                 :          4 :         Window* pSWindow = NULL;
    1073                 :            :         // get index, form start and form end
    1074                 :          4 :         sal_uInt16 nIndex=0, nFormStart=0, nFormEnd=0;
    1075                 :            :         pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
    1076                 :            :                                            pLabel,
    1077                 :            :                                            nIndex,
    1078                 :            :                                            nFormStart,
    1079         [ +  - ]:          4 :                                            nFormEnd );
    1080         [ -  + ]:          4 :         if( nAccel )
    1081                 :            :         {
    1082                 :            :             // find the accelerated window
    1083                 :            :             pWindow = ::ImplFindAccelWindow( pFrameWindow,
    1084                 :            :                                              nIndex,
    1085                 :            :                                              nAccel,
    1086                 :            :                                              nFormStart,
    1087                 :            :                                              nFormEnd,
    1088         [ #  # ]:          0 :                                              sal_False );
    1089                 :            :         }
    1090                 :            :         else
    1091                 :            :         {
    1092                 :            :             // find the next control; if that is a fixed text
    1093                 :            :             // fixed line or group box, then return NULL
    1094         [ -  + ]:          4 :             while( nIndex < nFormEnd )
    1095                 :            :             {
    1096                 :          0 :                 nIndex++;
    1097                 :            :                 pSWindow = ::ImplGetChildWindow( pFrameWindow,
    1098                 :            :                                                  nIndex,
    1099                 :            :                                                  nIndex,
    1100         [ #  # ]:          0 :                                                  sal_False );
    1101 [ #  # ][ #  # ]:          0 :                 if( pSWindow && pSWindow->IsVisible() && ! (pSWindow->GetStyle() & WB_NOLABEL) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    1102                 :            :                 {
    1103         [ #  # ]:          0 :                     WindowType nType = pSWindow->GetType();
    1104 [ #  # ][ #  # ]:          0 :                     if( nType != WINDOW_FIXEDTEXT   &&
                 [ #  # ]
    1105                 :            :                         nType != WINDOW_FIXEDLINE   &&
    1106                 :            :                         nType != WINDOW_GROUPBOX )
    1107                 :            :                     {
    1108                 :          0 :                         pWindow = pSWindow;
    1109                 :            :                     }
    1110 [ #  # ][ #  # ]:          0 :                     else if( bThisIsAGroupControl && ( nType == WINDOW_FIXEDTEXT ) )
    1111                 :            :                     {
    1112                 :          0 :                         pWindow = pSWindow;
    1113                 :            :                     }
    1114                 :          0 :                     break;
    1115                 :            :                 }
    1116                 :            :             }
    1117                 :            :         }
    1118                 :            :     }
    1119                 :            : 
    1120                 :          4 :     return pWindow;
    1121                 :            : }
    1122                 :            : 
    1123                 :       7612 : Window* Window::GetAccessibleRelationLabelFor() const
    1124                 :            : {
    1125         [ -  + ]:       7612 :     if ( mpWindowImpl->mbDisableAccessibleLabelForRelation )
    1126                 :          0 :         return NULL;
    1127                 :            : 
    1128 [ +  + ][ -  + ]:       7612 :     if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabelForWindow )
    1129                 :          0 :         return mpWindowImpl->mpAccessibleInfos->pLabelForWindow;
    1130                 :            : 
    1131                 :            : 
    1132                 :       7612 :     Window* pWindow = NULL;
    1133                 :       7612 :     Window* pFrameWindow = ImplGetFrameWindow();
    1134                 :            : 
    1135                 :       7612 :     WinBits nFrameStyle = pFrameWindow->GetStyle();
    1136 [ -  + ][ +  + ]:       7612 :     if( ! ( nFrameStyle & WB_DIALOGCONTROL )
    1137                 :            :         || ( nFrameStyle & WB_NODIALOGCONTROL )
    1138                 :            :         )
    1139                 :       7610 :         return NULL;
    1140                 :            : 
    1141         [ +  - ]:          2 :     if ( mpWindowImpl->mpRealParent )
    1142                 :          2 :         pWindow = mpWindowImpl->mpRealParent->GetParentLabelFor( this );
    1143                 :            : 
    1144         [ -  + ]:          2 :     if( pWindow )
    1145                 :          0 :         return pWindow;
    1146                 :            : 
    1147         [ +  - ]:          2 :     sal_Unicode nAccel = getAccel( GetText() );
    1148                 :            : 
    1149                 :          2 :     pWindow = ImplGetLabelFor( pFrameWindow, GetType(), const_cast<Window*>(this), nAccel );
    1150 [ +  - ][ +  - ]:          2 :     if( ! pWindow && mpWindowImpl->mpRealParent )
    1151                 :          2 :         pWindow = ImplGetLabelFor( mpWindowImpl->mpRealParent, GetType(), const_cast<Window*>(this), nAccel );
    1152                 :       7612 :     return pWindow;
    1153                 :            : }
    1154                 :            : 
    1155                 :            : // -----------------------------------------------------------------------
    1156                 :            : 
    1157                 :        112 : static Window* ImplGetLabeledBy( Window* pFrameWindow, WindowType nMyType, Window* pLabeled )
    1158                 :            : {
    1159                 :        112 :     Window* pWindow = NULL;
    1160 [ +  - ][ +  - ]:        112 :     if ( (nMyType != WINDOW_GROUPBOX) && (nMyType != WINDOW_FIXEDLINE) )
    1161                 :            :     {
    1162                 :            :         // search for a control that labels this window
    1163                 :            :         // a label is considered the last fixed text, fixed line or group box
    1164                 :            :         // that comes before this control; with the exception of push buttons
    1165                 :            :         // which are labeled only if the fixed text, fixed line or group box
    1166                 :            :         // is directly before the control
    1167                 :            : 
    1168                 :            :         // get form start and form end and index of this control
    1169                 :            :         sal_uInt16 nIndex, nFormStart, nFormEnd;
    1170                 :            :         Window* pSWindow = ::ImplFindDlgCtrlWindow( pFrameWindow,
    1171                 :            :                                                     pLabeled,
    1172                 :            :                                                     nIndex,
    1173                 :            :                                                     nFormStart,
    1174         [ +  - ]:        112 :                                                     nFormEnd );
    1175 [ +  - ][ +  + ]:        112 :         if( pSWindow && nIndex != nFormStart )
    1176                 :            :         {
    1177 [ +  - ][ +  - ]:        102 :             if( nMyType == WINDOW_PUSHBUTTON        ||
         [ +  - ][ -  + ]
    1178                 :            :                 nMyType == WINDOW_HELPBUTTON        ||
    1179                 :            :                 nMyType == WINDOW_OKBUTTON      ||
    1180                 :            :                 nMyType == WINDOW_CANCELBUTTON )
    1181                 :            :             {
    1182                 :          0 :                 nFormStart = nIndex-1;
    1183                 :            :             }
    1184         [ +  - ]:        214 :             for( sal_uInt16 nSearchIndex = nIndex-1; nSearchIndex >= nFormStart; nSearchIndex-- )
    1185                 :            :             {
    1186                 :        102 :                 sal_uInt16 nFoundIndex = 0;
    1187                 :            :                 pSWindow = ::ImplGetChildWindow( pFrameWindow,
    1188                 :            :                                                  nSearchIndex,
    1189                 :            :                                                  nFoundIndex,
    1190         [ +  - ]:        102 :                                                  sal_False );
    1191 [ +  - ][ +  - ]:        102 :                 if( pSWindow && pSWindow->IsVisible() && !(pSWindow->GetStyle() & WB_NOLABEL) )
         [ +  - ][ +  - ]
         [ +  - ][ +  - ]
    1192                 :            :                 {
    1193         [ +  - ]:        102 :                     WindowType nType = pSWindow->GetType();
    1194 [ +  - ][ +  - ]:        102 :                     if ( ( nType == WINDOW_FIXEDTEXT    ||
                 [ -  + ]
    1195                 :            :                           nType == WINDOW_FIXEDLINE ||
    1196                 :            :                           nType == WINDOW_GROUPBOX ) )
    1197                 :            :                     {
    1198                 :            :                         // a fixed text can't be labeld by a fixed text.
    1199 [ #  # ][ #  # ]:          0 :                         if ( ( nMyType != WINDOW_FIXEDTEXT ) || ( nType != WINDOW_FIXEDTEXT ) )
    1200                 :          0 :                             pWindow = pSWindow;
    1201                 :            :                         break;
    1202                 :            :                     }
    1203                 :            :                 }
    1204 [ +  - ][ -  + ]:        102 :                 if( nFoundIndex > nSearchIndex || nSearchIndex == 0 )
    1205                 :            :                     break;
    1206                 :            :             }
    1207                 :            :         }
    1208                 :            :     }
    1209                 :        112 :     return pWindow;
    1210                 :            : }
    1211                 :            : 
    1212                 :         56 : Window* Window::GetAccessibleRelationLabeledBy() const
    1213                 :            : {
    1214         [ -  + ]:         56 :     if ( mpWindowImpl->mbDisableAccessibleLabeledByRelation )
    1215                 :          0 :         return NULL;
    1216                 :            : 
    1217 [ +  + ][ -  + ]:         56 :     if ( mpWindowImpl->mpAccessibleInfos && mpWindowImpl->mpAccessibleInfos->pLabeledByWindow )
    1218                 :          0 :         return mpWindowImpl->mpAccessibleInfos->pLabeledByWindow;
    1219                 :            : 
    1220                 :         56 :     Window* pWindow = NULL;
    1221                 :         56 :     Window* pFrameWindow = ImplGetFrameWindow();
    1222                 :            : 
    1223         [ +  - ]:         56 :     if ( mpWindowImpl->mpRealParent )
    1224                 :            :     {
    1225                 :         56 :         pWindow = mpWindowImpl->mpRealParent->GetParentLabeledBy( this );
    1226                 :            : 
    1227         [ -  + ]:         56 :         if( pWindow )
    1228                 :          0 :             return pWindow;
    1229                 :            :     }
    1230                 :            : 
    1231                 :            :     // #i62723#, #104191# checkboxes and radiobuttons are not supposed to have labels
    1232 [ +  - ][ -  + ]:         56 :     if( GetType() == WINDOW_CHECKBOX || GetType() == WINDOW_RADIOBUTTON )
                 [ -  + ]
    1233                 :          0 :         return NULL;
    1234                 :            : 
    1235                 :            : //    if( ! ( GetType() == WINDOW_FIXEDTEXT     ||
    1236                 :            : //            GetType() == WINDOW_FIXEDLINE     ||
    1237                 :            : //            GetType() == WINDOW_GROUPBOX ) )
    1238                 :            :     // #i100833# MT 2010/02: Group box and fixed lines can also lable a fixed text.
    1239                 :            :     // See tools/options/print for example.
    1240                 :            : 
    1241                 :         56 :     pWindow = ImplGetLabeledBy( pFrameWindow, GetType(), const_cast<Window*>(this) );
    1242 [ +  - ][ +  - ]:         56 :     if( ! pWindow && mpWindowImpl->mpRealParent )
    1243                 :         56 :         pWindow = ImplGetLabeledBy( mpWindowImpl->mpRealParent, GetType(), const_cast<Window*>(this) );
    1244                 :            : 
    1245                 :         56 :     return pWindow;
    1246                 :            : }
    1247                 :            : 
    1248                 :            : // -----------------------------------------------------------------------
    1249                 :            : 
    1250                 :          0 : KeyEvent Window::GetActivationKey() const
    1251                 :            : {
    1252                 :          0 :     KeyEvent aKeyEvent;
    1253                 :            : 
    1254         [ #  # ]:          0 :     sal_Unicode nAccel = getAccel( GetText() );
    1255         [ #  # ]:          0 :     if( ! nAccel )
    1256                 :            :     {
    1257                 :          0 :         Window* pWindow = GetAccessibleRelationLabeledBy();
    1258         [ #  # ]:          0 :         if( pWindow )
    1259         [ #  # ]:          0 :             nAccel = getAccel( pWindow->GetText() );
    1260                 :            :     }
    1261         [ #  # ]:          0 :     if( nAccel )
    1262                 :            :     {
    1263                 :          0 :         sal_uInt16 nCode = 0;
    1264 [ #  # ][ #  # ]:          0 :         if( nAccel >= 'a' && nAccel <= 'z' )
    1265                 :          0 :             nCode = KEY_A + (nAccel-'a');
    1266 [ #  # ][ #  # ]:          0 :         else if( nAccel >= 'A' && nAccel <= 'Z' )
    1267                 :          0 :             nCode = KEY_A + (nAccel-'A');
    1268 [ #  # ][ #  # ]:          0 :         else if( nAccel >= '0' && nAccel <= '9' )
    1269                 :          0 :             nCode = KEY_0 + (nAccel-'0');
    1270         [ #  # ]:          0 :         else if( nAccel == '.' )
    1271                 :          0 :             nCode = KEY_POINT;
    1272         [ #  # ]:          0 :         else if( nAccel == '-' )
    1273                 :          0 :             nCode = KEY_SUBTRACT;
    1274         [ #  # ]:          0 :         KeyCode aKeyCode( nCode, sal_False, sal_False, sal_True, sal_False );
    1275 [ #  # ][ #  # ]:          0 :         aKeyEvent = KeyEvent( nAccel, aKeyCode );
    1276                 :            :     }
    1277                 :          0 :     return aKeyEvent;
    1278                 :            : }
    1279                 :            : 
    1280                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10