LCOV - code coverage report
Current view: top level - dbaccess/source/ui/app - AppDetailView.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 459 0.0 %
Date: 2014-04-14 Functions: 0 74 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "AppDetailView.hxx"
      21             : #include <osl/diagnose.h>
      22             : #include "dbaccess_helpid.hrc"
      23             : #include "dbu_app.hrc"
      24             : #include "AppView.hxx"
      25             : #include <com/sun/star/ui/XUIConfigurationManager.hpp>
      26             : #include <com/sun/star/ui/theModuleUIConfigurationManagerSupplier.hpp>
      27             : #include <com/sun/star/ui/XImageManager.hpp>
      28             : #include <com/sun/star/ui/ImageType.hpp>
      29             : #include <com/sun/star/sdbcx/XViewsSupplier.hpp>
      30             : #include <com/sun/star/graphic/XGraphic.hpp>
      31             : #include <com/sun/star/util/URL.hpp>
      32             : #include "listviewitems.hxx"
      33             : #include <vcl/image.hxx>
      34             : #include <vcl/mnemonic.hxx>
      35             : #include <vcl/settings.hxx>
      36             : #include "browserids.hxx"
      37             : #include "AppDetailPageHelper.hxx"
      38             : #include <vcl/svapp.hxx>
      39             : #include "callbacks.hxx"
      40             : #include <dbaccess/IController.hxx>
      41             : #include "moduledbu.hxx"
      42             : #include <svtools/localresaccess.hxx>
      43             : #include "svtools/treelistentry.hxx"
      44             : #include "svtools/viewdataentry.hxx"
      45             : #include <algorithm>
      46             : #include "dbtreelistbox.hxx"
      47             : #include "IApplicationController.hxx"
      48             : #include "imageprovider.hxx"
      49             : #include "comphelper/processfactory.hxx"
      50             : 
      51             : using namespace ::dbaui;
      52             : using namespace ::com::sun::star::uno;
      53             : using namespace ::com::sun::star::sdbc;
      54             : using namespace ::com::sun::star::sdbcx;
      55             : using namespace ::com::sun::star::lang;
      56             : using namespace ::com::sun::star::ucb;
      57             : using namespace ::com::sun::star::graphic;
      58             : using namespace ::com::sun::star::ui;
      59             : using namespace ::com::sun::star::container;
      60             : using namespace ::com::sun::star::beans;
      61             : using ::com::sun::star::util::URL;
      62             : using ::com::sun::star::sdb::application::NamedDatabaseObject;
      63             : 
      64             : #define SPACEBETWEENENTRIES     4
      65             : 
      66           0 : TaskEntry::TaskEntry( const sal_Char* _pAsciiUNOCommand, sal_uInt16 _nHelpID, sal_uInt16 _nTitleResourceID, bool _bHideWhenDisabled )
      67             :     :sUNOCommand( OUString::createFromAscii( _pAsciiUNOCommand ) )
      68             :     ,nHelpID( _nHelpID )
      69             :     ,sTitle( ModuleRes( _nTitleResourceID ) )
      70           0 :     ,bHideWhenDisabled( _bHideWhenDisabled )
      71             : {
      72           0 : }
      73             : 
      74           0 : OCreationList::OCreationList( OTasksWindow& _rParent )
      75             :     :SvTreeListBox( &_rParent, WB_TABSTOP | WB_HASBUTTONSATROOT | WB_HASBUTTONS )
      76             :     ,m_rTaskWindow( _rParent )
      77             :     ,m_pMouseDownEntry( NULL )
      78           0 :     ,m_pLastActiveEntry( NULL )
      79             : {
      80           0 :     sal_uInt16 nSize = SPACEBETWEENENTRIES;
      81           0 :     SetSpaceBetweenEntries(nSize);
      82           0 :     SetSelectionMode( NO_SELECTION );
      83           0 :     SetExtendedWinBits( EWB_NO_AUTO_CURENTRY );
      84           0 :     SetNodeDefaultImages( );
      85           0 :     EnableEntryMnemonics();
      86           0 : }
      87             : 
      88           0 : void OCreationList::Paint( const Rectangle& _rRect )
      89             : {
      90           0 :     if ( m_pMouseDownEntry )
      91           0 :         m_aOriginalFont = GetFont();
      92             : 
      93           0 :     m_aOriginalBackgroundColor = GetBackground().GetColor();
      94           0 :     SvTreeListBox::Paint( _rRect );
      95           0 :     SetBackground( m_aOriginalBackgroundColor );
      96             : 
      97           0 :     if ( m_pMouseDownEntry )
      98           0 :         Control::SetFont( m_aOriginalFont );
      99           0 : }
     100             : 
     101           0 : void OCreationList::PreparePaint( SvTreeListEntry* _pEntry )
     102             : {
     103           0 :     Wallpaper aEntryBackground( m_aOriginalBackgroundColor );
     104           0 :     if ( _pEntry )
     105             :     {
     106           0 :         if ( _pEntry == GetCurEntry() )
     107             :         {
     108             :             // draw a selection background
     109           0 :             bool bIsMouseDownEntry = ( _pEntry == m_pMouseDownEntry );
     110           0 :             DrawSelectionBackground( GetBoundingRect( _pEntry ), bIsMouseDownEntry ? 1 : 2, false, true, false );
     111             : 
     112           0 :             if ( bIsMouseDownEntry )
     113             :             {
     114           0 :                 Font aFont( GetFont() );
     115           0 :                 aFont.SetColor( GetSettings().GetStyleSettings().GetHighlightTextColor() );
     116           0 :                 Control::SetFont( aFont );
     117             :             }
     118             : 
     119             :             // and temporary set a transparent background, for all the other
     120             :             // paint operations the SvTreeListBox is going to do
     121           0 :             aEntryBackground = Wallpaper( Color( COL_TRANSPARENT ) );
     122             :         }
     123             :     }
     124             : 
     125           0 :     SetBackground( aEntryBackground );
     126           0 : }
     127             : 
     128           0 : void OCreationList::SelectSearchEntry( const void* _pEntry )
     129             : {
     130           0 :     SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pEntry ) );
     131             :     OSL_ENSURE( pEntry, "OCreationList::SelectSearchEntry: invalid entry!" );
     132             : 
     133           0 :     if ( pEntry )
     134           0 :         setCurrentEntryInvalidate( pEntry );
     135             : 
     136           0 :     if ( !HasChildPathFocus() )
     137           0 :         GrabFocus();
     138           0 : }
     139             : 
     140           0 : void OCreationList::ExecuteSearchEntry( const void* _pEntry ) const
     141             : {
     142           0 :     SvTreeListEntry* pEntry = const_cast< SvTreeListEntry* >( static_cast< const SvTreeListEntry* >( _pEntry ) );
     143             :     OSL_ENSURE( pEntry, "OCreationList::ExecuteSearchEntry: invalid entry!" );
     144             :     OSL_ENSURE( pEntry == GetCurEntry(), "OCreationList::ExecuteSearchEntry: SelectSearchEntry should have been called before!" );
     145             : 
     146           0 :     if ( pEntry )
     147           0 :         onSelected( pEntry );
     148           0 : }
     149             : 
     150           0 : Rectangle OCreationList::GetFocusRect( SvTreeListEntry* _pEntry, long _nLine )
     151             : {
     152           0 :     Rectangle aRect = SvTreeListBox::GetFocusRect( _pEntry, _nLine );
     153           0 :     aRect.Left() = 0;
     154             : 
     155             :     // try to let the focus rect start before the bitmap item - this looks better
     156           0 :     SvLBoxItem* pBitmapItem = _pEntry->GetFirstItem( SV_ITEM_ID_LBOXCONTEXTBMP );
     157           0 :     SvLBoxTab* pTab = pBitmapItem ? GetTab( _pEntry, pBitmapItem ) : NULL;
     158           0 :     SvViewDataItem* pItemData = pBitmapItem ? GetViewDataItem( _pEntry, pBitmapItem ) : NULL;
     159             :     OSL_ENSURE( pTab && pItemData, "OCreationList::GetFocusRect: could not find the first bitmap item!" );
     160           0 :     if ( pTab && pItemData )
     161           0 :         aRect.Left() = pTab->GetPos() - pItemData->maSize.Width() / 2;
     162             : 
     163             :     // inflate the rectangle a little bit - looks better, too
     164           0 :     aRect.Left() = ::std::max< long >( 0, aRect.Left() - 2 );
     165           0 :     aRect.Right() = ::std::min< long >( GetOutputSizePixel().Width() - 1, aRect.Right() + 2 );
     166             : 
     167           0 :     return aRect;
     168             : }
     169             : 
     170           0 : void OCreationList::StartDrag( sal_Int8 /*_nAction*/, const Point& /*_rPosPixel*/ )
     171             : {
     172             :     // don't give this to the base class, it does a ReleaseMouse as very first action
     173             :     // Though I think this is a bug (it should ReleaseMouse only if it is going to do
     174             :     // something with the drag-event), I hesitate to fix it in the current state,
     175             :     // since I don't overlook the consequences, and we're close to 2.0 ...)
     176           0 : }
     177             : 
     178           0 : void OCreationList::ModelHasCleared()
     179             : {
     180           0 :     SvTreeListBox::ModelHasCleared();
     181           0 :     m_pLastActiveEntry = NULL;
     182           0 :     m_pMouseDownEntry = NULL;
     183           0 : }
     184             : 
     185           0 : void OCreationList::GetFocus()
     186             : {
     187           0 :     SvTreeListBox::GetFocus();
     188           0 :     if ( !GetCurEntry() )
     189           0 :         setCurrentEntryInvalidate( m_pLastActiveEntry ? m_pLastActiveEntry : GetFirstEntryInView() );
     190           0 : }
     191             : 
     192           0 : void OCreationList::LoseFocus()
     193             : {
     194           0 :     SvTreeListBox::LoseFocus();
     195           0 :     m_pLastActiveEntry = GetCurEntry();
     196           0 :     setCurrentEntryInvalidate( NULL );
     197           0 : }
     198             : 
     199           0 : void OCreationList::MouseButtonDown( const MouseEvent& rMEvt )
     200             : {
     201           0 :     SvTreeListBox::MouseButtonDown( rMEvt );
     202             : 
     203             :     OSL_ENSURE( !m_pMouseDownEntry, "OCreationList::MouseButtonDown: I missed some mouse event!" );
     204           0 :     m_pMouseDownEntry = GetCurEntry();
     205           0 :     if ( m_pMouseDownEntry )
     206             :     {
     207           0 :         InvalidateEntry( m_pMouseDownEntry );
     208           0 :         CaptureMouse();
     209             :     }
     210           0 : }
     211             : 
     212           0 : void OCreationList::MouseMove( const MouseEvent& rMEvt )
     213             : {
     214           0 :     if ( rMEvt.IsLeaveWindow() )
     215             :     {
     216           0 :         setCurrentEntryInvalidate( NULL );
     217             :     }
     218           0 :     else if ( !rMEvt.IsSynthetic() )
     219             :     {
     220           0 :         SvTreeListEntry* pEntry = GetEntry( rMEvt.GetPosPixel() );
     221             : 
     222           0 :         if ( m_pMouseDownEntry )
     223             :         {
     224             :             // we're currently in a "mouse down" phase
     225             :             OSL_ENSURE( IsMouseCaptured(), "OCreationList::MouseMove: inconsistence (1)!" );
     226           0 :             if ( pEntry == m_pMouseDownEntry )
     227             :             {
     228           0 :                 setCurrentEntryInvalidate( m_pMouseDownEntry );
     229             :             }
     230             :             else
     231             :             {
     232             :                 OSL_ENSURE( ( GetCurEntry() == m_pMouseDownEntry ) || !GetCurEntry(),
     233             :                     "OCreationList::MouseMove: inconsistence (2)!" );
     234           0 :                 setCurrentEntryInvalidate( NULL );
     235             :             }
     236             :         }
     237             :         else
     238             :         {
     239             :             // the user is simply hovering with the mouse
     240           0 :             if ( setCurrentEntryInvalidate( pEntry ) )
     241             :             {
     242           0 :                 if ( !m_pMouseDownEntry )
     243           0 :                     updateHelpText();
     244             :             }
     245             :         }
     246             :     }
     247             : 
     248           0 :     SvTreeListBox::MouseMove(rMEvt);
     249           0 : }
     250             : 
     251           0 : void OCreationList::MouseButtonUp( const MouseEvent& rMEvt )
     252             : {
     253           0 :     SvTreeListEntry* pEntry = GetEntry( rMEvt.GetPosPixel() );
     254           0 :     bool bExecute = false;
     255             :     // Was the mouse released over the active entry?
     256             :     // (i.e. the entry which was under the mouse when the button went down)
     257           0 :     if ( pEntry && ( m_pMouseDownEntry == pEntry ) )
     258             :     {
     259           0 :         if ( !rMEvt.IsShift() && !rMEvt.IsMod1() && !rMEvt.IsMod2() && rMEvt.IsLeft() && rMEvt.GetClicks() == 1 )
     260           0 :             bExecute = true;
     261             :     }
     262             : 
     263           0 :     if ( m_pMouseDownEntry )
     264             :     {
     265             :         OSL_ENSURE( IsMouseCaptured(), "OCreationList::MouseButtonUp: hmmm .... no mouse captured, but an active entry?" );
     266           0 :         ReleaseMouse();
     267             : 
     268           0 :         InvalidateEntry( m_pMouseDownEntry );
     269           0 :         m_pMouseDownEntry = NULL;
     270             :     }
     271             : 
     272           0 :     SvTreeListBox::MouseButtonUp( rMEvt );
     273             : 
     274           0 :     if ( bExecute )
     275           0 :         onSelected( pEntry );
     276           0 : }
     277             : 
     278           0 : bool OCreationList::setCurrentEntryInvalidate( SvTreeListEntry* _pEntry )
     279             : {
     280           0 :     if ( GetCurEntry() != _pEntry )
     281             :     {
     282           0 :         if ( GetCurEntry() )
     283           0 :             InvalidateEntry( GetCurEntry() );
     284           0 :         SetCurEntry( _pEntry );
     285           0 :         if ( GetCurEntry() )
     286             :         {
     287           0 :             InvalidateEntry( GetCurEntry() );
     288           0 :             CallEventListeners( VCLEVENT_LISTBOX_SELECT, GetCurEntry() );
     289             :         }
     290           0 :         updateHelpText();
     291           0 :         return true;
     292             :     }
     293           0 :     return false;
     294             : }
     295             : 
     296           0 : void OCreationList::updateHelpText()
     297             : {
     298           0 :     sal_uInt16 nHelpTextId = 0;
     299           0 :     if ( GetCurEntry() )
     300           0 :         nHelpTextId = reinterpret_cast< TaskEntry* >( GetCurEntry()->GetUserData() )->nHelpID;
     301           0 :     m_rTaskWindow.setHelpText( nHelpTextId );
     302           0 : }
     303             : 
     304           0 : void OCreationList::onSelected( SvTreeListEntry* _pEntry ) const
     305             : {
     306             :     OSL_ENSURE( _pEntry, "OCreationList::onSelected: invalid entry!" );
     307           0 :     URL aCommand;
     308           0 :     aCommand.Complete = reinterpret_cast< TaskEntry* >( _pEntry->GetUserData() )->sUNOCommand;
     309           0 :     m_rTaskWindow.getDetailView()->getBorderWin().getView()->getAppController().executeChecked( aCommand, Sequence< PropertyValue >() );
     310           0 : }
     311             : 
     312           0 : void OCreationList::KeyInput( const KeyEvent& rKEvt )
     313             : {
     314           0 :     const KeyCode& rCode = rKEvt.GetKeyCode();
     315           0 :     if ( !rCode.IsMod1() && !rCode.IsMod2() && !rCode.IsShift() )
     316             :     {
     317           0 :         if ( rCode.GetCode() == KEY_RETURN )
     318             :         {
     319           0 :             SvTreeListEntry* pEntry = GetCurEntry() ? GetCurEntry() : FirstSelected();
     320           0 :             if ( pEntry )
     321           0 :                 onSelected( pEntry );
     322           0 :             return;
     323             :         }
     324             :     }
     325           0 :     SvTreeListEntry* pOldCurrent = GetCurEntry();
     326           0 :     SvTreeListBox::KeyInput(rKEvt);
     327           0 :     SvTreeListEntry* pNewCurrent = GetCurEntry();
     328             : 
     329           0 :     if ( pOldCurrent != pNewCurrent )
     330             :     {
     331           0 :         if ( pOldCurrent )
     332           0 :             InvalidateEntry( pOldCurrent );
     333           0 :         if ( pNewCurrent )
     334             :         {
     335           0 :             InvalidateEntry( pNewCurrent );
     336           0 :             CallEventListeners( VCLEVENT_LISTBOX_SELECT, pNewCurrent );
     337             :         }
     338           0 :         updateHelpText();
     339             :     }
     340             : }
     341             : 
     342           0 : OTasksWindow::OTasksWindow(Window* _pParent,OApplicationDetailView* _pDetailView)
     343             :     : Window(_pParent,WB_DIALOGCONTROL )
     344             :     ,m_aCreation(*this)
     345             :     ,m_aDescription(this)
     346             :     ,m_aHelpText(this,WB_WORDBREAK)
     347             :     ,m_aFL(this,WB_VERT)
     348           0 :     ,m_pDetailView(_pDetailView)
     349             : {
     350           0 :     SetUniqueId(UID_APP_TASKS_WINDOW);
     351           0 :     m_aCreation.SetHelpId(HID_APP_CREATION_LIST);
     352           0 :     m_aCreation.SetSelectHdl(LINK(this, OTasksWindow, OnEntrySelectHdl));
     353           0 :     m_aHelpText.SetHelpId(HID_APP_HELP_TEXT);
     354           0 :     m_aDescription.SetHelpId(HID_APP_DESCRIPTION_TEXT);
     355           0 :     m_aDescription.SetText(ModuleRes(STR_DESCRIPTION));
     356             : 
     357           0 :     ImageProvider aImageProvider;
     358           0 :     Image aFolderImage = aImageProvider.getFolderImage( DatabaseObject::FORM );
     359           0 :     m_aCreation.SetDefaultCollapsedEntryBmp( aFolderImage );
     360           0 :     m_aCreation.SetDefaultExpandedEntryBmp( aFolderImage );
     361             : 
     362           0 :     ImplInitSettings(sal_True,sal_True,sal_True);
     363           0 : }
     364             : 
     365           0 : OTasksWindow::~OTasksWindow()
     366             : {
     367           0 :     Clear();
     368           0 : }
     369             : 
     370           0 : void OTasksWindow::DataChanged( const DataChangedEvent& rDCEvt )
     371             : {
     372           0 :     Window::DataChanged( rDCEvt );
     373             : 
     374           0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
     375           0 :          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     376             :     {
     377           0 :         ImplInitSettings( sal_True, sal_True, sal_True );
     378           0 :         Invalidate();
     379             :     }
     380           0 : }
     381             : 
     382           0 : void OTasksWindow::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
     383             : {
     384           0 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     385           0 :     if( bFont )
     386             :     {
     387           0 :         Font aFont;
     388           0 :         aFont = rStyleSettings.GetFieldFont();
     389           0 :         aFont.SetColor( rStyleSettings.GetWindowTextColor() );
     390           0 :         SetPointFont( aFont );
     391             :     }
     392             : 
     393           0 :     if( bForeground || bFont )
     394             :     {
     395           0 :         SetTextColor( rStyleSettings.GetFieldTextColor() );
     396           0 :         SetTextFillColor();
     397           0 :         m_aHelpText.SetTextColor( rStyleSettings.GetFieldTextColor() );
     398           0 :         m_aHelpText.SetTextFillColor();
     399           0 :         m_aDescription.SetTextColor( rStyleSettings.GetFieldTextColor() );
     400           0 :         m_aDescription.SetTextFillColor();
     401             :     }
     402             : 
     403           0 :     if( bBackground )
     404             :     {
     405           0 :         SetBackground( rStyleSettings.GetFieldColor() );
     406           0 :         m_aHelpText.SetBackground( rStyleSettings.GetFieldColor() );
     407           0 :         m_aDescription.SetBackground( rStyleSettings.GetFieldColor() );
     408           0 :         m_aFL.SetBackground( rStyleSettings.GetFieldColor() );
     409             :     }
     410             : 
     411           0 :     Font aFont = m_aDescription.GetControlFont();
     412           0 :     aFont.SetWeight(WEIGHT_BOLD);
     413           0 :     m_aDescription.SetControlFont(aFont);
     414           0 : }
     415             : 
     416           0 : void OTasksWindow::setHelpText(sal_uInt16 _nId)
     417             : {
     418           0 :     if ( _nId )
     419             :     {
     420           0 :         OUString sText = ModuleRes(_nId);
     421             : 
     422           0 :         m_aHelpText.SetText(sText);
     423             :     }
     424             :     else
     425             :     {
     426           0 :         m_aHelpText.SetText(OUString());
     427             : }
     428             : 
     429           0 : }
     430             : 
     431           0 : IMPL_LINK(OTasksWindow, OnEntrySelectHdl, SvTreeListBox*, /*_pTreeBox*/)
     432             : {
     433           0 :     SvTreeListEntry* pEntry = m_aCreation.GetHdlEntry();
     434           0 :     if ( pEntry )
     435           0 :         m_aHelpText.SetText( ModuleRes( reinterpret_cast< TaskEntry* >( pEntry->GetUserData() )->nHelpID ) );
     436           0 :     return 1L;
     437             : }
     438             : 
     439           0 : void OTasksWindow::Resize()
     440             : {
     441             :     // parent window dimension
     442           0 :     Size aOutputSize( GetOutputSize() );
     443           0 :     long nOutputWidth   = aOutputSize.Width();
     444           0 :     long nOutputHeight  = aOutputSize.Height();
     445             : 
     446           0 :     Size aFLSize = LogicToPixel( Size( 2, 6 ), MAP_APPFONT );
     447           0 :     sal_Int32 n6PPT = aFLSize.Height();
     448           0 :     long nHalfOutputWidth = static_cast<long>(nOutputWidth * 0.5);
     449             : 
     450           0 :     m_aCreation.SetPosSizePixel( Point(0, 0), Size(nHalfOutputWidth - n6PPT, nOutputHeight) );
     451             :     // i77897 make the m_aHelpText a little bit smaller. (-5)
     452           0 :     sal_Int32 nNewWidth = nOutputWidth - nHalfOutputWidth - aFLSize.Width() - 5;
     453           0 :     m_aDescription.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, 0), Size(nNewWidth, nOutputHeight) );
     454           0 :     Size aDesc = m_aDescription.CalcMinimumSize();
     455           0 :     m_aHelpText.SetPosSizePixel( Point(nHalfOutputWidth + n6PPT, aDesc.Height() ), Size(nNewWidth, nOutputHeight - aDesc.Height() - n6PPT) );
     456             : 
     457           0 :     m_aFL.SetPosSizePixel( Point(nHalfOutputWidth , 0), Size(aFLSize.Width(), nOutputHeight ) );
     458           0 : }
     459             : 
     460           0 : void OTasksWindow::fillTaskEntryList( const TaskEntryList& _rList )
     461             : {
     462           0 :     Clear();
     463             : 
     464             :     try
     465             :     {
     466             :         Reference< XModuleUIConfigurationManagerSupplier > xModuleCfgMgrSupplier =
     467           0 :             theModuleUIConfigurationManagerSupplier::get( getDetailView()->getBorderWin().getView()->getORB() );
     468           0 :         Reference< XUIConfigurationManager > xUIConfigMgr = xModuleCfgMgrSupplier->getUIConfigurationManager(
     469             :             OUString( "com.sun.star.sdb.OfficeDatabaseDocument" )
     470           0 :         );
     471           0 :         Reference< XImageManager > xImageMgr( xUIConfigMgr->getImageManager(), UNO_QUERY );
     472             : 
     473             :         // copy the commands so we can use them with the config managers
     474           0 :         Sequence< OUString > aCommands( _rList.size() );
     475           0 :         OUString* pCommands = aCommands.getArray();
     476           0 :         TaskEntryList::const_iterator aEnd = _rList.end();
     477           0 :         for ( TaskEntryList::const_iterator pCopyTask = _rList.begin(); pCopyTask != aEnd; ++pCopyTask, ++pCommands )
     478           0 :             *pCommands = pCopyTask->sUNOCommand;
     479             : 
     480           0 :         Sequence< Reference< XGraphic> > aImages = xImageMgr->getImages(
     481             :             ImageType::SIZE_DEFAULT | ImageType::COLOR_NORMAL ,
     482             :             aCommands
     483           0 :         );
     484             : 
     485           0 :         const Reference< XGraphic >* pImages( aImages.getConstArray() );
     486             : 
     487           0 :         for ( TaskEntryList::const_iterator pTask = _rList.begin(); pTask != aEnd; ++pTask, ++pImages )
     488             :         {
     489           0 :             SvTreeListEntry* pEntry = m_aCreation.InsertEntry( pTask->sTitle );
     490           0 :             pEntry->SetUserData( reinterpret_cast< void* >( new TaskEntry( *pTask ) ) );
     491             : 
     492           0 :             Image aImage = Image( *pImages );
     493           0 :             m_aCreation.SetExpandedEntryBmp(  pEntry, aImage );
     494           0 :             m_aCreation.SetCollapsedEntryBmp( pEntry, aImage );
     495           0 :         }
     496             :     }
     497           0 :     catch(Exception&)
     498             :     {
     499             :     }
     500             : 
     501           0 :     m_aCreation.Show();
     502           0 :     m_aCreation.SelectAll(false);
     503           0 :     m_aHelpText.Show();
     504           0 :     m_aDescription.Show();
     505           0 :     m_aFL.Show();
     506           0 :     m_aCreation.updateHelpText();
     507           0 :     Enable(!_rList.empty());
     508           0 : }
     509             : 
     510           0 : void OTasksWindow::Clear()
     511             : {
     512           0 :     m_aCreation.resetLastActive();
     513           0 :     SvTreeListEntry* pEntry = m_aCreation.First();
     514           0 :     while ( pEntry )
     515             :     {
     516           0 :         delete reinterpret_cast< TaskEntry* >( pEntry->GetUserData() );
     517           0 :         pEntry = m_aCreation.Next(pEntry);
     518             :     }
     519           0 :     m_aCreation.Clear();
     520           0 : }
     521             : 
     522             : // class OApplicationDetailView
     523             : 
     524           0 : OApplicationDetailView::OApplicationDetailView(OAppBorderWindow& _rParent,PreviewMode _ePreviewMode) : OSplitterView(&_rParent,sal_False )
     525             :     ,m_aHorzSplitter(this)
     526             :     ,m_aTasks(this,STR_TASKS,WB_BORDER | WB_DIALOGCONTROL )
     527             :     ,m_aContainer(this,0,WB_BORDER | WB_DIALOGCONTROL )
     528           0 :     ,m_rBorderWin(_rParent)
     529             : {
     530           0 :     SetUniqueId(UID_APP_DETAIL_VIEW);
     531           0 :     ImplInitSettings( sal_True, sal_True, sal_True );
     532             : 
     533           0 :     m_pControlHelper = new OAppDetailPageHelper(&m_aContainer,m_rBorderWin,_ePreviewMode);
     534           0 :     m_pControlHelper->Show();
     535           0 :     m_aContainer.setChildWindow(m_pControlHelper);
     536             : 
     537           0 :     OTasksWindow* pTasks = new OTasksWindow(&m_aTasks,this);
     538           0 :     pTasks->Show();
     539           0 :     pTasks->Disable(m_rBorderWin.getView()->getCommandController().isDataSourceReadOnly());
     540           0 :     m_aTasks.setChildWindow(pTasks);
     541           0 :     m_aTasks.SetUniqueId(UID_APP_TASKS_VIEW);
     542           0 :     m_aTasks.Show();
     543             : 
     544           0 :     m_aContainer.SetUniqueId(UID_APP_CONTAINER_VIEW);
     545           0 :     m_aContainer.Show();
     546             : 
     547           0 :     const long  nFrameWidth = LogicToPixel( Size( 3, 0 ), MAP_APPFONT ).Width();
     548           0 :     m_aHorzSplitter.SetPosSizePixel( Point(0,50), Size(0,nFrameWidth) );
     549             :     // now set the components at the base class
     550           0 :     set(&m_aContainer,&m_aTasks);
     551             : 
     552           0 :     m_aHorzSplitter.Show();
     553           0 :     m_aHorzSplitter.SetUniqueId(UID_APP_VIEW_HORZ_SPLIT);
     554           0 :     setSplitter(&m_aHorzSplitter);
     555           0 : }
     556             : 
     557           0 : OApplicationDetailView::~OApplicationDetailView()
     558             : {
     559           0 :     set(NULL,NULL);
     560           0 :     setSplitter(NULL);
     561           0 :     m_pControlHelper = NULL;
     562           0 : }
     563             : 
     564           0 : void OApplicationDetailView::ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground )
     565             : {
     566           0 :     const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
     567           0 :     if( bFont )
     568             :     {
     569           0 :         Font aFont;
     570           0 :         aFont = rStyleSettings.GetFieldFont();
     571           0 :         aFont.SetColor( rStyleSettings.GetWindowTextColor() );
     572           0 :         SetPointFont( aFont );
     573             :     }
     574             : 
     575           0 :     if( bForeground || bFont )
     576             :     {
     577           0 :         SetTextColor( rStyleSettings.GetFieldTextColor() );
     578           0 :         SetTextFillColor();
     579             :     }
     580             : 
     581           0 :     if( bBackground )
     582           0 :         SetBackground( rStyleSettings.GetFieldColor() );
     583             : 
     584           0 :     m_aHorzSplitter.SetBackground( rStyleSettings.GetDialogColor() );
     585           0 :     m_aHorzSplitter.SetFillColor( rStyleSettings.GetDialogColor() );
     586           0 :     m_aHorzSplitter.SetTextFillColor(rStyleSettings.GetDialogColor() );
     587           0 : }
     588             : 
     589           0 : void OApplicationDetailView::DataChanged( const DataChangedEvent& rDCEvt )
     590             : {
     591           0 :     OSplitterView::DataChanged( rDCEvt );
     592             : 
     593           0 :     if ( (rDCEvt.GetType() == DATACHANGED_FONTS) ||
     594           0 :         (rDCEvt.GetType() == DATACHANGED_DISPLAY) ||
     595           0 :         (rDCEvt.GetType() == DATACHANGED_FONTSUBSTITUTION) ||
     596           0 :         ((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
     597           0 :         (rDCEvt.GetFlags() & SETTINGS_STYLE)) )
     598             :     {
     599           0 :         ImplInitSettings( sal_True, sal_True, sal_True );
     600           0 :         Invalidate();
     601             :     }
     602           0 : }
     603             : 
     604           0 : void OApplicationDetailView::GetFocus()
     605             : {
     606           0 :     OSplitterView::GetFocus();
     607           0 : }
     608             : 
     609           0 : void OApplicationDetailView::setTaskExternalMnemonics( MnemonicGenerator& _rMnemonics )
     610             : {
     611           0 :     m_aExternalMnemonics = _rMnemonics;
     612           0 : }
     613             : 
     614           0 : bool OApplicationDetailView::interceptKeyInput( const KeyEvent& _rEvent )
     615             : {
     616           0 :     const KeyCode& rKeyCode = _rEvent.GetKeyCode();
     617           0 :     if ( rKeyCode.GetModifier() == KEY_MOD2 )
     618           0 :         return getTasksWindow().HandleKeyInput( _rEvent );
     619             : 
     620             :     // not handled
     621           0 :     return false;
     622             : }
     623             : 
     624           0 : void OApplicationDetailView::createTablesPage(const Reference< XConnection >& _xConnection )
     625             : {
     626           0 :     impl_createPage( E_TABLE, _xConnection, NULL );
     627           0 : }
     628             : 
     629           0 : void OApplicationDetailView::createPage( ElementType _eType,const Reference< XNameAccess >& _xContainer )
     630             : {
     631           0 :     impl_createPage( _eType, NULL, _xContainer );
     632           0 : }
     633             : 
     634           0 : void OApplicationDetailView::impl_createPage( ElementType _eType, const Reference< XConnection >& _rxConnection,
     635             :     const Reference< XNameAccess >& _rxNonTableElements )
     636             : {
     637             :     // get the data for the pane
     638           0 :     const TaskPaneData& rData = impl_getTaskPaneData( _eType );
     639           0 :     getTasksWindow().fillTaskEntryList( rData.aTasks );
     640             : 
     641             :     // enable the pane as a whole, depending on the availability of the first command
     642             :     OSL_ENSURE( !rData.aTasks.empty(), "OApplicationDetailView::impl_createPage: no tasks at all!?" );
     643           0 :     bool bEnabled = rData.aTasks.empty()
     644             :                 ?   false
     645           0 :                 :   getBorderWin().getView()->getCommandController().isCommandEnabled( rData.aTasks[0].sUNOCommand );
     646           0 :     getTasksWindow().Enable( bEnabled );
     647           0 :     m_aContainer.setTitle( rData.nTitleId );
     648             : 
     649             :     // let our helper create the object list
     650           0 :     if ( _eType == E_TABLE )
     651           0 :         m_pControlHelper->createTablesPage( _rxConnection );
     652             :     else
     653           0 :         m_pControlHelper->createPage( _eType, _rxNonTableElements );
     654             : 
     655             :     // resize for proper window arrangements
     656           0 :     Resize();
     657           0 : }
     658             : 
     659           0 : const TaskPaneData& OApplicationDetailView::impl_getTaskPaneData( ElementType _eType )
     660             : {
     661           0 :     if ( m_aTaskPaneData.empty() )
     662           0 :         m_aTaskPaneData.resize( ELEMENT_COUNT );
     663             :     OSL_ENSURE( ( _eType >= 0 ) && ( _eType < E_ELEMENT_TYPE_COUNT ), "OApplicationDetailView::impl_getTaskPaneData: illegal element type!" );
     664           0 :     TaskPaneData& rData = m_aTaskPaneData[ _eType ];
     665             : 
     666             :     //oj: do not check, otherwise extensions will only be visible after a reload.
     667           0 :     impl_fillTaskPaneData( _eType, rData );
     668             : 
     669           0 :     return rData;
     670             : }
     671             : 
     672           0 : void OApplicationDetailView::impl_fillTaskPaneData( ElementType _eType, TaskPaneData& _rData ) const
     673             : {
     674           0 :     TaskEntryList& rList( _rData.aTasks );
     675           0 :     rList.clear(); rList.reserve( 4 );
     676             : 
     677           0 :     switch ( _eType )
     678             :     {
     679             :     case E_TABLE:
     680           0 :         rList.push_back( TaskEntry( ".uno:DBNewTable", RID_STR_TABLES_HELP_TEXT_DESIGN, RID_STR_NEW_TABLE ) );
     681           0 :         rList.push_back( TaskEntry( ".uno:DBNewTableAutoPilot", RID_STR_TABLES_HELP_TEXT_WIZARD, RID_STR_NEW_TABLE_AUTO ) );
     682           0 :         rList.push_back( TaskEntry( ".uno:DBNewView", RID_STR_VIEWS_HELP_TEXT_DESIGN, RID_STR_NEW_VIEW, true ) );
     683           0 :         _rData.nTitleId = RID_STR_TABLES_CONTAINER;
     684           0 :         break;
     685             : 
     686             :     case E_FORM:
     687           0 :         rList.push_back( TaskEntry( ".uno:DBNewForm", RID_STR_FORMS_HELP_TEXT, RID_STR_NEW_FORM ) );
     688           0 :         rList.push_back( TaskEntry( ".uno:DBNewFormAutoPilot", RID_STR_FORMS_HELP_TEXT_WIZARD, RID_STR_NEW_FORM_AUTO ) );
     689           0 :         _rData.nTitleId = RID_STR_FORMS_CONTAINER;
     690           0 :         break;
     691             : 
     692             :     case E_REPORT:
     693           0 :         rList.push_back( TaskEntry( ".uno:DBNewReport", RID_STR_REPORT_HELP_TEXT, RID_STR_NEW_REPORT, true ) );
     694           0 :         rList.push_back( TaskEntry( ".uno:DBNewReportAutoPilot", RID_STR_REPORTS_HELP_TEXT_WIZARD, RID_STR_NEW_REPORT_AUTO ) );
     695           0 :         _rData.nTitleId = RID_STR_REPORTS_CONTAINER;
     696           0 :         break;
     697             : 
     698             :     case E_QUERY:
     699           0 :         rList.push_back( TaskEntry( ".uno:DBNewQuery", RID_STR_QUERIES_HELP_TEXT, RID_STR_NEW_QUERY ) );
     700           0 :         rList.push_back( TaskEntry( ".uno:DBNewQueryAutoPilot", RID_STR_QUERIES_HELP_TEXT_WIZARD, RID_STR_NEW_QUERY_AUTO ) );
     701           0 :         rList.push_back( TaskEntry( ".uno:DBNewQuerySql", RID_STR_QUERIES_HELP_TEXT_SQL, RID_STR_NEW_QUERY_SQL ) );
     702           0 :         _rData.nTitleId = RID_STR_QUERIES_CONTAINER;
     703           0 :         break;
     704             : 
     705             :     default:
     706             :         OSL_FAIL( "OApplicationDetailView::impl_fillTaskPaneData: illegal element type!" );
     707             :     }
     708             : 
     709           0 :     MnemonicGenerator aAllMnemonics( m_aExternalMnemonics );
     710             : 
     711             :     // remove the entries which are not enabled currently
     712           0 :     for (   TaskEntryList::iterator pTask = rList.begin();
     713           0 :             pTask != rList.end();
     714             :         )
     715             :     {
     716           0 :         if  (   pTask->bHideWhenDisabled
     717           0 :             &&  !getBorderWin().getView()->getCommandController().isCommandEnabled( pTask->sUNOCommand )
     718             :             )
     719           0 :             pTask = rList.erase( pTask );
     720             :         else
     721             :         {
     722           0 :             aAllMnemonics.RegisterMnemonic( pTask->sTitle );
     723           0 :             ++pTask;
     724             :         }
     725             :     }
     726             : 
     727             :     // for the remaining entries, assign mnemonics
     728           0 :     for (   TaskEntryList::iterator pTask = rList.begin();
     729           0 :             pTask != rList.end();
     730             :             ++pTask
     731             :         )
     732             :     {
     733           0 :         aAllMnemonics.CreateMnemonic( pTask->sTitle );
     734             :         // don't do this for now, until our task window really supports mnemonics
     735           0 :     }
     736           0 : }
     737             : 
     738           0 : OUString OApplicationDetailView::getQualifiedName( SvTreeListEntry* _pEntry ) const
     739             : {
     740           0 :     return m_pControlHelper->getQualifiedName( _pEntry );
     741             : }
     742             : 
     743           0 : sal_Bool OApplicationDetailView::isLeaf(SvTreeListEntry* _pEntry) const
     744             : {
     745           0 :     return m_pControlHelper->isLeaf(_pEntry);
     746             : }
     747             : 
     748           0 : sal_Bool OApplicationDetailView::isALeafSelected() const
     749             : {
     750           0 :     return m_pControlHelper->isALeafSelected();
     751             : }
     752             : 
     753           0 : void OApplicationDetailView::selectAll()
     754             : {
     755           0 :     m_pControlHelper->selectAll();
     756           0 : }
     757             : 
     758           0 : void OApplicationDetailView::sortDown()
     759             : {
     760           0 :     m_pControlHelper->sortDown();
     761           0 : }
     762             : 
     763           0 : void OApplicationDetailView::sortUp()
     764             : {
     765           0 :     m_pControlHelper->sortUp();
     766           0 : }
     767             : 
     768           0 : sal_Bool OApplicationDetailView::isFilled() const
     769             : {
     770           0 :     return m_pControlHelper->isFilled();
     771             : }
     772             : 
     773           0 : ElementType OApplicationDetailView::getElementType() const
     774             : {
     775           0 :     return m_pControlHelper->getElementType();
     776             : }
     777             : 
     778           0 : void OApplicationDetailView::clearPages(sal_Bool _bTaskAlso)
     779             : {
     780           0 :     if ( _bTaskAlso )
     781           0 :         getTasksWindow().Clear();
     782           0 :     m_pControlHelper->clearPages();
     783           0 : }
     784             : 
     785           0 : sal_Int32 OApplicationDetailView::getSelectionCount()
     786             : {
     787           0 :     return m_pControlHelper->getSelectionCount();
     788             : }
     789             : 
     790           0 : sal_Int32 OApplicationDetailView::getElementCount()
     791             : {
     792           0 :     return m_pControlHelper->getElementCount();
     793             : }
     794             : 
     795           0 : void OApplicationDetailView::getSelectionElementNames( ::std::vector< OUString>& _rNames ) const
     796             : {
     797           0 :     m_pControlHelper->getSelectionElementNames( _rNames );
     798           0 : }
     799             : 
     800           0 : void OApplicationDetailView::describeCurrentSelectionForControl( const Control& _rControl, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
     801             : {
     802           0 :     m_pControlHelper->describeCurrentSelectionForControl( _rControl, _out_rSelectedObjects );
     803           0 : }
     804             : 
     805           0 : void OApplicationDetailView::describeCurrentSelectionForType( const ElementType _eType, Sequence< NamedDatabaseObject >& _out_rSelectedObjects )
     806             : {
     807           0 :     m_pControlHelper->describeCurrentSelectionForType( _eType, _out_rSelectedObjects );
     808           0 : }
     809             : 
     810           0 : void OApplicationDetailView::selectElements(const Sequence< OUString>& _aNames)
     811             : {
     812           0 :     m_pControlHelper->selectElements( _aNames );
     813           0 : }
     814             : 
     815           0 : SvTreeListEntry* OApplicationDetailView::getEntry( const Point& _aPoint ) const
     816             : {
     817           0 :     return m_pControlHelper->getEntry(_aPoint);
     818             : }
     819             : 
     820           0 : sal_Bool OApplicationDetailView::isCutAllowed()
     821             : {
     822           0 :     return m_pControlHelper->isCutAllowed();
     823             : }
     824             : 
     825           0 : sal_Bool OApplicationDetailView::isCopyAllowed()
     826             : {
     827           0 :     return m_pControlHelper->isCopyAllowed();
     828             : }
     829             : 
     830           0 : sal_Bool OApplicationDetailView::isPasteAllowed()   { return m_pControlHelper->isPasteAllowed(); }
     831             : 
     832           0 : void OApplicationDetailView::copy() { m_pControlHelper->copy(); }
     833             : 
     834           0 : void OApplicationDetailView::cut()  { m_pControlHelper->cut(); }
     835             : 
     836           0 : void OApplicationDetailView::paste()
     837             : {
     838           0 :     m_pControlHelper->paste();
     839           0 : }
     840             : 
     841           0 : SvTreeListEntry*  OApplicationDetailView::elementAdded(ElementType _eType,const OUString& _rName, const Any& _rObject )
     842             : {
     843           0 :     return m_pControlHelper->elementAdded(_eType,_rName, _rObject );
     844             : }
     845             : 
     846           0 : void OApplicationDetailView::elementRemoved(ElementType _eType,const OUString& _rName )
     847             : {
     848           0 :     m_pControlHelper->elementRemoved(_eType,_rName );
     849           0 : }
     850             : 
     851           0 : void OApplicationDetailView::elementReplaced(ElementType _eType
     852             :                                                     ,const OUString& _rOldName
     853             :                                                     ,const OUString& _rNewName )
     854             : {
     855           0 :     m_pControlHelper->elementReplaced( _eType, _rOldName, _rNewName );
     856           0 : }
     857             : 
     858           0 : PreviewMode OApplicationDetailView::getPreviewMode()
     859             : {
     860           0 :     return m_pControlHelper->getPreviewMode();
     861             : }
     862             : 
     863           0 : sal_Bool OApplicationDetailView::isPreviewEnabled()
     864             : {
     865           0 :     return m_pControlHelper->isPreviewEnabled();
     866             : }
     867             : 
     868           0 : void OApplicationDetailView::switchPreview(PreviewMode _eMode)
     869             : {
     870           0 :     m_pControlHelper->switchPreview(_eMode);
     871           0 : }
     872             : 
     873           0 : void OApplicationDetailView::showPreview(const Reference< XContent >& _xContent)
     874             : {
     875           0 :     m_pControlHelper->showPreview(_xContent);
     876           0 : }
     877             : 
     878           0 : void OApplicationDetailView::showPreview(   const OUString& _sDataSourceName,
     879             :                                             const OUString& _sName,
     880             :                                             sal_Bool _bTable)
     881             : {
     882           0 :     m_pControlHelper->showPreview(_sDataSourceName,_sName,_bTable);
     883           0 : }
     884             : 
     885           0 : sal_Bool OApplicationDetailView::isSortUp() const
     886             : {
     887           0 :     return m_pControlHelper->isSortUp();
     888             : }
     889             : 
     890           0 : Window* OApplicationDetailView::getTreeWindow() const
     891             : {
     892           0 :     return m_pControlHelper->getCurrentView();
     893             : }
     894             : 
     895             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10