summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-02-06 13:00:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2014-02-06 15:11:59 +0000
commitb37bce11cf59c6c9544e62e81f71a07e4d987a34 (patch)
tree855229c7d6e375846352dad3d06610700c7f337b
parenteb07ab05c3b8774ab2b2059befef0eadf61c97d6 (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
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx2
-rw-r--r--chart2/source/controller/dialogs/ChartTypeDialogController.cxx2
-rw-r--r--chart2/source/model/main/ChartModel_Persistence.cxx2
-rw-r--r--i18nlangtag/source/isolang/mslangid.cxx9
-rw-r--r--include/i18nlangtag/mslangid.hxx5
-rw-r--r--include/vcl/settings.hxx3
-rw-r--r--vcl/source/app/settings.cxx76
7 files changed, 64 insertions, 35 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index e1e38cd422d4..342facf7c49b 100644
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -1303,7 +1303,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
if( aTemplateWithService.first.is())
aTemplateWithService.first->resetStyles( xDiagram );//#i109371#
xTemplate->changeDiagram( xDiagram );
- if( Application::GetSettings().GetLayoutRTL() )
+ if( Application::GetSettings().GetMathLayoutRTL() )
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
ThreeDHelper::setScheme( xDiagram, e3DScheme );
}
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 3aee103766b5..5cdda02b0d62 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -329,7 +329,7 @@ bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame
if( aTemplateWithService.first.is())
aTemplateWithService.first->resetStyles( xDiagram );
xTemplate->changeDiagram( xDiagram );
- if( Application::GetSettings().GetLayoutRTL() )
+ if( Application::GetSettings().GetMathLayoutRTL() )
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
if( rParameter.b3DLook )
ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx
index d964ced0d9ff..003e3354a271 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -412,7 +412,7 @@ void SAL_CALL ChartModel::initNew()
setFirstDiagram( xDiagram );
- bool bIsRTL = Application::GetSettings().GetLayoutRTL();
+ bool bIsRTL = Application::GetSettings().GetMathLayoutRTL();
//reverse x axis for rtl charts
if( bIsRTL )
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index e27e13bb6c24..6bb92bbeba0d 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -233,6 +233,15 @@ bool MsLangId::isRightToLeft( LanguageType nLang )
}
// static
+bool MsLangId::isRightToLeftMath( LanguageType nLang )
+{
+ //http://www.w3.org/TR/arabic-math/
+ if (nLang == LANGUAGE_FARSI || nLang == LANGUAGE_ARABIC_MOROCCO)
+ return false;
+ return isRightToLeft(nLang);
+}
+
+// static
bool MsLangId::isSimplifiedChinese( LanguageType nLang )
{
return isChinese(nLang) && !isTraditionalChinese(nLang);
diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx
index a30bb1d20cbc..b12c34c9869d 100644
--- a/include/i18nlangtag/mslangid.hxx
+++ b/include/i18nlangtag/mslangid.hxx
@@ -107,9 +107,12 @@ public:
static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType );
- /** Whether locale has a Right-To-Left orientation. */
+ /** Whether locale has a Right-To-Left orientation for text. */
static bool isRightToLeft( LanguageType nLang );
+ /** Whether locale has a Right-To-Left orientation for math. */
+ static bool isRightToLeftMath( LanguageType nLang );
+
/** Whether locale is a CJK locale */
static bool isCJK( LanguageType nLang );
diff --git a/include/vcl/settings.hxx b/include/vcl/settings.hxx
index ed9e617f3810..d9711de3eb15 100644
--- a/include/vcl/settings.hxx
+++ b/include/vcl/settings.hxx
@@ -1144,7 +1144,8 @@ public:
const LanguageTag& GetLanguageTag() const;
void SetUILanguageTag( const LanguageTag& rLanguageTag );
const LanguageTag& GetUILanguageTag() const;
- bool GetLayoutRTL() const; // returns true if UI language requires right-to-left UI
+ bool GetLayoutRTL() const; // returns true if UI language requires right-to-left Text Layout
+ bool GetMathLayoutRTL() const; // returns true if UI language requires right-to-left Math Layout
const LocaleDataWrapper& GetLocaleDataWrapper() const;
const LocaleDataWrapper& GetUILocaleDataWrapper() const;
const vcl::I18nHelper& GetLocaleI18nHelper() const;
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);
}
// -----------------------------------------------------------------------