summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-05-05 09:58:47 +0200
committerNoel Grandin <noel@peralex.com>2015-05-06 09:01:29 +0200
commitbfcb2a1a75ae0ff780bff0747ea90c1e79a56fc3 (patch)
tree27c331cb0cfd7fd4717b61bfe7ec493e9c512fc1 /sw
parent9b37c2176e4da7575398c15921e3466208f19847 (diff)
convert DEFAULTFONT_ constants to scoped enum
Change-Id: Ia33e957f6cf530e2639b3c86d9482f642652cb46
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/doc/DocumentStylePoolManager.cxx62
-rw-r--r--sw/source/filter/html/htmlform.cxx2
-rw-r--r--sw/source/filter/html/htmlforw.cxx2
-rw-r--r--sw/source/ui/config/optpage.cxx6
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx2
-rw-r--r--sw/source/ui/misc/outline.cxx2
-rw-r--r--sw/source/uibase/app/docshini.cxx16
-rw-r--r--sw/source/uibase/config/fontcfg.cxx14
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx4
-rw-r--r--sw/source/uibase/shells/annotsh.cxx2
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx2
-rw-r--r--sw/source/uibase/uiview/viewling.cxx2
12 files changed, 65 insertions, 51 deletions
diff --git a/sw/source/core/doc/DocumentStylePoolManager.cxx b/sw/source/core/doc/DocumentStylePoolManager.cxx
index f415ca6fc1df..3276b9f4db46 100644
--- a/sw/source/core/doc/DocumentStylePoolManager.cxx
+++ b/sw/source/core/doc/DocumentStylePoolManager.cxx
@@ -102,7 +102,7 @@ namespace
return nWidth - nLeft - nRight;
}
- static void lcl_SetDfltFont( sal_uInt16 nFntType, SfxItemSet& rSet )
+ static void lcl_SetDfltFont( DefaultFontType nFntType, SfxItemSet& rSet )
{
static struct {
sal_uInt16 nResLngId;
@@ -125,17 +125,17 @@ namespace
}
}
- static void lcl_SetDfltFont( sal_uInt16 nLatinFntType, sal_uInt16 nCJKFntType,
- sal_uInt16 nCTLFntType, SfxItemSet& rSet )
+ static void lcl_SetDfltFont( DefaultFontType nLatinFntType, DefaultFontType nCJKFntType,
+ DefaultFontType nCTLFntType, SfxItemSet& rSet )
{
static struct {
sal_uInt16 nResLngId;
sal_uInt16 nResFntId;
- sal_uInt16 nFntType;
+ DefaultFontType nFntType;
} aArr[ 3 ] = {
- { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, 0 },
- { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, 0 },
- { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, 0 }
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_FONT, static_cast<DefaultFontType>(0) },
+ { RES_CHRATR_CJK_LANGUAGE, RES_CHRATR_CJK_FONT, static_cast<DefaultFontType>(0) },
+ { RES_CHRATR_CTL_LANGUAGE, RES_CHRATR_CTL_FONT, static_cast<DefaultFontType>(0) }
};
aArr[0].nFntType = nLatinFntType;
aArr[1].nFntType = nCJKFntType;
@@ -172,8 +172,8 @@ namespace
if( bHTMLMode )
{
- lcl_SetDfltFont( DEFAULTFONT_LATIN_TEXT, DEFAULTFONT_CJK_TEXT,
- DEFAULTFONT_CTL_TEXT, rSet );
+ lcl_SetDfltFont( DefaultFontType::LATIN_TEXT, DefaultFontType::CJK_TEXT,
+ DefaultFontType::CTL_TEXT, rSet );
}
if( pColl )
@@ -424,28 +424,42 @@ SwTxtFmtColl* DocumentStylePoolManager::GetTxtCollFromPool( sal_uInt16 nId, bool
case RES_POOLCOLL_HEADLINE_BASE: // Base headline
{
- static const sal_uInt16 aFntInit[] = {
- DEFAULTFONT_LATIN_HEADING, RES_CHRATR_FONT,
- RES_CHRATR_LANGUAGE, LANGUAGE_ENGLISH_US,
- DEFAULTFONT_CJK_HEADING, RES_CHRATR_CJK_FONT,
- RES_CHRATR_CJK_LANGUAGE, LANGUAGE_ENGLISH_US,
- DEFAULTFONT_CTL_HEADING, RES_CHRATR_CTL_FONT,
- RES_CHRATR_CTL_LANGUAGE, LANGUAGE_ARABIC_SAUDI_ARABIA,
- 0
+ static const sal_uInt16 aFontWhich[] =
+ { RES_CHRATR_FONT,
+ RES_CHRATR_CJK_FONT,
+ RES_CHRATR_CTL_FONT
+ };
+ static const sal_uInt16 aLangTypes[] =
+ {
+ RES_CHRATR_LANGUAGE,
+ RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE
+ };
+ static const sal_uInt16 aLangs[] =
+ {
+ LANGUAGE_ENGLISH_US,
+ LANGUAGE_ENGLISH_US,
+ LANGUAGE_ARABIC_SAUDI_ARABIA
+ };
+ static const DefaultFontType nFontTypes[] =
+ {
+ DefaultFontType::LATIN_HEADING,
+ DefaultFontType::CJK_HEADING,
+ DefaultFontType::CTL_HEADING
};
- for( const sal_uInt16* pArr = aFntInit; *pArr; pArr += 4 )
+ for( int i = 0; i < 3; ++i )
{
- sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(m_rDoc.GetDefault( *(pArr+2) )).GetLanguage();
+ sal_uInt16 nLng = static_cast<const SvxLanguageItem&>(m_rDoc.GetDefault( aLangTypes[i] )).GetLanguage();
if( LANGUAGE_DONTKNOW == nLng )
- nLng = *(pArr+3);
+ nLng = aLangs[i];
- vcl::Font aFnt( OutputDevice::GetDefaultFont( *pArr,
+ vcl::Font aFnt( OutputDevice::GetDefaultFont( nFontTypes[i],
nLng, DEFAULTFONT_FLAGS_ONLYONE ) );
aSet.Put( SvxFontItem( aFnt.GetFamily(), aFnt.GetName(),
OUString(), aFnt.GetPitch(),
- aFnt.GetCharSet(), *(pArr+1) ));
+ aFnt.GetCharSet(), aFontWhich[i] ));
}
SvxFontHeightItem aFntSize( PT_14, 100, RES_CHRATR_FONTSIZE );
@@ -978,7 +992,7 @@ SwTxtFmtColl* DocumentStylePoolManager::GetTxtCollFromPool( sal_uInt16 nId, bool
case RES_POOLCOLL_HTML_PRE:
{
- ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
+ ::lcl_SetDfltFont( DefaultFontType::FIXED, aSet );
// WORKAROUND: Set PRE to 10pt
SetAllScriptItem( aSet, SvxFontHeightItem(PT_10, 100, RES_CHRATR_FONTSIZE) );
@@ -1233,7 +1247,7 @@ SwFmt* DocumentStylePoolManager::GetFmtFromPool( sal_uInt16 nId )
case RES_POOLCHR_HTML_KEYBOARD:
case RES_POOLCHR_HTML_TELETYPE:
{
- ::lcl_SetDfltFont( DEFAULTFONT_FIXED, aSet );
+ ::lcl_SetDfltFont( DefaultFontType::FIXED, aSet );
}
break;
case RES_POOLCHR_VERT_NUM:
diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx
index ea8b4ab9d4cc..c99dd5f9bbbc 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -610,7 +610,7 @@ static void lcl_html_setFixedFontProperty(
const uno::Reference< beans::XPropertySet >& rPropSet )
{
vcl::Font aFixedFont( OutputDevice::GetDefaultFont(
- DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US,
+ DefaultFontType::FIXED, LANGUAGE_ENGLISH_US,
DEFAULTFONT_FLAGS_ONLYONE ) );
Any aTmp;
aTmp <<= OUString( aFixedFont.GetName() );
diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx
index d11447bf8a28..add3ced7b37c 100644
--- a/sw/source/filter/html/htmlforw.cxx
+++ b/sw/source/filter/html/htmlforw.cxx
@@ -1076,7 +1076,7 @@ Writer& OutHTML_DrawFrmFmtAsControl( Writer& rWrt,
!static_cast<const OUString*>(aTmp.getValue())->isEmpty() )
{
vcl::Font aFixedFont( OutputDevice::GetDefaultFont(
- DEFAULTFONT_FIXED, LANGUAGE_ENGLISH_US,
+ DefaultFontType::FIXED, LANGUAGE_ENGLISH_US,
DEFAULTFONT_FLAGS_ONLYONE ) );
OUString aFName( *static_cast<OUString const *>(aTmp.getValue()) );
if( !bEdit || aFName != aFixedFont.GetName() )
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 3186484c52a4..9d5e019b17ef 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -2311,11 +2311,11 @@ void SwRedlineOptionsTabPage::InitFontStyle(SvxFontPrevWindow& rExampleWin)
SvxFont& rCJKFont = rExampleWin.GetCJKFont();
SvxFont& rCTLFont = rExampleWin.GetCTLFont();
- vcl::Font aFont( OutputDevice::GetDefaultFont( DEFAULTFONT_SERIF, eLangType,
+ vcl::Font aFont( OutputDevice::GetDefaultFont( DefaultFontType::SERIF, eLangType,
DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
- vcl::Font aCJKFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT, eLangType,
+ vcl::Font aCJKFont( OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT, eLangType,
DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
- vcl::Font aCTLFont( OutputDevice::GetDefaultFont( DEFAULTFONT_CTL_TEXT, eLangType,
+ vcl::Font aCTLFont( OutputDevice::GetDefaultFont( DefaultFontType::CTL_TEXT, eLangType,
DEFAULTFONT_FLAGS_ONLYONE, &rExampleWin ) );
const Size aDefSize( 0, 12 );
aFont.SetSize( aDefSize );
diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx
index c80791318e9c..588e190dbe8f 100644
--- a/sw/source/ui/dialog/ascfldlg.cxx
+++ b/sw/source/ui/dialog/ascfldlg.cxx
@@ -204,7 +204,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh,
if( aOpt.GetFontName().isEmpty() )
{
LanguageType eLang = aOpt.GetLanguage();
- vcl::Font aTmpFont(OutputDevice::GetDefaultFont(DEFAULTFONT_FIXED, eLang, DEFAULTFONT_FLAGS_ONLYONE, pPrt));
+ vcl::Font aTmpFont(OutputDevice::GetDefaultFont(DefaultFontType::FIXED, eLang, DEFAULTFONT_FLAGS_ONLYONE, pPrt));
aOpt.SetFontName(aTmpFont.GetName());
}
diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx
index 679cdcbeedc6..38fa785ef4b9 100644
--- a/sw/source/ui/misc/outline.cxx
+++ b/sw/source/ui/misc/outline.cxx
@@ -954,7 +954,7 @@ void NumberingPreview::Paint( vcl::RenderContext& /*rRenderContext*/, const Rect
const long nYStep = (aSize.Height() - 6)/ MAXLEVEL;
long nYStart = 4;
aStdFont = OutputDevice::GetDefaultFont(
- DEFAULTFONT_UI_SANS, GetAppLanguage(),
+ DefaultFontType::UI_SANS, GetAppLanguage(),
DEFAULTFONT_FLAGS_ONLYONE, this );
// #101524# OJ
aStdFont.SetColor( SwViewOption::GetFontColor() );
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index c6fd4d17f3a8..7ea0063b9655 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -143,30 +143,30 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
SfxPrinter* pPrt = m_pDoc->getIDocumentDeviceAccess().getPrinter( false );
OUString sEntry;
- sal_uInt16 aFontWhich[] =
+ static const sal_uInt16 aFontWhich[] =
{ RES_CHRATR_FONT,
RES_CHRATR_CJK_FONT,
RES_CHRATR_CTL_FONT
};
- sal_uInt16 aFontHeightWhich[] =
+ static const sal_uInt16 aFontHeightWhich[] =
{
RES_CHRATR_FONTSIZE,
RES_CHRATR_CJK_FONTSIZE,
RES_CHRATR_CTL_FONTSIZE
};
- sal_uInt16 aFontIds[] =
+ static const sal_uInt16 aFontIds[] =
{
FONT_STANDARD,
FONT_STANDARD_CJK,
FONT_STANDARD_CTL
};
- sal_uInt16 nFontTypes[] =
+ static const DefaultFontType nFontTypes[] =
{
- DEFAULTFONT_LATIN_TEXT,
- DEFAULTFONT_CJK_TEXT,
- DEFAULTFONT_CTL_TEXT
+ DefaultFontType::LATIN_TEXT,
+ DefaultFontType::CJK_TEXT,
+ DefaultFontType::CTL_TEXT
};
- sal_uInt16 aLangTypes[] =
+ static const sal_uInt16 aLangTypes[] =
{
RES_CHRATR_LANGUAGE,
RES_CHRATR_CJK_LANGUAGE,
diff --git a/sw/source/uibase/config/fontcfg.cxx b/sw/source/uibase/config/fontcfg.cxx
index 53971f9aede6..949b43bcb06c 100644
--- a/sw/source/uibase/config/fontcfg.cxx
+++ b/sw/source/uibase/config/fontcfg.cxx
@@ -226,32 +226,32 @@ bool SwStdFontConfig::IsFontDefault(sal_uInt16 nFontType) const
OUString SwStdFontConfig::GetDefaultFor(sal_uInt16 nFontType, LanguageType eLang)
{
- sal_uInt16 nFontId;
+ DefaultFontType nFontId;
switch( nFontType )
{
case FONT_OUTLINE :
- nFontId = DEFAULTFONT_LATIN_HEADING;
+ nFontId = DefaultFontType::LATIN_HEADING;
break;
case FONT_OUTLINE_CJK :
- nFontId = DEFAULTFONT_CJK_HEADING;
+ nFontId = DefaultFontType::CJK_HEADING;
break;
case FONT_OUTLINE_CTL :
- nFontId = DEFAULTFONT_CTL_HEADING;
+ nFontId = DefaultFontType::CTL_HEADING;
break;
case FONT_STANDARD_CJK:
case FONT_LIST_CJK :
case FONT_CAPTION_CJK :
case FONT_INDEX_CJK :
- nFontId = DEFAULTFONT_CJK_TEXT;
+ nFontId = DefaultFontType::CJK_TEXT;
break;
case FONT_STANDARD_CTL:
case FONT_LIST_CTL :
case FONT_CAPTION_CTL :
case FONT_INDEX_CTL :
- nFontId = DEFAULTFONT_CTL_TEXT;
+ nFontId = DefaultFontType::CTL_TEXT;
break;
default:
- nFontId = DEFAULTFONT_LATIN_TEXT;
+ nFontId = DefaultFontType::LATIN_TEXT;
}
vcl::Font aFont = OutputDevice::GetDefaultFont(nFontId, eLang, DEFAULTFONT_FLAGS_ONLYONE);
return aFont.GetName();
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index b6776f23456e..9f9bc20b5e38 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -962,10 +962,10 @@ void SwSrcEditWindow::SetFont()
if(lcl_GetLanguagesForEncoding(eSourceEncoding, aLanguages))
{
//TODO: check for multiple languages
- aFont = OutputDevice::GetDefaultFont(DEFAULTFONT_FIXED, aLanguages[0], 0, this);
+ aFont = OutputDevice::GetDefaultFont(DefaultFontType::FIXED, aLanguages[0], 0, this);
}
else
- aFont = OutputDevice::GetDefaultFont(DEFAULTFONT_SANS_UNICODE,
+ aFont = OutputDevice::GetDefaultFont(DefaultFontType::SANS_UNICODE,
Application::GetSettings().GetLanguageTag().getLanguageType(), 0, this);
sFontName = aFont.GetName();
}
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index d2c7b17b4bc8..7a4f003eb4ab 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1284,7 +1284,7 @@ void SwAnnotationShell::ExecLingu(SfxRequest &rReq)
if( !bCommonTerms )
nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
- vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT,
+ vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT,
nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
pOLV->StartTextConversion( nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false );
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 96d5ea10b9e8..cb11915ca6c6 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -359,7 +359,7 @@ void SwDrawTextShell::ExecDrawLingu(SfxRequest &rReq)
if(!bCommonTerms)
nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
- vcl::Font aTargetFont = OutputDevice::GetDefaultFont(DEFAULTFONT_CJK_TEXT, nTargetLang, DEFAULTFONT_FLAGS_ONLYONE);
+ vcl::Font aTargetFont = OutputDevice::GetDefaultFont(DefaultFontType::CJK_TEXT, nTargetLang, DEFAULTFONT_FLAGS_ONLYONE);
pOutlinerView->StartTextConversion(nSourceLang, nTargetLang, &aTargetFont, nOptions, false, false);
}
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 7193b042f2f1..669d7e3fb178 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -164,7 +164,7 @@ void SwView::ExecLingu(SfxRequest &rReq)
if( !bCommonTerms )
nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;
- vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DEFAULTFONT_CJK_TEXT,
+ vcl::Font aTargetFont = OutputDevice::GetDefaultFont( DefaultFontType::CJK_TEXT,
nTargetLang, DEFAULTFONT_FLAGS_ONLYONE );
// disallow formatting, updating the view, ... while