diff options
author | Michael Meeks <michael.meeks@suse.com> | 2012-05-30 10:15:27 +0100 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-05-30 19:31:51 +0100 |
commit | f3aa2a45b4f014aa7631bffa3ac07b2332f80677 (patch) | |
tree | 3e8f7a9c3e74b5648daeeaf26d4adaddf7a0df91 /vcl/source | |
parent | 61acb9beb2bd5c76df6136d4fb3871db7906a827 (diff) |
vcl: rename unhelpful 'Default' screen to a BuiltIn screen
Add 'BuiltInDisplay' and 'ExternalDisplay' UNO properties to clarify
Change-Id: Idf5d26bf687871b3949d077fb89bfe1942839125
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/svapp.cxx | 6 | ||||
-rw-r--r-- | vcl/source/components/display.cxx | 42 |
2 files changed, 40 insertions, 8 deletions
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index 43eb6d8e5a83..7e6d54471169 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 60870e304b07..78b93d80294d 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 |