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