summaryrefslogtreecommitdiff
path: root/xmlhelp
diff options
context:
space:
mode:
authorMalte Timmermann <Malte.Timmermann@sun.com>2010-03-01 14:40:40 +0100
committerMalte Timmermann <Malte.Timmermann@sun.com>2010-03-01 14:40:40 +0100
commitcfd74e3d4f90f07ab527b3818435ddba33bc05c5 (patch)
tree5b0f0d6cfcc9a3e0f81a3c0decc0ced45c31b47a /xmlhelp
parentd8038d103a6228e64d9723142ed55ba1f0d08c1f (diff)
mtaccfixes: #i50760 Handle CSS for high contrast
Diffstat (limited to 'xmlhelp')
-rw-r--r--xmlhelp/source/cxxhelp/provider/databases.cxx45
1 files changed, 43 insertions, 2 deletions
diff --git a/xmlhelp/source/cxxhelp/provider/databases.cxx b/xmlhelp/source/cxxhelp/provider/databases.cxx
index 3f0087b5eb..cab9f4db62 100644
--- a/xmlhelp/source/cxxhelp/provider/databases.cxx
+++ b/xmlhelp/source/cxxhelp/provider/databases.cxx
@@ -60,6 +60,12 @@
#include <com/sun/star/script/XInvocation.hpp>
#include <comphelper/locale.hxx>
+#include <com/sun/star/awt/XToolkit.hpp>
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/awt/XVclWindowPeer.hpp>
+#include <com/sun/star/awt/XTopWindow.hpp>
+
#include <transex3/compilehelp.hxx>
#include <comphelper/storagehelper.hxx>
@@ -1293,20 +1299,48 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language,
int retry = 2;
bool error = true;
rtl::OUString fileURL;
+
+ sal_Bool bHighContrastMode = sal_False;
+ rtl::OUString aCSS( m_aCSS );
+ if ( aCSS.compareToAscii( "default" ) == 0 )
+ {
+ // #i50760: "default" needs to adapt HC mode
+ uno::Reference< awt::XToolkit > xToolkit = uno::Reference< awt::XToolkit >(
+ ::comphelper::getProcessServiceFactory()->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ) ), uno::UNO_QUERY );
+ if ( xToolkit.is() )
+ {
+ uno::Reference< awt::XExtendedToolkit > xExtToolkit( xToolkit, uno::UNO_QUERY );
+ if ( xExtToolkit.is() )
+ {
+ uno::Reference< awt::XTopWindow > xTopWindow = xExtToolkit->getActiveTopWindow();
+ if ( xTopWindow.is() )
+ {
+ uno::Reference< awt::XVclWindowPeer > xVclWindowPeer( xTopWindow, uno::UNO_QUERY );
+ if ( xVclWindowPeer.is() )
+ {
+ uno::Any aHCMode = xVclWindowPeer->getProperty( rtl::OUString::createFromAscii( "HighContrastMode" ) );
+ if ( ( aHCMode >>= bHighContrastMode ) && bHighContrastMode )
+ aCSS = rtl::OUString::createFromAscii( "highcontrastblack" );
+ }
+ }
+ }
+ }
+ }
while( error && retry )
{
+
if( retry == 2 )
fileURL =
getInstallPathAsURL() +
processLang( Language ) +
rtl::OUString::createFromAscii( "/" ) +
- m_aCSS +
+ aCSS +
rtl::OUString::createFromAscii( ".css" );
else if( retry == 1 )
fileURL =
getInstallPathAsURL() +
- m_aCSS +
+ aCSS +
rtl::OUString::createFromAscii( ".css" );
osl::DirectoryItem aDirItem;
@@ -1327,6 +1361,13 @@ void Databases::cascadingStylesheet( const rtl::OUString& Language,
}
--retry;
+ if ( !retry && error && bHighContrastMode )
+ {
+ // fall back to default css
+ aCSS = rtl::OUString::createFromAscii( "default" );
+ retry = 2;
+ bHighContrastMode = sal_False;
+ }
}
if( error )