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
This commit is contained in:
@@ -1303,7 +1303,7 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
|
|||||||
if( aTemplateWithService.first.is())
|
if( aTemplateWithService.first.is())
|
||||||
aTemplateWithService.first->resetStyles( xDiagram );//#i109371#
|
aTemplateWithService.first->resetStyles( xDiagram );//#i109371#
|
||||||
xTemplate->changeDiagram( xDiagram );
|
xTemplate->changeDiagram( xDiagram );
|
||||||
if( Application::GetSettings().GetLayoutRTL() )
|
if( Application::GetSettings().GetMathLayoutRTL() )
|
||||||
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
|
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
|
||||||
ThreeDHelper::setScheme( xDiagram, e3DScheme );
|
ThreeDHelper::setScheme( xDiagram, e3DScheme );
|
||||||
}
|
}
|
||||||
|
@@ -329,7 +329,7 @@ bool ChartTypeDialogController::commitToModel( const ChartTypeParameter& rParame
|
|||||||
if( aTemplateWithService.first.is())
|
if( aTemplateWithService.first.is())
|
||||||
aTemplateWithService.first->resetStyles( xDiagram );
|
aTemplateWithService.first->resetStyles( xDiagram );
|
||||||
xTemplate->changeDiagram( xDiagram );
|
xTemplate->changeDiagram( xDiagram );
|
||||||
if( Application::GetSettings().GetLayoutRTL() )
|
if( Application::GetSettings().GetMathLayoutRTL() )
|
||||||
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
|
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
|
||||||
if( rParameter.b3DLook )
|
if( rParameter.b3DLook )
|
||||||
ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
|
ThreeDHelper::setScheme( xDiagram, rParameter.eThreeDLookScheme );
|
||||||
|
@@ -412,7 +412,7 @@ void SAL_CALL ChartModel::initNew()
|
|||||||
|
|
||||||
setFirstDiagram( xDiagram );
|
setFirstDiagram( xDiagram );
|
||||||
|
|
||||||
bool bIsRTL = Application::GetSettings().GetLayoutRTL();
|
bool bIsRTL = Application::GetSettings().GetMathLayoutRTL();
|
||||||
//reverse x axis for rtl charts
|
//reverse x axis for rtl charts
|
||||||
if( bIsRTL )
|
if( bIsRTL )
|
||||||
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
|
AxisHelper::setRTLAxisLayout( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 ) );
|
||||||
|
@@ -232,6 +232,15 @@ bool MsLangId::isRightToLeft( LanguageType nLang )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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
|
// static
|
||||||
bool MsLangId::isSimplifiedChinese( LanguageType nLang )
|
bool MsLangId::isSimplifiedChinese( LanguageType nLang )
|
||||||
{
|
{
|
||||||
|
@@ -107,9 +107,12 @@ public:
|
|||||||
static LanguageType resolveSystemLanguageByScriptType( LanguageType nLang, sal_Int16 nType );
|
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 );
|
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 */
|
/** Whether locale is a CJK locale */
|
||||||
static bool isCJK( LanguageType nLang );
|
static bool isCJK( LanguageType nLang );
|
||||||
|
|
||||||
|
@@ -1144,7 +1144,8 @@ public:
|
|||||||
const LanguageTag& GetLanguageTag() const;
|
const LanguageTag& GetLanguageTag() const;
|
||||||
void SetUILanguageTag( const LanguageTag& rLanguageTag );
|
void SetUILanguageTag( const LanguageTag& rLanguageTag );
|
||||||
const LanguageTag& GetUILanguageTag() const;
|
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& GetLocaleDataWrapper() const;
|
||||||
const LocaleDataWrapper& GetUILocaleDataWrapper() const;
|
const LocaleDataWrapper& GetUILocaleDataWrapper() const;
|
||||||
const vcl::I18nHelper& GetLocaleI18nHelper() const;
|
const vcl::I18nHelper& GetLocaleI18nHelper() const;
|
||||||
|
@@ -1591,47 +1591,63 @@ void AllSettings::SetUILanguageTag( const LanguageTag& )
|
|||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
|
||||||
bool AllSettings::GetLayoutRTL() const
|
namespace
|
||||||
{
|
{
|
||||||
static const char* pEnv = getenv("SAL_RTL_ENABLED" );
|
bool GetConfigLayoutRTL(bool bMath)
|
||||||
static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
|
|
||||||
|
|
||||||
// environment always overrides
|
|
||||||
if( pEnv )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
bool bRTL = false;
|
|
||||||
|
|
||||||
if( nUIMirroring == -1 )
|
|
||||||
{
|
{
|
||||||
nUIMirroring = 0; // ask configuration only once
|
static const char* pEnv = getenv("SAL_RTL_ENABLED" );
|
||||||
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
|
static int nUIMirroring = -1; // -1: undef, 0: auto, 1: on 2: off
|
||||||
comphelper::getProcessComponentContext(),
|
|
||||||
OUString("org.openoffice.Office.Common/I18N/CTL") ); // note: case sensitive !
|
// environment always overrides
|
||||||
if ( aNode.isValid() )
|
if( pEnv )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool bRTL = false;
|
||||||
|
|
||||||
|
if( nUIMirroring == -1 )
|
||||||
{
|
{
|
||||||
sal_Bool bTmp = sal_Bool();
|
nUIMirroring = 0; // ask configuration only once
|
||||||
::com::sun::star::uno::Any aValue = aNode.getNodeValue( OUString("UIMirroring") );
|
utl::OConfigurationNode aNode = utl::OConfigurationTreeRoot::tryCreateWithComponentContext(
|
||||||
if( aValue >>= bTmp )
|
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
|
sal_Bool bTmp = sal_Bool();
|
||||||
nUIMirroring = bTmp ? 1 : 2;
|
::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
|
if( nUIMirroring == 0 ) // no config found (eg, setup) or default (nil) was set: check language
|
||||||
{
|
{
|
||||||
LanguageType aLang = LANGUAGE_DONTKNOW;
|
LanguageType aLang = LANGUAGE_DONTKNOW;
|
||||||
ImplSVData* pSVData = ImplGetSVData();
|
ImplSVData* pSVData = ImplGetSVData();
|
||||||
if ( pSVData->maAppData.mpSettings )
|
if ( pSVData->maAppData.mpSettings )
|
||||||
aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType();
|
aLang = pSVData->maAppData.mpSettings->GetUILanguageTag().getLanguageType();
|
||||||
bRTL = MsLangId::isRightToLeft( aLang );
|
if (bMath)
|
||||||
}
|
bRTL = MsLangId::isRightToLeftMath( aLang );
|
||||||
else
|
else
|
||||||
bRTL = (nUIMirroring == 1);
|
bRTL = MsLangId::isRightToLeft( aLang );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
bRTL = (nUIMirroring == 1);
|
||||||
|
|
||||||
return bRTL;
|
return bRTL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AllSettings::GetLayoutRTL() const
|
||||||
|
{
|
||||||
|
return GetConfigLayoutRTL(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool AllSettings::GetMathLayoutRTL() const
|
||||||
|
{
|
||||||
|
return GetConfigLayoutRTL(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user