diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-02-06 13:00:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-02-06 15:11:59 +0000 |
commit | b37bce11cf59c6c9544e62e81f71a07e4d987a34 (patch) | |
tree | 855229c7d6e375846352dad3d06610700c7f337b /vcl/source | |
parent | eb07ab05c3b8774ab2b2059befef0eadf61c97d6 (diff) |
Resolves: rhbz#975421 wrong chart direction in Farsi
Where Farsi (and apparenly Moroccon) are RTL but have LTR
math and charts should reportedly follow the math direction
Change-Id: Ib60eaaaa90fe46ef240030a91169fdff3f736329
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/app/settings.cxx | 76 |
1 files changed, 46 insertions, 30 deletions
diff --git a/vcl/source/app/settings.cxx b/vcl/source/app/settings.cxx index fe1456bdef07..541f881a4091 100644 --- a/vcl/source/app/settings.cxx +++ b/vcl/source/app/settings.cxx @@ -1591,47 +1591,63 @@ void AllSettings::SetUILanguageTag( const LanguageTag& ) // ----------------------------------------------------------------------- -bool AllSettings::GetLayoutRTL() const +namespace { - static const char* pEnv = getenv("SAL_RTL_ENABLED" ); - static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off + bool GetConfigLayoutRTL(bool bMath) + { + static const char* pEnv = getenv("SAL_RTL_ENABLED" ); + static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off - // environment always overrides - if( pEnv ) - return true; + // environment always overrides + if( pEnv ) + return true; - bool bRTL = false; + bool bRTL = false; - if( nUIMirroring == -1 ) - { - nUIMirroring = 0; // ask configuration only once - utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext( - comphelper::getProcessComponentContext(), - OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive ! - if ( aNode.isValid() ) + if( nUIMirroring == -1 ) { - sal_Bool bTmp = sal_Bool(); - ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") ); - if( aValue >>= bTmp ) + nUIMirroring = 0; // ask configuration only once + utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext( + comphelper::getProcessComponentContext(), + OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive ! + if ( aNode.isValid() ) { - // found true or false; if it was nil, nothing is changed - nUIMirroring = bTmp ? 1 : 2; + sal_Bool bTmp = sal_Bool(); + ::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") ); + if( aValue >>= bTmp ) + { + // found true or false; if it was nil, nothing is changed + nUIMirroring = bTmp ? 1 : 2; + } } } - } - if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language - { - LanguageType aLang = LANGUAGE_DONTKNOW; - ImplSVData* pSVData = ImplGetSVData(); - if ( pSVData->maAppData.mpSettings ) - aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType(); - bRTL = MsLangId::isRightToLeft( aLang ); + if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language + { + LanguageType aLang = LANGUAGE_DONTKNOW; + ImplSVData* pSVData = ImplGetSVData(); + if ( pSVData->maAppData.mpSettings ) + aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType(); + if (bMath) + bRTL = MsLangId::isRightToLeftMath( aLang ); + else + bRTL = MsLangId::isRightToLeft( aLang ); + } + else + bRTL = (nUIMirroring == 1); + + return bRTL; } - else - bRTL = (nUIMirroring == 1); +} - return bRTL; +bool AllSettings::GetLayoutRTL() const +{ + return GetConfigLayoutRTL(false); +} + +bool AllSettings::GetMathLayoutRTL() const +{ + return GetConfigLayoutRTL(true); } // ----------------------------------------------------------------------- |