xref: /AOO41X/main/dbaccess/source/ui/browser/brwview.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_dbaccess.hxx"
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #ifndef _SBA_BWRCTRLR_HXX
32*cdf0e10cSrcweir #include "brwctrlr.hxx"
33*cdf0e10cSrcweir #endif
34*cdf0e10cSrcweir #ifndef _SBX_BRWVIEW_HXX
35*cdf0e10cSrcweir #include "brwview.hxx"
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir #ifndef _SBA_GRID_HXX
38*cdf0e10cSrcweir #include "sbagrid.hxx"
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
41*cdf0e10cSrcweir #include <toolkit/helper/vclunohelper.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
44*cdf0e10cSrcweir #include <comphelper/types.hxx>
45*cdf0e10cSrcweir #endif
46*cdf0e10cSrcweir #ifndef _SV_SPLIT_HXX
47*cdf0e10cSrcweir #include <vcl/split.hxx>
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #ifndef DBACCESS_UI_DBTREEVIEW_HXX
50*cdf0e10cSrcweir #include "dbtreeview.hxx"
51*cdf0e10cSrcweir #endif
52*cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
53*cdf0e10cSrcweir #include "dbustrings.hrc"
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir #ifndef _DBU_BRW_HRC_
56*cdf0e10cSrcweir #include "dbu_brw.hrc"
57*cdf0e10cSrcweir #endif
58*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_FORM_XLOADABLE_HPP_
59*cdf0e10cSrcweir #include <com/sun/star/form/XLoadable.hpp>
60*cdf0e10cSrcweir #endif
61*cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XCONTROLCONTAINER_HPP_
62*cdf0e10cSrcweir #include <com/sun/star/awt/XControlContainer.hpp>
63*cdf0e10cSrcweir #endif
64*cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX
65*cdf0e10cSrcweir #include "UITools.hxx"
66*cdf0e10cSrcweir #endif
67*cdf0e10cSrcweir 
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir using namespace dbaui;
70*cdf0e10cSrcweir using namespace ::com::sun::star::uno;
71*cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
72*cdf0e10cSrcweir using namespace ::com::sun::star::form;
73*cdf0e10cSrcweir //	using namespace ::com::sun::star::sdbcx;
74*cdf0e10cSrcweir using namespace ::com::sun::star::beans;
75*cdf0e10cSrcweir using namespace ::com::sun::star::container;
76*cdf0e10cSrcweir using namespace ::com::sun::star::lang;
77*cdf0e10cSrcweir 
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir namespace
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir 	sal_Bool isGrabVclControlFocusAllowed(const UnoDataBrowserView* _pView)
82*cdf0e10cSrcweir 	{
83*cdf0e10cSrcweir 		sal_Bool bGrabFocus = sal_False;
84*cdf0e10cSrcweir 		SbaGridControl* pVclControl = _pView->getVclControl();
85*cdf0e10cSrcweir 		Reference< ::com::sun::star::awt::XControl > xGrid = _pView->getGridControl();
86*cdf0e10cSrcweir 		if (pVclControl && xGrid.is())
87*cdf0e10cSrcweir 		{
88*cdf0e10cSrcweir 			bGrabFocus = sal_True;
89*cdf0e10cSrcweir 			if(!pVclControl->HasChildPathFocus())
90*cdf0e10cSrcweir 			{
91*cdf0e10cSrcweir 				Reference<XChild> xChild(xGrid->getModel(),UNO_QUERY);
92*cdf0e10cSrcweir 				Reference<XLoadable> xLoad;
93*cdf0e10cSrcweir 				if(xChild.is())
94*cdf0e10cSrcweir 					xLoad.set(xChild->getParent(),UNO_QUERY);
95*cdf0e10cSrcweir 				bGrabFocus = xLoad.is() && xLoad->isLoaded();
96*cdf0e10cSrcweir 			}
97*cdf0e10cSrcweir 		}
98*cdf0e10cSrcweir 		return bGrabFocus;
99*cdf0e10cSrcweir 	}
100*cdf0e10cSrcweir }
101*cdf0e10cSrcweir //==================================================================
102*cdf0e10cSrcweir //= UnoDataBrowserView
103*cdf0e10cSrcweir //==================================================================
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir DBG_NAME(UnoDataBrowserView)
106*cdf0e10cSrcweir // -------------------------------------------------------------------------
107*cdf0e10cSrcweir UnoDataBrowserView::UnoDataBrowserView(	Window* pParent,
108*cdf0e10cSrcweir 										IController& _rController,
109*cdf0e10cSrcweir 										const Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rFactory)
110*cdf0e10cSrcweir 	:ODataView(pParent,_rController,_rFactory)
111*cdf0e10cSrcweir 	,m_pTreeView(NULL)
112*cdf0e10cSrcweir 	,m_pSplitter(NULL)
113*cdf0e10cSrcweir 	,m_pVclControl(NULL)
114*cdf0e10cSrcweir 	,m_pStatus(NULL)
115*cdf0e10cSrcweir {
116*cdf0e10cSrcweir     DBG_CTOR(UnoDataBrowserView,NULL);
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir }
119*cdf0e10cSrcweir // -------------------------------------------------------------------------
120*cdf0e10cSrcweir void UnoDataBrowserView::Construct(const Reference< ::com::sun::star::awt::XControlModel >& xModel)
121*cdf0e10cSrcweir {
122*cdf0e10cSrcweir 	try
123*cdf0e10cSrcweir 	{
124*cdf0e10cSrcweir 		ODataView::Construct();
125*cdf0e10cSrcweir 
126*cdf0e10cSrcweir 		// our UNO representation
127*cdf0e10cSrcweir 		m_xMe = VCLUnoHelper::CreateControlContainer(this);
128*cdf0e10cSrcweir 
129*cdf0e10cSrcweir 		// create the (UNO-) control
130*cdf0e10cSrcweir 		m_xGrid = new SbaXGridControl(getORB());
131*cdf0e10cSrcweir 		DBG_ASSERT(m_xGrid.is(), "UnoDataBrowserView::Construct : could not create a grid control !");
132*cdf0e10cSrcweir 		// in design mode (for the moment)
133*cdf0e10cSrcweir 		m_xGrid->setDesignMode(sal_True);
134*cdf0e10cSrcweir 
135*cdf0e10cSrcweir 		Reference< ::com::sun::star::awt::XWindow >  xGridWindow(m_xGrid, UNO_QUERY);
136*cdf0e10cSrcweir 		xGridWindow->setVisible(sal_True);
137*cdf0e10cSrcweir 		xGridWindow->setEnable(sal_True);
138*cdf0e10cSrcweir 
139*cdf0e10cSrcweir 		// introduce the model to the grid
140*cdf0e10cSrcweir 		m_xGrid->setModel(xModel);
141*cdf0e10cSrcweir 		// introduce the container (me) to the grid
142*cdf0e10cSrcweir 		Reference< ::com::sun::star::beans::XPropertySet >  xModelSet(xModel, UNO_QUERY);
143*cdf0e10cSrcweir 		getContainer()->addControl(::comphelper::getString(xModelSet->getPropertyValue(PROPERTY_NAME)), m_xGrid);
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 		// get the VCL-control
146*cdf0e10cSrcweir 		m_pVclControl = NULL;
147*cdf0e10cSrcweir 		getVclControl();
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir 		DBG_ASSERT(m_pVclControl != NULL, "UnoDataBrowserView::Construct : no real grid control !");
150*cdf0e10cSrcweir 	}
151*cdf0e10cSrcweir 	catch(Exception&)
152*cdf0e10cSrcweir 	{
153*cdf0e10cSrcweir 		::comphelper::disposeComponent(m_xGrid);
154*cdf0e10cSrcweir 		throw;
155*cdf0e10cSrcweir 	}
156*cdf0e10cSrcweir }
157*cdf0e10cSrcweir // -------------------------------------------------------------------------
158*cdf0e10cSrcweir UnoDataBrowserView::~UnoDataBrowserView()
159*cdf0e10cSrcweir {
160*cdf0e10cSrcweir 	{
161*cdf0e10cSrcweir 		::std::auto_ptr<Splitter> aTemp(m_pSplitter);
162*cdf0e10cSrcweir 		m_pSplitter = NULL;
163*cdf0e10cSrcweir 	}
164*cdf0e10cSrcweir 	setTreeView(NULL);
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	if ( m_pStatus )
167*cdf0e10cSrcweir 	{
168*cdf0e10cSrcweir 		delete m_pStatus;
169*cdf0e10cSrcweir 		m_pStatus = NULL;
170*cdf0e10cSrcweir 	}
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	try
173*cdf0e10cSrcweir 	{
174*cdf0e10cSrcweir 		::comphelper::disposeComponent(m_xGrid);
175*cdf0e10cSrcweir 		::comphelper::disposeComponent(m_xMe);
176*cdf0e10cSrcweir 	}
177*cdf0e10cSrcweir 	catch(Exception)
178*cdf0e10cSrcweir 	{}
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir     DBG_DTOR(UnoDataBrowserView,NULL);
181*cdf0e10cSrcweir }
182*cdf0e10cSrcweir // -----------------------------------------------------------------------------
183*cdf0e10cSrcweir IMPL_LINK( UnoDataBrowserView, SplitHdl, void*, /*NOINTERESTEDIN*/ )
184*cdf0e10cSrcweir {
185*cdf0e10cSrcweir 	long nYPos = m_pSplitter->GetPosPixel().Y();
186*cdf0e10cSrcweir 	m_pSplitter->SetPosPixel( Point( m_pSplitter->GetSplitPosPixel(), nYPos ) );
187*cdf0e10cSrcweir 	Resize();
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir 	return 0L;
190*cdf0e10cSrcweir }
191*cdf0e10cSrcweir // -------------------------------------------------------------------------
192*cdf0e10cSrcweir void UnoDataBrowserView::setSplitter(Splitter* _pSplitter)
193*cdf0e10cSrcweir {
194*cdf0e10cSrcweir 	m_pSplitter = _pSplitter;
195*cdf0e10cSrcweir 	m_pSplitter->SetSplitHdl( LINK( this, UnoDataBrowserView, SplitHdl ) );
196*cdf0e10cSrcweir 	LINK( this, UnoDataBrowserView, SplitHdl ).Call(m_pSplitter);
197*cdf0e10cSrcweir }
198*cdf0e10cSrcweir // -------------------------------------------------------------------------
199*cdf0e10cSrcweir void UnoDataBrowserView::setTreeView(DBTreeView* _pTreeView)
200*cdf0e10cSrcweir {
201*cdf0e10cSrcweir 	if (m_pTreeView != _pTreeView)
202*cdf0e10cSrcweir 	{
203*cdf0e10cSrcweir 		if (m_pTreeView)
204*cdf0e10cSrcweir 		{
205*cdf0e10cSrcweir 			::std::auto_ptr<Window> aTemp(m_pTreeView);
206*cdf0e10cSrcweir 			m_pTreeView = NULL;
207*cdf0e10cSrcweir 		}
208*cdf0e10cSrcweir 		m_pTreeView = _pTreeView;
209*cdf0e10cSrcweir 	}
210*cdf0e10cSrcweir }
211*cdf0e10cSrcweir // -------------------------------------------------------------------------
212*cdf0e10cSrcweir void UnoDataBrowserView::showStatus( const String& _rStatus )
213*cdf0e10cSrcweir {
214*cdf0e10cSrcweir 	if (0 == _rStatus.Len())
215*cdf0e10cSrcweir 		hideStatus();
216*cdf0e10cSrcweir 	else
217*cdf0e10cSrcweir 	{
218*cdf0e10cSrcweir 		if (!m_pStatus)
219*cdf0e10cSrcweir 			m_pStatus = new FixedText(this);
220*cdf0e10cSrcweir 		m_pStatus->SetText(_rStatus);
221*cdf0e10cSrcweir 		m_pStatus->Show();
222*cdf0e10cSrcweir 		Resize();
223*cdf0e10cSrcweir 		Update();
224*cdf0e10cSrcweir 	}
225*cdf0e10cSrcweir }
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir // -------------------------------------------------------------------------
228*cdf0e10cSrcweir void UnoDataBrowserView::hideStatus()
229*cdf0e10cSrcweir {
230*cdf0e10cSrcweir 	if (!m_pStatus || !m_pStatus->IsVisible())
231*cdf0e10cSrcweir 		// nothing to do
232*cdf0e10cSrcweir 		return;
233*cdf0e10cSrcweir 	m_pStatus->Hide();
234*cdf0e10cSrcweir 	Resize();
235*cdf0e10cSrcweir 	Update();
236*cdf0e10cSrcweir }
237*cdf0e10cSrcweir 
238*cdf0e10cSrcweir // -------------------------------------------------------------------------
239*cdf0e10cSrcweir void UnoDataBrowserView::resizeDocumentView(Rectangle& _rPlayground)
240*cdf0e10cSrcweir {
241*cdf0e10cSrcweir 	Point	aSplitPos;
242*cdf0e10cSrcweir 	Size	aSplitSize;
243*cdf0e10cSrcweir 	Point	aPlaygroundPos( _rPlayground.TopLeft() );
244*cdf0e10cSrcweir 	Size	aPlaygroundSize( _rPlayground.GetSize() );
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 	if (m_pTreeView && m_pTreeView->IsVisible() && m_pSplitter)
247*cdf0e10cSrcweir 	{
248*cdf0e10cSrcweir 		// calculate the splitter pos and size
249*cdf0e10cSrcweir 		aSplitPos	= m_pSplitter->GetPosPixel();
250*cdf0e10cSrcweir 		aSplitPos.Y() = aPlaygroundPos.Y();
251*cdf0e10cSrcweir 		aSplitSize	= m_pSplitter->GetOutputSizePixel();
252*cdf0e10cSrcweir 		aSplitSize.Height() = aPlaygroundSize.Height();
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 		if( ( aSplitPos.X() + aSplitSize.Width() ) > ( aPlaygroundSize.Width() ))
255*cdf0e10cSrcweir 			aSplitPos.X() = aPlaygroundSize.Width() - aSplitSize.Width();
256*cdf0e10cSrcweir 
257*cdf0e10cSrcweir 		if( aSplitPos.X() <= aPlaygroundPos.X() )
258*cdf0e10cSrcweir 			aSplitPos.X() = aPlaygroundPos.X() + sal_Int32(aPlaygroundSize.Width() * 0.2);
259*cdf0e10cSrcweir 
260*cdf0e10cSrcweir 		// the tree pos and size
261*cdf0e10cSrcweir 		Point	aTreeViewPos( aPlaygroundPos );
262*cdf0e10cSrcweir 		Size	aTreeViewSize( aSplitPos.X(), aPlaygroundSize.Height() );
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 		// the status pos and size
265*cdf0e10cSrcweir 		if (m_pStatus && m_pStatus->IsVisible())
266*cdf0e10cSrcweir 		{
267*cdf0e10cSrcweir 			Size aStatusSize(aPlaygroundPos.X(), GetTextHeight() + 2);
268*cdf0e10cSrcweir 			aStatusSize = LogicToPixel(aStatusSize, MAP_APPFONT);
269*cdf0e10cSrcweir 			aStatusSize.Width() = aTreeViewSize.Width() - 2 - 2;
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir 			Point aStatusPos( aPlaygroundPos.X() + 2, aTreeViewPos.Y() + aTreeViewSize.Height() - aStatusSize.Height() );
272*cdf0e10cSrcweir 			m_pStatus->SetPosSizePixel( aStatusPos, aStatusSize );
273*cdf0e10cSrcweir 			aTreeViewSize.Height() -= aStatusSize.Height();
274*cdf0e10cSrcweir 		}
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir 		// set the size of treelistbox
277*cdf0e10cSrcweir 		m_pTreeView->SetPosSizePixel( aTreeViewPos, aTreeViewSize );
278*cdf0e10cSrcweir 
279*cdf0e10cSrcweir 		//set the size of the splitter
280*cdf0e10cSrcweir 		m_pSplitter->SetPosSizePixel( aSplitPos, Size( aSplitSize.Width(), aPlaygroundSize.Height() ) );
281*cdf0e10cSrcweir 		m_pSplitter->SetDragRectPixel( _rPlayground );
282*cdf0e10cSrcweir 	}
283*cdf0e10cSrcweir 
284*cdf0e10cSrcweir 	// set the size of grid control
285*cdf0e10cSrcweir 	Reference< ::com::sun::star::awt::XWindow >  xGridAsWindow(m_xGrid, UNO_QUERY);
286*cdf0e10cSrcweir 	if (xGridAsWindow.is())
287*cdf0e10cSrcweir 		xGridAsWindow->setPosSize( aSplitPos.X() + aSplitSize.Width(), aPlaygroundPos.Y(),
288*cdf0e10cSrcweir 								   aPlaygroundSize.Width() - aSplitSize.Width() - aSplitPos.X(), aPlaygroundSize.Height(), ::com::sun::star::awt::PosSize::POSSIZE);
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir 	// just for completeness: there is no space left, we occupied it all ...
291*cdf0e10cSrcweir 	_rPlayground.SetPos( _rPlayground.BottomRight() );
292*cdf0e10cSrcweir 	_rPlayground.SetSize( Size( 0, 0 ) );
293*cdf0e10cSrcweir }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir //------------------------------------------------------------------
296*cdf0e10cSrcweir sal_uInt16 UnoDataBrowserView::View2ModelPos(sal_uInt16 nPos) const
297*cdf0e10cSrcweir {
298*cdf0e10cSrcweir 	return m_pVclControl ? m_pVclControl->GetModelColumnPos(m_pVclControl->GetColumnIdFromViewPos(nPos)) : -1;
299*cdf0e10cSrcweir }
300*cdf0e10cSrcweir 
301*cdf0e10cSrcweir // -----------------------------------------------------------------------------
302*cdf0e10cSrcweir SbaGridControl*	UnoDataBrowserView::getVclControl() const
303*cdf0e10cSrcweir {
304*cdf0e10cSrcweir 	if ( !m_pVclControl )
305*cdf0e10cSrcweir 	{
306*cdf0e10cSrcweir 		OSL_ENSURE(m_xGrid.is(),"Grid not set!");
307*cdf0e10cSrcweir 		if ( m_xGrid.is() )
308*cdf0e10cSrcweir 		{
309*cdf0e10cSrcweir 			Reference< ::com::sun::star::awt::XWindowPeer >  xPeer = m_xGrid->getPeer();
310*cdf0e10cSrcweir 			if ( xPeer.is() )
311*cdf0e10cSrcweir 			{
312*cdf0e10cSrcweir 				SbaXGridPeer* pPeer = SbaXGridPeer::getImplementation(xPeer);
313*cdf0e10cSrcweir 				UnoDataBrowserView* pTHIS = const_cast<UnoDataBrowserView*>(this);
314*cdf0e10cSrcweir 				if ( pPeer )
315*cdf0e10cSrcweir 				{
316*cdf0e10cSrcweir 					m_pVclControl = static_cast<SbaGridControl*>(pPeer->GetWindow());
317*cdf0e10cSrcweir 					pTHIS->startComponentListening(Reference<XComponent>(VCLUnoHelper::GetInterface(m_pVclControl),UNO_QUERY));
318*cdf0e10cSrcweir 				}
319*cdf0e10cSrcweir 			}
320*cdf0e10cSrcweir 		}
321*cdf0e10cSrcweir 	}
322*cdf0e10cSrcweir 	return m_pVclControl;
323*cdf0e10cSrcweir }
324*cdf0e10cSrcweir // -----------------------------------------------------------------------------
325*cdf0e10cSrcweir void UnoDataBrowserView::GetFocus()
326*cdf0e10cSrcweir {
327*cdf0e10cSrcweir 	ODataView::GetFocus();
328*cdf0e10cSrcweir 	if( m_pTreeView && m_pTreeView->IsVisible() && !m_pTreeView->HasChildPathFocus())
329*cdf0e10cSrcweir 		m_pTreeView->GrabFocus();
330*cdf0e10cSrcweir 	else if (m_pVclControl && m_xGrid.is())
331*cdf0e10cSrcweir 	{
332*cdf0e10cSrcweir 		sal_Bool bGrabFocus = sal_False;
333*cdf0e10cSrcweir 		if(!m_pVclControl->HasChildPathFocus())
334*cdf0e10cSrcweir 		{
335*cdf0e10cSrcweir 			bGrabFocus = isGrabVclControlFocusAllowed(this);
336*cdf0e10cSrcweir 			if( bGrabFocus )
337*cdf0e10cSrcweir 				m_pVclControl->GrabFocus();
338*cdf0e10cSrcweir 		}
339*cdf0e10cSrcweir 		if(!bGrabFocus && m_pTreeView && m_pTreeView->IsVisible() )
340*cdf0e10cSrcweir 			m_pTreeView->GrabFocus();
341*cdf0e10cSrcweir 	}
342*cdf0e10cSrcweir }
343*cdf0e10cSrcweir // -----------------------------------------------------------------------------
344*cdf0e10cSrcweir void UnoDataBrowserView::_disposing( const ::com::sun::star::lang::EventObject& /*_rSource*/ )
345*cdf0e10cSrcweir {
346*cdf0e10cSrcweir 	stopComponentListening(Reference<XComponent>(VCLUnoHelper::GetInterface(m_pVclControl),UNO_QUERY));
347*cdf0e10cSrcweir 	m_pVclControl = NULL;
348*cdf0e10cSrcweir }
349*cdf0e10cSrcweir // -------------------------------------------------------------------------
350*cdf0e10cSrcweir long UnoDataBrowserView::PreNotify( NotifyEvent& rNEvt )
351*cdf0e10cSrcweir {
352*cdf0e10cSrcweir 	long nDone = 0L;
353*cdf0e10cSrcweir 	if(rNEvt.GetType() == EVENT_KEYINPUT)
354*cdf0e10cSrcweir 	{
355*cdf0e10cSrcweir 		sal_Bool bGrabAllowed = isGrabVclControlFocusAllowed(this);
356*cdf0e10cSrcweir 		if ( bGrabAllowed )
357*cdf0e10cSrcweir 		{
358*cdf0e10cSrcweir 			const KeyEvent* pKeyEvt = rNEvt.GetKeyEvent();
359*cdf0e10cSrcweir 			const KeyCode& rKeyCode = pKeyEvt->GetKeyCode();
360*cdf0e10cSrcweir 			if (  ( rKeyCode == KeyCode( KEY_E, sal_True, sal_True, sal_False, sal_False ) )
361*cdf0e10cSrcweir                || ( rKeyCode == KeyCode( KEY_TAB, sal_True, sal_False, sal_False, sal_False ) )
362*cdf0e10cSrcweir                )
363*cdf0e10cSrcweir 			{
364*cdf0e10cSrcweir 				if ( m_pTreeView && m_pVclControl && m_pTreeView->HasChildPathFocus() )
365*cdf0e10cSrcweir 					m_pVclControl->GrabFocus();
366*cdf0e10cSrcweir 				else if ( m_pTreeView && m_pVclControl && m_pVclControl->HasChildPathFocus() )
367*cdf0e10cSrcweir 					m_pTreeView->GrabFocus();
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir 				nDone = 1L;
370*cdf0e10cSrcweir 			}
371*cdf0e10cSrcweir 		}
372*cdf0e10cSrcweir 	}
373*cdf0e10cSrcweir 	return nDone ? nDone : ODataView::PreNotify(rNEvt);
374*cdf0e10cSrcweir }
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir DBG_NAME(BrowserViewStatusDisplay)
377*cdf0e10cSrcweir // -----------------------------------------------------------------------------
378*cdf0e10cSrcweir BrowserViewStatusDisplay::BrowserViewStatusDisplay( UnoDataBrowserView* _pView, const String& _rStatus )
379*cdf0e10cSrcweir 	:m_pView(_pView)
380*cdf0e10cSrcweir {
381*cdf0e10cSrcweir     DBG_CTOR(BrowserViewStatusDisplay,NULL);
382*cdf0e10cSrcweir 
383*cdf0e10cSrcweir 	if (m_pView)
384*cdf0e10cSrcweir 		m_pView->showStatus(_rStatus);
385*cdf0e10cSrcweir }
386*cdf0e10cSrcweir 
387*cdf0e10cSrcweir // -----------------------------------------------------------------------------
388*cdf0e10cSrcweir BrowserViewStatusDisplay::~BrowserViewStatusDisplay( )
389*cdf0e10cSrcweir {
390*cdf0e10cSrcweir 	if (m_pView)
391*cdf0e10cSrcweir 		m_pView->showStatus(String());
392*cdf0e10cSrcweir 
393*cdf0e10cSrcweir     DBG_DTOR(BrowserViewStatusDisplay,NULL);
394*cdf0e10cSrcweir }
395*cdf0e10cSrcweir // -----------------------------------------------------------------------------
396