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