summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-08-13 09:59:06 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-08-13 10:53:42 +0100
commitd5c9e77296056aa5e29a26bd3d8fb01e28dabde2 (patch)
treebe6addc5c949eaac658879c3a267706c1631a014 /sw
parentfc2b42ed182c8e7d20a8626712b8a416d7a5bae5 (diff)
Default ascii import dialog to fixed text font the the detected language
For the Ascii import dialog detect the language first and base the default fonts off that as the default fixed width font for that language Change-Id: I6e81c7c38900a441076dc591c070b99a2184e081
Diffstat (limited to 'sw')
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx95
1 files changed, 40 insertions, 55 deletions
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index 595375af6bf7..399f807de10c 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -149,11 +149,44 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh,
}
}
+ sal_uInt16 nAppScriptType = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
SwDoc* pDoc = rDocSh.GetDoc();
- sal_uInt16 nAppScriptType = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() );
+ // initialise language
{
- sal_Bool bDelPrinter = sal_False;
+ if( !aOpt.GetLanguage() )
+ {
+ if(pDoc)
+ {
+ sal_uInt16 nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType);
+ aOpt.SetLanguage( ((SvxLanguageItem&)pDoc->
+ GetDefault( nWhich )).GetLanguage());
+ }
+ else
+ {
+ SvtLinguOptions aLinguOpt;
+ SvtLinguConfig().GetOptions( aLinguOpt );
+ switch(nAppScriptType)
+ {
+ case SCRIPTTYPE_ASIAN:
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, SCRIPTTYPE_ASIAN));
+ break;
+ case SCRIPTTYPE_COMPLEX:
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, SCRIPTTYPE_COMPLEX));
+ break;
+ //SCRIPTTYPE_LATIN:
+ default:
+ aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, SCRIPTTYPE_LATIN));
+ }
+ }
+ }
+
+ aLanguageLB.SetLanguageList( LANG_LIST_ALL, sal_True, sal_False );
+ aLanguageLB.SelectLanguage( aOpt.GetLanguage() );
+ }
+
+ {
+ bool bDelPrinter = false;
SfxPrinter* pPrt = pDoc ? pDoc->getPrinter(false) : 0;
if( !pPrt )
{
@@ -162,10 +195,9 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh,
SID_PRINTER_CHANGESTODOC, SID_PRINTER_CHANGESTODOC,
0 );
pPrt = new SfxPrinter( pSet );
- bDelPrinter = sal_True;
+ bDelPrinter = true;
}
-
// get the set of disctinct available family names
std::set< String > aFontNames;
int nFontNames = pPrt->GetDevFontCount();
@@ -184,65 +216,18 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh,
if( !aOpt.GetFontName().Len() )
{
- if(pDoc)
- {
- sal_uInt16 nFontRes = RES_CHRATR_FONT;
- if(SCRIPTTYPE_ASIAN == nAppScriptType)
- nFontRes = RES_CHRATR_CJK_FONT;
- else if(SCRIPTTYPE_COMPLEX == nAppScriptType)
- nFontRes = RES_CHRATR_CTL_FONT;
-
- aOpt.SetFontName( ((SvxFontItem&)pDoc->GetDefault(
- nFontRes )).GetFamilyName() );
- }
- else
- {
- sal_uInt16 nFontType = FONT_STANDARD;
- if(SCRIPTTYPE_ASIAN == nAppScriptType)
- nFontType = FONT_STANDARD_CJK;
- else if(SCRIPTTYPE_COMPLEX == nAppScriptType)
- nFontType = FONT_STANDARD_CTL;
- aOpt.SetFontName(SW_MOD()->GetStdFontConfig()->GetFontFor(nFontType));
- }
+ LanguageType eLang = aOpt.GetLanguage();
+ Font aTmpFont(OutputDevice::GetDefaultFont(DEFAULTFONT_FIXED, eLang, DEFAULTFONT_FLAGS_ONLYONE, pPrt));
+ aOpt.SetFontName(aTmpFont.GetName());
}
+
aFontLB.SelectEntry( aOpt.GetFontName() );
if( bDelPrinter )
delete pPrt;
}
- // initialise language
- {
- if( !aOpt.GetLanguage() )
- {
- if(pDoc)
- {
- sal_uInt16 nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType);
- aOpt.SetLanguage( ((SvxLanguageItem&)pDoc->
- GetDefault( nWhich )).GetLanguage());
- }
- else
- {
- SvtLinguOptions aLinguOpt;
- SvtLinguConfig().GetOptions( aLinguOpt );
- switch(nAppScriptType)
- {
- case SCRIPTTYPE_ASIAN:
- aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, SCRIPTTYPE_ASIAN));
- break;
- case SCRIPTTYPE_COMPLEX:
- aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, SCRIPTTYPE_COMPLEX));
- break;
- //SCRIPTTYPE_LATIN:
- default:
- aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, SCRIPTTYPE_LATIN));
- }
- }
- }
- aLanguageLB.SetLanguageList( LANG_LIST_ALL, sal_True, sal_False );
- aLanguageLB.SelectLanguage( aOpt.GetLanguage() );
- }
}
else
{