summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-07-18 14:51:29 +0100
committerFridrich Strba <fridrich@documentfoundation.org>2013-07-19 07:56:34 +0000
commit94dd6a449fe3c17f97264dd01bf263eb268ac19d (patch)
treea6df29fbee0676b913a1764c064948c414bc7cba /sd
parent4c500e745b38e1d0be2bd21210001eef631bcea9 (diff)
fdo#67045 - fix several nasty screen selection issues with presenter console.
Also add the ability to select the external screen (whatever it is) to the configuration dialog. Change-Id: I2c81175143ba8fdd7c9aee1dac433742c2a0ba69 Reviewed-on: https://gerrit.libreoffice.org/4971 Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/ui/dlg/present.cxx63
-rw-r--r--sd/source/ui/inc/present.hxx4
-rw-r--r--sd/source/ui/slideshow/slideshow.cxx28
3 files changed, 57 insertions, 38 deletions
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index 9fce09b1e878..6aec2896a4e8 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -149,6 +149,26 @@ SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow,
ChangePauseHdl( NULL );
}
+String SdStartPresentationDlg::GetDisplayName( sal_Int32 nDisplay, bool bExternal )
+{
+ String aName( bExternal ? msExternalMonitor->GetText() :
+ msMonitor->GetText() );
+ const String aNumber( OUString::number( nDisplay ) );
+ aName.SearchAndReplace( String("%1"), aNumber );
+ return aName;
+}
+
+/// Store display index together with name in user data
+sal_Int32 SdStartPresentationDlg::InsertDisplayEntry(const rtl::OUString &aName,
+ sal_Int32 nDisplay)
+{
+ maLBMonitor->InsertEntry( aName );
+ const sal_uInt32 nEntryIndex = maLBMonitor->GetEntryCount() - 1;
+ maLBMonitor->SetEntryData( nEntryIndex, (void*)(sal_IntPtr)nDisplay );
+
+ return nEntryIndex;
+}
+
void SdStartPresentationDlg::InitMonitorSettings()
{
try
@@ -172,36 +192,39 @@ void SdStartPresentationDlg::InitMonitorSettings()
sal_Int32 nDefaultExternalIndex (-1);
const sal_Int32 nDefaultSelectedDisplay (
( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue());
- const String sPlaceHolder( RTL_CONSTASCII_USTRINGPARAM( "%1" ) );
+
+ // Un-conditionally add a version for '0' the default external display
+ sal_Int32 nInsertedEntry;
+
+ // FIXME: string-freeze this should really be 'External (display %)'
+ String aName = GetDisplayName( nExternalIndex + 1, true);
+ nInsertedEntry = InsertDisplayEntry( aName, 0 );
+ if( nDefaultSelectedDisplay == 0)
+ nSelectedIndex = nInsertedEntry;
+
+ // The user data contains the real setting
for( sal_Int32 nDisplay = 0; nDisplay < mnMonitors; nDisplay++ )
{
- String aName( nDisplay == nExternalIndex ?
- msExternalMonitor->GetText() :
- msMonitor->GetText() );
- const String aNumber( OUString::number( nDisplay + 1 ) );
- aName.SearchAndReplace( sPlaceHolder, aNumber );
- maLBMonitor->InsertEntry( aName );
-
- // Store display index together with name.
- const sal_uInt32 nEntryIndex (maLBMonitor->GetEntryCount()-1);
- maLBMonitor->SetEntryData(nEntryIndex, (void*)(sal_IntPtr)nDisplay);
+ bool bIsExternal = nDisplay == nExternalIndex;
+ // FIXME: string-freeze, use true to denote external for now
+ bIsExternal = false;
+ aName = GetDisplayName( nDisplay + 1, bIsExternal );
+ nInsertedEntry = InsertDisplayEntry( aName, nDisplay + 1 );
// Remember the index of the default selection.
- if (nDefaultSelectedDisplay == nDisplay)
- nSelectedIndex = nEntryIndex;
+ if( nDisplay + 1 == nDefaultSelectedDisplay )
+ nSelectedIndex = nInsertedEntry;
// Remember index of the default display.
- if (nDisplay == nExternalIndex)
- nDefaultExternalIndex = nEntryIndex;
+ if( nDisplay == nExternalIndex )
+ nDefaultExternalIndex = nInsertedEntry;
}
if( bUnifiedDisplay )
{
- maLBMonitor->InsertEntry( msAllMonitors->GetText() );
- const sal_uInt32 nEntryIndex (maLBMonitor->GetEntryCount()-1);
- maLBMonitor->SetEntryData(nEntryIndex, (void*)-1);
- if (nDefaultSelectedDisplay == -1)
- nSelectedIndex = nEntryIndex;
+ nInsertedEntry = InsertDisplayEntry( msAllMonitors->GetText(), -1 );
+ if( nDefaultSelectedDisplay == -1 )
+ nSelectedIndex = nInsertedEntry;
}
if (nSelectedIndex < 0)
diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx
index 393e03a4759f..ef27bfbe5da3 100644
--- a/sd/source/ui/inc/present.hxx
+++ b/sd/source/ui/inc/present.hxx
@@ -74,7 +74,9 @@ private:
DECL_LINK( ChangePauseHdl, void * );
void InitMonitorSettings();
-
+ sal_Int32 InsertDisplayEntry(const rtl::OUString &aName,
+ sal_Int32 nDisplay);
+ String GetDisplayName( sal_Int32 nDisplay, bool bExternal );
public:
SdStartPresentationDlg( Window* pWindow,
const SfxItemSet& rInAttrs,
diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx
index f9154e255431..50a93e5ff4e0 100644
--- a/sd/source/ui/slideshow/slideshow.cxx
+++ b/sd/source/ui/slideshow/slideshow.cxx
@@ -550,14 +550,6 @@ void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const
sal_Int32 nDisplay = 0;
if( aValue >>= nDisplay )
{
- // Convert value to true display id.
- if (nDisplay == 0)
- nDisplay = Application::GetDisplayExternalScreen();
- else if (nDisplay < 0)
- nDisplay = -1;
- else
- --nDisplay;
-
bIllegalArgument = false;
SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
@@ -642,14 +634,7 @@ Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) throw(U
case ATTR_PRESENT_DISPLAY:
{
SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
- const sal_Int32 nDisplay (pOptions->GetDisplay());
- // Convert true display id to the previously used schema.
- if (nDisplay == (sal_Int32)Application::GetDisplayExternalScreen())
- return Any(sal_Int32(0));
- else if (nDisplay < 0)
- return Any(sal_Int32(-1));
- else
- return Any(nDisplay+1);
+ return Any(pOptions->GetDisplay());
}
default:
@@ -1288,8 +1273,8 @@ void SlideShow::StartFullscreenPresentation( )
// ---------------------------------------------------------
+/// convert configuration setting display concept to real screens
sal_Int32 SlideShow::GetDisplay()
-
{
sal_Int32 nDisplay = 0;
@@ -1297,6 +1282,15 @@ sal_Int32 SlideShow::GetDisplay()
if( pOptions )
nDisplay = pOptions->GetDisplay();
+ if( nDisplay < 0 )
+ nDisplay = -1;
+ else if( nDisplay == 0)
+ nDisplay = (sal_Int32)Application::GetDisplayExternalScreen();
+ else
+ nDisplay--;
+
+ SAL_INFO("sd", "Presenting on real screen " << nDisplay);
+
return nDisplay;
}