xref: /AOO41X/main/vcl/source/window/taskpanelist.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_vcl.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <tools/rcid.h>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir #include <vcl/dockwin.hxx>
34*cdf0e10cSrcweir #include <vcl/taskpanelist.hxx>
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #include <svdata.hxx>
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #include <functional>
39*cdf0e10cSrcweir #include <algorithm>
40*cdf0e10cSrcweir 
41*cdf0e10cSrcweir // can't have static linkage because SUNPRO 5.2 complains
42*cdf0e10cSrcweir Point ImplTaskPaneListGetPos( const Window *w )
43*cdf0e10cSrcweir {
44*cdf0e10cSrcweir     Point pos;
45*cdf0e10cSrcweir 	if( w->ImplIsDockingWindow() )
46*cdf0e10cSrcweir     {
47*cdf0e10cSrcweir         pos = ((DockingWindow*)w)->GetPosPixel();
48*cdf0e10cSrcweir         Window *pF = ((DockingWindow*)w)->GetFloatingWindow();
49*cdf0e10cSrcweir         if( pF )
50*cdf0e10cSrcweir             pos = pF->OutputToAbsoluteScreenPixel( pF->ScreenToOutputPixel( pos ) );
51*cdf0e10cSrcweir         else
52*cdf0e10cSrcweir             pos = w->OutputToAbsoluteScreenPixel( pos );
53*cdf0e10cSrcweir     }
54*cdf0e10cSrcweir     else
55*cdf0e10cSrcweir         pos = w->OutputToAbsoluteScreenPixel( w->GetPosPixel() );
56*cdf0e10cSrcweir 
57*cdf0e10cSrcweir     return pos;
58*cdf0e10cSrcweir }
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir // compares window pos left-to-right
61*cdf0e10cSrcweir struct LTRSort : public ::std::binary_function< const Window*, const Window*, bool >
62*cdf0e10cSrcweir {
63*cdf0e10cSrcweir     bool operator()( const Window* w1, const Window* w2 ) const
64*cdf0e10cSrcweir     {
65*cdf0e10cSrcweir         Point pos1(ImplTaskPaneListGetPos( w1 ));
66*cdf0e10cSrcweir         Point pos2(ImplTaskPaneListGetPos( w2 ));
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir         if( pos1.X() == pos2.X() )
69*cdf0e10cSrcweir             return ( pos1.Y() < pos2.Y() );
70*cdf0e10cSrcweir         else
71*cdf0e10cSrcweir             return ( pos1.X() < pos2.X() );
72*cdf0e10cSrcweir     }
73*cdf0e10cSrcweir };
74*cdf0e10cSrcweir struct LTRSortBackward : public ::std::binary_function< const Window*, const Window*, bool >
75*cdf0e10cSrcweir {
76*cdf0e10cSrcweir     bool operator()( const Window* w2, const Window* w1 ) const
77*cdf0e10cSrcweir     {
78*cdf0e10cSrcweir         Point pos1(ImplTaskPaneListGetPos( w1 ));
79*cdf0e10cSrcweir         Point pos2(ImplTaskPaneListGetPos( w2 ));
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir         if( pos1.X() == pos2.X() )
82*cdf0e10cSrcweir             return ( pos1.Y() < pos2.Y() );
83*cdf0e10cSrcweir         else
84*cdf0e10cSrcweir             return ( pos1.X() < pos2.X() );
85*cdf0e10cSrcweir     }
86*cdf0e10cSrcweir };
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir // --------------------------------------------------
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir static void ImplTaskPaneListGrabFocus( Window *pWindow )
91*cdf0e10cSrcweir {
92*cdf0e10cSrcweir 	// put focus in child of floating windows which is typically a toolbar
93*cdf0e10cSrcweir 	// that can deal with the focus
94*cdf0e10cSrcweir 	if( pWindow->ImplIsFloatingWindow() && pWindow->GetWindow( WINDOW_FIRSTCHILD ) )
95*cdf0e10cSrcweir 		pWindow = pWindow->GetWindow( WINDOW_FIRSTCHILD );
96*cdf0e10cSrcweir 	pWindow->GrabFocus();
97*cdf0e10cSrcweir }
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir // --------------------------------------------------
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir TaskPaneList::TaskPaneList()
102*cdf0e10cSrcweir {
103*cdf0e10cSrcweir }
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir TaskPaneList::~TaskPaneList()
106*cdf0e10cSrcweir {
107*cdf0e10cSrcweir }
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir // --------------------------------------------------
110*cdf0e10cSrcweir 
111*cdf0e10cSrcweir void TaskPaneList::AddWindow( Window *pWindow )
112*cdf0e10cSrcweir {
113*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
114*cdf0e10cSrcweir     bool bDockingWindow=false;
115*cdf0e10cSrcweir     bool bToolbox=false;
116*cdf0e10cSrcweir     bool bDialog=false;
117*cdf0e10cSrcweir     bool bUnknown=false;
118*cdf0e10cSrcweir #endif
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     if( pWindow )
121*cdf0e10cSrcweir     {
122*cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0
123*cdf0e10cSrcweir         if( pWindow->GetType() == RSC_DOCKINGWINDOW )
124*cdf0e10cSrcweir             bDockingWindow = true;
125*cdf0e10cSrcweir         else if( pWindow->GetType() == RSC_TOOLBOX )
126*cdf0e10cSrcweir             bToolbox = true;
127*cdf0e10cSrcweir         else if( pWindow->IsDialog() )
128*cdf0e10cSrcweir             bDialog = true;
129*cdf0e10cSrcweir         else
130*cdf0e10cSrcweir             bUnknown = true;
131*cdf0e10cSrcweir #endif
132*cdf0e10cSrcweir 
133*cdf0e10cSrcweir         ::std::vector< Window* >::iterator insertionPos = mTaskPanes.end();
134*cdf0e10cSrcweir         for ( ::std::vector< Window* >::iterator p = mTaskPanes.begin();
135*cdf0e10cSrcweir               p != mTaskPanes.end();
136*cdf0e10cSrcweir               ++p
137*cdf0e10cSrcweir             )
138*cdf0e10cSrcweir         {
139*cdf0e10cSrcweir             if ( *p == pWindow )
140*cdf0e10cSrcweir                 // avoid duplicates
141*cdf0e10cSrcweir                 return;
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir             // If the new window is the child of an existing pane window, or vice versa,
144*cdf0e10cSrcweir             // ensure that in our pane list, *first* the child window appears, *then*
145*cdf0e10cSrcweir             // the ancestor window.
146*cdf0e10cSrcweir             // This is necessary for HandleKeyEvent: There, the list is traveled from the
147*cdf0e10cSrcweir             // beginning, until the first window is found which has the ChildPathFocus. Now
148*cdf0e10cSrcweir             // if this would be the ancestor window of another pane window, this would fudge
149*cdf0e10cSrcweir             // the result
150*cdf0e10cSrcweir             // 2004-09-27 - fs@openoffice.org, while fixing #i33573#, which included replacing
151*cdf0e10cSrcweir             // the original fix for #98916# with this one here.
152*cdf0e10cSrcweir             if ( pWindow->IsWindowOrChild( *p ) )
153*cdf0e10cSrcweir             {
154*cdf0e10cSrcweir                 insertionPos = p + 1;
155*cdf0e10cSrcweir                 break;
156*cdf0e10cSrcweir             }
157*cdf0e10cSrcweir             if ( (*p)->IsWindowOrChild( pWindow ) )
158*cdf0e10cSrcweir             {
159*cdf0e10cSrcweir                 insertionPos = p;
160*cdf0e10cSrcweir                 break;
161*cdf0e10cSrcweir             }
162*cdf0e10cSrcweir         }
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir         mTaskPanes.insert( insertionPos, pWindow );
165*cdf0e10cSrcweir         pWindow->ImplIsInTaskPaneList( sal_True );
166*cdf0e10cSrcweir     }
167*cdf0e10cSrcweir }
168*cdf0e10cSrcweir 
169*cdf0e10cSrcweir // --------------------------------------------------
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir void TaskPaneList::RemoveWindow( Window *pWindow )
172*cdf0e10cSrcweir {
173*cdf0e10cSrcweir 	::std::vector< Window* >::iterator p;
174*cdf0e10cSrcweir     p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), pWindow );
175*cdf0e10cSrcweir     if( p != mTaskPanes.end() )
176*cdf0e10cSrcweir     {
177*cdf0e10cSrcweir 	    mTaskPanes.erase( p );
178*cdf0e10cSrcweir         pWindow->ImplIsInTaskPaneList( sal_False );
179*cdf0e10cSrcweir     }
180*cdf0e10cSrcweir }
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir // --------------------------------------------------
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir sal_Bool TaskPaneList::IsInList( Window *pWindow )
185*cdf0e10cSrcweir {
186*cdf0e10cSrcweir 	::std::vector< Window* >::iterator p;
187*cdf0e10cSrcweir     p = ::std::find( mTaskPanes.begin(), mTaskPanes.end(), pWindow );
188*cdf0e10cSrcweir     if( p != mTaskPanes.end() )
189*cdf0e10cSrcweir 	    return sal_True;
190*cdf0e10cSrcweir     else
191*cdf0e10cSrcweir         return sal_False;
192*cdf0e10cSrcweir }
193*cdf0e10cSrcweir 
194*cdf0e10cSrcweir // --------------------------------------------------
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir sal_Bool TaskPaneList::HandleKeyEvent( KeyEvent aKeyEvent )
197*cdf0e10cSrcweir {
198*cdf0e10cSrcweir 
199*cdf0e10cSrcweir     // F6 cycles through everything and works always
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir     // MAV, #i104204#
202*cdf0e10cSrcweir     // The old design was the following one:
203*cdf0e10cSrcweir     // < Ctrl-TAB cycles through Menubar, Toolbars and Floatingwindows only and is
204*cdf0e10cSrcweir     // < only active if one of those items has the focus
205*cdf0e10cSrcweir     //
206*cdf0e10cSrcweir     // Since the design of Ctrl-Tab looks to be inconsistent ( non-modal dialogs are not reachable
207*cdf0e10cSrcweir     // and the shortcut conflicts with tab-control shortcut ), it is no more supported
208*cdf0e10cSrcweir     sal_Bool bSplitterOnly = sal_False;
209*cdf0e10cSrcweir     sal_Bool bFocusInList = sal_False;
210*cdf0e10cSrcweir 	KeyCode aKeyCode = aKeyEvent.GetKeyCode();
211*cdf0e10cSrcweir     sal_Bool bForward = !aKeyCode.IsShift();
212*cdf0e10cSrcweir 	if( aKeyCode.GetCode() == KEY_F6 && ! aKeyCode.IsMod2() ) // F6
213*cdf0e10cSrcweir 	{
214*cdf0e10cSrcweir         bSplitterOnly = aKeyCode.IsMod1() && aKeyCode.IsShift();
215*cdf0e10cSrcweir 
216*cdf0e10cSrcweir 		// is the focus in the list ?
217*cdf0e10cSrcweir 		::std::vector< Window* >::iterator p = mTaskPanes.begin();
218*cdf0e10cSrcweir 		while( p != mTaskPanes.end() )
219*cdf0e10cSrcweir         {
220*cdf0e10cSrcweir             Window *pWin = *p;
221*cdf0e10cSrcweir 			if( pWin->HasChildPathFocus( sal_True ) )
222*cdf0e10cSrcweir 			{
223*cdf0e10cSrcweir                 bFocusInList = sal_True;
224*cdf0e10cSrcweir 
225*cdf0e10cSrcweir                 // Ctrl-F6 goes directly to the document
226*cdf0e10cSrcweir                 if( !pWin->IsDialog() && aKeyCode.IsMod1() && !aKeyCode.IsShift() )
227*cdf0e10cSrcweir                 {
228*cdf0e10cSrcweir 		            pWin->GrabFocusToDocument();
229*cdf0e10cSrcweir 		            return sal_True;
230*cdf0e10cSrcweir                 }
231*cdf0e10cSrcweir 
232*cdf0e10cSrcweir 				// activate next task pane
233*cdf0e10cSrcweir                 Window *pNextWin = NULL;
234*cdf0e10cSrcweir 
235*cdf0e10cSrcweir                 if( bSplitterOnly )
236*cdf0e10cSrcweir                     pNextWin = FindNextSplitter( *p, sal_True );
237*cdf0e10cSrcweir                 else
238*cdf0e10cSrcweir                     pNextWin = FindNextFloat( *p, bForward );
239*cdf0e10cSrcweir 
240*cdf0e10cSrcweir 				if( pNextWin != pWin )
241*cdf0e10cSrcweir 				{
242*cdf0e10cSrcweir 					ImplGetSVData()->maWinData.mbNoSaveFocus = sal_True;
243*cdf0e10cSrcweir 					ImplTaskPaneListGrabFocus( pNextWin );
244*cdf0e10cSrcweir 					ImplGetSVData()->maWinData.mbNoSaveFocus = sal_False;
245*cdf0e10cSrcweir 				}
246*cdf0e10cSrcweir                 else
247*cdf0e10cSrcweir                 {
248*cdf0e10cSrcweir                     // forward key if no splitter found
249*cdf0e10cSrcweir                     if( bSplitterOnly )
250*cdf0e10cSrcweir                         return sal_False;
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir                     // we did not find another taskpane, so
253*cdf0e10cSrcweir                     // put focus back into document
254*cdf0e10cSrcweir                     pWin->GrabFocusToDocument();
255*cdf0e10cSrcweir                 }
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 				return sal_True;
258*cdf0e10cSrcweir 			}
259*cdf0e10cSrcweir 			else
260*cdf0e10cSrcweir 				p++;
261*cdf0e10cSrcweir         }
262*cdf0e10cSrcweir 
263*cdf0e10cSrcweir         // the focus is not in the list: activate first float if F6 was pressed
264*cdf0e10cSrcweir         if( !bFocusInList )
265*cdf0e10cSrcweir         {
266*cdf0e10cSrcweir             Window *pWin;
267*cdf0e10cSrcweir             if( bSplitterOnly )
268*cdf0e10cSrcweir                 pWin = FindNextSplitter( NULL, sal_True );
269*cdf0e10cSrcweir             else
270*cdf0e10cSrcweir                 pWin = FindNextFloat( NULL, bForward );
271*cdf0e10cSrcweir             if( pWin )
272*cdf0e10cSrcweir             {
273*cdf0e10cSrcweir 				ImplTaskPaneListGrabFocus( pWin );
274*cdf0e10cSrcweir                 return sal_True;
275*cdf0e10cSrcweir             }
276*cdf0e10cSrcweir         }
277*cdf0e10cSrcweir 	}
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 	return sal_False;
280*cdf0e10cSrcweir }
281*cdf0e10cSrcweir 
282*cdf0e10cSrcweir // --------------------------------------------------
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir //  returns next valid pane
285*cdf0e10cSrcweir Window* TaskPaneList::FindNextPane( Window *pWindow, sal_Bool bForward )
286*cdf0e10cSrcweir {
287*cdf0e10cSrcweir     if( bForward )
288*cdf0e10cSrcweir         ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() );
289*cdf0e10cSrcweir     else
290*cdf0e10cSrcweir         ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() );
291*cdf0e10cSrcweir 
292*cdf0e10cSrcweir 	::std::vector< Window* >::iterator p = mTaskPanes.begin();
293*cdf0e10cSrcweir 	while( p != mTaskPanes.end() )
294*cdf0e10cSrcweir     {
295*cdf0e10cSrcweir         if( *p == pWindow )
296*cdf0e10cSrcweir         {
297*cdf0e10cSrcweir             unsigned n = mTaskPanes.size();
298*cdf0e10cSrcweir             while( --n )
299*cdf0e10cSrcweir             {
300*cdf0e10cSrcweir 		        if( ++p == mTaskPanes.end() )
301*cdf0e10cSrcweir 			        p = mTaskPanes.begin();
302*cdf0e10cSrcweir                 if( (*p)->IsReallyVisible() && !(*p)->IsDialog() && !(*p)->ImplIsSplitter() )
303*cdf0e10cSrcweir 				{
304*cdf0e10cSrcweir 					pWindow = *p;
305*cdf0e10cSrcweir 					break;
306*cdf0e10cSrcweir 				}
307*cdf0e10cSrcweir             }
308*cdf0e10cSrcweir             break;
309*cdf0e10cSrcweir         }
310*cdf0e10cSrcweir         else
311*cdf0e10cSrcweir             ++p;
312*cdf0e10cSrcweir     }
313*cdf0e10cSrcweir 
314*cdf0e10cSrcweir 	return pWindow;
315*cdf0e10cSrcweir }
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir // --------------------------------------------------
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir // returns next splitter
320*cdf0e10cSrcweir Window* TaskPaneList::FindNextSplitter( Window *pWindow, sal_Bool bForward )
321*cdf0e10cSrcweir {
322*cdf0e10cSrcweir     if( bForward )
323*cdf0e10cSrcweir         ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() );
324*cdf0e10cSrcweir     else
325*cdf0e10cSrcweir         ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() );
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	::std::vector< Window* >::iterator p = mTaskPanes.begin();
328*cdf0e10cSrcweir 	while( p != mTaskPanes.end() )
329*cdf0e10cSrcweir     {
330*cdf0e10cSrcweir         if( !pWindow || *p == pWindow )
331*cdf0e10cSrcweir         {
332*cdf0e10cSrcweir             unsigned n = mTaskPanes.size();
333*cdf0e10cSrcweir             while( --n )
334*cdf0e10cSrcweir             {
335*cdf0e10cSrcweir                 if( pWindow )   // increment before test
336*cdf0e10cSrcweir                     ++p;
337*cdf0e10cSrcweir 		        if( p == mTaskPanes.end() )
338*cdf0e10cSrcweir 			        p = mTaskPanes.begin();
339*cdf0e10cSrcweir                 if( (*p)->ImplIsSplitter() && (*p)->IsReallyVisible() && !(*p)->IsDialog() && (*p)->GetParent()->HasChildPathFocus() )
340*cdf0e10cSrcweir 				{
341*cdf0e10cSrcweir 					pWindow = *p;
342*cdf0e10cSrcweir 					break;
343*cdf0e10cSrcweir 				}
344*cdf0e10cSrcweir                 if( !pWindow )  // increment after test, otherwise first element is skipped
345*cdf0e10cSrcweir                     ++p;
346*cdf0e10cSrcweir             }
347*cdf0e10cSrcweir             break;
348*cdf0e10cSrcweir         }
349*cdf0e10cSrcweir         else
350*cdf0e10cSrcweir             ++p;
351*cdf0e10cSrcweir     }
352*cdf0e10cSrcweir 
353*cdf0e10cSrcweir 	return pWindow;
354*cdf0e10cSrcweir }
355*cdf0e10cSrcweir 
356*cdf0e10cSrcweir // --------------------------------------------------
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir // returns first valid item (regardless of type) if pWindow==0, otherwise returns next valid float
359*cdf0e10cSrcweir Window* TaskPaneList::FindNextFloat( Window *pWindow, sal_Bool bForward )
360*cdf0e10cSrcweir {
361*cdf0e10cSrcweir     if( bForward )
362*cdf0e10cSrcweir         ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSort() );
363*cdf0e10cSrcweir     else
364*cdf0e10cSrcweir         ::std::stable_sort( mTaskPanes.begin(), mTaskPanes.end(), LTRSortBackward() );
365*cdf0e10cSrcweir 
366*cdf0e10cSrcweir 	::std::vector< Window* >::iterator p = mTaskPanes.begin();
367*cdf0e10cSrcweir 	while( p != mTaskPanes.end() )
368*cdf0e10cSrcweir     {
369*cdf0e10cSrcweir         if( !pWindow || *p == pWindow )
370*cdf0e10cSrcweir         {
371*cdf0e10cSrcweir             while( p != mTaskPanes.end() )
372*cdf0e10cSrcweir             {
373*cdf0e10cSrcweir                 if( pWindow )   // increment before test
374*cdf0e10cSrcweir                     ++p;
375*cdf0e10cSrcweir 		        if( p == mTaskPanes.end() )
376*cdf0e10cSrcweir 			        break; // do not wrap, send focus back to document at end of list
377*cdf0e10cSrcweir                 /* #i83908# do not use the menubar if it is native and invisible
378*cdf0e10cSrcweir                    this relies on MenuBar::ImplCreate setting the height of the menubar
379*cdf0e10cSrcweir                    to 0 in this case
380*cdf0e10cSrcweir                 */
381*cdf0e10cSrcweir                 if( (*p)->IsReallyVisible() && !(*p)->ImplIsSplitter() &&
382*cdf0e10cSrcweir                     ( (*p)->GetType() != WINDOW_MENUBARWINDOW || (*p)->GetSizePixel().Height() > 0 )
383*cdf0e10cSrcweir                     )
384*cdf0e10cSrcweir 				{
385*cdf0e10cSrcweir                     pWindow = *p;
386*cdf0e10cSrcweir 					break;
387*cdf0e10cSrcweir 				}
388*cdf0e10cSrcweir                 if( !pWindow )  // increment after test, otherwise first element is skipped
389*cdf0e10cSrcweir                     ++p;
390*cdf0e10cSrcweir             }
391*cdf0e10cSrcweir             break;
392*cdf0e10cSrcweir         }
393*cdf0e10cSrcweir         else
394*cdf0e10cSrcweir             ++p;
395*cdf0e10cSrcweir     }
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir 	return pWindow;
398*cdf0e10cSrcweir }
399*cdf0e10cSrcweir 
400*cdf0e10cSrcweir // --------------------------------------------------
401*cdf0e10cSrcweir 
402