sd/source/ui/dlg/present.cxx | 12 ++++---- sd/source/ui/dlg/present.src | 4 +- sd/source/ui/inc/present.hrc | 2 - sd/source/ui/inc/present.hxx | 2 - sd/source/ui/slideshow/slideshow.cxx | 2 - sdext/source/presenter/PresenterScreen.cxx | 39 +++++++++++++------------- sdext/source/presenter/PresenterScreen.hxx | 7 ++-- vcl/inc/salsys.hxx | 2 - vcl/inc/unx/gtk/gtkdata.hxx | 2 - vcl/inc/unx/gtk/gtksys.hxx | 4 +- vcl/inc/unx/x11/x11sys.hxx | 2 - vcl/inc/vcl/svapp.hxx | 6 +++- vcl/inc/win/salsys.h | 2 - vcl/source/app/svapp.cxx | 6 ++-- vcl/source/components/display.cxx | 42 +++++++++++++++++++++++++---- vcl/unx/gtk/app/gtksys.cxx | 2 - vcl/unx/x11/x11sys.cxx | 2 - vcl/win/source/app/salinfo.cxx | 2 - 18 files changed, 88 insertions(+), 52 deletions(-)
New commits: commit 834eed7992c6b549bbd06fbbe6473bafc777c8e1 Author: Michael Meeks <[email protected]> Date: Wed May 30 16:48:20 2012 +0100 sdext: cleanup presenter screen handling pwrt. naming Change-Id: I9400ca0a704cfdeb7f333be704ec5690bedcf0c6 diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx index b83cad7..3aea637 100644 --- a/sd/source/ui/dlg/present.cxx +++ b/sd/source/ui/dlg/present.cxx @@ -90,7 +90,7 @@ SdStartPresentationDlg::SdStartPresentationDlg( Window* pWindow, rOutAttrs ( rInAttrs ), mnMonitors ( 0 ), - msPrimaryMonitor( SdResId(STR_PRIMARY_MONITOR ) ), + msExternalMonitor( SdResId(STR_EXTERNAL_MONITOR ) ), msMonitor( SdResId( STR_MONITOR ) ), msAllMonitors( SdResId( STR_ALL_MONITORS ) ) { @@ -200,14 +200,14 @@ void SdStartPresentationDlg::InitMonitorSettings() else { sal_Bool bUnifiedDisplay = false; - sal_Int32 nPrimaryIndex = 0; + sal_Int32 nExternalIndex = 0; Reference< XPropertySet > xMonProps( xMultiMon, UNO_QUERY ); if( xMonProps.is() ) try { const OUString sPropName1( "IsUnifiedDisplay" ); xMonProps->getPropertyValue( sPropName1 ) >>= bUnifiedDisplay; - const OUString sPropName2( "DefaultDisplay" ); - xMonProps->getPropertyValue( sPropName2 ) >>= nPrimaryIndex; + const OUString sPropName2( "ExternalDisplay" ); + xMonProps->getPropertyValue( sPropName2 ) >>= nExternalIndex; } catch( Exception& ) { @@ -216,7 +216,7 @@ void SdStartPresentationDlg::InitMonitorSettings() const String sPlaceHolder( RTL_CONSTASCII_USTRINGPARAM( "%1" ) ); for( sal_Int32 nDisplay = 0; nDisplay < mnMonitors; nDisplay++ ) { - String aName( nDisplay == nPrimaryIndex ? msPrimaryMonitor : msMonitor ); + String aName( nDisplay == nExternalIndex ? msExternalMonitor : msMonitor ); const String aNumber( String::CreateFromInt32( nDisplay + 1 ) ); aName.SearchAndReplace( sPlaceHolder, aNumber ); maLBMonitor.InsertEntry( aName ); @@ -227,7 +227,7 @@ void SdStartPresentationDlg::InitMonitorSettings() sal_Int32 nSelected = ( ( const SfxInt32Item& ) rOutAttrs.Get( ATTR_PRESENT_DISPLAY ) ).GetValue(); if( nSelected <= 0 ) - nSelected = nPrimaryIndex; + nSelected = nExternalIndex; else nSelected--; diff --git a/sd/source/ui/dlg/present.src b/sd/source/ui/dlg/present.src index 6ee3fd8..3f3888f 100644 --- a/sd/source/ui/dlg/present.src +++ b/sd/source/ui/dlg/present.src @@ -274,9 +274,9 @@ ModalDialog DLG_START_PRESENTATION ClipChildren = TRUE; }; - String STR_PRIMARY_MONITOR + String STR_EXTERNAL_MONITOR { - Text [ en-US ] = "Display %1 (primary)"; + Text [ en-US ] = "Display %1 (external)"; }; String STR_MONITOR diff --git a/sd/source/ui/inc/present.hrc b/sd/source/ui/inc/present.hrc index fc4d3b6..1d028be 100644 --- a/sd/source/ui/inc/present.hrc +++ b/sd/source/ui/inc/present.hrc @@ -59,7 +59,7 @@ #define FT_MONITOR 10 #define LB_MONITOR 11 -#define STR_PRIMARY_MONITOR 1 +#define STR_EXTERNAL_MONITOR 1 #define STR_MONITOR 2 #define STR_ALL_MONITORS 3 diff --git a/sd/source/ui/inc/present.hxx b/sd/source/ui/inc/present.hxx index e02f75d..2a19777 100644 --- a/sd/source/ui/inc/present.hxx +++ b/sd/source/ui/inc/present.hxx @@ -81,7 +81,7 @@ private: const SfxItemSet& rOutAttrs; sal_Int32 mnMonitors; - String msPrimaryMonitor; + String msExternalMonitor; String msMonitor; String msAllMonitors; diff --git a/sd/source/ui/slideshow/slideshow.cxx b/sd/source/ui/slideshow/slideshow.cxx index ffd8cef..ad9fbfb 100644 --- a/sd/source/ui/slideshow/slideshow.cxx +++ b/sd/source/ui/slideshow/slideshow.cxx @@ -1298,7 +1298,7 @@ sal_Int32 SlideShow::GetDisplay() Reference<XPropertySet> xMonitorProperties( xFactory->createInstance( "com.sun.star.awt.DisplayAccess" ), UNO_QUERY_THROW); - xMonitorProperties->getPropertyValue("DefaultDisplay") >>= nDisplay; + xMonitorProperties->getPropertyValue("ExternalDisplay") >>= nDisplay; } catch( Exception& ) { diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx index 1d8d8eb..d6e5057 100644 --- a/sdext/source/presenter/PresenterScreen.cxx +++ b/sdext/source/presenter/PresenterScreen.cxx @@ -433,21 +433,20 @@ void PresenterScreen::SwitchMonitors() Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW); Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW); - sal_Int32 nDefaultDisplay = 0; - sal_Int32 nScreen = GetScreenNumber (xPresentation); - - if (nScreen == -1) // only a single display somehow + // Get the existing presenter console screen, we want to switch the + // presentation to use that instead. + sal_Int32 nNewScreen = GetPresenterScreenNumber (xPresentation); + if (nNewScreen < 0) return; - sal_Int32 nNewScreen = GetPresenterScreenFromScreen (nScreen); - + // Adapt that display number to be the 'default' setting of 0 if it matches + sal_Int32 nDefaultDisplay = 0; Reference<beans::XPropertySet> xDisplayProperties = GetDisplayAccess(); xDisplayProperties->getPropertyValue(A2S("DefaultDisplay")) >>= nDefaultDisplay; - if (nNewScreen == nDefaultDisplay) nNewScreen = 0; // screen zero is best == the primary display else - nNewScreen++; + nNewScreen++; // otherwise we store screens offset by one. // Set the new presentation display Reference<beans::XPropertySet> xProperties (xPresentation, UNO_QUERY_THROW); @@ -458,20 +457,22 @@ void PresenterScreen::SwitchMonitors() } } -sal_Int32 PresenterScreen::GetScreenNumber ( +// FIXME: really VCL should hold the current 'external' and 'built-in' +// display states, and hide them behind some attractive API, and +// the PresenterConsole should link VCL directly ... +sal_Int32 PresenterScreen::GetPresenterScreenNumber ( const Reference<presentation::XPresentation2>& rxPresentation) const { - // Determine the screen on which the full screen presentation is being - // displayed. sal_Int32 nScreenNumber (0); sal_Int32 nScreenCount (1); - fprintf (stderr, "New foo!\n"); try { Reference<beans::XPropertySet> xProperties (rxPresentation, UNO_QUERY); if ( ! xProperties.is()) return -1; + // Determine the screen on which the full screen presentation is being + // displayed. sal_Int32 nDisplayNumber (-1); if ( ! (xProperties->getPropertyValue(A2S("Display")) >>= nDisplayNumber)) return -1; @@ -487,7 +488,7 @@ sal_Int32 PresenterScreen::GetScreenNumber ( // Instantiate the DisplayAccess service to find out which // screen number that is. if (nDisplayNumber <= 0 && xDisplayProperties.is()) - xDisplayProperties->getPropertyValue(A2S("DefaultDisplay")) >>= nScreenNumber; + xDisplayProperties->getPropertyValue(A2S("ExternalDisplay")) >>= nScreenNumber; } // We still have to determine the number of screens to decide @@ -513,7 +514,7 @@ sal_Int32 PresenterScreen::GetScreenNumber ( OUString(RTL_CONSTASCII_USTRINGPARAM("Presenter/StartAlways"))) >>= bStartAlways) { if (bStartAlways) - return nScreenNumber; + return GetPresenterScreenFromScreen(nScreenNumber); } return -1; } @@ -525,7 +526,7 @@ sal_Int32 PresenterScreen::GetScreenNumber ( // the default instead. } - return nScreenNumber; + return GetPresenterScreenFromScreen(nScreenNumber); } sal_Int32 PresenterScreen::GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen ) const @@ -558,17 +559,15 @@ Reference<drawing::framework::XResourceId> PresenterScreen::GetMainPaneId ( { // A negative value means that the presentation spans all available // displays. That leaves no room for the presenter. - const sal_Int32 nScreenNumber(GetScreenNumber(rxPresentation)); - if (nScreenNumber < 0) + const sal_Int32 nScreen(GetPresenterScreenNumber(rxPresentation)); + if (nScreen < 0) return NULL; - sal_Int32 nPresenterScreenNumber = GetPresenterScreenFromScreen (nScreenNumber); - return ResourceId::create( Reference<XComponentContext>(mxContextWeak), PresenterHelper::msFullScreenPaneURL +A2S("?FullScreen=true&ScreenNumber=") - + OUString::valueOf(nPresenterScreenNumber)); + + OUString::valueOf(nScreen)); } void PresenterScreen::RequestShutdownPresenterScreen (void) diff --git a/sdext/source/presenter/PresenterScreen.hxx b/sdext/source/presenter/PresenterScreen.hxx index 40f99a2..20a9735 100644 --- a/sdext/source/presenter/PresenterScreen.hxx +++ b/sdext/source/presenter/PresenterScreen.hxx @@ -224,13 +224,14 @@ private: const double nRight, const double nBottom); - /** Return the screen number on which to display the presentation itself + /** Return the built-in screen number on the presentation will normally + display the presenter console. @return Returns -1 when the presenter screen can or shall not be displayed. */ - sal_Int32 GetScreenNumber ( - const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const; + sal_Int32 GetPresenterScreenNumber ( + const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const; sal_Int32 GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen ) const; commit f3aa2a45b4f014aa7631bffa3ac07b2332f80677 Author: Michael Meeks <[email protected]> Date: Wed May 30 10:15:27 2012 +0100 vcl: rename unhelpful 'Default' screen to a BuiltIn screen Add 'BuiltInDisplay' and 'ExternalDisplay' UNO properties to clarify Change-Id: Idf5d26bf687871b3949d077fb89bfe1942839125 diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx index 001a8a9..6c9eb37 100644 --- a/vcl/inc/salsys.hxx +++ b/vcl/inc/salsys.hxx @@ -86,7 +86,7 @@ public: @returns the default screen number */ - virtual unsigned int GetDisplayDefaultScreen() { return 0; } + virtual unsigned int GetDisplayBuiltInScreen() { return 0; } /* Gets relative position and size of the screens attached to the display @param nScreen diff --git a/vcl/inc/unx/gtk/gtkdata.hxx b/vcl/inc/unx/gtk/gtkdata.hxx index 033bf1a..f2663f4 100644 --- a/vcl/inc/unx/gtk/gtkdata.hxx +++ b/vcl/inc/unx/gtk/gtkdata.hxx @@ -157,7 +157,7 @@ public: GdkCursor *getCursor( PointerStyle ePointerStyle ); virtual int CaptureMouse( SalFrame* pFrame ); - int GetDefaultScreen() { return m_pSys->GetDisplayDefaultScreen(); } + int GetDefaultScreen() { return m_pSys->GetDisplayBuiltInScreen(); } SalX11Screen GetDefaultXScreen() { return m_pSys->GetDisplayDefaultXScreen(); } Size GetScreenSize( int nDisplayScreen ); int GetXScreenCount() { return m_pSys->GetDisplayXScreenCount(); } diff --git a/vcl/inc/unx/gtk/gtksys.hxx b/vcl/inc/unx/gtk/gtksys.hxx index 94fe25a..3bd7988 100644 --- a/vcl/inc/unx/gtk/gtksys.hxx +++ b/vcl/inc/unx/gtk/gtksys.hxx @@ -49,7 +49,7 @@ public: virtual bool IsUnifiedDisplay(); virtual unsigned int GetDisplayScreenCount(); - virtual unsigned int GetDisplayDefaultScreen(); + virtual unsigned int GetDisplayBuiltInScreen(); virtual rtl::OUString GetDisplayScreenName (unsigned int nScreen); virtual Rectangle GetDisplayScreenPosSizePixel (unsigned int nScreen); virtual Rectangle GetDisplayScreenWorkAreaPosSizePixel (unsigned int nScreen); @@ -58,7 +58,7 @@ public: const std::list< rtl::OUString >& rButtons, int nDefButton); SalX11Screen GetDisplayDefaultXScreen() - { return getXScreenFromDisplayScreen( GetDisplayDefaultScreen() ); } + { return getXScreenFromDisplayScreen( GetDisplayBuiltInScreen() ); } int GetDisplayXScreenCount(); SalX11Screen getXScreenFromDisplayScreen(unsigned int nDisplayScreen); void countScreenMonitors(); diff --git a/vcl/inc/unx/x11/x11sys.hxx b/vcl/inc/unx/x11/x11sys.hxx index 8a36d3e..80b5d58 100644 --- a/vcl/inc/unx/x11/x11sys.hxx +++ b/vcl/inc/unx/x11/x11sys.hxx @@ -45,7 +45,7 @@ public: // overload pure virtual methods virtual unsigned int GetDisplayScreenCount(); virtual bool IsUnifiedDisplay(); - virtual unsigned int GetDisplayDefaultScreen(); + virtual unsigned int GetDisplayBuiltInScreen(); virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ); virtual Rectangle GetDisplayScreenWorkAreaPosSizePixel( unsigned int nScreen ); virtual rtl::OUString GetDisplayScreenName( unsigned int nScreen ); diff --git a/vcl/inc/vcl/svapp.hxx b/vcl/inc/vcl/svapp.hxx index 7b793c2..af766f4 100644 --- a/vcl/inc/vcl/svapp.hxx +++ b/vcl/inc/vcl/svapp.hxx @@ -300,7 +300,11 @@ public: // will always be GetDisplayDefaultScreen() SAL_DLLPRIVATE static unsigned int GetBestScreen( const Rectangle& ); SAL_DLLPRIVATE static Rectangle GetWorkAreaPosSizePixel( unsigned int nScreen ); - SAL_DLLPRIVATE static unsigned int GetDisplayDefaultScreen(); + // This returns the LCD screen number for a laptop, or the primary + // external VGA display for a desktop machine - it is where a presenter + // console should be rendered if there are other (non-built-in) screens + // present. + SAL_DLLPRIVATE static unsigned int GetDisplayBuiltInScreen(); SAL_DLLPRIVATE static rtl::OUString GetDisplayScreenName( unsigned int nScreen ); static const LocaleDataWrapper& GetAppLocaleDataWrapper(); diff --git a/vcl/inc/win/salsys.h b/vcl/inc/win/salsys.h index 7bd092c..b15c1a7 100644 --- a/vcl/inc/win/salsys.h +++ b/vcl/inc/win/salsys.h @@ -69,7 +69,7 @@ public: virtual ~WinSalSystem(); virtual unsigned int GetDisplayScreenCount(); - virtual unsigned int GetDisplayDefaultScreen(); + virtual unsigned int GetDisplayBuiltInScreen(); virtual Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ); virtual Rectangle GetDisplayScreenWorkAreaPosSizePixel( unsigned int nScreen ); virtual rtl::OUString GetDisplayScreenName( unsigned int nScreen ); diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 43eb6d8..7e6d544 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1260,10 +1260,10 @@ bool Application::IsUnifiedDisplay() return pSys ? pSys->IsUnifiedDisplay() : true; } -unsigned int Application::GetDisplayDefaultScreen() +unsigned int Application::GetDisplayBuiltInScreen() { SalSystem* pSys = ImplGetSalSystem(); - return pSys ? pSys->GetDisplayDefaultScreen() : 0; + return pSys ? pSys->GetDisplayBuiltInScreen() : 0; } Rectangle Application::GetScreenPosSizePixel( unsigned int nScreen ) @@ -1292,7 +1292,7 @@ unsigned long calcDistSquare( const Point& i_rPoint, const Rectangle& i_rRect ) unsigned int Application::GetBestScreen( const Rectangle& i_rRect ) { if( !IsUnifiedDisplay() ) - return GetDisplayDefaultScreen(); + return GetDisplayBuiltInScreen(); const unsigned int nScreens = GetScreenCount(); unsigned int nBestMatchScreen = 0; diff --git a/vcl/source/components/display.cxx b/vcl/source/components/display.cxx index 60870e3..78b93d8 100644 --- a/vcl/source/components/display.cxx +++ b/vcl/source/components/display.cxx @@ -231,6 +231,8 @@ DisplayAccess::DisplayAccess() static const char* pUnifiedDisplayName = "IsUnifiedDisplay"; static const char* pDefaultDisplayName = "DefaultDisplay"; +static const char* pBuiltInDisplayName = "BuiltInDisplay"; +static const char* pExternalDisplayName = "ExternalDisplay"; // XPropertySet Reference< XPropertySetInfo > SAL_CALL DisplayAccess::getPropertySetInfo() throw (RuntimeException) @@ -250,9 +252,32 @@ Any SAL_CALL DisplayAccess::getPropertyValue( const OUString& PropertyName ) thr { aRet <<= sal_Bool( Application::IsUnifiedDisplay() ); } - else if( PropertyName.equalsAscii( pDefaultDisplayName ) ) + else if( PropertyName.equalsAscii( pDefaultDisplayName ) || // Unhelpful name, legacy setting + PropertyName.equalsAscii( pBuiltInDisplayName ) ) { - aRet <<= sal_Int32( Application::GetDisplayDefaultScreen() ); + aRet <<= sal_Int32( Application::GetDisplayBuiltInScreen() ); + } + else if( PropertyName.equalsAscii( pExternalDisplayName ) ) + { + // This is really unpleasant, in theory we could have multiple + // external displays etc. + sal_Int32 nExternal(0); + switch (Application::GetDisplayBuiltInScreen()) + { + case 0: + nExternal = 1; + break; + case 1: + nExternal = 0; + break; + default: + // When the built-in display is neither 0 nor 1 + // then place the full-screen presentation on the + // first available screen. + nExternal = 0; + break; + } + aRet <<= nExternal; } else throw UnknownPropertyException(); @@ -268,9 +293,11 @@ void SAL_CALL DisplayAccess::removeVetoableChangeListener( const OUString&, cons // XPropertySetInfo Sequence< Property > SAL_CALL DisplayAccess::getProperties() throw (RuntimeException) { - Sequence< Property > aProps(2); + Sequence< Property > aProps(4); aProps[0] = getPropertyByName( OUString::createFromAscii( pUnifiedDisplayName ) ); aProps[1] = getPropertyByName( OUString::createFromAscii( pDefaultDisplayName ) ); + aProps[2] = getPropertyByName( OUString::createFromAscii( pBuiltInDisplayName ) ); + aProps[3] = getPropertyByName( OUString::createFromAscii( pExternalDisplayName ) ); return aProps; } @@ -279,15 +306,20 @@ Property SAL_CALL DisplayAccess::getPropertyByName( const OUString& aName ) thro if( aName.equalsAscii( pUnifiedDisplayName ) ) return Property( aName, 0, ::getCppuType( (sal_Bool const *)0 ), PropertyAttribute::READONLY ); - if( aName.equalsAscii( pDefaultDisplayName ) ) + if( aName.equalsAscii( pDefaultDisplayName ) || + aName.equalsAscii( pBuiltInDisplayName ) || + aName.equalsAscii( pExternalDisplayName ) ) return Property( aName, 0, ::getCppuType( (sal_Int32 const *)0 ), PropertyAttribute::READONLY ); + throw UnknownPropertyException(); } ::sal_Bool SAL_CALL DisplayAccess::hasPropertyByName( const OUString& Name ) throw (RuntimeException) { return Name.equalsAscii( pUnifiedDisplayName ) || - Name.equalsAscii( pDefaultDisplayName ); + Name.equalsAscii( pDefaultDisplayName ) || + Name.equalsAscii( pBuiltInDisplayName ) || + Name.equalsAscii( pExternalDisplayName ); } // XIndexAccess diff --git a/vcl/unx/gtk/app/gtksys.cxx b/vcl/unx/gtk/app/gtksys.cxx index 25578b3..179bf58 100644 --- a/vcl/unx/gtk/app/gtksys.cxx +++ b/vcl/unx/gtk/app/gtksys.cxx @@ -229,7 +229,7 @@ static int _get_primary_monitor (GdkScreen *pScreen) } } // end anonymous namespace -unsigned int GtkSalSystem::GetDisplayDefaultScreen() +unsigned int GtkSalSystem::GetDisplayBuiltInScreen() { GdkScreen *pDefault = gdk_display_get_default_screen (mpDisplay); int idx = getScreenIdxFromPtr (pDefault); diff --git a/vcl/unx/x11/x11sys.cxx b/vcl/unx/x11/x11sys.cxx index f30d873..8173dde 100644 --- a/vcl/unx/x11/x11sys.cxx +++ b/vcl/unx/x11/x11sys.cxx @@ -68,7 +68,7 @@ bool X11SalSystem::IsUnifiedDisplay() return pSalDisp->IsXinerama() ? true : (nScreenCount == 1); } -unsigned int X11SalSystem::GetDisplayDefaultScreen() +unsigned int X11SalSystem::GetDisplayBuiltInScreen() { SalDisplay* pSalDisp = GetGenericData()->GetSalDisplay(); return pSalDisp->GetDefaultXScreen().getXScreen(); diff --git a/vcl/win/source/app/salinfo.cxx b/vcl/win/source/app/salinfo.cxx index efd4d08..b5576c9 100644 --- a/vcl/win/source/app/salinfo.cxx +++ b/vcl/win/source/app/salinfo.cxx @@ -179,7 +179,7 @@ unsigned int WinSalSystem::GetDisplayScreenCount() return m_aMonitors.size(); } -unsigned int WinSalSystem::GetDisplayDefaultScreen() +unsigned int WinSalSystem::GetDisplayBuiltInScreen() { initMonitors(); return m_nPrimary; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
