diff options
author | Noel Grandin <noel@peralex.com> | 2015-04-15 09:36:39 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-04-17 07:21:08 +0000 |
commit | a7b7c64afc523cfd9ff4e724b3efbec6567fc1c8 (patch) | |
tree | 52fd05ef3292f3dab172864cbc3be96a8d44a9d0 /sw | |
parent | add7eeb7dbd0eefa0c5ae5430490864079add801 (diff) |
convert SCRIPTTYPE_ constants to scoped enum
Change-Id: I5be3980ac865162d8d7626556ca47eca4b0ee433
Reviewed-on: https://gerrit.libreoffice.org/15344
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw')
32 files changed, 141 insertions, 131 deletions
diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx index 588943efdb12..949d08d3c7f2 100644 --- a/sw/inc/breakit.hxx +++ b/sw/inc/breakit.hxx @@ -29,6 +29,8 @@ #include <i18nlangtag/languagetag.hxx> #include <swdllapi.h> +enum class SvtScriptType; + class SW_DLLPUBLIC SwBreakIt : private ::boost::noncopyable { com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; @@ -109,7 +111,7 @@ public: } sal_uInt16 GetRealScriptOfText( const OUString& rTxt, sal_Int32 nPos ) const; - sal_uInt16 GetAllScriptsOfText( const OUString& rTxt ) const; + SvtScriptType GetAllScriptsOfText( const OUString& rTxt ) const; sal_Int32 getGraphemeCount(const OUString& rStr, sal_Int32 nStart, sal_Int32 nEnd) const; diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index c1ea880361b8..5bfea500de7c 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -94,7 +94,7 @@ class SwLineNumberInfo; class SwAuthEntry; class SwRewriter; struct SwConversionArgs; - +enum class SvtScriptType; namespace com { namespace sun { namespace star { namespace uno { template < class > class Sequence; }}}} @@ -278,7 +278,7 @@ public: void GCAttr(); /// @return the scripttpye of the selection. - sal_uInt16 GetScriptType() const; + SvtScriptType GetScriptType() const; /// @return the language at current cursor position. sal_uInt16 GetCurLang() const; diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 04b7d25453b5..803e22202bd2 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -742,7 +742,7 @@ static void lcl_setWeight(SwWrtShell* pWrtShell, FontWeight aWeight) { SvxWeightItem aWeightItem(aWeight, EE_CHAR_WEIGHT); SvxScriptSetItem aScriptSetItem(SID_ATTR_CHAR_WEIGHT, pWrtShell->GetAttrPool()); - aScriptSetItem.PutItemForScriptType(SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX, aWeightItem); + aScriptSetItem.PutItemForScriptType(SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX, aWeightItem); pWrtShell->SetAttrSet(aScriptSetItem.GetItemSet()); } diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx index 2aed42659232..d0bdabdaca10 100644 --- a/sw/source/core/attr/hints.cxx +++ b/sw/source/core/attr/hints.cxx @@ -222,7 +222,7 @@ sal_uInt16 GetWhichOfScript( sal_uInt16 nWhich, sal_uInt16 nScript ) using namespace ::com::sun::star; { if( i18n::ScriptType::WEAK == nScript ) - nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + nScript = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); switch( nScript) { case i18n::ScriptType::COMPLEX: diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index 559d6f267a8e..b1c834926519 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -138,17 +138,18 @@ sal_uInt16 SwBreakIt::GetRealScriptOfText( const OUString& rTxt, sal_Int32 nPos } } if( i18n::ScriptType::WEAK == nScript ) - nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + nScript = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); return nScript; } -sal_uInt16 SwBreakIt::GetAllScriptsOfText( const OUString& rTxt ) const +SvtScriptType SwBreakIt::GetAllScriptsOfText( const OUString& rTxt ) const { - const sal_uInt16 coAllScripts = ( SCRIPTTYPE_LATIN | - SCRIPTTYPE_ASIAN | - SCRIPTTYPE_COMPLEX ); + const SvtScriptType coAllScripts = ( SvtScriptType::LATIN | + SvtScriptType::ASIAN | + SvtScriptType::COMPLEX ); createBreakIterator(); - sal_uInt16 nRet = 0, nScript; + SvtScriptType nRet = SvtScriptType::NONE; + sal_uInt16 nScript = 0; if( !xBreak.is() ) { nRet = coAllScripts; @@ -160,11 +161,11 @@ sal_uInt16 SwBreakIt::GetAllScriptsOfText( const OUString& rTxt ) const { switch( nScript = xBreak->getScriptType( rTxt, n ) ) { - case i18n::ScriptType::LATIN: nRet |= SCRIPTTYPE_LATIN; break; - case i18n::ScriptType::ASIAN: nRet |= SCRIPTTYPE_ASIAN; break; - case i18n::ScriptType::COMPLEX: nRet |= SCRIPTTYPE_COMPLEX; break; + case i18n::ScriptType::LATIN: nRet |= SvtScriptType::LATIN; break; + case i18n::ScriptType::ASIAN: nRet |= SvtScriptType::ASIAN; break; + case i18n::ScriptType::COMPLEX: nRet |= SvtScriptType::COMPLEX; break; case i18n::ScriptType::WEAK: - if( !nRet ) + if( nRet == SvtScriptType::NONE ) nRet |= coAllScripts; break; } diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 635fa1857355..f6891656a2d1 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -212,7 +212,7 @@ inline LanguageType GetDocAppScriptLang( SwDoc& rDoc ) { return static_cast<const SvxLanguageItem&>(rDoc.GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() )) + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() )) )).GetLanguage(); } diff --git a/sw/source/core/doc/extinput.cxx b/sw/source/core/doc/extinput.cxx index 13fe599ba3f7..052b555108dd 100644 --- a/sw/source/core/doc/extinput.cxx +++ b/sw/source/core/doc/extinput.cxx @@ -72,7 +72,7 @@ SwExtTextInput::~SwExtTextInput() // for CJK/CTL scripts. bool bLang = true; sal_uInt16 nWhich = RES_CHRATR_LANGUAGE; - switch(GetI18NScriptTypeOfLanguage(eInputLanguage)) + switch(SvtLanguageOptions::GetI18NScriptTypeOfLanguage(eInputLanguage)) { case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; case i18n::ScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break; diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index bfbcc066813e..fe78210af212 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -540,23 +540,23 @@ void SwEditShell::MoveLeftMargin( bool bRight, bool bModulus ) EndAllAction(); } -static inline sal_uInt16 lcl_SetScriptFlags( sal_uInt16 nType ) +static inline SvtScriptType lcl_SetScriptFlags( sal_uInt16 nType ) { switch( nType ) { case ::com::sun::star::i18n::ScriptType::LATIN: - return SCRIPTTYPE_LATIN; + return SvtScriptType::LATIN; case ::com::sun::star::i18n::ScriptType::ASIAN: - return SCRIPTTYPE_ASIAN; + return SvtScriptType::ASIAN; case ::com::sun::star::i18n::ScriptType::COMPLEX: - return SCRIPTTYPE_COMPLEX; + return SvtScriptType::COMPLEX; default: - return 0; + return SvtScriptType::NONE; } } static bool lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, sal_Int32 nPos, - sal_uInt16 &rScrpt, bool bInSelection, bool bNum ) + SvtScriptType &rScrpt, bool bInSelection, bool bNum ) { bool bRet = false; OUString sExp; @@ -634,9 +634,9 @@ static bool lcl_IsNoEndTxtAttrAtPos( const SwTxtNode& rTNd, sal_Int32 nPos, } /// returns the script type of the selection -sal_uInt16 SwEditShell::GetScriptType() const +SvtScriptType SwEditShell::GetScriptType() const { - sal_uInt16 nRet = 0; + SvtScriptType nRet = SvtScriptType::NONE; { for(SwPaM& rPaM : GetCrsr()->GetRingContainer()) @@ -672,7 +672,7 @@ sal_uInt16 SwEditShell::GetScriptType() const g_pBreakIt->GetBreakIter()->getScriptType( pTNd->GetTxt(), nPos ); } else - nScript = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + nScript = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); if( !lcl_IsNoEndTxtAttrAtPos( *pTNd, nPos, nRet, false, false )) nRet |= lcl_SetScriptFlags( nScript ); @@ -715,8 +715,8 @@ sal_uInt16 SwEditShell::GetScriptType() const 0 == nChg && rTxt.getLength() == nEndPos)) nRet |= lcl_SetScriptFlags( nScript ); - if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | - SCRIPTTYPE_COMPLEX) == nRet ) + if( (SvtScriptType::LATIN | SvtScriptType::ASIAN | + SvtScriptType::COMPLEX) == nRet ) break; sal_Int32 nFldPos = nChg+1; @@ -731,18 +731,18 @@ sal_uInt16 SwEditShell::GetScriptType() const if ((-1 != nFldPos) && (nFldPos < nChg)) nChg = nFldPos; } - if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | - SCRIPTTYPE_COMPLEX) == nRet ) + if( (SvtScriptType::LATIN | SvtScriptType::ASIAN | + SvtScriptType::COMPLEX) == nRet ) break; } } - if( (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | - SCRIPTTYPE_COMPLEX) == nRet ) + if( (SvtScriptType::LATIN | SvtScriptType::ASIAN | + SvtScriptType::COMPLEX) == nRet ) break; } } - if( !nRet ) + if( nRet == SvtScriptType::NONE ) nRet = SvtLanguageOptions::GetScriptTypeOfLanguage( LANGUAGE_SYSTEM ); return nRet; } diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index e3d1572c3b40..06dae1436a9c 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/linguistic2/XProofreader.hpp> #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/text/XFlatParagraph.hpp> +#include <com/sun/star/i18n/ScriptType.hpp> #include <comphelper/string.hxx> #include <unoflatpara.hxx> @@ -1159,12 +1160,12 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, pCrsr->SetMark(); pCrsr->GetPoint()->nContent = aCurrentOldPosition->nLeft; pCrsr->GetMark()->nContent = aCurrentOldPosition->nRight; - sal_uInt16 nScriptType = GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); + sal_uInt16 nScriptType = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage ); sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE; switch(nScriptType) { - case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; + case css::i18n::ScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; + case css::i18n::ScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; } if(aCurrentNewPortion->sText != aCurrentOldPortion->sText) { @@ -1208,12 +1209,13 @@ void SwEditShell::ApplyChangedSentence(const ::svx::SpellPortions& rNewPortions, while(aCurrentNewPortion != rNewPortions.end()) { // set the language attribute - sal_uInt16 nScriptType = GetScriptType(); + SvtScriptType nScriptType = GetScriptType(); sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE; switch(nScriptType) { - case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; + case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; + case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; + default: break; } SfxItemSet aSet(GetAttrPool(), nLangWhichId, nLangWhichId, 0); GetCurAttr( aSet ); @@ -1534,13 +1536,14 @@ void SwSpellIter::ToSentenceStart() static LanguageType lcl_GetLanguage(SwEditShell& rSh) { - sal_uInt16 nScriptType = rSh.GetScriptType(); + SvtScriptType nScriptType = rSh.GetScriptType(); sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE; switch(nScriptType) { - case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; + case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; + case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; + default: break; } SfxItemSet aSet(rSh.GetAttrPool(), nLangWhichId, nLangWhichId, 0); rSh.GetCurAttr( aSet ); diff --git a/sw/source/core/inc/scriptinfo.hxx b/sw/source/core/inc/scriptinfo.hxx index 215c8005bbcc..2fa1bc5cde26 100644 --- a/sw/source/core/inc/scriptinfo.hxx +++ b/sw/source/core/inc/scriptinfo.hxx @@ -178,7 +178,7 @@ public: // "high" level operations, nPos refers to string position sal_Int32 NextScriptChg( const sal_Int32 nPos ) const; - sal_uInt8 ScriptType( const sal_Int32 nPos ) const; + sal_Int16 ScriptType( const sal_Int32 nPos ) const; // Returns the position of the next direction level change. // If bLevel is set, the position of the next level which is smaller diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index e63aa81da0ff..36d41f4a48b6 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1489,7 +1489,7 @@ SwEnhancedPDFExportHelper::SwEnhancedPDFExportHelper( SwEditShell& rSh, aStructStack.clear(); #endif - const sal_uInt8 nScript = (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + const sal_Int16 nScript = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); sal_uInt16 nLangRes = RES_CHRATR_LANGUAGE; if ( i18n::ScriptType::ASIAN == nScript ) diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 442e22e2a16f..0fad655ed38b 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -663,7 +663,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL ) // counter for kashida array size_t nCntKash = 0; - sal_uInt8 nScript = i18n::ScriptType::LATIN; + sal_Int16 nScript = i18n::ScriptType::LATIN; // compression type const SwCharCompressType aCompEnum = rNode.getIDocumentSettingAccess()->getCharacterCompressionType(); @@ -777,7 +777,7 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, bool bRTL ) if (nEnd > rTxt.getLength() || nEnd < 0) nEnd = rTxt.getLength(); - nScript = (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + nScript = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); SAL_WARN_IF( i18n::ScriptType::LATIN != nScript && i18n::ScriptType::ASIAN != nScript && @@ -1243,7 +1243,7 @@ sal_Int32 SwScriptInfo::NextScriptChg(const sal_Int32 nPos) const } // returns the script of the character at the input position -sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const +sal_Int16 SwScriptInfo::ScriptType(const sal_Int32 nPos) const { const size_t nEnd = CountScriptChg(); for( size_t nX = 0; nX < nEnd; ++nX ) @@ -1253,7 +1253,7 @@ sal_uInt8 SwScriptInfo::ScriptType(const sal_Int32 nPos) const } // the default is the application language script - return (sal_uInt8)GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + return SvtLanguageOptions::GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); } sal_Int32 SwScriptInfo::NextDirChg( const sal_Int32 nPos, diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 7aa8b52a406f..ef0f681114e3 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -1165,7 +1165,7 @@ bool SwTxtNode::Convert( SwConversionArgs &rArgs ) SwEditShell *pEditShell = GetDoc()->GetEditShell(); pEditShell->Push(); // save current cursor on stack pEditShell->SetSelection( aCurPaM ); - bool bIsAsianScript = (SCRIPTTYPE_ASIAN == pEditShell->GetScriptType()); + bool bIsAsianScript = (SvtScriptType::ASIAN == pEditShell->GetScriptType()); pEditShell->Pop( false ); // restore cursor from stack if (!bIsAsianScript && rArgs.bAllowImplicitChangesForNotConvertibleText) diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index 9c1c164e9588..6bc9f674d3f5 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -55,7 +55,7 @@ class SwASCIIParser const SwAsciiOptions& rOpt; SfxItemSet* pItemSet; long nFileSize; - sal_uInt16 nScript; + SvtScriptType nScript; bool bNewDoc; sal_uLong ReadChars(); @@ -90,7 +90,7 @@ sal_uLong AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OU SwASCIIParser::SwASCIIParser(SwDoc* pD, const SwPaM& rCrsr, SvStream& rIn, bool bReadNewDoc, const SwAsciiOptions& rOpts) - : pDoc(pD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(0) + : pDoc(pD), rInput(rIn), rOpt(rOpts), nFileSize(0), nScript(SvtScriptType::NONE) , bNewDoc(bReadNewDoc) { pPam = new SwPaM( *rCrsr.GetPoint() ); @@ -168,17 +168,17 @@ sal_uLong SwASCIIParser::CallParser() if( pItemSet ) { // set only the attribute, for scanned scripts. - if( !( SCRIPTTYPE_LATIN & nScript )) + if( !( SvtScriptType::LATIN & nScript )) { pItemSet->ClearItem( RES_CHRATR_FONT ); pItemSet->ClearItem( RES_CHRATR_LANGUAGE ); } - if( !( SCRIPTTYPE_ASIAN & nScript )) + if( !( SvtScriptType::ASIAN & nScript )) { pItemSet->ClearItem( RES_CHRATR_CJK_FONT ); pItemSet->ClearItem( RES_CHRATR_CJK_LANGUAGE ); } - if( !( SCRIPTTYPE_COMPLEX & nScript )) + if( !( SvtScriptType::COMPLEX & nScript )) { pItemSet->ClearItem( RES_CHRATR_CTL_FONT ); pItemSet->ClearItem( RES_CHRATR_CTL_LANGUAGE ); @@ -491,9 +491,9 @@ void SwASCIIParser::InsertText( const OUString& rStr ) pDoc->UpdateRsid( *pPam, rStr.getLength() ); pDoc->UpdateParRsid( pPam->GetPoint()->nNode.GetNode().GetTxtNode() ); - if( pItemSet && g_pBreakIt && nScript != ( SCRIPTTYPE_LATIN | - SCRIPTTYPE_ASIAN | - SCRIPTTYPE_COMPLEX ) ) + if( pItemSet && g_pBreakIt && nScript != ( SvtScriptType::LATIN | + SvtScriptType::ASIAN | + SvtScriptType::COMPLEX ) ) nScript |= g_pBreakIt->GetAllScriptsOfText( rStr ); } diff --git a/sw/source/filter/html/htmlgrin.cxx b/sw/source/filter/html/htmlgrin.cxx index 5e56daac17a5..9eebbfa0af62 100644 --- a/sw/source/filter/html/htmlgrin.cxx +++ b/sw/source/filter/html/htmlgrin.cxx @@ -1037,15 +1037,16 @@ void SwHTMLParser::InsertBodyOptions() sal_uInt16 nWhich = 0; switch( SvtLanguageOptions::GetScriptTypeOfLanguage( eLang ) ) { - case SCRIPTTYPE_LATIN: + case SvtScriptType::LATIN: nWhich = RES_CHRATR_LANGUAGE; break; - case SCRIPTTYPE_ASIAN: + case SvtScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX: + case SvtScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break; + default: break; } if( nWhich ) { diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index fd7149b8feed..548d1c940bf9 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -306,13 +306,13 @@ sal_uLong SwHTMLWriter::WriteStream() nHeaderFooterSpace = 0; nTxtAttrsToIgnore = 0; nCSS1OutMode = 0; - sal_uInt16 nScript = SvtLanguageOptions::GetScriptTypeOfLanguage( GetAppLanguage() ); + SvtScriptType nScript = SvtLanguageOptions::GetScriptTypeOfLanguage( GetAppLanguage() ); switch( nScript ) { - case SCRIPTTYPE_ASIAN: + case SvtScriptType::ASIAN: nCSS1Script = CSS1_OUTMODE_CJK; break; - case SCRIPTTYPE_COMPLEX: + case SvtScriptType::COMPLEX: nCSS1Script = CSS1_OUTMODE_CTL; break; default: diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index eca4dd2376f5..586303caa0e1 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -1078,7 +1078,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(MM_DOCTYPE_TEXT == nDocType) { SwAsciiOptions aOpt; - sal_uInt16 nAppScriptType = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + sal_uInt16 nAppScriptType = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); sal_uInt16 nWhich = GetWhichOfScript( RES_CHRATR_LANGUAGE, nAppScriptType); aOpt.SetLanguage( static_cast<const SvxLanguageItem&>(pTargetView->GetWrtShell(). GetDefault( nWhich )).GetLanguage()); diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index f097f0f89903..93c3c7793e6e 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -136,7 +136,7 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, } } - const sal_uInt16 nAppScriptType = GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ); + const sal_uInt16 nAppScriptType = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ); SwDoc* pDoc = rDocSh.GetDoc(); // initialize language @@ -155,15 +155,15 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( vcl::Window* pParent, SwDocShell& rDocSh, SvtLinguConfig().GetOptions( aLinguOpt ); switch(nAppScriptType) { - case SCRIPTTYPE_ASIAN: - aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, SCRIPTTYPE_ASIAN)); + case css::i18n::ScriptType::ASIAN: + aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CJK, css::i18n::ScriptType::ASIAN)); break; - case SCRIPTTYPE_COMPLEX: - aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, SCRIPTTYPE_COMPLEX)); + case css::i18n::ScriptType::COMPLEX: + aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage_CTL, css::i18n::ScriptType::COMPLEX)); break; - //SCRIPTTYPE_LATIN: + //SvtScriptType::LATIN: default: - aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, SCRIPTTYPE_LATIN)); + aOpt.SetLanguage(MsLangId::resolveSystemLanguageByScriptType(aLinguOpt.nDefaultLanguage, css::i18n::ScriptType::LATIN)); } } } diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index b68938cb3709..526dbb42e606 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -322,8 +322,8 @@ void SwIndexMarkPane::UpdateLanguageDependenciesForPhoneticReading() sal_uInt16 nWhich; switch(pSh->GetScriptType()) { - case SCRIPTTYPE_ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break; + case SvtScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; + case SvtScriptType::COMPLEX:nWhich = RES_CHRATR_CTL_LANGUAGE; break; default:nWhich = RES_CHRATR_LANGUAGE; break; } SfxItemSet aLangSet(pSh->GetAttrPool(), nWhich, nWhich); diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index cbc518b4185c..5cff22259e9b 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -281,13 +281,13 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText) SvxLanguageItem SwAnnotationWin::GetLanguage() { // set initial language for outliner - sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() ); + SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( mpFld->GetLanguage() ); sal_uInt16 nLangWhichId = 0; switch (nScriptType) { - case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break; - case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; + case SvtScriptType::LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break; + case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; + case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; default: OSL_FAIL("GetLanguage: wrong script type"); } return SvxLanguageItem(mpFld->GetLanguage(),nLangWhichId); diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 85834017931d..763ae8986566 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -385,13 +385,14 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) { if ((*i)->pPostIt) { - const sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld().GetField()->GetLanguage() ); + const SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( (*i)->GetFmtFld().GetField()->GetLanguage() ); sal_uInt16 nLangWhichId = 0; switch (nScriptType) { - case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break; - case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; + case SvtScriptType::LATIN : nLangWhichId = EE_CHAR_LANGUAGE ; break; + case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; + case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; + default: break; } (*i)->pPostIt->SetLanguage( SvxLanguageItem( diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 14c45edf53b5..22b968a1b4e3 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -759,7 +759,7 @@ static sal_uInt16 lcl_isNonDefaultLanguage(LanguageType eBufferLanguage, SwView& bool bLang = true; if(eBufferLanguage != LANGUAGE_DONTKNOW) { - switch( GetI18NScriptTypeOfLanguage( eBufferLanguage )) + switch( SvtLanguageOptions::GetI18NScriptTypeOfLanguage( eBufferLanguage )) { case i18n::ScriptType::ASIAN: nWhich = RES_CHRATR_CJK_LANGUAGE; break; case i18n::ScriptType::COMPLEX: nWhich = RES_CHRATR_CTL_LANGUAGE; break; diff --git a/sw/source/uibase/inc/langhelper.hxx b/sw/source/uibase/inc/langhelper.hxx index 8a62282a6866..27812adf6cec 100644 --- a/sw/source/uibase/inc/langhelper.hxx +++ b/sw/source/uibase/inc/langhelper.hxx @@ -26,6 +26,7 @@ class EditView; class OutlinerView; class SfxItemSet; struct ESelection; +enum class SvtScriptType; namespace SwLangHelper { @@ -50,7 +51,7 @@ namespace SwLangHelper extern LanguageType GetLanguage( SfxItemSet aSet, sal_uInt16 nLangWhichId ); extern LanguageType GetLanguage( SwWrtShell &rSh, sal_uInt16 nLangWhichId ); - extern LanguageType GetCurrentLanguage( SfxItemSet aSet, sal_uInt16 nScriptType ); + extern LanguageType GetCurrentLanguage( SfxItemSet aSet, SvtScriptType nScriptType ); extern LanguageType GetCurrentLanguage( SwWrtShell &rSh ); } diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index e4edd46a7112..5cba01ec71c6 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -106,9 +106,9 @@ using namespace ::com::sun::star; /// selected text. Or in other words, the language a spell checker would use. /// If there is more than one language LANGUAGE_DONTKNOW will be returned. // check if nScriptType includes the script type associated to nLang -static inline bool lcl_checkScriptType( sal_Int16 nScriptType, LanguageType nLang ) +static inline bool lcl_checkScriptType( SvtScriptType nScriptType, LanguageType nLang ) { - return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); + return bool(nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); } void SwSpellPopup::fillLangPopupMenu( @@ -125,7 +125,7 @@ void SwSpellPopup::fillLangPopupMenu( std::set< OUString > aLangItems; OUString aCurLang( aSeq[0] ); - sal_uInt16 nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32()); + SvtScriptType nScriptType = static_cast<SvtScriptType>(aSeq[1].toInt32()); OUString aKeyboardLang( aSeq[2] ); OUString aGuessedTextLang( aSeq[3] ); @@ -178,7 +178,7 @@ void SwSpellPopup::fillLangPopupMenu( const sal_Int16 nMaxCount = 7; if (xDocumentLanguages.is()) { - uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount ) ); + uno::Sequence< lang::Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ) ); if (rLocales.getLength() > 0) { for (sal_uInt16 i = 0; i < rLocales.getLength(); ++i) @@ -408,7 +408,7 @@ SwSpellPopup::SwSpellPopup( //ADD NEW LANGUAGE MENU ITEM - OUString aScriptTypesInUse( OUString::number( pWrtSh->GetScriptType() ) ); + OUString aScriptTypesInUse( OUString::number( static_cast<int>(pWrtSh->GetScriptType()) ) ); // get keyboard language OUString aKeyboardLang; @@ -557,7 +557,7 @@ m_aInfo16( SW_RES(IMG_INFO_16) ) //ADD NEW LANGUAGE MENU ITEM - OUString aScriptTypesInUse( OUString::number( pWrtSh->GetScriptType() ) ); + OUString aScriptTypesInUse( OUString::number( static_cast<int>(pWrtSh->GetScriptType()) ) ); // get keyboard language OUString aKeyboardLang; diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 2796fb863e27..d2c7b17b4bc8 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -682,7 +682,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) case SID_ATTR_CHAR_WEIGHT: case SID_ATTR_CHAR_POSTURE: { - sal_uInt16 nScriptType = pOLV->GetSelectedScriptType(); + SvtScriptType nScriptType = pOLV->GetSelectedScriptType(); SfxItemPool* pSecondPool = aEditAttr.GetPool()->GetSecondaryPool(); if( !pSecondPool ) pSecondPool = aEditAttr.GetPool(); @@ -1347,7 +1347,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) { const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) ); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage())) ); LanguageType nLang = static_cast<const SvxLanguageItem &>( rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); @@ -1660,7 +1660,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) } SfxItemSet aSet(pOLV->GetAttribs()); - sal_uInt16 nScript = pOLV->GetSelectedScriptType(); + SvtScriptType nScript = pOLV->GetSelectedScriptType(); SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); { SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); @@ -1671,7 +1671,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) else aSetDlgFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); if (sFontName.isEmpty()) sFontName = aSetDlgFont.GetFamilyName(); } @@ -1741,12 +1741,12 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), EE_CHAR_FONTINFO ); - sal_uInt16 nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym ); - if( SCRIPTTYPE_LATIN & nScriptBreak ) + SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym ); + if( SvtScriptType::LATIN & nScriptBreak ) aSetFont.Put( aFontItem, EE_CHAR_FONTINFO ); - if( SCRIPTTYPE_ASIAN & nScriptBreak ) + if( SvtScriptType::ASIAN & nScriptBreak ) aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CJK ); - if( SCRIPTTYPE_COMPLEX & nScriptBreak ) + if( SvtScriptType::COMPLEX & nScriptBreak ) aSetFont.Put( aFontItem, EE_CHAR_FONTINFO_CTL ); pOLV->SetAttribs(aSetFont); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 66cb5f3db872..27a25d569fe1 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1943,7 +1943,7 @@ void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq ) sal_uInt16 nSlot = rReq.GetSlot(); SfxItemPool& rPool = rSh.GetAttrPool(); sal_uInt16 nWhich = rPool.GetWhich( nSlot ); - sal_uInt16 nScripts = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; + SvtScriptType nScripts = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX; SfxItemSet aHeightSet( GetPool(), RES_CHRATR_FONTSIZE, RES_CHRATR_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CJK_FONTSIZE, RES_CHRATR_CTL_FONTSIZE, RES_CHRATR_CTL_FONTSIZE, @@ -2007,21 +2007,22 @@ void SwBaseShell::ExecTxtCtrl( SfxRequest& rReq ) switch(nScripts) { - case SCRIPTTYPE_LATIN: + case SvtScriptType::LATIN: nCJKSize = nHeight * nCJKSize / nWesternSize; nCTLSize = nHeight * nCTLSize / nWesternSize; nWesternSize = (sal_Int32) nHeight; break; - case SCRIPTTYPE_ASIAN: + case SvtScriptType::ASIAN: nCTLSize = nHeight* nCTLSize / nCJKSize; nWesternSize = nHeight * nWesternSize / nCJKSize; nCJKSize = (sal_Int32) nHeight; break; - case SCRIPTTYPE_COMPLEX: + case SvtScriptType::COMPLEX: nCJKSize = nHeight * nCJKSize / nCTLSize; nWesternSize = nHeight * nWesternSize / nCTLSize; nCTLSize = (sal_Int32) nHeight; break; + default: break; } aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nWesternSize, 100, RES_CHRATR_FONTSIZE )); aHeightSet.Put( SvxFontHeightItem( (sal_uInt32)nCJKSize, 100, RES_CHRATR_CJK_FONTSIZE )); @@ -2068,7 +2069,7 @@ void SwBaseShell::GetTxtFontCtrlState( SfxItemSet& rSet ) SwWrtShell &rSh = GetShell(); bool bFirst = true; boost::scoped_ptr<SfxItemSet> pFntCoreSet; - sal_uInt16 nScriptType = SCRIPTTYPE_LATIN; + SvtScriptType nScriptType = SvtScriptType::LATIN; SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); while( nWhich ) diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index f0105c37ff12..8ebc76a8651c 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -156,7 +156,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SvxScriptSetItem aSetItem( nSlot, *pPool2 ); // #i78017 establish the same behaviour as in Writer - sal_uInt16 nScriptTypes = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX; + SvtScriptType nScriptTypes = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX; if (nSlot == SID_ATTR_CHAR_FONT) nScriptTypes = pOLV->GetSelectedScriptType(); @@ -560,7 +560,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONTHEIGHT, *pPool2 ); aSetItem.GetItemSet().Put( aEditAttr, false ); - sal_uInt16 nScriptTypes = pOLV->GetSelectedScriptType(); + SvtScriptType nScriptTypes = pOLV->GetSelectedScriptType(); const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) ); if (pSize) @@ -756,7 +756,7 @@ ASK_ESCAPE: // disable "Thesaurus" if the language is not supported const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) ); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage())) ); LanguageType nLang = static_cast<const SvxLanguageItem &>(rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); @@ -888,7 +888,7 @@ void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet) SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - sal_uInt16 nScriptType = pOLV->GetSelectedScriptType(); + SvtScriptType nScriptType = pOLV->GetSelectedScriptType(); while(nWhich) { sal_uInt16 nEEWhich = 0; diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index a2aa744ccb06..96d5ea10b9e8 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -712,7 +712,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) } SfxItemSet aSet(pOLV->GetAttribs()); - sal_uInt16 nScript = pOLV->GetSelectedScriptType(); + SvtScriptType nScript = pOLV->GetSelectedScriptType(); SvxFontItem aSetDlgFont( RES_CHRATR_FONT ); { SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, *aSet.GetPool() ); @@ -723,7 +723,7 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) else aSetDlgFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); if (sFontName.isEmpty()) sFontName = aSetDlgFont.GetFamilyName(); } @@ -792,11 +792,11 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) aFont.GetCharSet(), EE_CHAR_FONTINFO ); nScript = g_pBreakIt->GetAllScriptsOfText( sSym ); - if( SCRIPTTYPE_LATIN & nScript ) + if( SvtScriptType::LATIN & nScript ) aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO ); - if( SCRIPTTYPE_ASIAN & nScript ) + if( SvtScriptType::ASIAN & nScript ) aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CJK ); - if( SCRIPTTYPE_COMPLEX & nScript ) + if( SvtScriptType::COMPLEX & nScript ) aFontAttribSet.Put( aFontItem, EE_CHAR_FONTINFO_CTL ); pOLV->SetAttribs(aFontAttribSet); diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx index cf7bf29952cc..2b386bd07d0c 100644 --- a/sw/source/uibase/shells/langhelper.cxx +++ b/sw/source/uibase/shells/langhelper.cxx @@ -66,8 +66,8 @@ namespace SwLangHelper EditEngine* pEditEngine=rEditView.GetEditEngine(); // the value of used script types - const sal_uInt16 nScriptType =pOLV->GetSelectedScriptType(); - OUString aScriptTypesInUse( OUString::number( nScriptType ) );//pEditEngine->GetScriptType(aSelection) + const SvtScriptType nScriptType =pOLV->GetSelectedScriptType(); + OUString aScriptTypesInUse( OUString::number( static_cast<int>(nScriptType) ) );//pEditEngine->GetScriptType(aSelection) // get keyboard language OUString aKeyboardLang; @@ -244,9 +244,9 @@ namespace SwLangHelper bool bIsSingleScriptType = true; switch (SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )) { - case SCRIPTTYPE_LATIN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE : RES_CHRATR_LANGUAGE; break; - case SCRIPTTYPE_ASIAN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CJK : RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CTL : RES_CHRATR_CTL_LANGUAGE; break; + case SvtScriptType::LATIN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE : RES_CHRATR_LANGUAGE; break; + case SvtScriptType::ASIAN : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CJK : RES_CHRATR_CJK_LANGUAGE; break; + case SvtScriptType::COMPLEX : nLangWhichId = pEditEngine ? EE_CHAR_LANGUAGE_CTL : RES_CHRATR_CTL_LANGUAGE; break; default: bIsSingleScriptType = false; OSL_FAIL("unexpected case" ); @@ -451,9 +451,9 @@ namespace SwLangHelper bool bIsSingleScriptType = true; switch (rSh.GetScriptType()) { - case SCRIPTTYPE_LATIN : nLangWhichId = RES_CHRATR_LANGUAGE; break; - case SCRIPTTYPE_ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; + case SvtScriptType::LATIN : nLangWhichId = RES_CHRATR_LANGUAGE; break; + case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break; + case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break; default: bIsSingleScriptType = false; break; } @@ -492,16 +492,16 @@ namespace SwLangHelper /// 'In use' means the language(s) matching the script type(s) of the /// selected text. Or in other words, the language a spell checker would use. /// If there is more than one language LANGUAGE_DONTKNOW will be returned. - LanguageType GetCurrentLanguage( SfxItemSet aSet, sal_uInt16 nScriptType ) + LanguageType GetCurrentLanguage( SfxItemSet aSet, SvtScriptType nScriptType ) { //set language attribute to use according to the script type sal_uInt16 nLangWhichId = 0; bool bIsSingleScriptType = true; switch (nScriptType) { - case SCRIPTTYPE_LATIN : nLangWhichId = EE_CHAR_LANGUAGE; break; - case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; - case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; + case SvtScriptType::LATIN : nLangWhichId = EE_CHAR_LANGUAGE; break; + case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break; + case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break; default: bIsSingleScriptType = false; } diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 912ce34066a0..57bfb92d3673 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -987,7 +987,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 0 ); rSh.GetCurAttr( aSet ); - sal_uInt16 nScript = rSh.GetScriptType(); + SvtScriptType nScript = rSh.GetScriptType(); SvxFontItem aFont( RES_CHRATR_FONT ); { @@ -1001,7 +1001,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); if (aFontName.isEmpty()) aFontName = aFont.GetFamilyName(); } @@ -1067,7 +1067,7 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) else aFont = static_cast<const SvxFontItem&>(aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); + SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetAppLanguage() ) ))); } // Insert character. @@ -1087,17 +1087,17 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONT, 0 ); nScript = g_pBreakIt->GetAllScriptsOfText( aChars ); - if( SCRIPTTYPE_LATIN & nScript ) + if( SvtScriptType::LATIN & nScript ) { aRestoreSet.Put( aSet.Get( RES_CHRATR_FONT, true ) ); aSet.Put( aNewFontItem, RES_CHRATR_FONT); } - if( SCRIPTTYPE_ASIAN & nScript ) + if( SvtScriptType::ASIAN & nScript ) { aRestoreSet.Put( aSet.Get( RES_CHRATR_CJK_FONT, true ) ); aSet.Put( aNewFontItem, RES_CHRATR_CJK_FONT ); } - if( SCRIPTTYPE_COMPLEX & nScript ) + if( SvtScriptType::COMPLEX & nScript ) { aRestoreSet.Put( aSet.Get( RES_CHRATR_CTL_FONT, true ) ); aSet.Put( aNewFontItem, RES_CHRATR_CTL_FONT ); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 8ad15cf406d7..3c268fc3908e 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1393,7 +1393,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case SID_LANGUAGE_STATUS: { // the value of used script types - OUString aScriptTypesInUse( OUString::number( rSh.GetScriptType() ) ); + OUString aScriptTypesInUse( OUString::number( static_cast<int>(rSh.GetScriptType()) ) ); // get keyboard language OUString aKeyboardLang; diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 49fc1741a7ce..17015b256823 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -222,7 +222,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq) rWrtSh.GetCurAttr( aSetItem.GetItemSet() ); SfxItemSet aAttrSet( rPool, aSetItem.GetItemSet().GetRanges() ); - sal_uInt16 nScriptTypes = rWrtSh.GetScriptType(); + SvtScriptType nScriptTypes = rWrtSh.GetScriptType(); const SvxFontHeightItem* pSize( static_cast<const SvxFontHeightItem*>( aSetItem.GetItemOfScript( nScriptTypes ) ) ); std::vector<std::pair< const SfxPoolItem*, std::unique_ptr<SwPaM> >> vItems; |