diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-10-06 08:51:57 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-10-06 08:51:57 +0000 |
commit | 58a2d900f9b2c600f3b7abdebe5eef5d0f7e48bc (patch) | |
tree | 220ad9874c438d68e3553f6d1968980146ca782d /sd/source/ui/dlg/present.cxx | |
parent | a6a2e1159db6c717dfa35a7fc910b02778173794 (diff) |
INTEGRATION: CWS impresshydra (1.6.246); FILE MERGED
2006/09/20 10:57:56 cl 1.6.246.9: RESYNC: (1.7-1.8); FILE MERGED
2006/09/20 07:35:49 cl 1.6.246.8: #i12719# added support for multi monitors
2006/09/18 12:02:39 cl 1.6.246.7: #i12719# updated code to latest spec for multi display
2006/09/04 14:26:53 cl 1.6.246.6: #i67721# fixed display spanning
2006/09/01 11:50:00 cl 1.6.246.5: #i12719# added support for span displays
2006/08/28 12:24:56 cl 1.6.246.4: RESYNC: (1.6-1.7); FILE MERGED
2006/07/20 13:23:39 cl 1.6.246.3: #i12719# added support for multi monitors
2006/07/19 15:44:38 cl 1.6.246.2: #i12719# added support for multi monitors
2006/07/18 07:58:04 cl 1.6.246.1: #i12719# added support for multi monitors
Diffstat (limited to 'sd/source/ui/dlg/present.cxx')
-rw-r--r-- | sd/source/ui/dlg/present.cxx | 122 |
1 files changed, 102 insertions, 20 deletions
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx index 7c8d895deef5..4a930cae6b13 100644 --- a/sd/source/ui/dlg/present.cxx +++ b/sd/source/ui/dlg/present.cxx @@ -4,9 +4,9 @@ * * $RCSfile: present.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: obo $ $Date: 2006-09-16 18:41:32 $ + * last change: $Author: kz $ $Date: 2006-10-06 09:51:57 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -40,6 +40,18 @@ #undef SD_DLLIMPLEMENTATION #endif +#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#endif +#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_ +#include <com/sun/star/beans/XPropertySet.hpp> +#endif +#ifndef _COM_SUN_STAR_CONTAINER_XINDEXACCESS_HPP_ +#include <com/sun/star/container/XIndexAccess.hpp> +#endif +#ifndef _COMPHELPER_PROCESSFACTORY_HXX_ +#include <comphelper/processfactory.hxx> +#endif #ifndef _SFXITEMSET_HXX //autogen #include <svtools/itemset.hxx> @@ -51,6 +63,12 @@ #include "sdresid.hxx" #include "cusshow.hxx" +using ::rtl::OUString; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; +using namespace ::com::sun::star::beans; + /************************************************************************* |* Ctor \************************************************************************/ @@ -79,11 +97,19 @@ SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow, aCbxChangePage ( this, SdResId( CBX_CHANGE_PAGE ) ), aCbxAlwaysOnTop ( this, SdResId( CBX_ALWAYS_ON_TOP ) ), aGrpOptions ( this, SdResId( GRP_OPTIONS ) ), + maGrpMonitor ( this, SdResId( GRP_MONITOR ) ), + maFtMonitor ( this, SdResId( FT_MONITOR ) ), + maLBMonitor ( this, SdResId( LB_MONITOR ) ), + aBtnOK ( this, SdResId( BTN_OK ) ), aBtnCancel ( this, SdResId( BTN_CANCEL ) ), aBtnHelp ( this, SdResId( BTN_HELP ) ), pCustomShowList ( pCSList ), - rOutAttrs ( rInAttrs ) + rOutAttrs ( rInAttrs ), + mnMonitors ( 0 ), + msPrimaryMonitor( SdResId(STR_PRIMARY_MONITOR ) ), + msMonitor( SdResId( STR_MONITOR ) ), + msAllMonitors( SdResId( STR_ALL_MONITORS ) ) { FreeResource(); @@ -163,26 +189,73 @@ SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow, else aRbtStandard.Check( TRUE ); -/* #109180# change in behaviour, even when always start with current page is enabled, range settings are - still used - BOOL bStartWithActualPage = ( ( const SfxBoolItem& ) rOutAttrs.Get( ATTR_PRESENT_START_ACTUAL_PAGE ) ).GetValue(); - if( bStartWithActualPage ) - { - aRbtAll.Enable( FALSE ); - aRbtAtDia.Check(); - aRbtAtDia.Enable( FALSE ); - aLbDias.Enable( FALSE ); - aLbCustomshow.Enable( FALSE ); - aGrpRange.Enable( FALSE ); - } - else -*/ + InitMonitorSettings(); + ChangeRangeHdl( this ); ClickWindowPresentationHdl( NULL ); ChangePauseHdl( NULL ); } +void SdStartPresentationDlg::InitMonitorSettings() +{ + try + { + Reference< XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); + Reference< XIndexAccess > xMultiMon( xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); + maGrpMonitor.Show( true ); + maFtMonitor.Show( true ); + maLBMonitor.Show( true ); + + mnMonitors = xMultiMon->getCount(); + + if( mnMonitors <= 1 ) + { + maFtMonitor.Enable( false ); + maLBMonitor.Enable( false ); + } + else + { + sal_Bool bMultiscreen = false; + sal_Int32 nPrimaryIndex = 0; + Reference< XPropertySet > xMonProps( xMultiMon, UNO_QUERY ); + if( xMonProps.is() ) try + { + const OUString sPropName1( RTL_CONSTASCII_USTRINGPARAM( "MultiDisplay" ) ); + xMonProps->getPropertyValue( sPropName1 ) >>= bMultiscreen; + const OUString sPropName2( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); + xMonProps->getPropertyValue( sPropName2 ) >>= nPrimaryIndex; + } + catch( Exception& ) + { + } + + const String sPlaceHolder( RTL_CONSTASCII_USTRINGPARAM( "%N" ) ); + for( sal_Int32 nDisplay = 0; nDisplay < mnMonitors; nDisplay++ ) + { + String aName( nDisplay == nPrimaryIndex ? msPrimaryMonitor : msMonitor ); + const String aNumber( String::CreateFromInt32( nDisplay + 1 ) ); + aName.SearchAndReplace( sPlaceHolder, aNumber ); + maLBMonitor.InsertEntry( aName ); + } + + if( !bMultiscreen ) + maLBMonitor.InsertEntry( msAllMonitors ); + + sal_Int32 nSelected = ( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue(); + if( nSelected <= 0 ) + nSelected = nPrimaryIndex; + else + nSelected--; + + maLBMonitor.SelectEntryPos( nSelected ); + } + } + catch( Exception& ) + { + } +} + /************************************************************************* |* Setzt die ausgewaehlten Attribute des Dialogs \************************************************************************/ @@ -203,7 +276,11 @@ void SdStartPresentationDlg::GetAttr( SfxItemSet& rOutAttrs ) rOutAttrs.Put( SfxUInt32Item ( ATTR_PRESENT_PAUSE_TIMEOUT, aTmfPause.GetTime().GetMSFromTime() / 1000 ) ); rOutAttrs.Put( SfxBoolItem ( ATTR_PRESENT_SHOW_PAUSELOGO, aCbxAutoLogo.IsChecked() ) ); - USHORT nPos = aLbCustomshow.GetSelectEntryPos(); + USHORT nPos = maLBMonitor.GetSelectEntryPos(); + if( nPos != LISTBOX_ENTRY_NOTFOUND ) + rOutAttrs.Put( SfxInt32Item ( ATTR_PRESENT_DISPLAY, nPos + 1 ) ); + + nPos = aLbCustomshow.GetSelectEntryPos(); if( nPos != LISTBOX_ENTRY_NOTFOUND ) pCustomShowList->Seek( nPos ); } @@ -224,13 +301,18 @@ IMPL_LINK( SdStartPresentationDlg, ChangeRangeHdl, void *, EMPTYARG ) \************************************************************************/ IMPL_LINK( SdStartPresentationDlg, ClickWindowPresentationHdl, void *, EMPTYARG ) { - const BOOL bAuto = aRbtAuto.IsChecked(); + const bool bAuto = aRbtAuto.IsChecked(); + const bool bWindow = aRbtWindow.IsChecked(); // aFtPause.Enable( bAuto ); aTmfPause.Enable( bAuto ); aCbxAutoLogo.Enable( bAuto && ( aTmfPause.GetTime().GetMSFromTime() > 0UL ) ); - if( aRbtWindow.IsChecked() ) + const bool bDisplay = !bWindow && ( mnMonitors > 1 ); + maFtMonitor.Enable( bDisplay ); + maLBMonitor.Enable( bDisplay ); + + if( bWindow ) { aCbxAlwaysOnTop.Enable( FALSE ); aCbxAlwaysOnTop.Check( FALSE ); |