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