summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-03-30 18:30:47 +0200
committerNoel Grandin <noel@peralex.com>2016-03-31 11:56:02 +0200
commit41bdaa37cc62f656cc164992c4c7d39bec7e57e2 (patch)
tree197c7c42fac134ccf99a7438bc4f2bcbf98cefbb
parent385f6862e303030d24a2c9d3459c074fcf15c279 (diff)
tdf#84938 convert SW_* script constants to scoped enum
Change-Id: I09ad92f194a136318ea77edb802ac6601c4e58dc
-rw-r--r--sw/source/core/inc/scriptinfo.hxx3
-rw-r--r--sw/source/core/inc/swfont.hxx220
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx4
-rw-r--r--sw/source/core/text/atrstck.cxx54
-rw-r--r--sw/source/core/text/frmpaint.cxx12
-rw-r--r--sw/source/core/text/guess.cxx4
-rw-r--r--sw/source/core/text/inftxt.cxx4
-rw-r--r--sw/source/core/text/itratr.hxx6
-rw-r--r--sw/source/core/text/itrcrsr.cxx2
-rw-r--r--sw/source/core/text/itrform2.cxx18
-rw-r--r--sw/source/core/text/itrpaint.cxx2
-rw-r--r--sw/source/core/text/porfld.cxx26
-rw-r--r--sw/source/core/text/porfld.hxx4
-rw-r--r--sw/source/core/text/porftn.hxx4
-rw-r--r--sw/source/core/text/porlay.cxx12
-rw-r--r--sw/source/core/text/pormulti.cxx6
-rw-r--r--sw/source/core/text/pormulti.hxx4
-rw-r--r--sw/source/core/text/redlnitr.cxx14
-rw-r--r--sw/source/core/text/txtfld.cxx14
-rw-r--r--sw/source/core/text/txtftn.cxx20
-rw-r--r--sw/source/core/txtnode/fntcache.cxx72
-rw-r--r--sw/source/core/txtnode/swfont.cxx205
22 files changed, 357 insertions, 353 deletions
diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx
index 2cc44b208d6a..865bac95bb24 100644
--- a/sw/source/core/inc/scriptinfo.hxx
+++ b/sw/source/core/inc/scriptinfo.hxx
@@ -30,6 +30,7 @@ class SwTextNode;
class Point;
class MultiSelection;
typedef std::list< sal_Int32 > PositionList;
+enum class SwFontScript;
#define SPACING_PRECISION_FACTOR 100
@@ -354,7 +355,7 @@ public:
static SwScriptInfo* GetScriptInfo( const SwTextNode& rNode,
bool bAllowInvalid = false );
- static sal_uInt8 WhichFont(sal_Int32 nIdx, const OUString* pText, const SwScriptInfo* pSI);
+ static SwFontScript WhichFont(sal_Int32 nIdx, const OUString* pText, const SwScriptInfo* pSI);
};
#endif
diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx
index e5608e5d65c7..8070d1e2f4cc 100644
--- a/sw/source/core/inc/swfont.hxx
+++ b/sw/source/core/inc/swfont.hxx
@@ -27,6 +27,7 @@
#include <drawfont.hxx>
#include <editeng/borderline.hxx>
#include <boost/optional.hpp>
+#include <o3tl/enumarray.hxx>
class SfxItemSet;
class SwAttrSet;
@@ -117,16 +118,19 @@ public:
sal_uInt16 GetPropWidth() const { return m_nProportionalWidth; }
};
-#define SW_LATIN 0
-#define SW_CJK 1
-#define SW_CTL 2
-#define SW_SCRIPTS 3
+enum class SwFontScript
+{
+ Latin, CJK, CTL, LAST = CTL
+};
+
+// mostly used as a "unknown script" marker
+#define SW_SCRIPTS (SwFontScript(int(SwFontScript::LAST)+1))
class SW_DLLPUBLIC SwFont
{
// CJK == Chinese, Japanese, Korean
// CTL == Complex text layout ( Hebrew, Arabic )
- SwSubFont m_aSub[SW_SCRIPTS]; // Latin-, CJK- and CTL-font
+ o3tl::enumarray<SwFontScript, SwSubFont> m_aSub; // Latin-, CJK- and CTL-font
Color* m_pBackColor; // background color (i.e. at character styles)
Color m_aHighlightColor; // highlight color
@@ -154,7 +158,7 @@ class SW_DLLPUBLIC SwFont
sal_uInt8 m_nMetaCount; // count META/METAFIELD
sal_uInt8 m_nInputFieldCount; // count INPUTFIELD
- sal_uInt8 m_nActual; // actual font (Latin, CJK or CTL)
+ SwFontScript m_nActual; // actual font (Latin, CJK or CTL)
// switch for the font-extensions
bool m_bNoHyph :1; // SwTextNoHyphenHere: no separator
@@ -178,29 +182,29 @@ public:
SwFont& operator=( const SwFont &rFont );
- inline sal_uInt8 GetActual() const { return m_nActual; }
- inline void SetActual( sal_uInt8 nNew );
+ inline SwFontScript GetActual() const { return m_nActual; }
+ inline void SetActual( SwFontScript nNew );
inline const SvxFont& GetActualFont() const { return m_aSub[m_nActual]; }
// gets a MagicNumber via SwFntAccess
- void GoMagic( SwViewShell *pSh, sal_uInt8 nWhich );
+ void GoMagic( SwViewShell *pSh, SwFontScript nWhich );
// set background color
void SetBackColor( Color* pNewColor );
inline const Color* GetBackColor() const{ return m_pBackColor; }
void SetHighlightColor( const Color& aNewColor );
const Color& GetHighlightColor() const { return m_aHighlightColor; }
- inline void ChkMagic( SwViewShell *pSh, sal_uInt8 nWhich )
+ inline void ChkMagic( SwViewShell *pSh, SwFontScript nWhich )
{ if( !m_aSub[ nWhich ].m_pMagic ) GoMagic( pSh, nWhich ); }
- inline void GetMagic( const void* &rMagic, sal_uInt16 &rIdx, sal_uInt8 nWhich )
+ inline void GetMagic( const void* &rMagic, sal_uInt16 &rIdx, SwFontScript nWhich )
{ rMagic = m_aSub[nWhich].m_pMagic; rIdx = m_aSub[nWhich].m_nFontIndex; }
- inline void SetMagic( const void* pNew, const sal_uInt16 nIdx, sal_uInt8 nWhich )
+ inline void SetMagic( const void* pNew, const sal_uInt16 nIdx, SwFontScript nWhich )
{ m_aSub[nWhich].m_pMagic = pNew; m_aSub[nWhich].m_nFontIndex = nIdx; }
- inline bool DifferentMagic( const SwFont* pFnt, sal_uInt8 nWhich )
+ inline bool DifferentMagic( const SwFont* pFnt, SwFontScript nWhich )
{ return m_aSub[nWhich].m_pMagic != pFnt->m_aSub[nWhich].m_pMagic ||
!m_aSub[nWhich].m_pMagic || !pFnt->m_aSub[nWhich].m_pMagic; }
- inline const Size &GetSize( sal_uInt8 nWhich ) const
+ inline const Size &GetSize( SwFontScript nWhich ) const
{ return m_aSub[nWhich].m_aSize; }
inline bool IsFntChg() const { return m_bFontChg; }
inline void SetFntChg( const bool bNew ) { m_bFontChg = bNew; }
@@ -230,15 +234,15 @@ public:
inline void SetPropWidth( const sal_uInt16 nNew );
- inline void SetFamily( const FontFamily eFamily, const sal_uInt8 nWhich );
- inline void SetName( const OUString& rName, const sal_uInt8 nWhich );
- inline void SetStyleName( const OUString& rStyleName, const sal_uInt8 nWhich );
- inline void SetSize( const Size& rSize, const sal_uInt8 nWhich );
- inline void SetWeight( const FontWeight eWeight, const sal_uInt8 nWhich );
- inline void SetItalic( const FontItalic eItalic, const sal_uInt8 nWhich );
- inline void SetLanguage( LanguageType eNewLang, const sal_uInt8 nWhich );
- inline void SetCharSet( const rtl_TextEncoding eCharSet, const sal_uInt8 nWhich );
- inline void SetPitch( const FontPitch ePitch, const sal_uInt8 nWhich );
+ inline void SetFamily( const FontFamily eFamily, const SwFontScript nWhich );
+ inline void SetName( const OUString& rName, const SwFontScript nWhich );
+ inline void SetStyleName( const OUString& rStyleName, const SwFontScript nWhich );
+ inline void SetSize( const Size& rSize, const SwFontScript nWhich );
+ inline void SetWeight( const FontWeight eWeight, const SwFontScript nWhich );
+ inline void SetItalic( const FontItalic eItalic, const SwFontScript nWhich );
+ inline void SetLanguage( LanguageType eNewLang, const SwFontScript nWhich );
+ inline void SetCharSet( const rtl_TextEncoding eCharSet, const SwFontScript nWhich );
+ inline void SetPitch( const FontPitch ePitch, const SwFontScript nWhich );
inline void SetRelief( const FontRelief eNew );
// Get/Set-methods for the current setting
@@ -263,7 +267,7 @@ public:
void SetDiffFnt( const SfxItemSet* pSet,
const IDocumentSettingAccess* pIDocumentSettingAccess );
- inline const SvxFont &GetFnt( const sal_uInt8 nWhich ) const
+ inline const SvxFont &GetFnt( const SwFontScript nWhich ) const
{ return m_aSub[nWhich]; };
bool IsSymbol( SwViewShell *pSh )
@@ -286,13 +290,13 @@ public:
{ return m_aSub[m_nActual].GetEmphasisMark(); }
sal_uInt16 GetOrientation( const bool bVertLayout = false ) const;
- inline const OUString& GetName( const sal_uInt8 nWhich ) const
+ inline const OUString& GetName( const SwFontScript nWhich ) const
{ return m_aSub[nWhich].GetFamilyName(); }
- inline LanguageType GetLanguage( const sal_uInt8 nWhich ) const
+ inline LanguageType GetLanguage( const SwFontScript nWhich ) const
{ return m_aSub[nWhich].GetLanguage(); }
- inline rtl_TextEncoding GetCharSet( const sal_uInt8 nWhich ) const
+ inline rtl_TextEncoding GetCharSet( const SwFontScript nWhich ) const
{ return m_aSub[nWhich].GetCharSet(); }
- inline long GetHeight( const sal_uInt8 nWhich ) const
+ inline long GetHeight( const SwFontScript nWhich ) const
{ return m_aSub[nWhich].GetFontSize().Height(); }
// makes the logical font be effective in the OutputDevice
@@ -405,9 +409,9 @@ public:
inline void SwFont::SetColor( const Color& rColor )
{
m_bFontChg = true;
- m_aSub[0].SetColor( rColor );
- m_aSub[1].SetColor( rColor );
- m_aSub[2].SetColor( rColor );
+ m_aSub[SwFontScript::Latin].SetColor( rColor );
+ m_aSub[SwFontScript::CJK].SetColor( rColor );
+ m_aSub[SwFontScript::CTL].SetColor( rColor );
}
// encapsulated SV-Font-method
@@ -427,9 +431,9 @@ inline void SwSubFont::SetFillColor( const Color& rColor )
inline void SwFont::SetFillColor( const Color& rColor )
{
m_bFontChg = true;
- m_aSub[0].SetFillColor( rColor );
- m_aSub[1].SetFillColor( rColor );
- m_aSub[2].SetFillColor( rColor );
+ m_aSub[SwFontScript::Latin].SetFillColor( rColor );
+ m_aSub[SwFontScript::CJK].SetFillColor( rColor );
+ m_aSub[SwFontScript::CTL].SetFillColor( rColor );
}
// encapsulated SV-Font-method
@@ -439,7 +443,7 @@ inline void SwSubFont::SetFamily( const FontFamily eFamily )
Font::SetFamily( eFamily );
}
-inline void SwFont::SetFamily( const FontFamily eFamily, const sal_uInt8 nWhich )
+inline void SwFont::SetFamily( const FontFamily eFamily, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetFamily( eFamily );
@@ -452,7 +456,7 @@ inline void SwSubFont::SetName( const OUString& rName )
Font::SetFamilyName( rName );
}
-inline void SwFont::SetName( const OUString& rName, const sal_uInt8 nWhich )
+inline void SwFont::SetName( const OUString& rName, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetName( rName );
@@ -465,7 +469,7 @@ inline void SwSubFont::SetStyleName( const OUString& rStyleName )
Font::SetStyleName( rStyleName );
}
-inline void SwFont::SetStyleName( const OUString& rStyle, const sal_uInt8 nWhich )
+inline void SwFont::SetStyleName( const OUString& rStyle, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetStyleName( rStyle );
@@ -478,7 +482,7 @@ inline void SwSubFont::SetCharSet( const rtl_TextEncoding eCharSet )
Font::SetCharSet( eCharSet );
}
-inline void SwFont::SetCharSet( const rtl_TextEncoding eCharSet, const sal_uInt8 nWhich )
+inline void SwFont::SetCharSet( const rtl_TextEncoding eCharSet, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetCharSet( eCharSet );
@@ -492,7 +496,7 @@ inline void SwSubFont::SetPitch( const FontPitch ePitch )
}
// encapsulated SV-Font-method
-inline void SwFont::SetPitch( const FontPitch ePitch, const sal_uInt8 nWhich )
+inline void SwFont::SetPitch( const FontPitch ePitch, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetPitch( ePitch );
@@ -508,9 +512,9 @@ inline void SwSubFont::SetAlign( const FontAlign eAlign )
inline void SwFont::SetAlign( const FontAlign eAlign )
{
m_bFontChg = true;
- m_aSub[0].SetAlign( eAlign );
- m_aSub[1].SetAlign( eAlign );
- m_aSub[2].SetAlign( eAlign );
+ m_aSub[SwFontScript::Latin].SetAlign( eAlign );
+ m_aSub[SwFontScript::CJK].SetAlign( eAlign );
+ m_aSub[SwFontScript::CTL].SetAlign( eAlign );
}
// encapsulated SV-Font-method
@@ -520,7 +524,7 @@ inline void SwSubFont::SetWeight( const FontWeight eWeight )
Font::SetWeight( eWeight );
}
-inline void SwFont::SetWeight( const FontWeight eWeight, const sal_uInt8 nWhich )
+inline void SwFont::SetWeight( const FontWeight eWeight, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetWeight( eWeight );
@@ -536,9 +540,9 @@ inline void SwSubFont::SetUnderline( const FontLineStyle eUnderline )
inline void SwFont::SetUnderline( const FontLineStyle eUnderline )
{
m_bFontChg = true;
- m_aSub[0].SetUnderline( eUnderline );
- m_aSub[1].SetUnderline( eUnderline );
- m_aSub[2].SetUnderline( eUnderline );
+ m_aSub[SwFontScript::Latin].SetUnderline( eUnderline );
+ m_aSub[SwFontScript::CJK].SetUnderline( eUnderline );
+ m_aSub[SwFontScript::CTL].SetUnderline( eUnderline );
}
// encapsulated SV-Font-method
@@ -551,9 +555,9 @@ inline void SwSubFont::SetOverline( const FontLineStyle eOverline )
inline void SwFont::SetOverline( const FontLineStyle eOverline )
{
m_bFontChg = true;
- m_aSub[0].SetOverline( eOverline );
- m_aSub[1].SetOverline( eOverline );
- m_aSub[2].SetOverline( eOverline );
+ m_aSub[SwFontScript::Latin].SetOverline( eOverline );
+ m_aSub[SwFontScript::CJK].SetOverline( eOverline );
+ m_aSub[SwFontScript::CTL].SetOverline( eOverline );
}
// encapsulated SV-Font-method
@@ -566,9 +570,9 @@ inline void SwSubFont::SetStrikeout( const FontStrikeout eStrikeout )
inline void SwFont::SetStrikeout( const FontStrikeout eStrikeout )
{
m_bFontChg = true;
- m_aSub[0].SetStrikeout( eStrikeout );
- m_aSub[1].SetStrikeout( eStrikeout );
- m_aSub[2].SetStrikeout( eStrikeout );
+ m_aSub[SwFontScript::Latin].SetStrikeout( eStrikeout );
+ m_aSub[SwFontScript::CJK].SetStrikeout( eStrikeout );
+ m_aSub[SwFontScript::CTL].SetStrikeout( eStrikeout );
}
// encapsulated SV-Font-method
@@ -578,7 +582,7 @@ inline void SwSubFont::SetItalic( const FontItalic eItalic )
Font::SetItalic( eItalic );
}
-inline void SwFont::SetItalic( const FontItalic eItalic, const sal_uInt8 nWhich )
+inline void SwFont::SetItalic( const FontItalic eItalic, const SwFontScript nWhich )
{
m_bFontChg = true;
m_aSub[nWhich].SetItalic( eItalic );
@@ -594,9 +598,9 @@ inline void SwSubFont::SetOutline( const bool bOutline )
inline void SwFont::SetOutline( const bool bOutline )
{
m_bFontChg = true;
- m_aSub[0].SetOutline( bOutline );
- m_aSub[1].SetOutline( bOutline );
- m_aSub[2].SetOutline( bOutline );
+ m_aSub[SwFontScript::Latin].SetOutline( bOutline );
+ m_aSub[SwFontScript::CJK].SetOutline( bOutline );
+ m_aSub[SwFontScript::CTL].SetOutline( bOutline );
}
// encapsulated SV-Font-method
@@ -609,9 +613,9 @@ inline void SwSubFont::SetShadow( const bool bShadow )
inline void SwFont::SetShadow( const bool bShadow )
{
m_bFontChg = true;
- m_aSub[0].SetShadow( bShadow );
- m_aSub[1].SetShadow( bShadow );
- m_aSub[2].SetShadow( bShadow );
+ m_aSub[SwFontScript::Latin].SetShadow( bShadow );
+ m_aSub[SwFontScript::CJK].SetShadow( bShadow );
+ m_aSub[SwFontScript::CTL].SetShadow( bShadow );
}
// encapsulated SV-Font-method
@@ -624,32 +628,32 @@ inline void SwSubFont::SetAutoKern( FontKerning nAutoKern )
inline void SwFont::SetAutoKern( FontKerning nAutoKern )
{
m_bFontChg = true;
- m_aSub[1].SetAutoKern( nAutoKern );
+ m_aSub[SwFontScript::CJK].SetAutoKern( nAutoKern );
if( nAutoKern != FontKerning::NONE )
nAutoKern = FontKerning::FontSpecific;
- m_aSub[0].SetAutoKern( nAutoKern );
- m_aSub[2].SetAutoKern( nAutoKern );
+ m_aSub[SwFontScript::Latin].SetAutoKern( nAutoKern );
+ m_aSub[SwFontScript::CTL].SetAutoKern( nAutoKern );
}
inline void SwFont::SetTransparent( const bool bTrans )
{
- m_aSub[0].SetTransparent( bTrans );
- m_aSub[1].SetTransparent( bTrans );
- m_aSub[2].SetTransparent( bTrans );
+ m_aSub[SwFontScript::Latin].SetTransparent( bTrans );
+ m_aSub[SwFontScript::CJK].SetTransparent( bTrans );
+ m_aSub[SwFontScript::CTL].SetTransparent( bTrans );
}
inline void SwFont::SetFixKerning( const short nNewKern )
{
- m_aSub[SW_LATIN].SetFixKerning( nNewKern );
- m_aSub[SW_CJK].SetFixKerning( nNewKern );
- m_aSub[SW_CTL].SetFixKerning( nNewKern );
+ m_aSub[SwFontScript::Latin].SetFixKerning( nNewKern );
+ m_aSub[SwFontScript::CJK].SetFixKerning( nNewKern );
+ m_aSub[SwFontScript::CTL].SetFixKerning( nNewKern );
}
inline void SwFont::SetCaseMap( const SvxCaseMap eNew )
{
- m_aSub[SW_LATIN].SetCaseMap( eNew );
- m_aSub[SW_CJK].SetCaseMap( eNew );
- m_aSub[SW_CTL].SetCaseMap( eNew );
+ m_aSub[SwFontScript::Latin].SetCaseMap( eNew );
+ m_aSub[SwFontScript::CJK].SetCaseMap( eNew );
+ m_aSub[SwFontScript::CTL].SetCaseMap( eNew );
}
// encapsulated SV-Font-method
@@ -662,9 +666,9 @@ inline void SwSubFont::SetWordLineMode( const bool bWordLineMode )
inline void SwFont::SetWordLineMode( const bool bWordLineMode )
{
m_bFontChg = true;
- m_aSub[0].SetWordLineMode( bWordLineMode );
- m_aSub[1].SetWordLineMode( bWordLineMode );
- m_aSub[2].SetWordLineMode( bWordLineMode );
+ m_aSub[SwFontScript::Latin].SetWordLineMode( bWordLineMode );
+ m_aSub[SwFontScript::CJK].SetWordLineMode( bWordLineMode );
+ m_aSub[SwFontScript::CTL].SetWordLineMode( bWordLineMode );
}
// encapsulated SV-Font-method
inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue )
@@ -676,19 +680,19 @@ inline void SwSubFont::SetEmphasisMark( const FontEmphasisMark eValue )
inline void SwFont::SetEmphasisMark( const FontEmphasisMark eValue )
{
m_bFontChg = true;
- m_aSub[0].SetEmphasisMark( eValue );
- m_aSub[1].SetEmphasisMark( eValue );
- m_aSub[2].SetEmphasisMark( eValue );
+ m_aSub[SwFontScript::Latin].SetEmphasisMark( eValue );
+ m_aSub[SwFontScript::CJK].SetEmphasisMark( eValue );
+ m_aSub[SwFontScript::CTL].SetEmphasisMark( eValue );
}
inline void SwFont::SetPropWidth( const sal_uInt16 nNew )
{
- if( nNew != m_aSub[0].GetPropWidth() )
+ if( nNew != m_aSub[SwFontScript::Latin].GetPropWidth() )
{
m_bFontChg = true;
- m_aSub[0].SetPropWidth( nNew );
- m_aSub[1].SetPropWidth( nNew );
- m_aSub[2].SetPropWidth( nNew );
+ m_aSub[SwFontScript::Latin].SetPropWidth( nNew );
+ m_aSub[SwFontScript::CJK].SetPropWidth( nNew );
+ m_aSub[SwFontScript::CTL].SetPropWidth( nNew );
}
}
@@ -701,12 +705,12 @@ inline void SwSubFont::SetRelief( const FontRelief eNew )
inline void SwFont::SetRelief( const FontRelief eNew )
{
- if( eNew != m_aSub[0].GetRelief() )
+ if( eNew != m_aSub[SwFontScript::Latin].GetRelief() )
{
m_bFontChg = true;
- m_aSub[0].SetRelief( eNew );
- m_aSub[1].SetRelief( eNew );
- m_aSub[2].SetRelief( eNew );
+ m_aSub[SwFontScript::Latin].SetRelief( eNew );
+ m_aSub[SwFontScript::CJK].SetRelief( eNew );
+ m_aSub[SwFontScript::CTL].SetRelief( eNew );
}
}
@@ -725,7 +729,7 @@ inline void SwSubFont::SetSize( const Size& rSize )
m_pMagic = nullptr;
}
-inline void SwFont::SetSize( const Size& rSize, const sal_uInt8 nWhich )
+inline void SwFont::SetSize( const Size& rSize, const SwFontScript nWhich )
{
if( m_aSub[nWhich].m_aSize != rSize )
{
@@ -735,7 +739,7 @@ inline void SwFont::SetSize( const Size& rSize, const sal_uInt8 nWhich )
}
}
-inline void SwFont::SetActual( sal_uInt8 nNew )
+inline void SwFont::SetActual( SwFontScript nNew )
{
if ( m_nActual != nNew )
{
@@ -755,14 +759,14 @@ inline void SwSubFont::SetProportion( const sal_uInt8 nNewPropr )
inline void SwFont::SetProportion( const sal_uInt8 nNewPropr )
{
- if( nNewPropr != m_aSub[0].GetPropr() )
+ if( nNewPropr != m_aSub[SwFontScript::Latin].GetPropr() )
{
m_bFontChg = true;
m_bOrgChg = true;
- m_aSub[0].SetProportion( nNewPropr );
- m_aSub[1].SetProportion( nNewPropr );
- m_aSub[2].SetProportion( nNewPropr );
+ m_aSub[SwFontScript::Latin].SetProportion( nNewPropr );
+ m_aSub[SwFontScript::CJK].SetProportion( nNewPropr );
+ m_aSub[SwFontScript::CTL].SetProportion( nNewPropr );
}
}
@@ -774,16 +778,16 @@ inline void SwSubFont::SetEscapement( const short nNewEsc )
inline void SwFont::SetEscapement( const short nNewEsc )
{
- if( nNewEsc != m_aSub[0].GetEscapement() )
+ if( nNewEsc != m_aSub[SwFontScript::Latin].GetEscapement() )
{
// these have to be set, otherwise nOrgHeight and nOrgAscent will not
// be calculated
m_bFontChg = true;
m_bOrgChg = true;
- m_aSub[0].SetEscapement( nNewEsc );
- m_aSub[1].SetEscapement( nNewEsc );
- m_aSub[2].SetEscapement( nNewEsc );
+ m_aSub[SwFontScript::Latin].SetEscapement( nNewEsc );
+ m_aSub[SwFontScript::CJK].SetEscapement( nNewEsc );
+ m_aSub[SwFontScript::CTL].SetEscapement( nNewEsc );
}
}
@@ -795,14 +799,14 @@ inline void SwSubFont::SetLanguage( LanguageType eNewLang )
SvxFont::SetLanguage( eNewLang );
}
-inline void SwFont::SetLanguage( const LanguageType eNewLang, const sal_uInt8 nWhich )
+inline void SwFont::SetLanguage( const LanguageType eNewLang, const SwFontScript nWhich )
{
m_aSub[nWhich].SetLanguage( eNewLang );
- if( SW_CJK == nWhich )
+ if( SwFontScript::CJK == nWhich )
{
- m_aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
- m_aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
- m_aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
}
}
@@ -837,28 +841,28 @@ inline void SwFont::SetTopBorderDist( const sal_uInt16 nTopDist )
{
m_nTopBorderDist = nTopDist;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline void SwFont::SetBottomBorderDist( const sal_uInt16 nBottomDist )
{
m_nBottomBorderDist = nBottomDist;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline void SwFont::SetRightBorderDist( const sal_uInt16 nRightDist )
{
m_nRightBorderDist = nRightDist;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline void SwFont::SetLeftBorderDist( const sal_uInt16 nLeftDist )
{
m_nLeftBorderDist = nLeftDist;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline sal_uInt16 SwFont::GetTopBorderSpace() const
@@ -930,28 +934,28 @@ inline void SwFont::SetShadowColor( const Color& rColor )
{
m_aShadowColor = rColor;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline void SwFont::SetShadowWidth( const sal_uInt16 nWidth )
{
m_nShadowWidth = nWidth;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline void SwFont::SetShadowLocation( const SvxShadowLocation aLocation )
{
m_aShadowLocation = aLocation;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
inline void SwFont::SetHighlightColor( const Color& aNewColor )
{
m_aHighlightColor = aNewColor;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
// Used for the "continuous underline" feature.
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index b9b72cdb4700..c20cb7572329 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1374,7 +1374,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
else
{
const LanguageType nCurrentLanguage = rInf.GetFont()->GetLanguage();
- const sal_uInt8 nFont = rInf.GetFont()->GetActual();
+ const SwFontScript nFont = rInf.GetFont()->GetActual();
const LanguageType nDefaultLang = SwEnhancedPDFExportHelper::GetDefaultLanguage();
if ( LINESTYLE_NONE != rInf.GetFont()->GetUnderline() ||
@@ -1382,7 +1382,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
STRIKEOUT_NONE != rInf.GetFont()->GetStrikeout() ||
EMPHASISMARK_NONE != rInf.GetFont()->GetEmphasisMark() ||
0 != rInf.GetFont()->GetEscapement() ||
- SW_LATIN != nFont ||
+ SwFontScript::Latin != nFont ||
nCurrentLanguage != nDefaultLang ||
!sStyleName.isEmpty())
{
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 103f32d6be62..c5dea9769857 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -653,23 +653,23 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
rFnt.SetProportion( static_cast<const SvxEscapementItem&>(rItem).GetProportionalHeight() );
break;
case RES_CHRATR_FONT :
- rFnt.SetName( static_cast<const SvxFontItem&>(rItem).GetFamilyName(), SW_LATIN );
- rFnt.SetStyleName( static_cast<const SvxFontItem&>(rItem).GetStyleName(), SW_LATIN );
- rFnt.SetFamily( static_cast<const SvxFontItem&>(rItem).GetFamily(), SW_LATIN );
- rFnt.SetPitch( static_cast<const SvxFontItem&>(rItem).GetPitch(), SW_LATIN );
- rFnt.SetCharSet( static_cast<const SvxFontItem&>(rItem).GetCharSet(), SW_LATIN );
+ rFnt.SetName( static_cast<const SvxFontItem&>(rItem).GetFamilyName(), SwFontScript::Latin );
+ rFnt.SetStyleName( static_cast<const SvxFontItem&>(rItem).GetStyleName(), SwFontScript::Latin );
+ rFnt.SetFamily( static_cast<const SvxFontItem&>(rItem).GetFamily(), SwFontScript::Latin );
+ rFnt.SetPitch( static_cast<const SvxFontItem&>(rItem).GetPitch(), SwFontScript::Latin );
+ rFnt.SetCharSet( static_cast<const SvxFontItem&>(rItem).GetCharSet(), SwFontScript::Latin );
break;
case RES_CHRATR_FONTSIZE :
- rFnt.SetSize(Size(0,static_cast<const SvxFontHeightItem&>(rItem).GetHeight() ), SW_LATIN );
+ rFnt.SetSize(Size(0,static_cast<const SvxFontHeightItem&>(rItem).GetHeight() ), SwFontScript::Latin );
break;
case RES_CHRATR_KERNING :
rFnt.SetFixKerning( static_cast<const SvxKerningItem&>(rItem).GetValue() );
break;
case RES_CHRATR_LANGUAGE :
- rFnt.SetLanguage( static_cast<const SvxLanguageItem&>(rItem).GetLanguage(), SW_LATIN );
+ rFnt.SetLanguage( static_cast<const SvxLanguageItem&>(rItem).GetLanguage(), SwFontScript::Latin );
break;
case RES_CHRATR_POSTURE :
- rFnt.SetItalic( static_cast<const SvxPostureItem&>(rItem).GetPosture(), SW_LATIN );
+ rFnt.SetItalic( static_cast<const SvxPostureItem&>(rItem).GetPosture(), SwFontScript::Latin );
break;
case RES_CHRATR_SHADOWED :
rFnt.SetShadow( static_cast<const SvxShadowedItem&>(rItem).GetValue() );
@@ -717,7 +717,7 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
rFnt.SetOverColor( static_cast<const SvxOverlineItem&>(rItem).GetColor() );
break;
case RES_CHRATR_WEIGHT :
- rFnt.SetWeight( static_cast<const SvxWeightItem&>(rItem).GetWeight(), SW_LATIN );
+ rFnt.SetWeight( static_cast<const SvxWeightItem&>(rItem).GetWeight(), SwFontScript::Latin );
break;
case RES_CHRATR_WORDLINEMODE :
rFnt.SetWordLineMode( static_cast<const SvxWordLineModeItem&>(rItem).GetValue() );
@@ -743,42 +743,42 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush )
rFnt.SetHighlightColor( static_cast<const SvxBrushItem&>(rItem).GetColor() );
break;
case RES_CHRATR_CJK_FONT :
- rFnt.SetName( static_cast<const SvxFontItem&>(rItem).GetFamilyName(), SW_CJK );
- rFnt.SetStyleName( static_cast<const SvxFontItem&>(rItem).GetStyleName(), SW_CJK );
- rFnt.SetFamily( static_cast<const SvxFontItem&>(rItem).GetFamily(), SW_CJK );
- rFnt.SetPitch( static_cast<const SvxFontItem&>(rItem).GetPitch(), SW_CJK );
- rFnt.SetCharSet( static_cast<const SvxFontItem&>(rItem).GetCharSet(), SW_CJK );
+ rFnt.SetName( static_cast<const SvxFontItem&>(rItem).GetFamilyName(), SwFontScript::CJK );
+ rFnt.SetStyleName( static_cast<const SvxFontItem&>(rItem).GetStyleName(), SwFontScript::CJK );
+ rFnt.SetFamily( static_cast<const SvxFontItem&>(rItem).GetFamily(), SwFontScript::CJK );
+ rFnt.SetPitch( static_cast<const SvxFontItem&>(rItem).GetPitch(), SwFontScript::CJK );
+ rFnt.SetCharSet( static_cast<const SvxFontItem&>(rItem).GetCharSet(), SwFontScript::CJK );
break;
case RES_CHRATR_CJK_FONTSIZE :
- rFnt.SetSize(Size( 0, static_cast<const SvxFontHeightItem&>(rItem).GetHeight()), SW_CJK);
+ rFnt.SetSize(Size( 0, static_cast<const SvxFontHeightItem&>(rItem).GetHeight()), SwFontScript::CJK);
break;
case RES_CHRATR_CJK_LANGUAGE :
- rFnt.SetLanguage( static_cast<const SvxLanguageItem&>(rItem).GetLanguage(), SW_CJK );
+ rFnt.SetLanguage( static_cast<const SvxLanguageItem&>(rItem).GetLanguage(), SwFontScript::CJK );
break;
case RES_CHRATR_CJK_POSTURE :
- rFnt.SetItalic( static_cast<const SvxPostureItem&>(rItem).GetPosture(), SW_CJK );
+ rFnt.SetItalic( static_cast<const SvxPostureItem&>(rItem).GetPosture(), SwFontScript::CJK );
break;
case RES_CHRATR_CJK_WEIGHT :
- rFnt.SetWeight( static_cast<const SvxWeightItem&>(rItem).GetWeight(), SW_CJK );
+ rFnt.SetWeight( static_cast<const SvxWeightItem&>(rItem).GetWeight(), SwFontScript::CJK );
break;
case RES_CHRATR_CTL_FONT :
- rFnt.SetName( static_cast<const SvxFontItem&>(rItem).GetFamilyName(), SW_CTL );
- rFnt.SetStyleName( static_cast<const SvxFontItem&>(rItem).GetStyleName(), SW_CTL );
- rFnt.SetFamily( static_cast<const SvxFontItem&>(rItem).GetFamily(), SW_CTL );
- rFnt.SetPitch( static_cast<const SvxFontItem&>(rItem).GetPitch(), SW_CTL );
- rFnt.SetCharSet( static_cast<const SvxFontItem&>(rItem).GetCharSet(), SW_CTL );
+ rFnt.SetName( static_cast<const SvxFontItem&>(rItem).GetFamilyName(), SwFontScript::CTL );
+ rFnt.SetStyleName( static_cast<const SvxFontItem&>(rItem).GetStyleName(), SwFontScript::CTL );
+ rFnt.SetFamily( static_cast<const SvxFontItem&>(rItem).GetFamily(), SwFontScript::CTL );
+ rFnt.SetPitch( static_cast<const SvxFontItem&>(rItem).GetPitch(), SwFontScript::CTL );
+ rFnt.SetCharSet( static_cast<const SvxFontItem&>(rItem).GetCharSet(), SwFontScript::CTL );
break;
case RES_CHRATR_CTL_FONTSIZE :
- rFnt.SetSize(Size(0, static_cast<const SvxFontHeightItem&>(rItem).GetHeight() ), SW_CTL);
+ rFnt.SetSize(Size(0, static_cast<const SvxFontHeightItem&>(rItem).GetHeight() ), SwFontScript::CTL);
break;
case RES_CHRATR_CTL_LANGUAGE :
- rFnt.SetLanguage( static_cast<const SvxLanguageItem&>(rItem).GetLanguage(), SW_CTL );
+ rFnt.SetLanguage( static_cast<const SvxLanguageItem&>(rItem).GetLanguage(), SwFontScript::CTL );
break;
case RES_CHRATR_CTL_POSTURE :
- rFnt.SetItalic( static_cast<const SvxPostureItem&>(rItem).GetPosture(), SW_CTL );
+ rFnt.SetItalic( static_cast<const SvxPostureItem&>(rItem).GetPosture(), SwFontScript::CTL );
break;
case RES_CHRATR_CTL_WEIGHT :
- rFnt.SetWeight( static_cast<const SvxWeightItem&>(rItem).GetWeight(), SW_CTL );
+ rFnt.SetWeight( static_cast<const SvxWeightItem&>(rItem).GetWeight(), SwFontScript::CTL );
break;
case RES_CHRATR_EMPHASIS_MARK :
rFnt.SetEmphasisMark(
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index b287c77e9b05..842bd4073123 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -493,13 +493,13 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const
if( pSh->GetViewOptions()->IsParagraph() && Prt().Height() )
{
- if( RTL_TEXTENCODING_SYMBOL == pFnt->GetCharSet( SW_LATIN ) &&
- pFnt->GetName( SW_LATIN ) != numfunc::GetDefBulletFontname() )
+ if( RTL_TEXTENCODING_SYMBOL == pFnt->GetCharSet( SwFontScript::Latin ) &&
+ pFnt->GetName( SwFontScript::Latin ) != numfunc::GetDefBulletFontname() )
{
- pFnt->SetFamily( FAMILY_DONTKNOW, SW_LATIN );
- pFnt->SetName( numfunc::GetDefBulletFontname(), SW_LATIN );
- pFnt->SetStyleName( aEmptyOUStr, SW_LATIN );
- pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, SW_LATIN );
+ pFnt->SetFamily( FAMILY_DONTKNOW, SwFontScript::Latin );
+ pFnt->SetName( numfunc::GetDefBulletFontname(), SwFontScript::Latin );
+ pFnt->SetStyleName( aEmptyOUStr, SwFontScript::Latin );
+ pFnt->SetCharSet( RTL_TEXTENCODING_SYMBOL, SwFontScript::Latin );
}
pFnt->SetVertical( 0, IsVertical() );
SwFrameSwapper aSwapper( this, true );
diff --git a/sw/source/core/text/guess.cxx b/sw/source/core/text/guess.cxx
index 92a43c00e608..ce0c0f0ed38d 100644
--- a/sw/source/core/text/guess.cxx
+++ b/sw/source/core/text/guess.cxx
@@ -63,7 +63,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
const SwScriptInfo& rSI =
static_cast<SwParaPortion*>(rInf.GetParaPortion())->GetScriptInfo();
- sal_uInt16 nMaxComp = ( SW_CJK == rInf.GetFont()->GetActual() ) &&
+ sal_uInt16 nMaxComp = ( SwFontScript::CJK == rInf.GetFont()->GetActual() ) &&
rSI.CountCompChg() &&
! rInf.IsMulti() &&
! rPor.InFieldGrp() &&
@@ -335,7 +335,7 @@ bool SwTextGuess::Guess( const SwTextPortion& rPor, SwTextFormatInfo &rInf,
OSL_ENSURE( nScript, "Script is not between 1 and 4" );
// compare current script with script from last "real" character
- if ( nScript - 1 != rInf.GetFont()->GetActual() )
+ if ( SwFontScript(nScript - 1) != rInf.GetFont()->GetActual() )
aLang = rInf.GetTextFrame()->GetTextNode()->GetLang(
CH_TXTATR_BREAKWORD == cFieldChr ?
nDoNotStepOver :
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index eafd1ec92f0a..3f4a64ca2a72 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -406,7 +406,7 @@ SwPosSize SwTextSizeInfo::GetTextSize() const
// in some cases, compression is not allowed or suppressed for
// performance reasons
- sal_uInt16 nComp =( SW_CJK == GetFont()->GetActual() &&
+ sal_uInt16 nComp =( SwFontScript::CJK == GetFont()->GetActual() &&
rSI.CountCompChg() &&
! IsMulti() ) ?
GetKanaComp() :
@@ -884,7 +884,7 @@ static void lcl_DrawSpecial( const SwTextPaintInfo& rInf, const SwLinePortion& r
const SwTwips nOldWidth = aFontSize.Width();
// new height for font
- const sal_uInt8 nAct = m_pFnt->GetActual();
+ const SwFontScript nAct = m_pFnt->GetActual();
aFontSize.Height() = ( 100 * m_pFnt->GetSize( nAct ).Height() ) / nFactor;
aFontSize.Width() = ( 100 * m_pFnt->GetSize( nAct).Width() ) / nFactor;
diff --git a/sw/source/core/text/itratr.hxx b/sw/source/core/text/itratr.hxx
index 4687039b3e54..7bd8e2ce3f0e 100644
--- a/sw/source/core/text/itratr.hxx
+++ b/sw/source/core/text/itratr.hxx
@@ -54,8 +54,8 @@ private:
size_t nEndIndex;
sal_Int32 nPos;
sal_uInt8 nPropFont;
- const void* aMagicNo[ SW_SCRIPTS ];
- sal_uInt16 aFntIdx[ SW_SCRIPTS ];
+ o3tl::enumarray<SwFontScript, const void*> aMagicNo;
+ o3tl::enumarray<SwFontScript, sal_uInt16> aFntIdx;
const SwTextNode* m_pTextNode;
void SeekFwd( const sal_Int32 nPos );
@@ -80,7 +80,7 @@ protected:
, nPropFont(0)
, m_pTextNode(pTextNode)
{
- aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = nullptr;
+ aMagicNo[SwFontScript::Latin] = aMagicNo[SwFontScript::CJK] = aMagicNo[SwFontScript::CTL] = nullptr;
}
public:
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index b1ddd9397925..4acbda965b09 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1665,7 +1665,7 @@ sal_Int32 SwTextCursor::GetCursorOfst( SwPosition *pPos, const Point &rPoint,
aDrawInf.SetSnapToGrid( aSizeInf.SnapToGrid() );
aDrawInf.SetPosMatchesBounds( pCMS && pCMS->m_bPosMatchesBounds );
- if ( SW_CJK == aSizeInf.GetFont()->GetActual() &&
+ if ( SwFontScript::CJK == aSizeInf.GetFont()->GetActual() &&
pPara->GetScriptInfo().CountCompChg() &&
! pPor->InFieldGrp() )
aDrawInf.SetKanaComp( nKanaComp );
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index f8c1d418c94d..185fd6496f25 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -411,8 +411,8 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
rInf.GetLast() && rInf.GetLast()->InTextGrp() &&
rInf.GetLast()->Width() && !rInf.GetLast()->InNumberGrp() )
{
- sal_uInt8 nNxtActual = rInf.GetFont()->GetActual();
- sal_uInt8 nLstActual = nNxtActual;
+ SwFontScript nNxtActual = rInf.GetFont()->GetActual();
+ SwFontScript nLstActual = nNxtActual;
sal_uInt16 nLstHeight = (sal_uInt16)rInf.GetFont()->GetHeight();
bool bAllowBehind = false;
const CharClass& rCC = GetAppCharClass();
@@ -465,7 +465,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
bAllowBefore = rCC.isLetterNumeric( rInf.GetText(), rInf.GetIdx() - 1 );
// Note: ScriptType returns values in [1,4]
if ( bAllowBefore )
- nLstActual = pScriptInfo->ScriptType( rInf.GetIdx() - 1 ) - 1;
+ nLstActual = SwFontScript(pScriptInfo->ScriptType( rInf.GetIdx() - 1 ) - 1);
}
nLstHeight /= 5;
@@ -574,7 +574,7 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
rInf.GetReformatStart() >= rInf.GetIdx() &&
rInf.GetReformatStart() <= rInf.GetIdx() + pPor->GetLen() )
// 6. Grid Mode
- || ( bHasGrid && SW_CJK != pFnt->GetActual() )
+ || ( bHasGrid && SwFontScript::CJK != pFnt->GetActual() )
)
)
// we store the beginning of the critical portion as our
@@ -628,17 +628,17 @@ void SwTextFormatter::BuildPortions( SwTextFormatInfo &rInf )
sal_Int32 nTmp = rInf.GetIdx() + pPor->GetLen();
const SwTwips nRestWidth = rInf.Width() - rInf.X() - pPor->Width();
- const sal_uInt8 nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() );
- const sal_uInt8 nNextScript = nTmp >= rInf.GetText().getLength() ?
- SW_CJK :
+ const SwFontScript nCurrScript = pFnt->GetActual(); // pScriptInfo->ScriptType( rInf.GetIdx() );
+ const SwFontScript nNextScript = nTmp >= rInf.GetText().getLength() ?
+ SwFontScript::CJK :
SwScriptInfo::WhichFont( nTmp, nullptr, pScriptInfo );
// snap non-asian text to grid if next portion is ASIAN or
// there are no more portions in this line
// be careful when handling an underflow event: the gridkernportion
// could have been deleted
- if ( nRestWidth > 0 && SW_CJK != nCurrScript &&
- ! rInf.IsUnderflow() && ( bFull || SW_CJK == nNextScript ) )
+ if ( nRestWidth > 0 && SwFontScript::CJK != nCurrScript &&
+ ! rInf.IsUnderflow() && ( bFull || SwFontScript::CJK == nNextScript ) )
{
OSL_ENSURE( pGridKernPortion, "No GridKernPortion available" );
diff --git a/sw/source/core/text/itrpaint.cxx b/sw/source/core/text/itrpaint.cxx
index 91f9eea1b77f..e91428a9b719 100644
--- a/sw/source/core/text/itrpaint.cxx
+++ b/sw/source/core/text/itrpaint.cxx
@@ -625,7 +625,7 @@ void SwTextPainter::CheckSpecialUnderline( const SwLinePortion* pPor,
pUnderlineFnt = new SwFont( *GetInfo().GetFont() );
// font height
- const sal_uInt8 nActual = pUnderlineFnt->GetActual();
+ const SwFontScript nActual = pUnderlineFnt->GetActual();
pUnderlineFnt->SetSize( Size( pUnderlineFnt->GetSize( nActual ).Width(),
nNewFontHeight ), nActual );
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 6322a2fa4db9..6aedf5426e28 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -196,7 +196,7 @@ void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
OUString aText;
if( GetExpText( rInf, aText ) && !aText.isEmpty() && g_pBreakIt->GetBreakIter().is() )
{
- sal_uInt8 nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
+ SwFontScript nActual = pFnt ? pFnt->GetActual() : rInf.GetFont()->GetActual();
sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( aText, 0 );
sal_Int32 nChg = 0;
if( i18n::ScriptType::WEAK == nScript )
@@ -213,11 +213,11 @@ void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
else
nNextScriptChg = aText.getLength();
- sal_uInt8 nTmp;
+ SwFontScript nTmp;
switch ( nScript ) {
- case i18n::ScriptType::LATIN : nTmp = SW_LATIN; break;
- case i18n::ScriptType::ASIAN : nTmp = SW_CJK; break;
- case i18n::ScriptType::COMPLEX : nTmp = SW_CTL; break;
+ case i18n::ScriptType::LATIN : nTmp = SwFontScript::Latin; break;
+ case i18n::ScriptType::ASIAN : nTmp = SwFontScript::CJK; break;
+ case i18n::ScriptType::COMPLEX : nTmp = SwFontScript::CTL; break;
default: nTmp = nActual;
}
@@ -261,7 +261,7 @@ void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
if (nCurrDir == UBIDI_RTL)
{
- nTmp = SW_CTL;
+ nTmp = SwFontScript::CTL;
// If we decided that this range was RTL after all and the
// previous range was complex but clipped to the start of this
// range, then extend it to be complex over the additional RTL range
@@ -1076,13 +1076,13 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
// the arrays of width and position are filled by the format function
if( g_pBreakIt->GetBreakIter().is() )
{
- sal_uInt8 nScr = SW_SCRIPTS;
+ SwFontScript nScr = SW_SCRIPTS;
for( sal_Int32 i = 0; i < rText.getLength(); ++i )
{
switch ( g_pBreakIt->GetBreakIter()->getScriptType( rText, i ) ) {
- case i18n::ScriptType::LATIN : nScr = SW_LATIN; break;
- case i18n::ScriptType::ASIAN : nScr = SW_CJK; break;
- case i18n::ScriptType::COMPLEX : nScr = SW_CTL; break;
+ case i18n::ScriptType::LATIN : nScr = SwFontScript::Latin; break;
+ case i18n::ScriptType::ASIAN : nScr = SwFontScript::CJK; break;
+ case i18n::ScriptType::COMPLEX : nScr = SwFontScript::CTL; break;
}
aScrType[i] = nScr;
}
@@ -1090,7 +1090,7 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
else
{
for( int i = 0; i < 6; ++i )
- aScrType[i] = 0;
+ aScrType[i] = SwFontScript::Latin;
}
memset( &aWidth, 0, sizeof(aWidth) );
}
@@ -1126,7 +1126,7 @@ void SwCombinedPortion::Paint( const SwTextPaintInfo &rInf ) const
if( i == nTop ) // change the row
aOutPos.Y() = aOldPos.Y() + nLowPos; // Y of the second row
aOutPos.X() = aOldPos.X() + aPos[i]; // X position
- const sal_uInt8 nAct = aScrType[i]; // script type
+ const SwFontScript nAct = aScrType[i]; // script type
aTmpFont.SetActual( nAct );
// if there're more than 4 characters to display, we choose fonts
@@ -1208,7 +1208,7 @@ bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
// local nMaxAscent, nMaxDescent and nMaxWidth variables.
for( sal_Int32 i = 0; i < nCount; ++i )
{
- sal_uInt8 nScrp = aScrType[i];
+ SwFontScript nScrp = aScrType[i];
aTmpFont.SetActual( nScrp );
if( aWidth[ nScrp ] )
{
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 3efd8983da00..06e6ca84b9c9 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -212,8 +212,8 @@ public:
class SwCombinedPortion : public SwFieldPortion
{
sal_uInt16 aPos[6]; // up to six X positions
- sal_uInt16 aWidth[3]; // one width for every scripttype
- sal_uInt8 aScrType[6]; // scripttype of every character
+ o3tl::enumarray<SwFontScript,sal_uInt16> aWidth; // one width for every scripttype
+ SwFontScript aScrType[6]; // scripttype of every character
sal_uInt16 nUpPos; // the Y position of the upper baseline
sal_uInt16 nLowPos; // the Y position of the lower baseline
sal_uInt8 nProportion; // relative font height
diff --git a/sw/source/core/text/porftn.hxx b/sw/source/core/text/porftn.hxx
index 1d8b333ad136..e5fe68a125c4 100644
--- a/sw/source/core/text/porftn.hxx
+++ b/sw/source/core/text/porftn.hxx
@@ -30,7 +30,7 @@ class SwFootnotePortion : public SwFieldPortion
sal_uInt16 nOrigHeight;
// #i98418#
bool mbPreferredScriptTypeSet;
- sal_uInt8 mnPreferredScriptType;
+ SwFontScript mnPreferredScriptType;
public:
SwFootnotePortion( const OUString &rExpand, SwTextFootnote *pFootnote,
sal_uInt16 nOrig = USHRT_MAX );
@@ -42,7 +42,7 @@ public:
virtual bool Format( SwTextFormatInfo &rInf ) override;
// #i98418#
- void SetPreferredScriptType( sal_uInt8 nPreferredScriptType );
+ void SetPreferredScriptType( SwFontScript nPreferredScriptType );
const SwTextFootnote* GetTextFootnote() const { return pFootnote; };
OUTPUT_OPERATOR_OVERRIDE
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 362bbafc7581..fb9ee3f72954 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -598,8 +598,8 @@ SwScriptInfo::~SwScriptInfo()
}
// Converts i18n Script Type (LATIN, ASIAN, COMPLEX, WEAK) to
-// Sw Script Types (SW_LATIN, SW_CJK, SW_CTL), used to identify the font
-sal_uInt8 SwScriptInfo::WhichFont( sal_Int32 nIdx, const OUString* pText, const SwScriptInfo* pSI )
+// Sw Script Types (SwFontScript::Latin, SwFontScript::CJK, SwFontScript::CTL), used to identify the font
+SwFontScript SwScriptInfo::WhichFont( sal_Int32 nIdx, const OUString* pText, const SwScriptInfo* pSI )
{
assert((pSI || pText) && "How should I determine the script type?");
const sal_uInt16 nScript = pSI
@@ -607,13 +607,13 @@ sal_uInt8 SwScriptInfo::WhichFont( sal_Int32 nIdx, const OUString* pText, const
: g_pBreakIt->GetRealScriptOfText( *pText, nIdx ); // else ask the break iterator
switch ( nScript ) {
- case i18n::ScriptType::LATIN : return SW_LATIN;
- case i18n::ScriptType::ASIAN : return SW_CJK;
- case i18n::ScriptType::COMPLEX : return SW_CTL;
+ case i18n::ScriptType::LATIN : return SwFontScript::Latin;
+ case i18n::ScriptType::ASIAN : return SwFontScript::CJK;
+ case i18n::ScriptType::COMPLEX : return SwFontScript::CTL;
}
OSL_FAIL( "Somebody tells lies about the script type!" );
- return SW_LATIN;
+ return SwFontScript::Latin;
}
// searches for script changes in rText and stores them
diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx
index 762e8f886551..0b87e2c7b991 100644
--- a/sw/source/core/text/pormulti.cxx
+++ b/sw/source/core/text/pormulti.cxx
@@ -289,7 +289,7 @@ SwDoubleLinePortion::SwDoubleLinePortion(const SwMultiCreator& rCreate, sal_Int3
pBracket->cPre = 0;
pBracket->cPost = 0;
}
- sal_uInt8 nTmp = SW_SCRIPTS;
+ SwFontScript nTmp = SW_SCRIPTS;
if( pBracket->cPre > 255 )
{
OUString aText = OUString(pBracket->cPre);
@@ -342,7 +342,7 @@ void SwDoubleLinePortion::PaintBracket( SwTextPaintInfo &rInf,
aBlank.Height( pBracket->nHeight );
{
SwFont* pTmpFnt = new SwFont( *rInf.GetFont() );
- sal_uInt8 nAct = bOpen ? pBracket->nPreScript : pBracket->nPostScript;
+ SwFontScript nAct = bOpen ? pBracket->nPreScript : pBracket->nPostScript;
if( SW_SCRIPTS > nAct )
pTmpFnt->SetActual( nAct );
pTmpFnt->SetProportion( 100 );
@@ -382,7 +382,7 @@ void SwDoubleLinePortion::FormatBrackets( SwTextFormatInfo &rInf, SwTwips& nMaxW
if( pBracket->cPre )
{
OUString aStr( pBracket->cPre );
- sal_uInt8 nActualScr = pTmpFnt->GetActual();
+ SwFontScript nActualScr = pTmpFnt->GetActual();
if( SW_SCRIPTS > pBracket->nPreScript )
pTmpFnt->SetActual( pBracket->nPreScript );
SwFontSave aSave( rInf, pTmpFnt );
diff --git a/sw/source/core/text/pormulti.hxx b/sw/source/core/text/pormulti.hxx
index 8bcf409e2c6c..dc1177808d22 100644
--- a/sw/source/core/text/pormulti.hxx
+++ b/sw/source/core/text/pormulti.hxx
@@ -60,8 +60,8 @@ struct SwBracket
sal_uInt16 nPostWidth; // Width of the closing bracket
sal_Unicode cPre; // Initial character, e.g. '('
sal_Unicode cPost; // Final character, e.g. ')'
- sal_uInt8 nPreScript; // Script of the initial character
- sal_uInt8 nPostScript; // Script of the final character
+ SwFontScript nPreScript; // Script of the initial character
+ SwFontScript nPostScript; // Script of the final character
};
// The SwMultiPortion is line portion inside a line portion,
diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx
index e19da53a60aa..9aff17f5049a 100644
--- a/sw/source/core/text/redlnitr.cxx
+++ b/sw/source/core/text/redlnitr.cxx
@@ -82,7 +82,7 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
aAttrHandler.Init( aFontAccess.Get()->GetDefault(), pAttrSet,
*rTextNode.getIDocumentSettingAccess(), pShell, *pFnt, bVertLayout );
- aMagicNo[SW_LATIN] = aMagicNo[SW_CJK] = aMagicNo[SW_CTL] = nullptr;
+ aMagicNo[SwFontScript::Latin] = aMagicNo[SwFontScript::CJK] = aMagicNo[SwFontScript::CTL] = nullptr;
// determine script changes if not already done for current paragraph
OSL_ENSURE( pScriptInfo, "No script info available");
@@ -101,16 +101,16 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
if ( nCnt >= pScriptInfo->CountScriptChg() )
break;
nChg = pScriptInfo->GetScriptChg( nCnt );
- int nTmp = SW_SCRIPTS;
+ SwFontScript nTmp = SW_SCRIPTS;
switch ( pScriptInfo->GetScriptType( nCnt++ ) ) {
case i18n::ScriptType::ASIAN :
- if( !aMagicNo[SW_CJK] ) nTmp = SW_CJK;
+ if( !aMagicNo[SwFontScript::CJK] ) nTmp = SwFontScript::CJK;
break;
case i18n::ScriptType::COMPLEX :
- if( !aMagicNo[SW_CTL] ) nTmp = SW_CTL;
+ if( !aMagicNo[SwFontScript::CTL] ) nTmp = SwFontScript::CTL;
break;
default:
- if( !aMagicNo[SW_LATIN ] ) nTmp = SW_LATIN;
+ if( !aMagicNo[SwFontScript::Latin ] ) nTmp = SwFontScript::Latin;
}
if( nTmp < SW_SCRIPTS )
{
@@ -121,8 +121,8 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf,
}
else
{
- pFnt->ChkMagic( pShell, SW_LATIN );
- pFnt->GetMagic( aMagicNo[ SW_LATIN ], aFntIdx[ SW_LATIN ], SW_LATIN );
+ pFnt->ChkMagic( pShell, SwFontScript::Latin );
+ pFnt->GetMagic( aMagicNo[ SwFontScript::Latin ], aFntIdx[ SwFontScript::Latin ], SwFontScript::Latin );
}
nStartIndex = nEndIndex = nPos = nChgCnt = 0;
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index fdf673523538..d024e556ea43 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -518,12 +518,12 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
// Posture style of paragraph font should not be considered
pNumFnt->SetUnderline( LINESTYLE_NONE );
pNumFnt->SetOverline( LINESTYLE_NONE );
- pNumFnt->SetItalic( ITALIC_NONE, SW_LATIN );
- pNumFnt->SetItalic( ITALIC_NONE, SW_CJK );
- pNumFnt->SetItalic( ITALIC_NONE, SW_CTL );
- pNumFnt->SetWeight( WEIGHT_NORMAL, SW_LATIN );
- pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CJK );
- pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CTL );
+ pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::Latin );
+ pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::CJK );
+ pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::CTL );
+ pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::Latin );
+ pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::CJK );
+ pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::CTL );
}
// Apply the explicit attributes from the character style
@@ -535,7 +535,7 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con
if ( pFormatFnt )
{
- const sal_uInt8 nAct = pNumFnt->GetActual();
+ const SwFontScript nAct = pNumFnt->GetActual();
pNumFnt->SetFamily( pFormatFnt->GetFamilyType(), nAct );
pNumFnt->SetName( pFormatFnt->GetFamilyName(), nAct );
pNumFnt->SetStyleName( pFormatFnt->GetStyleName(), nAct );
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index 1d8d5f36541d..ac704e1a1441 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -962,12 +962,12 @@ SwNumberPortion *SwTextFormatter::NewFootnoteNumPortion( SwTextFormatInfo &rInf
// See also #i18463# and SwTextFormatter::NewNumberPortion()
pNumFnt->SetUnderline( LINESTYLE_NONE );
pNumFnt->SetOverline( LINESTYLE_NONE );
- pNumFnt->SetItalic( ITALIC_NONE, SW_LATIN );
- pNumFnt->SetItalic( ITALIC_NONE, SW_CJK );
- pNumFnt->SetItalic( ITALIC_NONE, SW_CTL );
- pNumFnt->SetWeight( WEIGHT_NORMAL, SW_LATIN );
- pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CJK );
- pNumFnt->SetWeight( WEIGHT_NORMAL, SW_CTL );
+ pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::Latin );
+ pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::CJK );
+ pNumFnt->SetItalic( ITALIC_NONE, SwFontScript::CTL );
+ pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::Latin );
+ pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::CJK );
+ pNumFnt->SetWeight( WEIGHT_NORMAL, SwFontScript::CTL );
pNumFnt->SetDiffFnt(&rSet, pIDSA );
pNumFnt->SetVertical( pNumFnt->GetOrientation(), m_pFrame->IsVertical() );
@@ -1236,14 +1236,14 @@ public:
SwFootnoteSave( const SwTextSizeInfo &rInf,
const SwTextFootnote *pTextFootnote,
const bool bApplyGivenScriptType,
- const sal_uInt8 nGivenScriptType );
+ const SwFontScript nGivenScriptType );
~SwFootnoteSave();
};
SwFootnoteSave::SwFootnoteSave( const SwTextSizeInfo &rInf,
const SwTextFootnote* pTextFootnote,
const bool bApplyGivenScriptType,
- const sal_uInt8 nGivenScriptType )
+ const SwFontScript nGivenScriptType )
: pInf( &((SwTextSizeInfo&)rInf) )
, pFnt( nullptr )
, pOld( nullptr )
@@ -1322,7 +1322,7 @@ SwFootnotePortion::SwFootnotePortion( const OUString &rExpand,
, nOrigHeight( nReal )
// #i98418#
, mbPreferredScriptTypeSet( false )
- , mnPreferredScriptType( SW_LATIN )
+ , mnPreferredScriptType( SwFontScript::Latin )
{
SetLen(1);
SetWhichPor( POR_FTN );
@@ -1371,7 +1371,7 @@ SwPosSize SwFootnotePortion::GetTextSize( const SwTextSizeInfo &rInfo ) const
}
// #i98418#
-void SwFootnotePortion::SetPreferredScriptType( sal_uInt8 nPreferredScriptType )
+void SwFootnotePortion::SetPreferredScriptType( SwFontScript nPreferredScriptType )
{
mbPreferredScriptTypeSet = true;
mnPreferredScriptType = nPreferredScriptType;
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 9dee24ac89a0..b612985c731d 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -86,7 +86,7 @@ long EvalGridWidthAdd( const SwTextGridItem *const pGrid, const SwDrawTextInfo &
const SwDoc* pDoc = rInf.GetShell()->GetDoc();
const long nGridWidthAdd = GetGridWidth(*pGrid, *pDoc) - aDefaultFontItem.GetHeight();
- if( SW_LATIN == rInf.GetFont()->GetActual() )
+ if( SwFontScript::Latin == rInf.GetFont()->GetActual() )
return nGridWidthAdd / 2;
return nGridWidthAdd;
@@ -913,7 +913,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
// ASIAN LINE AND CHARACTER GRID MODE START
if ( rInf.GetFrame() && rInf.SnapToGrid() && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
+ SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
@@ -1026,7 +1026,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
// ASIAN LINE AND CHARACTER GRID MODE START: not snap to characters
if ( rInf.GetFrame() && rInf.SnapToGrid() && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
+ SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
@@ -1052,9 +1052,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
{
bool bSpecialJust = false;
const SwScriptInfo* pSI = rInf.GetScriptInfo();
- const sal_uInt8 nActual = rInf.GetFont()->GetActual();
+ const SwFontScript nActual = rInf.GetFont()->GetActual();
///Kana Compression
- if( SW_CJK == nActual && rInf.GetKanaComp() &&
+ if( SwFontScript::CJK == nActual && rInf.GetKanaComp() &&
pSI && pSI->CountCompChg() &&
lcl_IsMonoSpaceFont( *(rInf.GetpOut()) ) )
{
@@ -1063,9 +1063,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
bSpecialJust = true;
}
///Asian Justification
- if ( ( SW_CJK == nActual || SW_LATIN == nActual ) && nSpaceAdd )
+ if ( ( SwFontScript::CJK == nActual || SwFontScript::Latin == nActual ) && nSpaceAdd )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CJK );
if (!MsLangId::isKorean(aLang))
{
long nSpaceSum = nSpaceAdd;
@@ -1221,10 +1221,10 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( rInf.GetFont() && rInf.GetLen() )
{
const SwScriptInfo* pSI = rInf.GetScriptInfo();
- const sal_uInt8 nActual = rInf.GetFont()->GetActual();
+ const SwFontScript nActual = rInf.GetFont()->GetActual();
// Kana Compression
- if ( SW_CJK == nActual && rInf.GetKanaComp() &&
+ if ( SwFontScript::CJK == nActual && rInf.GetKanaComp() &&
pSI && pSI->CountCompChg() &&
lcl_IsMonoSpaceFont( rInf.GetOut() ) )
{
@@ -1235,9 +1235,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
}
// Asian Justification
- if ( SW_CJK == nActual && nSpaceAdd )
+ if ( SwFontScript::CJK == nActual && nSpaceAdd )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CJK );
if (!MsLangId::isKorean(aLang))
{
@@ -1254,7 +1254,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
}
// Kashida Justification
- if ( SW_CTL == nActual && nSpaceAdd )
+ if ( SwFontScript::CTL == nActual && nSpaceAdd )
{
if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) )
{
@@ -1269,9 +1269,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
}
// Thai Justification
- if ( SW_CTL == nActual && nSpaceAdd )
+ if ( SwFontScript::CTL == nActual && nSpaceAdd )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CTL );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CTL );
if ( LANGUAGE_THAI == aLang )
{
@@ -1429,11 +1429,11 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
if ( rInf.GetFont() && rInf.GetLen() )
{
- const sal_uInt8 nActual = rInf.GetFont()->GetActual();
+ const SwFontScript nActual = rInf.GetFont()->GetActual();
const SwScriptInfo* pSI = rInf.GetScriptInfo();
// Kana Compression
- if ( SW_CJK == nActual && rInf.GetKanaComp() &&
+ if ( SwFontScript::CJK == nActual && rInf.GetKanaComp() &&
pSI && pSI->CountCompChg() &&
lcl_IsMonoSpaceFont( rInf.GetOut() ) )
{
@@ -1447,9 +1447,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
}
// Asian Justification
- if ( SW_CJK == nActual && nSpaceAdd )
+ if ( SwFontScript::CJK == nActual && nSpaceAdd )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CJK );
if (!MsLangId::isKorean(aLang))
{
@@ -1466,7 +1466,7 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
}
// Kashida Justification
- if ( SW_CTL == nActual && nSpaceAdd )
+ if ( SwFontScript::CTL == nActual && nSpaceAdd )
{
if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) )
{
@@ -1480,9 +1480,9 @@ void SwFntObj::DrawText( SwDrawTextInfo &rInf )
}
// Thai Justification
- if ( SW_CTL == nActual && nSpaceAdd )
+ if ( SwFontScript::CTL == nActual && nSpaceAdd )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CTL );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CTL );
if ( LANGUAGE_THAI == aLang )
{
@@ -1834,7 +1834,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
}
if ( rInf.GetFrame() && nLn && rInf.SnapToGrid() && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
+ SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars() )
@@ -1876,7 +1876,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
//for textgrid refactor
if ( rInf.GetFrame() && nLn && rInf.SnapToGrid() && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
+ SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && !pGrid->IsSnapToChars() )
@@ -1905,7 +1905,7 @@ Size SwFntObj::GetTextSize( SwDrawTextInfo& rInf )
const bool bCompress = rInf.GetKanaComp() && nLn &&
rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() &&
+ SwFontScript::CJK == rInf.GetFont()->GetActual() &&
rInf.GetScriptInfo() &&
rInf.GetScriptInfo()->CountCompChg() &&
lcl_IsMonoSpaceFont( rInf.GetOut() );
@@ -2046,10 +2046,10 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
const SwScriptInfo* pSI = rInf.GetScriptInfo();
if ( rInf.GetFont() && rInf.GetLen() )
{
- const sal_uInt8 nActual = rInf.GetFont()->GetActual();
+ const SwFontScript nActual = rInf.GetFont()->GetActual();
// Kana Compression
- if ( SW_CJK == nActual && rInf.GetKanaComp() &&
+ if ( SwFontScript::CJK == nActual && rInf.GetKanaComp() &&
pSI && pSI->CountCompChg() &&
lcl_IsMonoSpaceFont( rInf.GetOut() ) )
{
@@ -2060,9 +2060,9 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
}
// Asian Justification
- if ( SW_CJK == rInf.GetFont()->GetActual() )
+ if ( SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CJK );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CJK );
if (!MsLangId::isKorean(aLang))
{
@@ -2079,7 +2079,7 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
}
// Kashida Justification
- if ( SW_CTL == nActual && rInf.GetSpace() )
+ if ( SwFontScript::CTL == nActual && rInf.GetSpace() )
{
if ( SwScriptInfo::IsArabicText( rInf.GetText(), rInf.GetIdx(), rInf.GetLen() ) )
{
@@ -2091,9 +2091,9 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
}
// Thai Justification
- if ( SW_CTL == nActual && nSpaceAdd )
+ if ( SwFontScript::CTL == nActual && nSpaceAdd )
{
- LanguageType aLang = rInf.GetFont()->GetLanguage( SW_CTL );
+ LanguageType aLang = rInf.GetFont()->GetLanguage( SwFontScript::CTL );
if ( LANGUAGE_THAI == aLang )
{
@@ -2115,7 +2115,7 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
long nKernSum = 0;
if ( rInf.GetFrame() && rInf.GetLen() && rInf.SnapToGrid() &&
- rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() )
+ rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars() )
@@ -2142,7 +2142,7 @@ sal_Int32 SwFntObj::GetCursorOfst( SwDrawTextInfo &rInf )
//for textgrid refactor
if ( rInf.GetFrame() && rInf.GetLen() && rInf.SnapToGrid() &&
- rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() )
+ rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && !pGrid->IsSnapToChars() )
@@ -2336,7 +2336,7 @@ sal_Int32 SwFont::GetTextBreak( SwDrawTextInfo& rInf, long nTextWidth )
ChgFnt( rInf.GetShell(), rInf.GetOut() );
const bool bCompress = rInf.GetKanaComp() && rInf.GetLen() &&
- SW_CJK == GetActual() &&
+ SwFontScript::CJK == GetActual() &&
rInf.GetScriptInfo() &&
rInf.GetScriptInfo()->CountCompChg() &&
lcl_IsMonoSpaceFont( rInf.GetOut() );
@@ -2351,7 +2351,7 @@ sal_Int32 SwFont::GetTextBreak( SwDrawTextInfo& rInf, long nTextWidth )
? rInf.GetText().getLength() : rInf.GetLen();
if ( rInf.GetFrame() && nLn && rInf.SnapToGrid() &&
- rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() )
+ rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && pGrid->IsSnapToChars() )
@@ -2385,7 +2385,7 @@ sal_Int32 SwFont::GetTextBreak( SwDrawTextInfo& rInf, long nTextWidth )
//for text grid enhancement
if ( rInf.GetFrame() && nLn && rInf.SnapToGrid() && rInf.GetFont() &&
- SW_CJK == rInf.GetFont()->GetActual() )
+ SwFontScript::CJK == rInf.GetFont()->GetActual() )
{
SwTextGridItem const*const pGrid(GetGridItem(rInf.GetFrame()->FindPageFrame()));
if ( pGrid && GRID_LINES_CHARS == pGrid->GetGridType() && !pGrid->IsSnapToChars() )
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index 29e6ae4f23fc..b92dccc8ad58 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -72,7 +72,7 @@ void SwFont::SetBackColor( Color* pNewColor )
delete m_pBackColor;
m_pBackColor = pNewColor;
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
void SwFont::SetTopBorder( const editeng::SvxBorderLine* pTopBorder )
@@ -85,7 +85,7 @@ void SwFont::SetTopBorder( const editeng::SvxBorderLine* pTopBorder )
m_nTopBorderDist = 0;
}
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
void SwFont::SetBottomBorder( const editeng::SvxBorderLine* pBottomBorder )
@@ -98,7 +98,7 @@ void SwFont::SetBottomBorder( const editeng::SvxBorderLine* pBottomBorder )
m_nBottomBorderDist = 0;
}
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
void SwFont::SetRightBorder( const editeng::SvxBorderLine* pRightBorder )
@@ -111,7 +111,7 @@ void SwFont::SetRightBorder( const editeng::SvxBorderLine* pRightBorder )
m_nRightBorderDist = 0;
}
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
void SwFont::SetLeftBorder( const editeng::SvxBorderLine* pLeftBorder )
@@ -124,7 +124,7 @@ void SwFont::SetLeftBorder( const editeng::SvxBorderLine* pLeftBorder )
m_nLeftBorderDist = 0;
}
m_bFontChg = true;
- m_aSub[SW_LATIN].m_pMagic = m_aSub[SW_CJK].m_pMagic = m_aSub[SW_CTL].m_pMagic = nullptr;
+ m_aSub[SwFontScript::Latin].m_pMagic = m_aSub[SwFontScript::CJK].m_pMagic = m_aSub[SwFontScript::CTL].m_pMagic = nullptr;
}
const boost::optional<editeng::SvxBorderLine>&
@@ -428,12 +428,12 @@ void SwFont::SetVertical( sal_uInt16 nDir, const bool bVertFormat )
// map direction if frame has vertical layout
nDir = MapDirection( nDir, bVertFormat );
- if( nDir != m_aSub[0].GetOrientation() )
+ if( nDir != m_aSub[SwFontScript::Latin].GetOrientation() )
{
m_bFontChg = true;
- m_aSub[0].SetVertical( nDir, bVertFormat );
- m_aSub[1].SetVertical( nDir, bVertFormat );
- m_aSub[2].SetVertical( nDir, bVertFormat );
+ m_aSub[SwFontScript::Latin].SetVertical( nDir, bVertFormat );
+ m_aSub[SwFontScript::CJK].SetVertical( nDir, bVertFormat );
+ m_aSub[SwFontScript::CTL].SetVertical( nDir, bVertFormat );
}
}
@@ -491,97 +491,97 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
true, &pItem ))
{
const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
- m_aSub[SW_LATIN].SetFamily( pFont->GetFamily() );
- m_aSub[SW_LATIN].Font::SetFamilyName( pFont->GetFamilyName() );
- m_aSub[SW_LATIN].Font::SetStyleName( pFont->GetStyleName() );
- m_aSub[SW_LATIN].Font::SetPitch( pFont->GetPitch() );
- m_aSub[SW_LATIN].Font::SetCharSet( pFont->GetCharSet() );
+ m_aSub[SwFontScript::Latin].SetFamily( pFont->GetFamily() );
+ m_aSub[SwFontScript::Latin].Font::SetFamilyName( pFont->GetFamilyName() );
+ m_aSub[SwFontScript::Latin].Font::SetStyleName( pFont->GetStyleName() );
+ m_aSub[SwFontScript::Latin].Font::SetPitch( pFont->GetPitch() );
+ m_aSub[SwFontScript::Latin].Font::SetCharSet( pFont->GetCharSet() );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_FONTSIZE,
true, &pItem ))
{
const SvxFontHeightItem *pHeight = static_cast<const SvxFontHeightItem *>(pItem);
- m_aSub[SW_LATIN].SvxFont::SetPropr( 100 );
- m_aSub[SW_LATIN].m_aSize = m_aSub[SW_LATIN].Font::GetFontSize();
- Size aTmpSize = m_aSub[SW_LATIN].m_aSize;
+ m_aSub[SwFontScript::Latin].SvxFont::SetPropr( 100 );
+ m_aSub[SwFontScript::Latin].m_aSize = m_aSub[SwFontScript::Latin].Font::GetFontSize();
+ Size aTmpSize = m_aSub[SwFontScript::Latin].m_aSize;
aTmpSize.Height() = pHeight->GetHeight();
- m_aSub[SW_LATIN].SetSize( aTmpSize );
+ m_aSub[SwFontScript::Latin].SetSize( aTmpSize );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_POSTURE,
true, &pItem ))
- m_aSub[SW_LATIN].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
+ m_aSub[SwFontScript::Latin].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_WEIGHT,
true, &pItem ))
- m_aSub[SW_LATIN].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
+ m_aSub[SwFontScript::Latin].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_LANGUAGE,
true, &pItem ))
- m_aSub[SW_LATIN].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
+ m_aSub[SwFontScript::Latin].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONT,
true, &pItem ))
{
const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
- m_aSub[SW_CJK].SetFamily( pFont->GetFamily() );
- m_aSub[SW_CJK].Font::SetFamilyName( pFont->GetFamilyName() );
- m_aSub[SW_CJK].Font::SetStyleName( pFont->GetStyleName() );
- m_aSub[SW_CJK].Font::SetPitch( pFont->GetPitch() );
- m_aSub[SW_CJK].Font::SetCharSet( pFont->GetCharSet() );
+ m_aSub[SwFontScript::CJK].SetFamily( pFont->GetFamily() );
+ m_aSub[SwFontScript::CJK].Font::SetFamilyName( pFont->GetFamilyName() );
+ m_aSub[SwFontScript::CJK].Font::SetStyleName( pFont->GetStyleName() );
+ m_aSub[SwFontScript::CJK].Font::SetPitch( pFont->GetPitch() );
+ m_aSub[SwFontScript::CJK].Font::SetCharSet( pFont->GetCharSet() );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_FONTSIZE,
true, &pItem ))
{
const SvxFontHeightItem *pHeight = static_cast<const SvxFontHeightItem *>(pItem);
- m_aSub[SW_CJK].SvxFont::SetPropr( 100 );
- m_aSub[SW_CJK].m_aSize = m_aSub[SW_CJK].Font::GetFontSize();
- Size aTmpSize = m_aSub[SW_CJK].m_aSize;
+ m_aSub[SwFontScript::CJK].SvxFont::SetPropr( 100 );
+ m_aSub[SwFontScript::CJK].m_aSize = m_aSub[SwFontScript::CJK].Font::GetFontSize();
+ Size aTmpSize = m_aSub[SwFontScript::CJK].m_aSize;
aTmpSize.Height() = pHeight->GetHeight();
- m_aSub[SW_CJK].SetSize( aTmpSize );
+ m_aSub[SwFontScript::CJK].SetSize( aTmpSize );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_POSTURE,
true, &pItem ))
- m_aSub[SW_CJK].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
+ m_aSub[SwFontScript::CJK].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_WEIGHT,
true, &pItem ))
- m_aSub[SW_CJK].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
+ m_aSub[SwFontScript::CJK].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CJK_LANGUAGE,
true, &pItem ))
{
LanguageType eNewLang = static_cast<const SvxLanguageItem*>(pItem)->GetLanguage();
- m_aSub[SW_CJK].SetLanguage( eNewLang );
- m_aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
- m_aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
- m_aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CJK].SetLanguage( eNewLang );
+ m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONT,
true, &pItem ))
{
const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
- m_aSub[SW_CTL].SetFamily( pFont->GetFamily() );
- m_aSub[SW_CTL].Font::SetFamilyName( pFont->GetFamilyName() );
- m_aSub[SW_CTL].Font::SetStyleName( pFont->GetStyleName() );
- m_aSub[SW_CTL].Font::SetPitch( pFont->GetPitch() );
- m_aSub[SW_CTL].Font::SetCharSet( pFont->GetCharSet() );
+ m_aSub[SwFontScript::CTL].SetFamily( pFont->GetFamily() );
+ m_aSub[SwFontScript::CTL].Font::SetFamilyName( pFont->GetFamilyName() );
+ m_aSub[SwFontScript::CTL].Font::SetStyleName( pFont->GetStyleName() );
+ m_aSub[SwFontScript::CTL].Font::SetPitch( pFont->GetPitch() );
+ m_aSub[SwFontScript::CTL].Font::SetCharSet( pFont->GetCharSet() );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_FONTSIZE,
true, &pItem ))
{
const SvxFontHeightItem *pHeight = static_cast<const SvxFontHeightItem *>(pItem);
- m_aSub[SW_CTL].SvxFont::SetPropr( 100 );
- m_aSub[SW_CTL].m_aSize = m_aSub[SW_CTL].Font::GetFontSize();
- Size aTmpSize = m_aSub[SW_CTL].m_aSize;
+ m_aSub[SwFontScript::CTL].SvxFont::SetPropr( 100 );
+ m_aSub[SwFontScript::CTL].m_aSize = m_aSub[SwFontScript::CTL].Font::GetFontSize();
+ Size aTmpSize = m_aSub[SwFontScript::CTL].m_aSize;
aTmpSize.Height() = pHeight->GetHeight();
- m_aSub[SW_CTL].SetSize( aTmpSize );
+ m_aSub[SwFontScript::CTL].SetSize( aTmpSize );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_POSTURE,
true, &pItem ))
- m_aSub[SW_CTL].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
+ m_aSub[SwFontScript::CTL].Font::SetItalic( static_cast<const SvxPostureItem*>(pItem)->GetPosture() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_WEIGHT,
true, &pItem ))
- m_aSub[SW_CTL].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
+ m_aSub[SwFontScript::CTL].Font::SetWeight( static_cast<const SvxWeightItem*>(pItem)->GetWeight() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CTL_LANGUAGE,
true, &pItem ))
- m_aSub[SW_CTL].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
+ m_aSub[SwFontScript::CTL].SetLanguage( static_cast<const SvxLanguageItem*>(pItem)->GetLanguage() );
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_UNDERLINE,
true, &pItem ))
@@ -641,7 +641,7 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
{
const SvxEscapementItem *pEsc = static_cast<const SvxEscapementItem *>(pItem);
SetEscapement( pEsc->GetEsc() );
- if( m_aSub[SW_LATIN].IsEsc() )
+ if( m_aSub[SwFontScript::Latin].IsEsc() )
SetProportion( pEsc->GetProportionalHeight() );
}
if( SfxItemState::SET == pAttrSet->GetItemState( RES_CHRATR_CASEMAP,
@@ -700,14 +700,12 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet,
}
m_bPaintBlank = false;
m_bPaintWrong = false;
- OSL_ENSURE( m_aSub[SW_LATIN].IsTransparent(), "SwFont: Transparent revolution" );
+ OSL_ENSURE( m_aSub[SwFontScript::Latin].IsTransparent(), "SwFont: Transparent revolution" );
}
SwFont::SwFont( const SwFont &rFont )
+ : m_aSub(rFont.m_aSub)
{
- m_aSub[SW_LATIN] = rFont.m_aSub[SW_LATIN];
- m_aSub[SW_CJK] = rFont.m_aSub[SW_CJK];
- m_aSub[SW_CTL] = rFont.m_aSub[SW_CTL];
m_nActual = rFont.m_nActual;
m_pBackColor = rFont.m_pBackColor ? new Color( *rFont.m_pBackColor ) : nullptr;
m_aHighlightColor = rFont.m_aHighlightColor;
@@ -741,8 +739,9 @@ SwFont::SwFont( const SwFont &rFont )
SwFont::SwFont( const SwAttrSet* pAttrSet,
const IDocumentSettingAccess* pIDocumentSettingAccess )
+ : m_aSub { SwSubFont(), SwSubFont(), SwSubFont() }
{
- m_nActual = SW_LATIN;
+ m_nActual = SwFontScript::Latin;
m_nToxCount = 0;
m_nRefCount = 0;
m_nMetaCount = 0;
@@ -757,54 +756,54 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
m_bOrgChg = true;
{
const SvxFontItem& rFont = pAttrSet->GetFont();
- m_aSub[SW_LATIN].SetFamily( rFont.GetFamily() );
- m_aSub[SW_LATIN].SetFamilyName( rFont.GetFamilyName() );
- m_aSub[SW_LATIN].SetStyleName( rFont.GetStyleName() );
- m_aSub[SW_LATIN].SetPitch( rFont.GetPitch() );
- m_aSub[SW_LATIN].SetCharSet( rFont.GetCharSet() );
- m_aSub[SW_LATIN].SvxFont::SetPropr( 100 ); // 100% der FontSize
- Size aTmpSize = m_aSub[SW_LATIN].m_aSize;
+ m_aSub[SwFontScript::Latin].SetFamily( rFont.GetFamily() );
+ m_aSub[SwFontScript::Latin].SetFamilyName( rFont.GetFamilyName() );
+ m_aSub[SwFontScript::Latin].SetStyleName( rFont.GetStyleName() );
+ m_aSub[SwFontScript::Latin].SetPitch( rFont.GetPitch() );
+ m_aSub[SwFontScript::Latin].SetCharSet( rFont.GetCharSet() );
+ m_aSub[SwFontScript::Latin].SvxFont::SetPropr( 100 ); // 100% der FontSize
+ Size aTmpSize = m_aSub[SwFontScript::Latin].m_aSize;
aTmpSize.Height() = pAttrSet->GetSize().GetHeight();
- m_aSub[SW_LATIN].SetSize( aTmpSize );
- m_aSub[SW_LATIN].SetItalic( pAttrSet->GetPosture().GetPosture() );
- m_aSub[SW_LATIN].SetWeight( pAttrSet->GetWeight().GetWeight() );
- m_aSub[SW_LATIN].SetLanguage( pAttrSet->GetLanguage().GetLanguage() );
+ m_aSub[SwFontScript::Latin].SetSize( aTmpSize );
+ m_aSub[SwFontScript::Latin].SetItalic( pAttrSet->GetPosture().GetPosture() );
+ m_aSub[SwFontScript::Latin].SetWeight( pAttrSet->GetWeight().GetWeight() );
+ m_aSub[SwFontScript::Latin].SetLanguage( pAttrSet->GetLanguage().GetLanguage() );
}
{
const SvxFontItem& rFont = pAttrSet->GetCJKFont();
- m_aSub[SW_CJK].SetFamily( rFont.GetFamily() );
- m_aSub[SW_CJK].SetFamilyName( rFont.GetFamilyName() );
- m_aSub[SW_CJK].SetStyleName( rFont.GetStyleName() );
- m_aSub[SW_CJK].SetPitch( rFont.GetPitch() );
- m_aSub[SW_CJK].SetCharSet( rFont.GetCharSet() );
- m_aSub[SW_CJK].SvxFont::SetPropr( 100 ); // 100% der FontSize
- Size aTmpSize = m_aSub[SW_CJK].m_aSize;
+ m_aSub[SwFontScript::CJK].SetFamily( rFont.GetFamily() );
+ m_aSub[SwFontScript::CJK].SetFamilyName( rFont.GetFamilyName() );
+ m_aSub[SwFontScript::CJK].SetStyleName( rFont.GetStyleName() );
+ m_aSub[SwFontScript::CJK].SetPitch( rFont.GetPitch() );
+ m_aSub[SwFontScript::CJK].SetCharSet( rFont.GetCharSet() );
+ m_aSub[SwFontScript::CJK].SvxFont::SetPropr( 100 ); // 100% der FontSize
+ Size aTmpSize = m_aSub[SwFontScript::CJK].m_aSize;
aTmpSize.Height() = pAttrSet->GetCJKSize().GetHeight();
- m_aSub[SW_CJK].SetSize( aTmpSize );
- m_aSub[SW_CJK].SetItalic( pAttrSet->GetCJKPosture().GetPosture() );
- m_aSub[SW_CJK].SetWeight( pAttrSet->GetCJKWeight().GetWeight() );
+ m_aSub[SwFontScript::CJK].SetSize( aTmpSize );
+ m_aSub[SwFontScript::CJK].SetItalic( pAttrSet->GetCJKPosture().GetPosture() );
+ m_aSub[SwFontScript::CJK].SetWeight( pAttrSet->GetCJKWeight().GetWeight() );
LanguageType eNewLang = pAttrSet->GetCJKLanguage().GetLanguage();
- m_aSub[SW_CJK].SetLanguage( eNewLang );
- m_aSub[SW_LATIN].SetCJKContextLanguage( eNewLang );
- m_aSub[SW_CJK].SetCJKContextLanguage( eNewLang );
- m_aSub[SW_CTL].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CJK].SetLanguage( eNewLang );
+ m_aSub[SwFontScript::Latin].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CJK].SetCJKContextLanguage( eNewLang );
+ m_aSub[SwFontScript::CTL].SetCJKContextLanguage( eNewLang );
}
{
const SvxFontItem& rFont = pAttrSet->GetCTLFont();
- m_aSub[SW_CTL].SetFamily( rFont.GetFamily() );
- m_aSub[SW_CTL].SetFamilyName( rFont.GetFamilyName() );
- m_aSub[SW_CTL].SetStyleName( rFont.GetStyleName() );
- m_aSub[SW_CTL].SetPitch( rFont.GetPitch() );
- m_aSub[SW_CTL].SetCharSet( rFont.GetCharSet() );
- m_aSub[SW_CTL].SvxFont::SetPropr( 100 ); // 100% der FontSize
- Size aTmpSize = m_aSub[SW_CTL].m_aSize;
+ m_aSub[SwFontScript::CTL].SetFamily( rFont.GetFamily() );
+ m_aSub[SwFontScript::CTL].SetFamilyName( rFont.GetFamilyName() );
+ m_aSub[SwFontScript::CTL].SetStyleName( rFont.GetStyleName() );
+ m_aSub[SwFontScript::CTL].SetPitch( rFont.GetPitch() );
+ m_aSub[SwFontScript::CTL].SetCharSet( rFont.GetCharSet() );
+ m_aSub[SwFontScript::CTL].SvxFont::SetPropr( 100 ); // 100% der FontSize
+ Size aTmpSize = m_aSub[SwFontScript::CTL].m_aSize;
aTmpSize.Height() = pAttrSet->GetCTLSize().GetHeight();
- m_aSub[SW_CTL].SetSize( aTmpSize );
- m_aSub[SW_CTL].SetItalic( pAttrSet->GetCTLPosture().GetPosture() );
- m_aSub[SW_CTL].SetWeight( pAttrSet->GetCTLWeight().GetWeight() );
- m_aSub[SW_CTL].SetLanguage( pAttrSet->GetCTLLanguage().GetLanguage() );
+ m_aSub[SwFontScript::CTL].SetSize( aTmpSize );
+ m_aSub[SwFontScript::CTL].SetItalic( pAttrSet->GetCTLPosture().GetPosture() );
+ m_aSub[SwFontScript::CTL].SetWeight( pAttrSet->GetCTLWeight().GetWeight() );
+ m_aSub[SwFontScript::CTL].SetLanguage( pAttrSet->GetCTLLanguage().GetLanguage() );
}
if ( pAttrSet->GetCharHidden().GetValue() )
SetUnderline( LINESTYLE_DOTTED );
@@ -834,7 +833,7 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
SetWordLineMode( pAttrSet->GetWordLineMode().GetValue() );
const SvxEscapementItem &rEsc = pAttrSet->GetEscapement();
SetEscapement( rEsc.GetEsc() );
- if( m_aSub[SW_LATIN].IsEsc() )
+ if( m_aSub[SwFontScript::Latin].IsEsc() )
SetProportion( rEsc.GetProportionalHeight() );
SetCaseMap( pAttrSet->GetCaseMap().GetCaseMap() );
SetFixKerning( pAttrSet->GetKerning().GetValue() );
@@ -896,9 +895,9 @@ SwFont::SwFont( const SwAttrSet* pAttrSet,
SetVertical( 0 );
if( pIDocumentSettingAccess && pIDocumentSettingAccess->get( DocumentSettingId::SMALL_CAPS_PERCENTAGE_66 ))
{
- m_aSub[ SW_LATIN ].m_bSmallCapsPercentage66 = true;
- m_aSub[ SW_CJK ].m_bSmallCapsPercentage66 = true;
- m_aSub[ SW_CTL ].m_bSmallCapsPercentage66 = true;
+ m_aSub[ SwFontScript::Latin ].m_bSmallCapsPercentage66 = true;
+ m_aSub[ SwFontScript::CJK ].m_bSmallCapsPercentage66 = true;
+ m_aSub[ SwFontScript::CTL ].m_bSmallCapsPercentage66 = true;
}
}
@@ -922,9 +921,9 @@ SwSubFont& SwSubFont::operator=( const SwSubFont &rFont )
SwFont& SwFont::operator=( const SwFont &rFont )
{
- m_aSub[SW_LATIN] = rFont.m_aSub[SW_LATIN];
- m_aSub[SW_CJK] = rFont.m_aSub[SW_CJK];
- m_aSub[SW_CTL] = rFont.m_aSub[SW_CTL];
+ m_aSub[SwFontScript::Latin] = rFont.m_aSub[SwFontScript::Latin];
+ m_aSub[SwFontScript::CJK] = rFont.m_aSub[SwFontScript::CJK];
+ m_aSub[SwFontScript::CTL] = rFont.m_aSub[SwFontScript::CTL];
m_nActual = rFont.m_nActual;
delete m_pBackColor;
m_pBackColor = rFont.m_pBackColor ? new Color( *rFont.m_pBackColor ) : nullptr;
@@ -958,7 +957,7 @@ SwFont& SwFont::operator=( const SwFont &rFont )
return *this;
}
-void SwFont::GoMagic( SwViewShell *pSh, sal_uInt8 nWhich )
+void SwFont::GoMagic( SwViewShell *pSh, SwFontScript nWhich )
{
SwFntAccess aFntAccess( m_aSub[nWhich].m_pMagic, m_aSub[nWhich].m_nFontIndex,
&m_aSub[nWhich], pSh, true );
@@ -1253,7 +1252,7 @@ void SwSubFont::_DrawText( SwDrawTextInfo &rInf, const bool bGrey )
const SwScriptInfo* pSI = rInf.GetScriptInfo();
const bool bAsianFont =
- ( rInf.GetFont() && SW_CJK == rInf.GetFont()->GetActual() );
+ ( rInf.GetFont() && SwFontScript::CJK == rInf.GetFont()->GetActual() );
for( sal_Int32 nTmp = nOldIdx; nTmp < nTmpEnd; ++nTmp )
{
if (CH_BLANK == oldStr[nTmp] || bAsianFont ||
@@ -1522,18 +1521,18 @@ long AttrSetToLineHeight( const IDocumentSettingAccess& rIDocumentSettingAccess,
const vcl::RenderContext &rOut, sal_Int16 nScript)
{
SwFont aFont(&rSet, &rIDocumentSettingAccess);
- sal_uInt8 nActual;
+ SwFontScript nActual;
switch (nScript)
{
default:
case i18n::ScriptType::LATIN:
- nActual = SW_LATIN;
+ nActual = SwFontScript::Latin;
break;
case i18n::ScriptType::ASIAN:
- nActual = SW_CJK;
+ nActual = SwFontScript::CJK;
break;
case i18n::ScriptType::COMPLEX:
- nActual = SW_CTL;
+ nActual = SwFontScript::CTL;
break;
}
aFont.SetActual(nActual);