xref: /aoo42x/main/dbaccess/source/ui/app/AppView.cxx (revision b63233d8)
196de5490SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
396de5490SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
496de5490SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
596de5490SAndrew Rist  * distributed with this work for additional information
696de5490SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
796de5490SAndrew Rist  * to you under the Apache License, Version 2.0 (the
896de5490SAndrew Rist  * "License"); you may not use this file except in compliance
996de5490SAndrew Rist  * with the License.  You may obtain a copy of the License at
1096de5490SAndrew Rist  *
1196de5490SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1296de5490SAndrew Rist  *
1396de5490SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1496de5490SAndrew Rist  * software distributed under the License is distributed on an
1596de5490SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1696de5490SAndrew Rist  * KIND, either express or implied.  See the License for the
1796de5490SAndrew Rist  * specific language governing permissions and limitations
1896de5490SAndrew Rist  * under the License.
1996de5490SAndrew Rist  *
2096de5490SAndrew Rist  *************************************************************/
2196de5490SAndrew Rist 
2296de5490SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25*b63233d8Sdamjan #include "precompiled_dbui.hxx"
26cdf0e10cSrcweir #ifndef DBAUI_APPVIEW_HXX
27cdf0e10cSrcweir #include "AppView.hxx"
28cdf0e10cSrcweir #endif
29cdf0e10cSrcweir #ifndef _DBU_APP_HRC_
30cdf0e10cSrcweir #include "dbu_app.hrc"
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir #ifndef _TOOLS_DEBUG_HXX
33cdf0e10cSrcweir #include <tools/debug.hxx>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef TOOLS_DIAGNOSE_EX_H
36cdf0e10cSrcweir #include <tools/diagnose_ex.h>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir #ifndef _DBA_DBACCESS_HELPID_HRC_
39cdf0e10cSrcweir #include "dbaccess_helpid.hrc"
40cdf0e10cSrcweir #endif
41cdf0e10cSrcweir #ifndef _SV_TOOLBOX_HXX
42cdf0e10cSrcweir #include <vcl/toolbox.hxx>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #ifndef _UTL_CONFIGMGR_HXX_
45cdf0e10cSrcweir #include <unotools/configmgr.hxx>
46cdf0e10cSrcweir #endif
47cdf0e10cSrcweir #ifndef _SV_WAITOBJ_HXX
48cdf0e10cSrcweir #include <vcl/waitobj.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #ifndef _COMPHELPER_TYPES_HXX_
51cdf0e10cSrcweir #include <comphelper/types.hxx>
52cdf0e10cSrcweir #endif
53cdf0e10cSrcweir #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBOARD_XCLIPBOARD_HPP_
54cdf0e10cSrcweir #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
55cdf0e10cSrcweir #endif
56cdf0e10cSrcweir #ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
57cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
58cdf0e10cSrcweir #endif
59cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBCX_XTABLESSUPPLIER_HPP_
60cdf0e10cSrcweir #include <com/sun/star/sdbcx/XTablesSupplier.hpp>
61cdf0e10cSrcweir #endif
62cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDB_XQUERIESSUPPLIER_HPP_
63cdf0e10cSrcweir #include <com/sun/star/sdb/XQueriesSupplier.hpp>
64cdf0e10cSrcweir #endif
65cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_SYSLOCALE_HXX
66cdf0e10cSrcweir #include <unotools/syslocale.hxx>
67cdf0e10cSrcweir #endif
68cdf0e10cSrcweir #ifndef DBAUI_TOOLS_HXX
69cdf0e10cSrcweir #include "UITools.hxx"
70cdf0e10cSrcweir #endif
71cdf0e10cSrcweir #ifndef DBAUI_APPDETAILVIEW_HXX
72cdf0e10cSrcweir #include "AppDetailView.hxx"
73cdf0e10cSrcweir #endif
74cdf0e10cSrcweir #ifndef _DBAUI_TABLETREE_HXX_
75cdf0e10cSrcweir #include "tabletree.hxx"
76cdf0e10cSrcweir #endif
77cdf0e10cSrcweir #ifndef DBAUI_APPSWAPWINDOW_HXX
78cdf0e10cSrcweir #include "AppSwapWindow.hxx"
79cdf0e10cSrcweir #endif
80cdf0e10cSrcweir #ifndef _SV_SVAPP_HXX //autogen
81cdf0e10cSrcweir #include <vcl/svapp.hxx>
82cdf0e10cSrcweir #endif
83cdf0e10cSrcweir #ifndef DBAUI_APPSWAPWINDOW_HXX
84cdf0e10cSrcweir #include "AppSwapWindow.hxx"
85cdf0e10cSrcweir #endif
86cdf0e10cSrcweir #ifndef DBAUI_TITLE_WINDOW_HXX
87cdf0e10cSrcweir #include "AppTitleWindow.hxx"
88cdf0e10cSrcweir #endif
89cdf0e10cSrcweir #ifndef _DBAUI_DSNTYPES_HXX_
90cdf0e10cSrcweir #include "dsntypes.hxx"
91cdf0e10cSrcweir #endif
92cdf0e10cSrcweir #ifndef DBACCESS_SHARED_DBUSTRINGS_HRC
93cdf0e10cSrcweir #include "dbustrings.hrc"
94cdf0e10cSrcweir #endif
95cdf0e10cSrcweir #ifndef DBAUI_ICONTROLLER_HXX
96cdf0e10cSrcweir #include "IController.hxx"
97cdf0e10cSrcweir #endif
98cdf0e10cSrcweir #ifndef DBACCESS_UI_BROWSER_ID_HXX
99cdf0e10cSrcweir #include "browserids.hxx"
100cdf0e10cSrcweir #endif
101cdf0e10cSrcweir #ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
102cdf0e10cSrcweir #include <unotools/pathoptions.hxx>
103cdf0e10cSrcweir #endif
104cdf0e10cSrcweir #include "IApplicationController.hxx"
105cdf0e10cSrcweir 
106cdf0e10cSrcweir using namespace ::dbaui;
107cdf0e10cSrcweir using namespace ::com::sun::star::uno;
108cdf0e10cSrcweir using namespace ::com::sun::star::ucb;
109cdf0e10cSrcweir using namespace ::com::sun::star::beans;
110cdf0e10cSrcweir using namespace ::com::sun::star::sdb;
111cdf0e10cSrcweir using namespace ::com::sun::star::sdbc;
112cdf0e10cSrcweir using namespace ::com::sun::star::sdbcx;
113cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::clipboard;
114cdf0e10cSrcweir using namespace ::com::sun::star::lang;
115cdf0e10cSrcweir using namespace ::com::sun::star::beans;
116cdf0e10cSrcweir using namespace ::com::sun::star::frame;
117cdf0e10cSrcweir using namespace ::com::sun::star::container;
118cdf0e10cSrcweir using ::com::sun::star::sdb::application::NamedDatabaseObject;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir //==================================================================
121cdf0e10cSrcweir // class OAppBorderWindow
DBG_NAME(OAppBorderWindow)122cdf0e10cSrcweir DBG_NAME(OAppBorderWindow)
123cdf0e10cSrcweir //==================================================================
124cdf0e10cSrcweir OAppBorderWindow::OAppBorderWindow(OApplicationView* _pParent,PreviewMode _ePreviewMode) : Window(_pParent,WB_DIALOGCONTROL)
125cdf0e10cSrcweir 	,m_pPanel(NULL)
126cdf0e10cSrcweir     ,m_pDetailView(NULL)
127cdf0e10cSrcweir 	,m_pView(_pParent)
128cdf0e10cSrcweir {
129cdf0e10cSrcweir     DBG_CTOR(OAppBorderWindow,NULL);
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	SetBorderStyle(WINDOW_BORDER_MONO);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	m_pPanel = new OTitleWindow(this,STR_DATABASE,WB_BORDER | WB_DIALOGCONTROL ,sal_False);
134cdf0e10cSrcweir 	m_pPanel->SetBorderStyle(WINDOW_BORDER_MONO);
135cdf0e10cSrcweir 	OApplicationSwapWindow* pSwap = new OApplicationSwapWindow( m_pPanel, *this );
136cdf0e10cSrcweir 	pSwap->Show();
137cdf0e10cSrcweir 	pSwap->SetUniqueId(UID_APP_SWAP_VIEW);
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	m_pPanel->setChildWindow(pSwap);
140cdf0e10cSrcweir 	m_pPanel->SetUniqueId(UID_APP_DATABASE_VIEW);
141cdf0e10cSrcweir 	m_pPanel->Show();
142cdf0e10cSrcweir 
143cdf0e10cSrcweir 	m_pDetailView = new OApplicationDetailView(*this,_ePreviewMode);
144cdf0e10cSrcweir 	m_pDetailView->Show();
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	ImplInitSettings();
147cdf0e10cSrcweir }
148cdf0e10cSrcweir // -----------------------------------------------------------------------------
~OAppBorderWindow()149cdf0e10cSrcweir OAppBorderWindow::~OAppBorderWindow()
150cdf0e10cSrcweir {
151cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
152cdf0e10cSrcweir 	// Childs zerstoeren
153cdf0e10cSrcweir 	if ( m_pPanel )
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 		m_pPanel->Hide();
156cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp(m_pPanel);
157cdf0e10cSrcweir 		m_pPanel = NULL;
158cdf0e10cSrcweir 	}
159cdf0e10cSrcweir 	if ( m_pDetailView )
160cdf0e10cSrcweir 	{
161cdf0e10cSrcweir 		m_pDetailView->Hide();
162cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp(m_pDetailView);
163cdf0e10cSrcweir 		m_pDetailView = NULL;
164cdf0e10cSrcweir 	}
165cdf0e10cSrcweir 
166cdf0e10cSrcweir     DBG_DTOR(OAppBorderWindow,NULL);
167cdf0e10cSrcweir }
168cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFocus()169cdf0e10cSrcweir void OAppBorderWindow::GetFocus()
170cdf0e10cSrcweir {
171cdf0e10cSrcweir 	if ( m_pPanel )
172cdf0e10cSrcweir 		m_pPanel->GrabFocus();
173cdf0e10cSrcweir }
174cdf0e10cSrcweir // -----------------------------------------------------------------------------
Resize()175cdf0e10cSrcweir void OAppBorderWindow::Resize()
176cdf0e10cSrcweir {
177cdf0e10cSrcweir 	//////////////////////////////////////////////////////////////////////
178cdf0e10cSrcweir 	// Abmessungen parent window
179cdf0e10cSrcweir 	Size aOutputSize( GetOutputSize() );
180cdf0e10cSrcweir 	long nOutputWidth	= aOutputSize.Width();
181cdf0e10cSrcweir 	long nOutputHeight	= aOutputSize.Height();
182cdf0e10cSrcweir 	long nX = 0;
183cdf0e10cSrcweir 
184cdf0e10cSrcweir 	Size aFLSize = LogicToPixel( Size( 3, 8 ), MAP_APPFONT );
185cdf0e10cSrcweir 	if ( m_pPanel )
186cdf0e10cSrcweir 	{
187cdf0e10cSrcweir 		OApplicationSwapWindow* pSwap = getPanel();
188cdf0e10cSrcweir 		if ( pSwap )
189cdf0e10cSrcweir 		{
190cdf0e10cSrcweir 			if ( pSwap->GetEntryCount() != 0 )
191cdf0e10cSrcweir 				nX = pSwap->GetBoundingBox( pSwap->GetEntry(0) ).GetWidth() + aFLSize.Height();
192cdf0e10cSrcweir 		}
193cdf0e10cSrcweir 		nX = ::std::max(m_pPanel->GetWidthPixel() ,nX);
194cdf0e10cSrcweir 		m_pPanel->SetPosSizePixel(Point(0,0),Size(nX,nOutputHeight));
195cdf0e10cSrcweir 	}
196cdf0e10cSrcweir 
197cdf0e10cSrcweir 	if ( m_pDetailView )
198cdf0e10cSrcweir 		m_pDetailView->SetPosSizePixel(Point(nX + aFLSize.Width(),0),Size(nOutputWidth - nX - aFLSize.Width(),nOutputHeight));
199cdf0e10cSrcweir }
200cdf0e10cSrcweir // -----------------------------------------------------------------------------
DataChanged(const DataChangedEvent & rDCEvt)201cdf0e10cSrcweir void OAppBorderWindow::DataChanged( const DataChangedEvent& rDCEvt )
202cdf0e10cSrcweir {
203cdf0e10cSrcweir 	Window::DataChanged( rDCEvt );
204cdf0e10cSrcweir 
205cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
206cdf0e10cSrcweir 		(rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
207cdf0e10cSrcweir 		(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
208cdf0e10cSrcweir 		((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
209cdf0e10cSrcweir 		(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
210cdf0e10cSrcweir 	{
211cdf0e10cSrcweir 		ImplInitSettings();
212cdf0e10cSrcweir 		Invalidate();
213cdf0e10cSrcweir 	}
214cdf0e10cSrcweir }
215cdf0e10cSrcweir // -----------------------------------------------------------------------------
ImplInitSettings()216cdf0e10cSrcweir void OAppBorderWindow::ImplInitSettings()
217cdf0e10cSrcweir {
218cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
219cdf0e10cSrcweir 	if( true )
220cdf0e10cSrcweir 	{
221cdf0e10cSrcweir 		Font aFont;
222cdf0e10cSrcweir 		aFont = rStyleSettings.GetFieldFont();
223cdf0e10cSrcweir 		aFont.SetColor( rStyleSettings.GetWindowTextColor() );
224cdf0e10cSrcweir 		SetPointFont( aFont );
225cdf0e10cSrcweir 	}
226cdf0e10cSrcweir 
227cdf0e10cSrcweir 	if( true )
228cdf0e10cSrcweir 	{
229cdf0e10cSrcweir 		SetTextColor( rStyleSettings.GetFieldTextColor() );
230cdf0e10cSrcweir 		SetTextFillColor();
231cdf0e10cSrcweir 	}
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	if( true )
234cdf0e10cSrcweir 		SetBackground( rStyleSettings.GetDialogColor() );
235cdf0e10cSrcweir 
236cdf0e10cSrcweir 	/*SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
237cdf0e10cSrcweir 	SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
238cdf0e10cSrcweir 	SetTextFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );*/
239cdf0e10cSrcweir }
240cdf0e10cSrcweir // -----------------------------------------------------------------------------
getView() const241cdf0e10cSrcweir OApplicationView* OAppBorderWindow::getView() const
242cdf0e10cSrcweir {
243cdf0e10cSrcweir     return m_pView;
244cdf0e10cSrcweir }
245cdf0e10cSrcweir 
246cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPanel() const247cdf0e10cSrcweir OApplicationSwapWindow*	OAppBorderWindow::getPanel() const
248cdf0e10cSrcweir {
249cdf0e10cSrcweir     return static_cast< OApplicationSwapWindow* >( m_pPanel->getChildWindow() );
250cdf0e10cSrcweir }
251cdf0e10cSrcweir 
252cdf0e10cSrcweir // -----------------------------------------------------------------------------
getDetailView() const253cdf0e10cSrcweir OApplicationDetailView*	OAppBorderWindow::getDetailView() const
254cdf0e10cSrcweir {
255cdf0e10cSrcweir     return m_pDetailView;
256cdf0e10cSrcweir }
257cdf0e10cSrcweir 
258cdf0e10cSrcweir //==================================================================
259cdf0e10cSrcweir // class OApplicationView
260cdf0e10cSrcweir //==================================================================
261cdf0e10cSrcweir DBG_NAME(OApplicationView);
262cdf0e10cSrcweir //------------------------------------------------------------------------------
OApplicationView(Window * pParent,const Reference<XMultiServiceFactory> & _rxOrb,IApplicationController & _rAppController,PreviewMode _ePreviewMode)263cdf0e10cSrcweir OApplicationView::OApplicationView( Window* pParent
264cdf0e10cSrcweir 									,const Reference< XMultiServiceFactory >& _rxOrb
265cdf0e10cSrcweir 									,IApplicationController& _rAppController
266cdf0e10cSrcweir 									,PreviewMode _ePreviewMode
267cdf0e10cSrcweir 								   ) :
268cdf0e10cSrcweir 	ODataView( pParent, _rAppController, _rxOrb, WB_DIALOGCONTROL )
269cdf0e10cSrcweir 	,m_rAppController( _rAppController )
270cdf0e10cSrcweir 	,m_eChildFocus(NONE)
271cdf0e10cSrcweir {
272cdf0e10cSrcweir 	DBG_CTOR(OApplicationView,NULL);
273cdf0e10cSrcweir 
274cdf0e10cSrcweir 	try
275cdf0e10cSrcweir 	{
276cdf0e10cSrcweir 		m_aLocale = SvtSysLocale().GetLocaleData().getLocale();
277cdf0e10cSrcweir 	}
278cdf0e10cSrcweir 	catch(Exception&)
279cdf0e10cSrcweir 	{
280cdf0e10cSrcweir 	}
281cdf0e10cSrcweir 
282cdf0e10cSrcweir 	m_pWin = new OAppBorderWindow(this,_ePreviewMode);
283cdf0e10cSrcweir 	m_pWin->SetUniqueId(UID_APP_VIEW_BORDER_WIN);
284cdf0e10cSrcweir 	m_pWin->Show();
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	ImplInitSettings();
287cdf0e10cSrcweir }
288cdf0e10cSrcweir 
289cdf0e10cSrcweir //------------------------------------------------------------------------------
~OApplicationView()290cdf0e10cSrcweir OApplicationView::~OApplicationView()
291cdf0e10cSrcweir {
292cdf0e10cSrcweir 	DBG_DTOR(OApplicationView,NULL);
293cdf0e10cSrcweir 
294cdf0e10cSrcweir 	{
295cdf0e10cSrcweir 		stopComponentListening(m_xObject);
296cdf0e10cSrcweir 		m_pWin->Hide();
297cdf0e10cSrcweir 		::std::auto_ptr<Window> aTemp(m_pWin);
298cdf0e10cSrcweir 		m_pWin = NULL;
299cdf0e10cSrcweir 	}
300cdf0e10cSrcweir }
301cdf0e10cSrcweir // -----------------------------------------------------------------------------
createIconAutoMnemonics(MnemonicGenerator & _rMnemonics)302cdf0e10cSrcweir void OApplicationView::createIconAutoMnemonics( MnemonicGenerator& _rMnemonics )
303cdf0e10cSrcweir {
304cdf0e10cSrcweir     if ( m_pWin && m_pWin->getPanel() )
305cdf0e10cSrcweir         m_pWin->getPanel()->createIconAutoMnemonics( _rMnemonics );
306cdf0e10cSrcweir }
307cdf0e10cSrcweir 
308cdf0e10cSrcweir // -----------------------------------------------------------------------------
setTaskExternalMnemonics(MnemonicGenerator & _rMnemonics)309cdf0e10cSrcweir void OApplicationView::setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics )
310cdf0e10cSrcweir {
311cdf0e10cSrcweir     if ( m_pWin && m_pWin->getDetailView() )
312cdf0e10cSrcweir         m_pWin->getDetailView()->setTaskExternalMnemonics( _rMnemonics );
313cdf0e10cSrcweir }
314cdf0e10cSrcweir 
315cdf0e10cSrcweir // -----------------------------------------------------------------------------
DataChanged(const DataChangedEvent & rDCEvt)316cdf0e10cSrcweir void OApplicationView::DataChanged( const DataChangedEvent& rDCEvt )
317cdf0e10cSrcweir {
318cdf0e10cSrcweir 	ODataView::DataChanged( rDCEvt );
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
321cdf0e10cSrcweir 		(rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
322cdf0e10cSrcweir 		(rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
323cdf0e10cSrcweir 		((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
324cdf0e10cSrcweir 		(rDCEvt.GetFlags() & SETTINGS_STYLE)) )
325cdf0e10cSrcweir 	{
326cdf0e10cSrcweir 		ImplInitSettings();
327cdf0e10cSrcweir 		Invalidate();
328cdf0e10cSrcweir 	}
329cdf0e10cSrcweir }
330cdf0e10cSrcweir //------------------------------------------------------------------------------
resizeDocumentView(Rectangle & _rPlayground)331cdf0e10cSrcweir void OApplicationView::resizeDocumentView(Rectangle& _rPlayground)
332cdf0e10cSrcweir {
333cdf0e10cSrcweir 	if ( m_pWin && !_rPlayground.IsEmpty() )
334cdf0e10cSrcweir 	{
335cdf0e10cSrcweir 		Size aFLSize = LogicToPixel( Size( 3, 3 ), MAP_APPFONT );
336cdf0e10cSrcweir 		_rPlayground.Move( aFLSize.A(),aFLSize.B() );
337cdf0e10cSrcweir 		Size aOldSize = _rPlayground.GetSize();
338cdf0e10cSrcweir 		_rPlayground.SetSize( Size(aOldSize.A() - 2*aFLSize.A(), aOldSize.B() - 2*aFLSize.B()) );
339cdf0e10cSrcweir 
340cdf0e10cSrcweir 		m_pWin->SetPosSizePixel(_rPlayground.TopLeft() , _rPlayground.GetSize() );
341cdf0e10cSrcweir 	}
342cdf0e10cSrcweir 	// just for completeness: there is no space left, we occupied it all ...
343cdf0e10cSrcweir 	_rPlayground.SetPos( _rPlayground.BottomRight() );
344cdf0e10cSrcweir 	_rPlayground.SetSize( Size( 0, 0 ) );
345cdf0e10cSrcweir }
346cdf0e10cSrcweir //------------------------------------------------------------------------------
PreNotify(NotifyEvent & rNEvt)347cdf0e10cSrcweir long OApplicationView::PreNotify( NotifyEvent& rNEvt )
348cdf0e10cSrcweir {
349cdf0e10cSrcweir 	switch(rNEvt.GetType())
350cdf0e10cSrcweir 	{
351cdf0e10cSrcweir 		case EVENT_GETFOCUS:
352cdf0e10cSrcweir 			if( m_pWin && getPanel() && getPanel()->HasChildPathFocus() )
353cdf0e10cSrcweir 				m_eChildFocus = PANELSWAP;
354cdf0e10cSrcweir 			else if ( m_pWin && getDetailView() && getDetailView()->HasChildPathFocus() )
355cdf0e10cSrcweir 				m_eChildFocus = DETAIL;
356cdf0e10cSrcweir 			else
357cdf0e10cSrcweir 				m_eChildFocus = NONE;
358cdf0e10cSrcweir 			break;
359cdf0e10cSrcweir         case EVENT_KEYINPUT:
360cdf0e10cSrcweir         {
361cdf0e10cSrcweir             const KeyEvent* pKeyEvent = rNEvt.GetKeyEvent();
362cdf0e10cSrcweir             // give the pane the chance to intercept mnemonic accelerators
363cdf0e10cSrcweir             // #i34790# - 2004-09-30 - fs@openoffice.org
364cdf0e10cSrcweir             if ( getPanel() && getPanel()->interceptKeyInput( *pKeyEvent ) )
365cdf0e10cSrcweir                 return 1L;
366cdf0e10cSrcweir             // and ditto the detail view
367cdf0e10cSrcweir             // #i72799# - 2006-12-20 / frank.schoenheit@sun.com
368cdf0e10cSrcweir             if ( getDetailView() && getDetailView()->interceptKeyInput( *pKeyEvent ) )
369cdf0e10cSrcweir                 return 1L;
370cdf0e10cSrcweir         }
371cdf0e10cSrcweir         break;
372cdf0e10cSrcweir 	}
373cdf0e10cSrcweir 
374cdf0e10cSrcweir 	return ODataView::PreNotify(rNEvt);
375cdf0e10cSrcweir }
376cdf0e10cSrcweir // -----------------------------------------------------------------------------
getActiveChild() const377cdf0e10cSrcweir IClipboardTest* OApplicationView::getActiveChild() const
378cdf0e10cSrcweir {
379cdf0e10cSrcweir 	IClipboardTest* pTest = NULL;
380cdf0e10cSrcweir 	if ( DETAIL == m_eChildFocus )
381cdf0e10cSrcweir 		pTest = getDetailView();
382cdf0e10cSrcweir 	return pTest;
383cdf0e10cSrcweir }
384cdf0e10cSrcweir // -----------------------------------------------------------------------------
isCopyAllowed()385cdf0e10cSrcweir sal_Bool OApplicationView::isCopyAllowed()
386cdf0e10cSrcweir {
387cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
388cdf0e10cSrcweir 	return pTest && pTest->isCopyAllowed();
389cdf0e10cSrcweir }
390cdf0e10cSrcweir // -----------------------------------------------------------------------------
isCutAllowed()391cdf0e10cSrcweir sal_Bool OApplicationView::isCutAllowed()
392cdf0e10cSrcweir {
393cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
394cdf0e10cSrcweir 	return pTest && pTest->isCutAllowed();
395cdf0e10cSrcweir }
396cdf0e10cSrcweir // -----------------------------------------------------------------------------
isPasteAllowed()397cdf0e10cSrcweir sal_Bool OApplicationView::isPasteAllowed()
398cdf0e10cSrcweir {
399cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
400cdf0e10cSrcweir 	return pTest && pTest->isPasteAllowed();
401cdf0e10cSrcweir }
402cdf0e10cSrcweir // -----------------------------------------------------------------------------
copy()403cdf0e10cSrcweir void OApplicationView::copy()
404cdf0e10cSrcweir {
405cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
406cdf0e10cSrcweir 	if ( pTest )
407cdf0e10cSrcweir 		pTest->copy();
408cdf0e10cSrcweir }
409cdf0e10cSrcweir // -----------------------------------------------------------------------------
cut()410cdf0e10cSrcweir void OApplicationView::cut()
411cdf0e10cSrcweir {
412cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
413cdf0e10cSrcweir 	if ( pTest )
414cdf0e10cSrcweir 		pTest->cut();
415cdf0e10cSrcweir }
416cdf0e10cSrcweir // -----------------------------------------------------------------------------
paste()417cdf0e10cSrcweir void OApplicationView::paste()
418cdf0e10cSrcweir {
419cdf0e10cSrcweir 	IClipboardTest* pTest = getActiveChild();
420cdf0e10cSrcweir 	if ( pTest )
421cdf0e10cSrcweir 		pTest->paste();
422cdf0e10cSrcweir }
423cdf0e10cSrcweir // -----------------------------------------------------------------------------
getQualifiedName(SvLBoxEntry * _pEntry) const424cdf0e10cSrcweir ::rtl::OUString OApplicationView::getQualifiedName( SvLBoxEntry* _pEntry ) const
425cdf0e10cSrcweir {
426cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
427cdf0e10cSrcweir 	return getDetailView()->getQualifiedName( _pEntry );
428cdf0e10cSrcweir }
429cdf0e10cSrcweir // -----------------------------------------------------------------------------
isLeaf(SvLBoxEntry * _pEntry) const430cdf0e10cSrcweir sal_Bool OApplicationView::isLeaf(SvLBoxEntry* _pEntry) const
431cdf0e10cSrcweir {
432cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
433cdf0e10cSrcweir 	return getDetailView()->isLeaf(_pEntry);
434cdf0e10cSrcweir }
435cdf0e10cSrcweir // -----------------------------------------------------------------------------
isALeafSelected() const436cdf0e10cSrcweir sal_Bool OApplicationView::isALeafSelected() const
437cdf0e10cSrcweir {
438cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
439cdf0e10cSrcweir 	return getDetailView()->isALeafSelected();
440cdf0e10cSrcweir }
441cdf0e10cSrcweir // -----------------------------------------------------------------------------
selectAll()442cdf0e10cSrcweir void OApplicationView::selectAll()
443cdf0e10cSrcweir {
444cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
445cdf0e10cSrcweir 	getDetailView()->selectAll();
446cdf0e10cSrcweir }
447cdf0e10cSrcweir // -----------------------------------------------------------------------------
isSortUp() const448cdf0e10cSrcweir sal_Bool OApplicationView::isSortUp() const
449cdf0e10cSrcweir {
450cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
451cdf0e10cSrcweir 	return getDetailView()->isSortUp();
452cdf0e10cSrcweir }
453cdf0e10cSrcweir // -----------------------------------------------------------------------------
sortDown()454cdf0e10cSrcweir void OApplicationView::sortDown()
455cdf0e10cSrcweir {
456cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
457cdf0e10cSrcweir 	getDetailView()->sortDown();
458cdf0e10cSrcweir }
459cdf0e10cSrcweir // -----------------------------------------------------------------------------
sortUp()460cdf0e10cSrcweir void OApplicationView::sortUp()
461cdf0e10cSrcweir {
462cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
463cdf0e10cSrcweir 	getDetailView()->sortUp();
464cdf0e10cSrcweir }
465cdf0e10cSrcweir // -----------------------------------------------------------------------------
isFilled() const466cdf0e10cSrcweir sal_Bool OApplicationView::isFilled() const
467cdf0e10cSrcweir {
468cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
469cdf0e10cSrcweir 	return getDetailView()->isFilled();
470cdf0e10cSrcweir }
471cdf0e10cSrcweir // -----------------------------------------------------------------------------
getElementType() const472cdf0e10cSrcweir ElementType OApplicationView::getElementType() const
473cdf0e10cSrcweir {
474cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView() && getPanel(),"Detail view is NULL! -> GPF");
475cdf0e10cSrcweir 	return getDetailView()->HasChildPathFocus() ? getDetailView()->getElementType() : getPanel()->getElementType();
476cdf0e10cSrcweir }
477cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSelectionCount()478cdf0e10cSrcweir sal_Int32 OApplicationView::getSelectionCount()
479cdf0e10cSrcweir {
480cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
481cdf0e10cSrcweir 	return getDetailView()->getSelectionCount();
482cdf0e10cSrcweir }
483cdf0e10cSrcweir // -----------------------------------------------------------------------------
getElementCount()484cdf0e10cSrcweir sal_Int32 OApplicationView::getElementCount()
485cdf0e10cSrcweir {
486cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
487cdf0e10cSrcweir 	return getDetailView()->getElementCount();
488cdf0e10cSrcweir }
489cdf0e10cSrcweir // -----------------------------------------------------------------------------
getSelectionElementNames(::std::vector<::rtl::OUString> & _rNames) const490cdf0e10cSrcweir void OApplicationView::getSelectionElementNames( ::std::vector< ::rtl::OUString>& _rNames ) const
491cdf0e10cSrcweir {
492cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
493cdf0e10cSrcweir 	getDetailView()->getSelectionElementNames( _rNames );
494cdf0e10cSrcweir }
495cdf0e10cSrcweir // -----------------------------------------------------------------------------
describeCurrentSelectionForControl(const Control & _rControl,Sequence<NamedDatabaseObject> & _out_rSelectedObjects)496cdf0e10cSrcweir void OApplicationView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
497cdf0e10cSrcweir {
498cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
499cdf0e10cSrcweir 	getDetailView()->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
500cdf0e10cSrcweir }
501cdf0e10cSrcweir // -----------------------------------------------------------------------------
describeCurrentSelectionForType(const ElementType _eType,Sequence<NamedDatabaseObject> & _out_rSelectedObjects)502cdf0e10cSrcweir void OApplicationView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
503cdf0e10cSrcweir {
504cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
505cdf0e10cSrcweir 	getDetailView()->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
506cdf0e10cSrcweir }
507cdf0e10cSrcweir // -----------------------------------------------------------------------------
selectElements(const Sequence<::rtl::OUString> & _aNames)508cdf0e10cSrcweir void OApplicationView::selectElements(const Sequence< ::rtl::OUString>& _aNames)
509cdf0e10cSrcweir {
510cdf0e10cSrcweir     OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
511cdf0e10cSrcweir 	getDetailView()->selectElements( _aNames );
512cdf0e10cSrcweir }
513cdf0e10cSrcweir // -----------------------------------------------------------------------------
elementAdded(ElementType eType,const::rtl::OUString & _rName,const Any & _rObject)514cdf0e10cSrcweir SvLBoxEntry* OApplicationView::elementAdded(ElementType eType,const ::rtl::OUString& _rName, const Any& _rObject )
515cdf0e10cSrcweir {
516cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
517cdf0e10cSrcweir 	return getDetailView()->elementAdded(eType,_rName,_rObject);
518cdf0e10cSrcweir }
519cdf0e10cSrcweir // -----------------------------------------------------------------------------
elementRemoved(ElementType eType,const::rtl::OUString & _rName)520cdf0e10cSrcweir void OApplicationView::elementRemoved(ElementType eType,const ::rtl::OUString& _rName )
521cdf0e10cSrcweir {
522cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
523cdf0e10cSrcweir 	getDetailView()->elementRemoved(eType,_rName);
524cdf0e10cSrcweir }
525cdf0e10cSrcweir // -----------------------------------------------------------------------------
elementReplaced(ElementType _eType,const::rtl::OUString & _rOldName,const::rtl::OUString & _rNewName)526cdf0e10cSrcweir void OApplicationView::elementReplaced(ElementType _eType
527cdf0e10cSrcweir 													,const ::rtl::OUString& _rOldName
528cdf0e10cSrcweir 													,const ::rtl::OUString& _rNewName )
529cdf0e10cSrcweir {
530cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
531cdf0e10cSrcweir 	getDetailView()->elementReplaced(_eType, _rOldName, _rNewName );
532cdf0e10cSrcweir }
533cdf0e10cSrcweir // -----------------------------------------------------------------------------
clearPages(sal_Bool _bTaskAlso)534cdf0e10cSrcweir void OApplicationView::clearPages(sal_Bool _bTaskAlso)
535cdf0e10cSrcweir {
536cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView() && getPanel(),"Detail view is NULL! -> GPF");
537cdf0e10cSrcweir 	getPanel()->clearSelection();
538cdf0e10cSrcweir 	getDetailView()->clearPages(_bTaskAlso);
539cdf0e10cSrcweir }
540cdf0e10cSrcweir // -----------------------------------------------------------------------------
selectContainer(ElementType _eType)541cdf0e10cSrcweir void OApplicationView::selectContainer(ElementType _eType)
542cdf0e10cSrcweir {
543cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getPanel(),"Detail view is NULL! -> GPF");
544cdf0e10cSrcweir 	WaitObject aWO(this);
545cdf0e10cSrcweir 	getPanel()->selectContainer(_eType);
546cdf0e10cSrcweir }
547cdf0e10cSrcweir // -----------------------------------------------------------------------------
getEntry(const Point & _aPosPixel) const548cdf0e10cSrcweir SvLBoxEntry* OApplicationView::getEntry( const Point& _aPosPixel ) const
549cdf0e10cSrcweir {
550cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
551cdf0e10cSrcweir 	return getDetailView()->getEntry(_aPosPixel);
552cdf0e10cSrcweir }
553cdf0e10cSrcweir // -----------------------------------------------------------------------------
getPreviewMode()554cdf0e10cSrcweir PreviewMode OApplicationView::getPreviewMode()
555cdf0e10cSrcweir {
556cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
557cdf0e10cSrcweir 	return getDetailView()->getPreviewMode();
558cdf0e10cSrcweir }
559cdf0e10cSrcweir // -----------------------------------------------------------------------------
isPreviewEnabled()560cdf0e10cSrcweir sal_Bool OApplicationView::isPreviewEnabled()
561cdf0e10cSrcweir {
562cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
563cdf0e10cSrcweir 	return getDetailView()->isPreviewEnabled();
564cdf0e10cSrcweir }
565cdf0e10cSrcweir // -----------------------------------------------------------------------------
switchPreview(PreviewMode _eMode)566cdf0e10cSrcweir void OApplicationView::switchPreview(PreviewMode _eMode)
567cdf0e10cSrcweir {
568cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
569cdf0e10cSrcweir 	getDetailView()->switchPreview(_eMode);
570cdf0e10cSrcweir }
571cdf0e10cSrcweir // -----------------------------------------------------------------------------
showPreview(const Reference<XContent> & _xContent)572cdf0e10cSrcweir void OApplicationView::showPreview(const Reference< XContent >& _xContent)
573cdf0e10cSrcweir {
574cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
575cdf0e10cSrcweir 	stopComponentListening(m_xObject);
576cdf0e10cSrcweir 	m_xObject = NULL;
577cdf0e10cSrcweir 	getDetailView()->showPreview(_xContent);
578cdf0e10cSrcweir }
579cdf0e10cSrcweir // -----------------------------------------------------------------------------
showPreview(const::rtl::OUString & _sDataSourceName,const::com::sun::star::uno::Reference<::com::sun::star::sdbc::XConnection> & _xConnection,const::rtl::OUString & _sName,sal_Bool _bTable)580cdf0e10cSrcweir void OApplicationView::showPreview(	const ::rtl::OUString& _sDataSourceName,
581cdf0e10cSrcweir 									const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _xConnection,
582cdf0e10cSrcweir 									const ::rtl::OUString& _sName,
583cdf0e10cSrcweir 									sal_Bool _bTable)
584cdf0e10cSrcweir {
585cdf0e10cSrcweir 	OSL_ENSURE(m_pWin && getDetailView(),"Detail view is NULL! -> GPF");
586cdf0e10cSrcweir 	if ( isPreviewEnabled() )
587cdf0e10cSrcweir 	{
588cdf0e10cSrcweir 		stopComponentListening(m_xObject);
589cdf0e10cSrcweir 		m_xObject = NULL;
590cdf0e10cSrcweir 		try
591cdf0e10cSrcweir 		{
592cdf0e10cSrcweir 			Reference<XNameAccess> xNameAccess;
593cdf0e10cSrcweir 			if ( _bTable )
594cdf0e10cSrcweir 			{
595cdf0e10cSrcweir 				Reference<XTablesSupplier> xSup(_xConnection,UNO_QUERY);
596cdf0e10cSrcweir 				if ( xSup.is() )
597cdf0e10cSrcweir 					xNameAccess.set(xSup->getTables(),UNO_QUERY);
598cdf0e10cSrcweir 			}
599cdf0e10cSrcweir 			else
600cdf0e10cSrcweir 			{
601cdf0e10cSrcweir 				Reference<XQueriesSupplier> xSup(_xConnection,UNO_QUERY);
602cdf0e10cSrcweir 				if ( xSup.is() )
603cdf0e10cSrcweir 					xNameAccess.set(xSup->getQueries(),UNO_QUERY);
604cdf0e10cSrcweir 			}
605cdf0e10cSrcweir 			if ( xNameAccess.is() && xNameAccess->hasByName(_sName) )
606cdf0e10cSrcweir 				m_xObject.set(xNameAccess->getByName(_sName),UNO_QUERY);
607cdf0e10cSrcweir 		}
608cdf0e10cSrcweir 	    catch( const Exception& )
609cdf0e10cSrcweir 	    {
610cdf0e10cSrcweir             DBG_UNHANDLED_EXCEPTION();
611cdf0e10cSrcweir 	    }
612cdf0e10cSrcweir 		if ( m_xObject.is() )
613cdf0e10cSrcweir 			startComponentListening(m_xObject);
614cdf0e10cSrcweir 		getDetailView()->showPreview(_sDataSourceName,_sName,_bTable);
615cdf0e10cSrcweir 	}
616cdf0e10cSrcweir }
617cdf0e10cSrcweir // -----------------------------------------------------------------------------
GetFocus()618cdf0e10cSrcweir void OApplicationView::GetFocus()
619cdf0e10cSrcweir {
620cdf0e10cSrcweir 	if ( m_eChildFocus == NONE && m_pWin )
621cdf0e10cSrcweir 	{
622cdf0e10cSrcweir 		m_pWin->GrabFocus();
623cdf0e10cSrcweir 	}
624cdf0e10cSrcweir }
625cdf0e10cSrcweir // -----------------------------------------------------------------------------
_disposing(const::com::sun::star::lang::EventObject &)626cdf0e10cSrcweir void OApplicationView::_disposing( const ::com::sun::star::lang::EventObject& /*_rSource*/ )
627cdf0e10cSrcweir {
628cdf0e10cSrcweir 	if ( m_pWin && getDetailView() )
629cdf0e10cSrcweir 		showPreview(NULL);
630cdf0e10cSrcweir }
631cdf0e10cSrcweir // -----------------------------------------------------------------------------
ImplInitSettings()632cdf0e10cSrcweir void OApplicationView::ImplInitSettings()
633cdf0e10cSrcweir {
634cdf0e10cSrcweir 	const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
635cdf0e10cSrcweir 	if( true )
636cdf0e10cSrcweir 	{
637cdf0e10cSrcweir 		Font aFont;
638cdf0e10cSrcweir 		aFont = rStyleSettings.GetFieldFont();
639cdf0e10cSrcweir 		aFont.SetColor( rStyleSettings.GetWindowTextColor() );
640cdf0e10cSrcweir 		SetPointFont( aFont );
641cdf0e10cSrcweir 	}
642cdf0e10cSrcweir 
643cdf0e10cSrcweir 	if( true )
644cdf0e10cSrcweir 	{
645cdf0e10cSrcweir 		SetTextColor( rStyleSettings.GetFieldTextColor() );
646cdf0e10cSrcweir 		SetTextFillColor();
647cdf0e10cSrcweir 	}
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 	if( true )
650cdf0e10cSrcweir 		SetBackground( rStyleSettings.GetFieldColor() );
651cdf0e10cSrcweir 	/*SetBackground( Wallpaper( Application::GetSettings().GetStyleSettings().GetDialogColor() ) );
652cdf0e10cSrcweir 	SetFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );
653cdf0e10cSrcweir 	SetTextFillColor( Application::GetSettings().GetStyleSettings().GetDialogColor() );*/
654cdf0e10cSrcweir }
655cdf0e10cSrcweir //-----------------------------------------------------------------------------
656