1*b0724fc6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*b0724fc6SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*b0724fc6SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*b0724fc6SAndrew Rist  * distributed with this work for additional information
6*b0724fc6SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*b0724fc6SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*b0724fc6SAndrew Rist  * "License"); you may not use this file except in compliance
9*b0724fc6SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*b0724fc6SAndrew Rist  *
11*b0724fc6SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*b0724fc6SAndrew Rist  *
13*b0724fc6SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*b0724fc6SAndrew Rist  * software distributed under the License is distributed on an
15*b0724fc6SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b0724fc6SAndrew Rist  * KIND, either express or implied.  See the License for the
17*b0724fc6SAndrew Rist  * specific language governing permissions and limitations
18*b0724fc6SAndrew Rist  * under the License.
19*b0724fc6SAndrew Rist  *
20*b0724fc6SAndrew Rist  *************************************************************/
21*b0724fc6SAndrew Rist 
22*b0724fc6SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_toolkit.hxx"
26cdf0e10cSrcweir #include <com/sun/star/awt/WindowEvent.hpp>
27cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <toolkit/helper/unowrapper.hxx>
30cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
31cdf0e10cSrcweir #include <toolkit/helper/convert.hxx>
32cdf0e10cSrcweir #include <toolkit/awt/vclxwindow.hxx>
33cdf0e10cSrcweir #include <toolkit/awt/vclxwindows.hxx>
34cdf0e10cSrcweir #include <toolkit/awt/vclxcontainer.hxx>
35cdf0e10cSrcweir #include <toolkit/awt/vclxtopwindow.hxx>
36cdf0e10cSrcweir #include <toolkit/awt/vclxgraphics.hxx>
37cdf0e10cSrcweir 
38cdf0e10cSrcweir #include "toolkit/dllapi.h"
39cdf0e10cSrcweir #include <vcl/svapp.hxx>
40cdf0e10cSrcweir #include <vcl/syswin.hxx>
41cdf0e10cSrcweir #include <vcl/menu.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include <tools/debug.hxx>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir using namespace ::com::sun::star;
46cdf0e10cSrcweir 
CreateXWindow(Window * pWindow)47cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > CreateXWindow( Window* pWindow )
48cdf0e10cSrcweir {
49cdf0e10cSrcweir     switch ( pWindow->GetType() )
50cdf0e10cSrcweir     {
51cdf0e10cSrcweir 		case WINDOW_IMAGERADIOBUTTON:
52cdf0e10cSrcweir 		case WINDOW_IMAGEBUTTON:
53cdf0e10cSrcweir 		case WINDOW_SPINBUTTON:
54cdf0e10cSrcweir 		case WINDOW_MENUBUTTON:
55cdf0e10cSrcweir 		case WINDOW_MOREBUTTON:
56cdf0e10cSrcweir 		case WINDOW_PUSHBUTTON:
57cdf0e10cSrcweir 		case WINDOW_HELPBUTTON:
58cdf0e10cSrcweir 		case WINDOW_OKBUTTON:
59cdf0e10cSrcweir 		case WINDOW_CANCELBUTTON:   return new VCLXButton;
60cdf0e10cSrcweir 		case WINDOW_CHECKBOX:       return new VCLXCheckBox;
61cdf0e10cSrcweir         // --> OD 2009-06-29 #i95042#
62cdf0e10cSrcweir         // A Window of type <MetricBox> is inherited from type <ComboBox>.
63cdf0e10cSrcweir         // Thus, it does make more sense to return a <VCLXComboBox> instance
64cdf0e10cSrcweir         // instead of only a <VCLXWindow> instance, especially regarding its
65cdf0e10cSrcweir         // corresponding accessibility API.
66cdf0e10cSrcweir         case WINDOW_METRICBOX:
67cdf0e10cSrcweir         case WINDOW_COMBOBOX:       return new VCLXComboBox;
68cdf0e10cSrcweir 		case WINDOW_SPINFIELD:
69cdf0e10cSrcweir 		case WINDOW_NUMERICFIELD:
70cdf0e10cSrcweir 		case WINDOW_CURRENCYFIELD:  return new VCLXNumericField;
71cdf0e10cSrcweir 		case WINDOW_DATEFIELD:      return new VCLXDateField;
72cdf0e10cSrcweir         case WINDOW_MULTILINEEDIT:
73cdf0e10cSrcweir 		case WINDOW_EDIT:           return new VCLXEdit;
74cdf0e10cSrcweir 		case WINDOW_METRICFIELD:    return new VCLXSpinField;
75cdf0e10cSrcweir 		case WINDOW_MESSBOX:
76cdf0e10cSrcweir 		case WINDOW_INFOBOX:
77cdf0e10cSrcweir 		case WINDOW_WARNINGBOX:
78cdf0e10cSrcweir 		case WINDOW_QUERYBOX:
79cdf0e10cSrcweir 		case WINDOW_ERRORBOX:       return new VCLXMessageBox;
80cdf0e10cSrcweir 		case WINDOW_FIXEDIMAGE:     return new VCLXImageControl;
81cdf0e10cSrcweir 		case WINDOW_FIXEDTEXT:      return new VCLXFixedText;
82cdf0e10cSrcweir 		case WINDOW_MULTILISTBOX:
83cdf0e10cSrcweir 		case WINDOW_LISTBOX:        return new VCLXListBox;
84cdf0e10cSrcweir 		case WINDOW_LONGCURRENCYFIELD:  return new VCLXCurrencyField;
85cdf0e10cSrcweir 		case WINDOW_DIALOG:
86cdf0e10cSrcweir 		case WINDOW_MODALDIALOG:
87cdf0e10cSrcweir 		case WINDOW_TABDIALOG:
88cdf0e10cSrcweir 		case WINDOW_BUTTONDIALOG:
89cdf0e10cSrcweir 		case WINDOW_MODELESSDIALOG: return new VCLXDialog;
90cdf0e10cSrcweir 		case WINDOW_PATTERNFIELD:   return new VCLXPatternField;
91cdf0e10cSrcweir 		case WINDOW_RADIOBUTTON:    return new VCLXRadioButton;
92cdf0e10cSrcweir 		case WINDOW_SCROLLBAR:      return new VCLXScrollBar;
93cdf0e10cSrcweir 		case WINDOW_TIMEFIELD:      return new VCLXTimeField;
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 		case WINDOW_SYSWINDOW:
96cdf0e10cSrcweir 		case WINDOW_WORKWINDOW:
97cdf0e10cSrcweir 		case WINDOW_DOCKINGWINDOW:
98cdf0e10cSrcweir 		case WINDOW_FLOATINGWINDOW:
99cdf0e10cSrcweir 		case WINDOW_HELPTEXTWINDOW:	return new VCLXTopWindow;
100cdf0e10cSrcweir 
101cdf0e10cSrcweir 		case WINDOW_WINDOW:
102cdf0e10cSrcweir 		case WINDOW_TABPAGE:        return new VCLXContainer;
103cdf0e10cSrcweir 
104cdf0e10cSrcweir 		case WINDOW_TOOLBOX:		return new VCLXToolBox;
105cdf0e10cSrcweir 
106cdf0e10cSrcweir         // case WINDOW_FIXEDLINE:
107cdf0e10cSrcweir 		// case WINDOW_FIXEDBITMAP:
108cdf0e10cSrcweir 		// case WINDOW_DATEBOX:
109cdf0e10cSrcweir 		// case WINDOW_GROUPBOX:
110cdf0e10cSrcweir 		// case WINDOW_LONGCURRENCYBOX:
111cdf0e10cSrcweir 		// case WINDOW_SPLITTER:
112cdf0e10cSrcweir 		// case WINDOW_STATUSBAR:
113cdf0e10cSrcweir 		// case WINDOW_TABCONTROL:
114cdf0e10cSrcweir 		// case WINDOW_NUMERICBOX:
115cdf0e10cSrcweir 		// case WINDOW_TRISTATEBOX:
116cdf0e10cSrcweir 		// case WINDOW_TIMEBOX:
117cdf0e10cSrcweir 		// case WINDOW_SPLITWINDOW:
118cdf0e10cSrcweir 		// case WINDOW_SCROLLBARBOX:
119cdf0e10cSrcweir 		// case WINDOW_PATTERNBOX:
120cdf0e10cSrcweir 		// case WINDOW_CURRENCYBOX:
121cdf0e10cSrcweir         default:                    return new VCLXWindow( true );
122cdf0e10cSrcweir     }
123cdf0e10cSrcweir }
124cdf0e10cSrcweir 
125cdf0e10cSrcweir //	----------------------------------------------------
126cdf0e10cSrcweir //	class UnoWrapper
127cdf0e10cSrcweir //	----------------------------------------------------
128cdf0e10cSrcweir 
129cdf0e10cSrcweir extern "C" {
130cdf0e10cSrcweir 
CreateUnoWrapper()131cdf0e10cSrcweir TOOLKIT_DLLPUBLIC UnoWrapperBase* CreateUnoWrapper()
132cdf0e10cSrcweir {
133cdf0e10cSrcweir 	return new UnoWrapper( NULL );
134cdf0e10cSrcweir }
135cdf0e10cSrcweir 
136cdf0e10cSrcweir }	// extern "C"
137cdf0e10cSrcweir 
138cdf0e10cSrcweir 
UnoWrapper(const::com::sun::star::uno::Reference<::com::sun::star::awt::XToolkit> & rxToolkit)139cdf0e10cSrcweir UnoWrapper::UnoWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit>& rxToolkit )
140cdf0e10cSrcweir {
141cdf0e10cSrcweir     mxToolkit = rxToolkit;
142cdf0e10cSrcweir }
143cdf0e10cSrcweir 
Destroy()144cdf0e10cSrcweir void UnoWrapper::Destroy()
145cdf0e10cSrcweir {
146cdf0e10cSrcweir 	delete this;
147cdf0e10cSrcweir }
148cdf0e10cSrcweir 
~UnoWrapper()149cdf0e10cSrcweir UnoWrapper::~UnoWrapper()
150cdf0e10cSrcweir {
151cdf0e10cSrcweir }
152cdf0e10cSrcweir 
GetVCLToolkit()153cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XToolkit> UnoWrapper::GetVCLToolkit()
154cdf0e10cSrcweir {
155cdf0e10cSrcweir 	if ( !mxToolkit.is() )
156cdf0e10cSrcweir 		mxToolkit = VCLUnoHelper::CreateToolkit();
157cdf0e10cSrcweir 	return mxToolkit.get();
158cdf0e10cSrcweir }
159cdf0e10cSrcweir 
GetWindowInterface(Window * pWindow,sal_Bool bCreate)160cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> UnoWrapper::GetWindowInterface( Window* pWindow, sal_Bool bCreate )
161cdf0e10cSrcweir {
162cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
163cdf0e10cSrcweir 	if ( !xPeer.is() && bCreate )
164cdf0e10cSrcweir 	{
165cdf0e10cSrcweir         xPeer = CreateXWindow( pWindow );
166cdf0e10cSrcweir 		SetWindowInterface( pWindow, xPeer );
167cdf0e10cSrcweir 	}
168cdf0e10cSrcweir 	return xPeer;
169cdf0e10cSrcweir }
170cdf0e10cSrcweir 
SetWindowInterface(Window * pWindow,::com::sun::star::uno::Reference<::com::sun::star::awt::XWindowPeer> xIFace)171cdf0e10cSrcweir void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xIFace )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir 	VCLXWindow* pVCLXWindow = VCLXWindow::GetImplementation( xIFace );
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 	DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" );
176cdf0e10cSrcweir 	if ( pVCLXWindow )
177cdf0e10cSrcweir 	{
178cdf0e10cSrcweir 		::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer();
179cdf0e10cSrcweir 		if( xPeer.is() )
180cdf0e10cSrcweir 		{
181cdf0e10cSrcweir 			bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() ));
182cdf0e10cSrcweir             DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" );
183cdf0e10cSrcweir 			if ( bSameInstance )
184cdf0e10cSrcweir 				return;
185cdf0e10cSrcweir 		}
186cdf0e10cSrcweir 		pVCLXWindow->SetWindow( pWindow );
187cdf0e10cSrcweir 		pWindow->SetWindowPeer( xIFace, pVCLXWindow );
188cdf0e10cSrcweir 	}
189cdf0e10cSrcweir }
190cdf0e10cSrcweir 
CreateGraphics(OutputDevice * pOutDev)191cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> UnoWrapper::CreateGraphics( OutputDevice* pOutDev )
192cdf0e10cSrcweir {
193cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::awt::XGraphics> xGrf;
194cdf0e10cSrcweir 	VCLXGraphics* pGrf = new VCLXGraphics;
195cdf0e10cSrcweir 	xGrf = pGrf;
196cdf0e10cSrcweir 	pGrf->Init( pOutDev );
197cdf0e10cSrcweir 	return xGrf;
198cdf0e10cSrcweir }
199cdf0e10cSrcweir 
ReleaseAllGraphics(OutputDevice * pOutDev)200cdf0e10cSrcweir void UnoWrapper::ReleaseAllGraphics( OutputDevice* pOutDev )
201cdf0e10cSrcweir {
202cdf0e10cSrcweir 	List* pLst = pOutDev->GetUnoGraphicsList();
203cdf0e10cSrcweir 	if ( pLst )
204cdf0e10cSrcweir 	{
205cdf0e10cSrcweir 		for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
206cdf0e10cSrcweir 		{
207cdf0e10cSrcweir 			VCLXGraphics* pGrf = (VCLXGraphics*)pLst->GetObject( n );
208cdf0e10cSrcweir 			pGrf->SetOutputDevice( NULL );
209cdf0e10cSrcweir 		}
210cdf0e10cSrcweir 	}
211cdf0e10cSrcweir 
212cdf0e10cSrcweir }
213cdf0e10cSrcweir 
214cdf0e10cSrcweir // MT: Wurde im Window-CTOR gerufen, damit Container-Listener
215cdf0e10cSrcweir // vom Parent reagieren, aber hat sowieso nicht richtig funktioniert,
216cdf0e10cSrcweir // weil im Window-CTOR das Interface noch nicht da ist!
217cdf0e10cSrcweir // => Nur Listener rufen, wenn ueber das ::com::sun::star::awt::Toolkit erzeugt
218cdf0e10cSrcweir 
219cdf0e10cSrcweir /*
220cdf0e10cSrcweir void ImplSmartWindowCreated( Window* pNewWindow )
221cdf0e10cSrcweir {
222cdf0e10cSrcweir 	UNOWindowData* pParentUNOData = pNewWindow->GetParent() ?
223cdf0e10cSrcweir 							pNewWindow->GetParent()->GetUNOData() : NULL;
224cdf0e10cSrcweir 
225cdf0e10cSrcweir 	if ( pParentUNOData && pParentUNOData->GetListeners( EL_CONTAINER ) )
226cdf0e10cSrcweir 	{
227cdf0e10cSrcweir 		UNOWindowData* pUNOData = pNewWindow->GetUNOData();
228cdf0e10cSrcweir 		if ( !pUNOData )
229cdf0e10cSrcweir 			pUNOData = ImplSmartCreateUNOData( pNewWindow );
230cdf0e10cSrcweir 
231cdf0e10cSrcweir 		::com::sun::star::awt::VclContainerEvent aEvent;
232cdf0e10cSrcweir 		aEvent.Source = (UsrObject*)pParentUNOData->GetWindowPeer();
233cdf0e10cSrcweir 		aEvent.Id = VCLCOMPONENT_ADDED;
234cdf0e10cSrcweir 		aEvent.Child = (UsrObject*)pUNOData->GetWindowPeer();
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 		EventList* pLst = pParentUNOData->GetListeners( EL_CONTAINER );
237cdf0e10cSrcweir 		for ( sal_uInt32 n = 0; n < pLst->Count(); n++ )
238cdf0e10cSrcweir 		{
239cdf0e10cSrcweir 			::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > * pRef = pLst->GetObject( n );
240cdf0e10cSrcweir 			((::com::sun::star::awt::XVclContainerListener*)(::com::sun::star::lang::XEventListener*)*pRef)->windowAdded( aEvent );
241cdf0e10cSrcweir 		}
242cdf0e10cSrcweir 	}
243cdf0e10cSrcweir }
244cdf0e10cSrcweir */
245cdf0e10cSrcweir 
lcl_ImplIsParent(Window * pParentWindow,Window * pPossibleChild)246cdf0e10cSrcweir sal_Bool lcl_ImplIsParent( Window* pParentWindow, Window* pPossibleChild )
247cdf0e10cSrcweir {
248cdf0e10cSrcweir     Window* pWindow = ( pPossibleChild != pParentWindow ) ? pPossibleChild : NULL;
249cdf0e10cSrcweir 	while ( pWindow && ( pWindow != pParentWindow ) )
250cdf0e10cSrcweir 		pWindow = pWindow->GetParent();
251cdf0e10cSrcweir 
252cdf0e10cSrcweir 	return pWindow ? sal_True : sal_False;
253cdf0e10cSrcweir }
254cdf0e10cSrcweir 
WindowDestroyed(Window * pWindow)255cdf0e10cSrcweir void UnoWrapper::WindowDestroyed( Window* pWindow )
256cdf0e10cSrcweir {
257cdf0e10cSrcweir 	// ggf. existieren noch von ::com::sun::star::loader::Java erzeugte Childs, die sonst erst
258cdf0e10cSrcweir 	// im Garbage-Collector zerstoert werden...
259cdf0e10cSrcweir 	Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
260cdf0e10cSrcweir 	while ( pChild )
261cdf0e10cSrcweir 	{
262cdf0e10cSrcweir 		Window* pNextChild = pChild->GetWindow( WINDOW_NEXT );
263cdf0e10cSrcweir 
264cdf0e10cSrcweir 		Window* pClient = pChild->GetWindow( WINDOW_CLIENT );
265cdf0e10cSrcweir         if ( pClient->GetWindowPeer() )
266cdf0e10cSrcweir         {
267cdf0e10cSrcweir             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( sal_False ), ::com::sun::star::uno::UNO_QUERY );
268cdf0e10cSrcweir 			xComp->dispose();
269cdf0e10cSrcweir         }
270cdf0e10cSrcweir 
271cdf0e10cSrcweir 		pChild = pNextChild;
272cdf0e10cSrcweir 	}
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	// ::com::sun::star::chaos::System-Windows suchen...
275cdf0e10cSrcweir 	Window* pOverlap = pWindow->GetWindow( WINDOW_OVERLAP );
276cdf0e10cSrcweir 	pOverlap = pOverlap->GetWindow( WINDOW_FIRSTOVERLAP );
277cdf0e10cSrcweir 	while ( pOverlap )
278cdf0e10cSrcweir 	{
279cdf0e10cSrcweir 		Window* pNextOverlap = pOverlap->GetWindow( WINDOW_NEXT );
280cdf0e10cSrcweir 		Window* pClient = pOverlap->GetWindow( WINDOW_CLIENT );
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 		if ( pClient->GetWindowPeer() && lcl_ImplIsParent( pWindow, pClient ) )
283cdf0e10cSrcweir         {
284cdf0e10cSrcweir             ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( pClient->GetComponentInterface( sal_False ), ::com::sun::star::uno::UNO_QUERY );
285cdf0e10cSrcweir 			xComp->dispose();
286cdf0e10cSrcweir         }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir 		pOverlap = pNextOverlap;
289cdf0e10cSrcweir 	}
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 	Window* pParent = pWindow->GetParent();
292cdf0e10cSrcweir 	if ( pParent && pParent->GetWindowPeer() )
293cdf0e10cSrcweir         pParent->GetWindowPeer()->notifyWindowRemoved( *pWindow );
294cdf0e10cSrcweir 
295cdf0e10cSrcweir     VCLXWindow* pWindowPeer = pWindow->GetWindowPeer();
296cdf0e10cSrcweir     uno::Reference< lang::XComponent > xWindowPeerComp( pWindow->GetComponentInterface( sal_False ), uno::UNO_QUERY );
297cdf0e10cSrcweir     OSL_ENSURE( ( pWindowPeer != NULL ) == ( xWindowPeerComp.is() == sal_True ),
298cdf0e10cSrcweir         "UnoWrapper::WindowDestroyed: inconsistency in the window's peers!" );
299cdf0e10cSrcweir 	if ( pWindowPeer )
300cdf0e10cSrcweir 	{
301cdf0e10cSrcweir 		pWindowPeer->SetWindow( NULL );
302cdf0e10cSrcweir 		pWindow->SetWindowPeer( NULL, NULL );
303cdf0e10cSrcweir 	}
304cdf0e10cSrcweir     if ( xWindowPeerComp.is() )
305cdf0e10cSrcweir         xWindowPeerComp->dispose();
306cdf0e10cSrcweir 
307cdf0e10cSrcweir     // #102132# Iterate over frames after setting Window peer to NULL,
308cdf0e10cSrcweir     // because while destroying other frames, we get get into the method again and try
309cdf0e10cSrcweir     // to destroy this window again...
310cdf0e10cSrcweir     // #i42462#/#116855# no, don't loop: Instead, just ensure that all our top-window-children
311cdf0e10cSrcweir     // are disposed, too (which should also be a valid fix for #102132#, but doesn't have the extreme
312cdf0e10cSrcweir     // performance penalties)
313cdf0e10cSrcweir     if ( pWindow )
314cdf0e10cSrcweir     {
315cdf0e10cSrcweir         Window* pTopWindowChild = pWindow->GetWindow( WINDOW_FIRSTTOPWINDOWCHILD );
316cdf0e10cSrcweir         while ( pTopWindowChild )
317cdf0e10cSrcweir         {
318cdf0e10cSrcweir             OSL_ENSURE( pTopWindowChild->GetParent() == pWindow,
319cdf0e10cSrcweir                         "UnoWrapper::WindowDestroyed: inconsistency in the SystemWindow relationship!" );
320cdf0e10cSrcweir 
321cdf0e10cSrcweir             Window* pNextTopChild = pTopWindowChild->GetWindow( WINDOW_NEXTTOPWINDOWSIBLING );
322cdf0e10cSrcweir 
323cdf0e10cSrcweir             //the window still could be on the stack, so we have to
324cdf0e10cSrcweir             // use lazy delete ( it will automatically
325cdf0e10cSrcweir             // disconnect from the currently destroyed parent window )
326cdf0e10cSrcweir             pTopWindowChild->doLazyDelete();
327cdf0e10cSrcweir 
328cdf0e10cSrcweir             pTopWindowChild = pNextTopChild;
329cdf0e10cSrcweir         }
330cdf0e10cSrcweir     }
331cdf0e10cSrcweir }
332cdf0e10cSrcweir 
333cdf0e10cSrcweir // ----------------------------------------------------------------------------
CreateAccessible(Menu * pMenu,sal_Bool bIsMenuBar)334cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > UnoWrapper::CreateAccessible( Menu* pMenu, sal_Bool bIsMenuBar )
335cdf0e10cSrcweir {
336cdf0e10cSrcweir     return maAccessibleFactoryAccess.getFactory().createAccessible( pMenu, bIsMenuBar );
337cdf0e10cSrcweir }
338