summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-04-15 09:36:39 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-04-17 07:21:08 +0000
commita7b7c64afc523cfd9ff4e724b3efbec6567fc1c8 (patch)
tree52fd05ef3292f3dab172864cbc3be96a8d44a9d0
parentadd7eeb7dbd0eefa0c5ae5430490864079add801 (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>
-rw-r--r--cui/source/options/optgdlg.cxx10
-rw-r--r--desktop/source/app/langselect.cxx4
-rw-r--r--editeng/source/editeng/editdoc.cxx18
-rw-r--r--editeng/source/editeng/editdoc.hxx5
-rw-r--r--editeng/source/editeng/editeng.cxx6
-rw-r--r--editeng/source/editeng/editobj.cxx12
-rw-r--r--editeng/source/editeng/editobj2.hxx13
-rw-r--r--editeng/source/editeng/editview.cxx10
-rw-r--r--editeng/source/editeng/impedit.hxx7
-rw-r--r--editeng/source/editeng/impedit2.cxx12
-rw-r--r--editeng/source/editeng/impedit3.cxx9
-rw-r--r--editeng/source/editeng/impedit4.cxx22
-rw-r--r--editeng/source/items/textitem.cxx80
-rw-r--r--editeng/source/outliner/outlin2.cxx2
-rw-r--r--editeng/source/outliner/outlvw.cxx10
-rw-r--r--forms/source/richtext/richtextimplcontrol.cxx8
-rw-r--r--forms/source/richtext/richtextimplcontrol.hxx4
-rw-r--r--forms/source/richtext/rtattributehandler.cxx19
-rw-r--r--forms/source/richtext/rtattributehandler.hxx21
-rw-r--r--forms/source/richtext/rtattributes.hxx2
-rw-r--r--framework/inc/helper/mischelper.hxx11
-rw-r--r--framework/inc/uielement/langselectionmenucontroller.hxx8
-rw-r--r--framework/source/fwi/helper/mischelper.cxx4
-rw-r--r--framework/source/uielement/langselectionmenucontroller.cxx6
-rw-r--r--framework/source/uielement/langselectionstatusbarcontroller.cxx14
-rw-r--r--include/editeng/editeng.hxx7
-rw-r--r--include/editeng/editobj.hxx3
-rw-r--r--include/editeng/editview.hxx3
-rw-r--r--include/editeng/outliner.hxx7
-rw-r--r--include/editeng/scripttypeitem.hxx12
-rw-r--r--include/svl/languageoptions.hxx48
-rw-r--r--include/svx/svdedxv.hxx5
-rw-r--r--oox/source/export/drawingml.cxx4
-rw-r--r--sc/inc/celltextattr.hxx5
-rw-r--r--sc/inc/column.hxx8
-rw-r--r--sc/inc/document.hxx15
-rw-r--r--sc/inc/documentimport.hxx3
-rw-r--r--sc/inc/global.hxx7
-rw-r--r--sc/inc/globalnames.hxx4
-rw-r--r--sc/inc/patattr.hxx7
-rw-r--r--sc/inc/table.hxx6
-rw-r--r--sc/qa/unit/ucalc_column.cxx8
-rw-r--r--sc/source/core/data/celltextattr.cxx2
-rw-r--r--sc/source/core/data/column.cxx14
-rw-r--r--sc/source/core/data/column2.cxx42
-rw-r--r--sc/source/core/data/column3.cxx2
-rw-r--r--sc/source/core/data/column4.cxx2
-rw-r--r--sc/source/core/data/documen6.cxx39
-rw-r--r--sc/source/core/data/documen8.cxx6
-rw-r--r--sc/source/core/data/document.cxx6
-rw-r--r--sc/source/core/data/documentimport.cxx14
-rw-r--r--sc/source/core/data/global.cxx24
-rw-r--r--sc/source/core/data/patattr.cxx12
-rw-r--r--sc/source/core/data/table1.cxx10
-rw-r--r--sc/source/core/data/table5.cxx4
-rw-r--r--sc/source/core/tool/numformat.cxx4
-rw-r--r--sc/source/filter/excel/xestyle.cxx28
-rw-r--r--sc/source/filter/excel/xlroot.cxx6
-rw-r--r--sc/source/filter/html/htmlexp.cxx4
-rw-r--r--sc/source/filter/inc/htmlexp.hxx4
-rw-r--r--sc/source/filter/rtf/eeimpars.cxx6
-rw-r--r--sc/source/filter/xml/xmlimprt.cxx2
-rw-r--r--sc/source/ui/app/inputwin.cxx14
-rw-r--r--sc/source/ui/drawfunc/drtxtob.cxx6
-rw-r--r--sc/source/ui/inc/gridwin.hxx2
-rw-r--r--sc/source/ui/inc/viewfunc.hxx2
-rw-r--r--sc/source/ui/inc/viewutil.hxx4
-rw-r--r--sc/source/ui/view/editsh.cxx24
-rw-r--r--sc/source/ui/view/formatsh.cxx20
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/gridwin4.cxx6
-rw-r--r--sc/source/ui/view/output2.cxx22
-rw-r--r--sc/source/ui/view/viewfun2.cxx4
-rw-r--r--sc/source/ui/view/viewfunc.cxx6
-rw-r--r--sc/source/ui/view/viewutil.cxx12
-rw-r--r--sd/source/core/sdpage.cxx6
-rw-r--r--sd/source/filter/eppt/pptx-text.cxx2
-rw-r--r--sd/source/ui/docshell/docshel3.cxx8
-rw-r--r--sd/source/ui/inc/OutlineView.hxx2
-rw-r--r--sd/source/ui/view/drtxtob.cxx2
-rw-r--r--sd/source/ui/view/drtxtob1.cxx2
-rw-r--r--sd/source/ui/view/outlview.cxx4
-rw-r--r--starmath/source/format.cxx6
-rw-r--r--svl/source/config/cjkoptions.cxx8
-rw-r--r--svl/source/config/ctloptions.cxx8
-rw-r--r--svl/source/config/languageoptions.cxx41
-rw-r--r--svx/source/dialog/langbox.cxx6
-rw-r--r--svx/source/svdraw/svdedxv.cxx8
-rw-r--r--sw/inc/breakit.hxx4
-rw-r--r--sw/inc/editsh.hxx4
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx2
-rw-r--r--sw/source/core/attr/hints.cxx2
-rw-r--r--sw/source/core/bastyp/breakit.cxx21
-rw-r--r--sw/source/core/bastyp/calc.cxx2
-rw-r--r--sw/source/core/doc/extinput.cxx2
-rw-r--r--sw/source/core/edit/edattr.cxx32
-rw-r--r--sw/source/core/edit/edlingu.cxx21
-rw-r--r--sw/source/core/inc/scriptinfo.hxx2
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx2
-rw-r--r--sw/source/core/text/porlay.cxx8
-rw-r--r--sw/source/core/txtnode/txtedt.cxx2
-rw-r--r--sw/source/filter/ascii/parasc.cxx16
-rw-r--r--sw/source/filter/html/htmlgrin.cxx7
-rw-r--r--sw/source/filter/html/wrthtml.cxx6
-rw-r--r--sw/source/ui/dbui/mmoutputpage.cxx2
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx14
-rw-r--r--sw/source/ui/index/swuiidxmrk.cxx4
-rw-r--r--sw/source/uibase/docvw/AnnotationWin.cxx8
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx9
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx2
-rw-r--r--sw/source/uibase/inc/langhelper.hxx3
-rw-r--r--sw/source/uibase/lingu/olmenu.cxx12
-rw-r--r--sw/source/uibase/shells/annotsh.cxx16
-rw-r--r--sw/source/uibase/shells/basesh.cxx11
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx8
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx10
-rw-r--r--sw/source/uibase/shells/langhelper.cxx24
-rw-r--r--sw/source/uibase/shells/textsh.cxx12
-rw-r--r--sw/source/uibase/shells/textsh1.cxx2
-rw-r--r--sw/source/uibase/shells/txtattr.cxx2
120 files changed, 603 insertions, 596 deletions
diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx
index 75869bc6c3c1..107f3f1b6103 100644
--- a/cui/source/options/optgdlg.cxx
+++ b/cui/source/options/optgdlg.cxx
@@ -1331,8 +1331,8 @@ bool OfaLanguagesTabPage::FillItemSet( SfxItemSet* rSet )
pLangConfig->aSysLocaleOptions.SetLocaleConfigString( sNewLang );
rSet->Put( SfxBoolItem( SID_OPT_LOCALE_CHANGED, true ) );
- sal_uInt16 nNewType = SvtLanguageOptions::GetScriptTypeOfLanguage( eNewLocale );
- bool bNewCJK = ( nNewType & SCRIPTTYPE_ASIAN ) != 0;
+ SvtScriptType nNewType = SvtLanguageOptions::GetScriptTypeOfLanguage( eNewLocale );
+ bool bNewCJK = bool( nNewType & SvtScriptType::ASIAN );
SvtCompatibilityOptions aCompatOpts;
aCompatOpts.SetDefault( COMPATIBILITY_PROPERTYNAME_EXPANDWORDSPACE, !bNewCJK );
}
@@ -1677,12 +1677,12 @@ namespace
IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
{
LanguageType eLang = pBox->GetSelectLanguage();
- sal_uInt16 nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang);
+ SvtScriptType nType = SvtLanguageOptions::GetScriptTypeOfLanguage(eLang);
// first check if CTL must be enabled
// #103299# - if CTL font setting is not readonly
if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_CTLFONT))
{
- bool bIsCTLFixed = (nType & SCRIPTTYPE_COMPLEX) != 0;
+ bool bIsCTLFixed = bool(nType & SvtScriptType::COMPLEX);
lcl_checkLanguageCheckBox(m_pCTLSupportCB, bIsCTLFixed, m_bOldCtl);
SupportHdl( m_pCTLSupportCB );
}
@@ -1690,7 +1690,7 @@ IMPL_LINK( OfaLanguagesTabPage, LocaleSettingHdl, SvxLanguageBox*, pBox )
// #103299# - if CJK support is not readonly
if(!pLangConfig->aLanguageOptions.IsReadOnly(SvtLanguageOptions::E_ALLCJK))
{
- bool bIsCJKFixed = (nType & SCRIPTTYPE_ASIAN) != 0;
+ bool bIsCJKFixed = bool(nType & SvtScriptType::ASIAN);
lcl_checkLanguageCheckBox(m_pAsianSupportCB, bIsCJKFixed, m_bOldAsian);
SupportHdl( m_pAsianSupportCB );
}
diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx
index a3f94791f091..d57a68f75cb9 100644
--- a/desktop/source/app/langselect.cxx
+++ b/desktop/source/app/langselect.cxx
@@ -79,10 +79,10 @@ void setMsLangIdFallback(OUString const & locale) {
if (!locale.isEmpty()) {
LanguageType type = LanguageTag::convertToLanguageTypeWithFallback(locale);
switch (SvtLanguageOptions::GetScriptTypeOfLanguage(type)) {
- case SCRIPTTYPE_ASIAN:
+ case SvtScriptType::ASIAN:
MsLangId::setConfiguredAsianFallback(type);
break;
- case SCRIPTTYPE_COMPLEX:
+ case SvtScriptType::COMPLEX:
MsLangId::setConfiguredComplexFallback(type);
break;
default:
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index faa6825d0aa1..a1651abb2bc0 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -74,29 +74,29 @@ using namespace ::com::sun::star;
-sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType )
+sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, SvtScriptType nScriptType )
{
sal_uInt16 nId = nItemId;
- if ( ( nScriptType == i18n::ScriptType::ASIAN ) ||
- ( nScriptType == i18n::ScriptType::COMPLEX ) )
+ if ( ( nScriptType == SvtScriptType::ASIAN ) ||
+ ( nScriptType == SvtScriptType::COMPLEX ) )
{
switch ( nItemId )
{
case EE_CHAR_LANGUAGE:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_LANGUAGE_CJK : EE_CHAR_LANGUAGE_CTL;
+ nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_LANGUAGE_CJK : EE_CHAR_LANGUAGE_CTL;
break;
case EE_CHAR_FONTINFO:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_FONTINFO_CJK : EE_CHAR_FONTINFO_CTL;
+ nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_FONTINFO_CJK : EE_CHAR_FONTINFO_CTL;
break;
case EE_CHAR_FONTHEIGHT:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_FONTHEIGHT_CJK : EE_CHAR_FONTHEIGHT_CTL;
+ nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_FONTHEIGHT_CJK : EE_CHAR_FONTHEIGHT_CTL;
break;
case EE_CHAR_WEIGHT:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_WEIGHT_CJK : EE_CHAR_WEIGHT_CTL;
+ nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_WEIGHT_CJK : EE_CHAR_WEIGHT_CTL;
break;
case EE_CHAR_ITALIC:
- nId = ( nScriptType == i18n::ScriptType::ASIAN ) ? EE_CHAR_ITALIC_CJK : EE_CHAR_ITALIC_CTL;
+ nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_ITALIC_CJK : EE_CHAR_ITALIC_CTL;
break;
}
}
@@ -2024,7 +2024,7 @@ void EditDoc::RemoveItemsFromPool(const ContentNode& rNode)
}
}
-void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, short nScriptType )
+void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, SvtScriptType nScriptType )
{
vcl::Font aPrevFont( rFont );
rFont.SetAlign( ALIGN_BASELINE );
diff --git a/editeng/source/editeng/editdoc.hxx b/editeng/source/editeng/editdoc.hxx
index 5d120972a13a..61e8a34854cd 100644
--- a/editeng/source/editeng/editdoc.hxx
+++ b/editeng/source/editeng/editdoc.hxx
@@ -28,6 +28,7 @@
#include <svl/itemset.hxx>
#include <svl/style.hxx>
#include <svl/itempool.hxx>
+#include <svl/languageoptions.hxx>
#include <tools/lineend.hxx>
#include <vector>
@@ -44,8 +45,8 @@ class SvxTabStop;
#define CHARPOSGROW 16
#define DEFTAB 720
-void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent = true, short nScriptType = 0 );
-sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, short nScriptType );
+void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent = true, SvtScriptType nScriptType = SvtScriptType::NONE );
+sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, SvtScriptType nScriptType );
bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType );
EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sal_Int32 nS, sal_Int32 nE );
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index eec5cb9771ea..70a012bb85e8 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -459,7 +459,7 @@ EEHorizontalTextDirection EditEngine::GetDefaultHorizontalTextDirection() const
return pImpEditEngine->GetDefaultHorizontalTextDirection();
}
-sal_uInt16 EditEngine::GetScriptType( const ESelection& rSelection ) const
+SvtScriptType EditEngine::GetScriptType( const ESelection& rSelection ) const
{
EditSelection aSel( pImpEditEngine->CreateSel( rSelection ) );
return pImpEditEngine->GetItemScriptType( aSel );
@@ -666,7 +666,7 @@ const ParaPortion* EditEngine::GetPrevVisPortion(const ParaPortion* pCurPortion)
return pImpEditEngine->GetPrevVisPortion(pCurPortion);
}
-sal_uInt16 EditEngine::GetScriptType(const EditSelection& rSel) const
+SvtScriptType EditEngine::GetScriptType(const EditSelection& rSel) const
{
return pImpEditEngine->GetItemScriptType(rSel);
}
@@ -2598,7 +2598,7 @@ void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const SvxFont& rFont )
rSet.Put( SvxCharReliefItem( rFont.GetRelief(), EE_CHAR_RELIEF ) );
}
-vcl::Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType )
+vcl::Font EditEngine::CreateFontFromItemSet( const SfxItemSet& rItemSet, SvtScriptType nScriptType )
{
SvxFont aFont;
CreateFont( aFont, rItemSet, true, nScriptType );
diff --git a/editeng/source/editeng/editobj.cxx b/editeng/source/editeng/editobj.cxx
index 03b7f04ae84e..2f4c3d4a2062 100644
--- a/editeng/source/editeng/editobj.cxx
+++ b/editeng/source/editeng/editobj.cxx
@@ -368,7 +368,7 @@ void EditTextObject::SetVertical( bool bVertical )
return mpImpl->SetVertical(bVertical);
}
-sal_uInt16 EditTextObject::GetScriptType() const
+SvtScriptType EditTextObject::GetScriptType() const
{
return mpImpl->GetScriptType();
}
@@ -569,7 +569,7 @@ EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, SfxItemPool* pP
bVertical = false;
bStoreUnicodeStrings = false;
- nScriptType = 0;
+ nScriptType = SvtScriptType::NONE;
}
EditTextObjectImpl::EditTextObjectImpl( EditTextObject* pFront, const EditTextObjectImpl& r ) :
@@ -672,7 +672,7 @@ void EditTextObjectImpl::SetVertical( bool b )
}
-void EditTextObjectImpl::SetScriptType( sal_uInt16 nType )
+void EditTextObjectImpl::SetScriptType( SvtScriptType nType )
{
nScriptType = nType;
}
@@ -1244,7 +1244,7 @@ void EditTextObjectImpl::StoreData( SvStream& rOStream ) const
rOStream.WriteUInt32( nObjSettings );
rOStream.WriteUChar( bVertical );
- rOStream.WriteUInt16( nScriptType );
+ rOStream.WriteUInt16( static_cast<sal_uInt16>(nScriptType) );
rOStream.WriteUChar( bStoreUnicodeStrings );
if ( bStoreUnicodeStrings )
@@ -1503,7 +1503,9 @@ void EditTextObjectImpl::CreateData( SvStream& rIStream )
if ( nVersion >= 602 )
{
- rIStream.ReadUInt16( nScriptType );
+ sal_uInt16 aTmp16;
+ rIStream.ReadUInt16( aTmp16 );
+ nScriptType = static_cast<SvtScriptType>(aTmp16);
bool bUnicodeStrings(false);
rIStream.ReadCharAsBool( bUnicodeStrings );
diff --git a/editeng/source/editeng/editobj2.hxx b/editeng/source/editeng/editobj2.hxx
index 57725bced441..fe1fcf30972f 100644
--- a/editeng/source/editeng/editobj2.hxx
+++ b/editeng/source/editeng/editobj2.hxx
@@ -26,6 +26,7 @@
#include <unotools/fontcvt.hxx>
#include "svl/sharedstring.hxx"
+#include <svl/languageoptions.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/noncopyable.hpp>
@@ -185,10 +186,10 @@ private:
XParaPortionList* pPortionInfo;
sal_uInt32 nObjSettings;
- sal_uInt16 nMetric;
- sal_uInt16 nVersion;
- sal_uInt16 nUserType;
- sal_uInt16 nScriptType;
+ sal_uInt16 nMetric;
+ sal_uInt16 nVersion;
+ sal_uInt16 nUserType;
+ SvtScriptType nScriptType;
bool bOwnerOfPool:1;
bool bVertical:1;
@@ -214,8 +215,8 @@ public:
bool IsVertical() const { return bVertical;}
void SetVertical( bool b );
- sal_uInt16 GetScriptType() const { return nScriptType;}
- void SetScriptType( sal_uInt16 nType );
+ SvtScriptType GetScriptType() const { return nScriptType;}
+ void SetScriptType( SvtScriptType nType );
ContentInfo* CreateAndInsertContent();
XEditAttribute* CreateAttrib( const SfxPoolItem& rItem, sal_uInt16 nStart, sal_uInt16 nEnd );
diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx
index d407e4e26402..4d96e64c8a4b 100644
--- a/editeng/source/editeng/editview.cxx
+++ b/editeng/source/editeng/editview.cxx
@@ -259,7 +259,7 @@ void EditView::DeleteSelected()
pImpEditView->DeleteSelected();
}
-sal_uInt16 EditView::GetSelectedScriptType() const
+SvtScriptType EditView::GetSelectedScriptType() const
{
return pImpEditView->pEditEngine->GetScriptType( pImpEditView->GetEditSelection() );
}
@@ -945,14 +945,14 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack )
else if ( ( nId == MN_WORDLANGUAGE ) || ( nId == MN_PARALANGUAGE ) )
{
LanguageType nLangToUse = (nId == MN_WORDLANGUAGE) ? nGuessLangWord : nGuessLangPara;
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLangToUse );
SfxItemSet aAttrs = GetEditEngine()->GetEmptyItemSet();
- if (nScriptType == SCRIPTTYPE_LATIN)
+ if (nScriptType == SvtScriptType::LATIN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE ) );
- if (nScriptType == SCRIPTTYPE_COMPLEX)
+ if (nScriptType == SvtScriptType::COMPLEX)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CTL ) );
- if (nScriptType == SCRIPTTYPE_ASIAN)
+ if (nScriptType == SvtScriptType::ASIAN)
aAttrs.Put( SvxLanguageItem( nLangToUse, EE_CHAR_LANGUAGE_CJK ) );
if ( nId == MN_PARALANGUAGE )
{
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 92e7f274302b..45dc28a27123 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -37,6 +37,7 @@
#include <vcl/dndhelp.hxx>
#include <svl/ondemand.hxx>
+#include <svl/languageoptions.hxx>
#include <com/sun/star/linguistic2/XSpellAlternatives.hpp>
#include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
@@ -608,9 +609,9 @@ private:
void InitScriptTypes( sal_Int32 nPara );
sal_uInt16 GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEndPos = NULL ) const;
- sal_uInt16 GetItemScriptType( const EditSelection& rSel ) const;
- bool IsScriptChange( const EditPaM& rPaM ) const;
- bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const;
+ SvtScriptType GetItemScriptType( const EditSelection& rSel ) const;
+ bool IsScriptChange( const EditPaM& rPaM ) const;
+ bool HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const;
bool ImplCalcAsianCompression( ContentNode* pNode, TextPortion* pTextPortion, sal_Int32 nStartPos,
long* pDXArray, sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 7d4f1c8a2b92..b0593cde7b6b 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1686,7 +1686,7 @@ void ImpEditEngine::InitScriptTypes( sal_Int32 nPara )
}
if ( rTypes[0].nScriptType == i18n::ScriptType::WEAK )
- rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
+ rTypes[0].nScriptType = ( rTypes.size() > 1 ) ? rTypes[1].nScriptType : SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
// create writing direction information:
if ( pParaPortion->aWritingDirectionInfos.empty() )
@@ -1776,15 +1776,15 @@ sal_uInt16 ImpEditEngine::GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEn
*pEndPos = itr->nEndPos;
}
}
- return nScriptType ? nScriptType : GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
+ return nScriptType ? nScriptType : SvtLanguageOptions::GetI18NScriptTypeOfLanguage( GetDefaultLanguage() );
}
-sal_uInt16 ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) const
+SvtScriptType ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) const
{
EditSelection aSel( rSel );
aSel.Adjust( aEditDoc );
- short nScriptType = 0;
+ SvtScriptType nScriptType = SvtScriptType::NONE;
sal_Int32 nStartPara = GetEditDoc().GetPos( aSel.Min().GetNode() );
sal_Int32 nEndPara = GetEditDoc().GetPos( aSel.Max().GetNode() );
@@ -1821,11 +1821,11 @@ sal_uInt16 ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) const
if (bStartInRange || bEndInRange)
{
if ( rTypes[n].nScriptType != i18n::ScriptType::WEAK )
- nScriptType |= ::GetItemScriptType( rTypes[n].nScriptType );
+ nScriptType |= SvtLanguageOptions::FromI18NToSvtScriptType( rTypes[n].nScriptType );
}
}
}
- return nScriptType ? nScriptType : SvtLanguageOptions::GetScriptTypeOfLanguage( GetDefaultLanguage() );
+ return bool(nScriptType) ? nScriptType : SvtLanguageOptions::GetScriptTypeOfLanguage( GetDefaultLanguage() );
}
bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 5157b8b95708..eb9f2ebb9265 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -2564,8 +2564,9 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
/*
* Set attributes for script types Asian and Complex
*/
- short nScriptType = GetI18NScriptType( EditPaM( pNode, nPos ) );
- if ( ( nScriptType == i18n::ScriptType::ASIAN ) || ( nScriptType == i18n::ScriptType::COMPLEX ) )
+ short nScriptTypeI18N = GetI18NScriptType( EditPaM( pNode, nPos ) );
+ SvtScriptType nScriptType = SvtLanguageOptions::FromI18NToSvtScriptType(nScriptTypeI18N);
+ if ( ( nScriptTypeI18N == i18n::ScriptType::ASIAN ) || ( nScriptTypeI18N == i18n::ScriptType::COMPLEX ) )
{
const SvxFontItem& rFontItem = static_cast<const SvxFontItem&>(pNode->GetContentAttribs().GetItem( GetScriptItemId( EE_CHAR_FONTINFO, nScriptType ) ));
rFont.SetName( rFontItem.GetFamilyName() );
@@ -2624,7 +2625,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
|| ( !pNode->Len() ) ) )
{
DBG_ASSERT( ( pAttrib->Which() >= EE_CHAR_START ) && ( pAttrib->Which() <= EE_FEATURE_END ), "Invalid Attribute in Seek() " );
- if ( IsScriptItemValid( pAttrib->Which(), nScriptType ) )
+ if ( IsScriptItemValid( pAttrib->Which(), nScriptTypeI18N ) )
{
pAttrib->SetFont( rFont, pOut );
// #i1550# hard color attrib should win over text color from field
@@ -2649,7 +2650,7 @@ void ImpEditEngine::SeekCursor( ContentNode* pNode, sal_Int32 nPos, SvxFont& rFo
rFont.SetCJKContextLanguage( pCJKLanguageItem->GetLanguage() );
- if ( rFont.GetKerning() && IsKernAsianPunctuation() && ( nScriptType == i18n::ScriptType::ASIAN ) )
+ if ( rFont.GetKerning() && IsKernAsianPunctuation() && ( nScriptTypeI18N == i18n::ScriptType::ASIAN ) )
rFont.SetKerning( rFont.GetKerning() | KERNING_ASIAN );
if ( aStatus.DoNotUseColors() )
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 37d0b2080cc4..6067a908d88c 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -641,7 +641,8 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
else
{
aAttribItems.Clear();
- sal_uInt16 nScriptType = GetI18NScriptType( EditPaM( pNode, nIndex+1 ) );
+ sal_uInt16 nScriptTypeI18N = GetI18NScriptType( EditPaM( pNode, nIndex+1 ) );
+ SvtScriptType nScriptType = SvtLanguageOptions::FromI18NToSvtScriptType(nScriptTypeI18N);
if ( !n || IsScriptChange( EditPaM( pNode, nIndex ) ) )
{
SfxItemSet aAttribs = GetAttribs( nNode, nIndex+1, nIndex+1 );
@@ -652,7 +653,7 @@ sal_uInt32 ImpEditEngine::WriteRTF( SvStream& rOutput, EditSelection aSel )
aAttribItems.Insert( &aAttribs.Get( GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType ) ) );
}
// Insert hard attribs AFTER CJK attribs...
- lcl_FindValidAttribs( aAttribItems, pNode, nIndex, nScriptType );
+ lcl_FindValidAttribs( aAttribItems, pNode, nIndex, nScriptTypeI18N );
rOutput.WriteChar( '{' );
if ( WriteItemListAsRTF( aAttribItems, rOutput, nNode, nIndex, aFontTable, aColorList ) )
@@ -1421,7 +1422,8 @@ void ImpEditEngine::SetAllMisspellRanges( const std::vector<editeng::MisspellRan
LanguageType ImpEditEngine::GetLanguage( const EditPaM& rPaM, sal_Int32* pEndPos ) const
{
- short nScriptType = GetI18NScriptType( rPaM, pEndPos ); // pEndPos will be valid now, pointing to ScriptChange or NodeLen
+ short nScriptTypeI18N = GetI18NScriptType( rPaM, pEndPos ); // pEndPos will be valid now, pointing to ScriptChange or NodeLen
+ SvtScriptType nScriptType = SvtLanguageOptions::FromI18NToSvtScriptType(nScriptTypeI18N);
sal_uInt16 nLangId = GetScriptItemId( EE_CHAR_LANGUAGE, nScriptType );
const SvxLanguageItem* pLangItem = &static_cast<const SvxLanguageItem&>(rPaM.GetNode()->GetContentAttribs().GetItem( nLangId ));
const EditCharAttrib* pAttr = rPaM.GetNode()->GetCharAttribs().FindAttrib( nLangId, rPaM.GetIndex() );
@@ -2146,12 +2148,13 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
rEditView.pImpEditView->SetEditSelection( aCurrentOldPosition->Max() );
}
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
switch(nScriptType)
{
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: break;
}
if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
{
@@ -2193,12 +2196,13 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
LanguageType eCurLanguage = GetLanguage( aCurrentPaM );
if(eCurLanguage != aCurrentNewPortion->eLanguage)
{
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
sal_uInt16 nLangWhichId = EE_CHAR_LANGUAGE;
switch(nScriptType)
{
- case SCRIPTTYPE_ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
- case SCRIPTTYPE_COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ case SvtScriptType::ASIAN : nLangWhichId = EE_CHAR_LANGUAGE_CJK; break;
+ case SvtScriptType::COMPLEX : nLangWhichId = EE_CHAR_LANGUAGE_CTL; break;
+ default: break;
}
SfxItemSet aSet( aEditDoc.GetItemPool(), nLangWhichId, nLangWhichId);
aSet.Put(SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId));
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 5209e55e3341..7b3f647d8083 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -3316,13 +3316,13 @@ bool SvxCharReliefItem::QueryValue( com::sun::star::uno::Any& rVal,
|* class SvxScriptTypeItemItem
*************************************************************************/
-SvxScriptTypeItem::SvxScriptTypeItem( sal_uInt16 nType )
- : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, nType )
+SvxScriptTypeItem::SvxScriptTypeItem( SvtScriptType nType )
+ : SfxUInt16Item( SID_ATTR_CHAR_SCRIPTTYPE, static_cast<sal_uInt16>(nType) )
{
}
SfxPoolItem* SvxScriptTypeItem::Clone( SfxItemPool * ) const
{
- return new SvxScriptTypeItem( GetValue() );
+ return new SvxScriptTypeItem( static_cast<SvtScriptType>(GetValue()) );
}
/*************************************************************************
@@ -3363,80 +3363,73 @@ const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet(
return pI;
}
-const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript )
+const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, SvtScriptType nScript )
{
sal_uInt16 nLatin, nAsian, nComplex;
GetWhichIds( nSlotId, rSet, nLatin, nAsian, nComplex );
const SfxPoolItem *pRet, *pAsn, *pCmplx;
- switch( nScript )
+ if (nScript == SvtScriptType::ASIAN)
{
- default: //no one valid -> match to latin
- // case SCRIPTTYPE_LATIN:
- pRet = GetItemOfScriptSet( rSet, nLatin );
- break;
- case SCRIPTTYPE_ASIAN:
pRet = GetItemOfScriptSet( rSet, nAsian );
- break;
- case SCRIPTTYPE_COMPLEX:
+ } else if (nScript == SvtScriptType::COMPLEX)
+ {
pRet = GetItemOfScriptSet( rSet, nComplex );
- break;
-
- case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN:
+ } else if (nScript == (SvtScriptType::LATIN|SvtScriptType::ASIAN))
+ {
if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
*pRet != *pAsn )
pRet = 0;
- break;
-
- case SCRIPTTYPE_LATIN|SCRIPTTYPE_COMPLEX:
+ } else if (nScript == (SvtScriptType::LATIN|SvtScriptType::COMPLEX))
+ {
if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
*pRet != *pCmplx )
pRet = 0;
- break;
-
- case SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX:
+ } else if (nScript == (SvtScriptType::ASIAN|SvtScriptType::COMPLEX))
+ {
if( 0 == (pRet = GetItemOfScriptSet( rSet, nAsian )) ||
0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
*pRet != *pCmplx )
pRet = 0;
- break;
-
- case SCRIPTTYPE_LATIN|SCRIPTTYPE_ASIAN|SCRIPTTYPE_COMPLEX:
+ } else if (nScript == (SvtScriptType::LATIN|SvtScriptType::ASIAN|SvtScriptType::COMPLEX))
+ {
if( 0 == (pRet = GetItemOfScriptSet( rSet, nLatin )) ||
0 == (pAsn = GetItemOfScriptSet( rSet, nAsian )) ||
0 == (pCmplx = GetItemOfScriptSet( rSet, nComplex )) ||
*pRet != *pAsn || *pRet != *pCmplx )
pRet = 0;
- break;
+ } else {
+ //no one valid -> match to latin
+ pRet = GetItemOfScriptSet( rSet, nLatin );
}
return pRet;
}
-const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( sal_uInt16 nScript ) const
+const SfxPoolItem* SvxScriptSetItem::GetItemOfScript( SvtScriptType nScript ) const
{
return GetItemOfScript( Which(), GetItemSet(), nScript );
}
-void SvxScriptSetItem::PutItemForScriptType( sal_uInt16 nScriptType,
+void SvxScriptSetItem::PutItemForScriptType( SvtScriptType nScriptType,
const SfxPoolItem& rItem )
{
sal_uInt16 nLatin, nAsian, nComplex;
GetWhichIds( nLatin, nAsian, nComplex );
SfxPoolItem* pCpy = rItem.Clone();
- if( SCRIPTTYPE_LATIN & nScriptType )
+ if( SvtScriptType::LATIN & nScriptType )
{
pCpy->SetWhich( nLatin );
GetItemSet().Put( *pCpy );
}
- if( SCRIPTTYPE_ASIAN & nScriptType )
+ if( SvtScriptType::ASIAN & nScriptType )
{
pCpy->SetWhich( nAsian );
GetItemSet().Put( *pCpy );
}
- if( SCRIPTTYPE_COMPLEX & nScriptType )
+ if( SvtScriptType::COMPLEX & nScriptType )
{
pCpy->SetWhich( nComplex );
GetItemSet().Put( *pCpy );
@@ -3539,33 +3532,6 @@ void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rCo
}
-sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang )
-{
- return GetI18NScriptType( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) );
-}
-
-sal_uInt16 GetItemScriptType( short nI18NType )
-{
- switch ( nI18NType )
- {
- case i18n::ScriptType::LATIN: return SCRIPTTYPE_LATIN;
- case i18n::ScriptType::ASIAN: return SCRIPTTYPE_ASIAN;
- case i18n::ScriptType::COMPLEX: return SCRIPTTYPE_COMPLEX;
- }
- return 0;
-}
-
-short GetI18NScriptType( sal_uInt16 nItemType )
-{
- switch ( nItemType )
- {
- case SCRIPTTYPE_LATIN: return i18n::ScriptType::LATIN;
- case SCRIPTTYPE_ASIAN: return i18n::ScriptType::ASIAN;
- case SCRIPTTYPE_COMPLEX: return i18n::ScriptType::COMPLEX;
- }
- return 0;
-}
-
bool SvxRsidItem::QueryValue( uno::Any& rVal, sal_uInt8 ) const
{
rVal <<= ( (sal_uInt32)GetValue() );
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index 9f3defc4d765..13b17442bdbe 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -552,7 +552,7 @@ EEHorizontalTextDirection Outliner::GetDefaultHorizontalTextDirection() const
return pEditEngine->GetDefaultHorizontalTextDirection();
}
-sal_uInt16 Outliner::GetScriptType( const ESelection& rSelection ) const
+SvtScriptType Outliner::GetScriptType( const ESelection& rSelection ) const
{
return pEditEngine->GetScriptType( rSelection );
}
diff --git a/editeng/source/outliner/outlvw.cxx b/editeng/source/outliner/outlvw.cxx
index 09d1341ec691..a41059595a5b 100644
--- a/editeng/source/outliner/outlvw.cxx
+++ b/editeng/source/outliner/outlvw.cxx
@@ -1440,7 +1440,7 @@ SfxItemSet OutlinerView::GetAttribs()
return pEditView->GetAttribs();
}
-sal_uInt16 OutlinerView::GetSelectedScriptType() const
+SvtScriptType OutlinerView::GetSelectedScriptType() const
{
return pEditView->GetSelectedScriptType();
}
@@ -1462,15 +1462,15 @@ Selection OutlinerView::GetSurroundingTextSelection() const
namespace {
-bool isSingleScriptType( sal_uInt16 nScriptType )
+bool isSingleScriptType( SvtScriptType nScriptType )
{
sal_uInt8 nScriptCount = 0;
- if (nScriptType & SCRIPTTYPE_LATIN)
+ if (nScriptType & SvtScriptType::LATIN)
++nScriptCount;
- if (nScriptType & SCRIPTTYPE_ASIAN)
+ if (nScriptType & SvtScriptType::ASIAN)
++nScriptCount;
- if (nScriptType & SCRIPTTYPE_COMPLEX)
+ if (nScriptType & SvtScriptType::COMPLEX)
++nScriptCount;
return nScriptCount == 1;
diff --git a/forms/source/richtext/richtextimplcontrol.cxx b/forms/source/richtext/richtextimplcontrol.cxx
index 1d1efb297cea..a29f626749af 100644
--- a/forms/source/richtext/richtextimplcontrol.cxx
+++ b/forms/source/richtext/richtextimplcontrol.cxx
@@ -167,7 +167,7 @@ namespace frm
}
- bool RichTextControlImpl::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rAttribs, AttributeId _nAttribute, const SfxPoolItem* _pArgument, ScriptType _nForScriptType )
+ bool RichTextControlImpl::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rAttribs, AttributeId _nAttribute, const SfxPoolItem* _pArgument, SvtScriptType _nForScriptType )
{
// let's see whether we have a handler for this attribute
AttributeHandlerPool::const_iterator aHandlerPos = m_aAttributeHandlers.find( _nAttribute );
@@ -263,10 +263,10 @@ namespace frm
}
- ScriptType RichTextControlImpl::getSelectedScriptType() const
+ SvtScriptType RichTextControlImpl::getSelectedScriptType() const
{
- ScriptType nScript = m_pView->GetSelectedScriptType();
- if ( !nScript )
+ SvtScriptType nScript = m_pView->GetSelectedScriptType();
+ if ( nScript == SvtScriptType::NONE )
nScript = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
return nScript;
}
diff --git a/forms/source/richtext/richtextimplcontrol.hxx b/forms/source/richtext/richtextimplcontrol.hxx
index 5c6c448879b3..0b6c42cc63ad 100644
--- a/forms/source/richtext/richtextimplcontrol.hxx
+++ b/forms/source/richtext/richtextimplcontrol.hxx
@@ -91,7 +91,7 @@ namespace frm
void disableAttributeNotification( AttributeId _nAttributeId );
/// executes a toggle of the given attribute
- bool executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, AttributeId _nAttribute, const SfxPoolItem* _pArgument, ScriptType _nForScriptType );
+ bool executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, AttributeId _nAttribute, const SfxPoolItem* _pArgument, SvtScriptType _nForScriptType );
/// retrieves the state of the given attribute from the cache
AttributeState getAttributeState( AttributeId _nAttributeId ) const;
@@ -113,7 +113,7 @@ namespace frm
void normalizeScriptDependentAttribute( SvxScriptSetItem& _rScriptSetItem );
// gets the script type of the selection in our edit view (with fallback)
- ScriptType getSelectedScriptType() const;
+ SvtScriptType getSelectedScriptType() const;
/** re-arranges the view and the scrollbars
*/
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index c9b90c0e5e33..6698de7ba654 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -65,7 +65,7 @@ namespace frm
}
- void AttributeHandler::putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, ScriptType _nForScriptType ) const
+ void AttributeHandler::putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, SvtScriptType _nForScriptType ) const
{
SvxScriptSetItem aSetItem( (WhichId)getAttributeId(), *_rAttribs.GetPool() );
aSetItem.PutItemForScriptType( _nForScriptType, _rItem );
@@ -189,7 +189,7 @@ namespace frm
}
- void ParaAlignmentHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType /*_nForScriptType*/ ) const
+ void ParaAlignmentHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const
{
OSL_ENSURE( !_pAdditionalArg, "ParaAlignmentHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
(void)_pAdditionalArg;
@@ -220,7 +220,7 @@ namespace frm
}
- void LineSpacingHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType /*_nForScriptType*/ ) const
+ void LineSpacingHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const
{
OSL_ENSURE( !_pAdditionalArg, "LineSpacingHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
(void)_pAdditionalArg;
@@ -258,8 +258,7 @@ namespace frm
}
- void EscapementHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType /*_nForScriptType*/ ) const
- {
+ void EscapementHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const {
OSL_ENSURE( !_pAdditionalArg, "EscapementHandler::executeAttribute: this is a simple toggle attribute - no args possible!" );
// well, in theory we could allow an SvxEscapementItem here, but this is not needed
(void)_pAdditionalArg;
@@ -290,7 +289,7 @@ namespace frm
}
- void SlotHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const
+ void SlotHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const
{
if ( _pAdditionalArg )
{
@@ -345,7 +344,7 @@ namespace frm
}
- void FontSizeHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const
+ void FontSizeHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const
{
const SvxFontHeightItem* pFontHeightItem = PTR_CAST( SvxFontHeightItem, _pAdditionalArg );
OSL_ENSURE( pFontHeightItem, "FontSizeHandler::executeAttribute: need a FontHeightItem!" );
@@ -367,7 +366,7 @@ namespace frm
SvxFontHeightItem aNewItem( nHeight, 100, getWhich() );
aNewItem.SetProp( pFontHeightItem->GetProp(), pFontHeightItem->GetPropUnit() );
- if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType )
+ if ( ( getAttributeId() == SID_ATTR_CHAR_FONTHEIGHT ) && _nForScriptType != SvtScriptType::NONE)
putItemForScript( _rNewAttribs, aNewItem, _nForScriptType );
else
_rNewAttribs.Put( aNewItem );
@@ -403,7 +402,7 @@ namespace frm
}
- void ParagraphDirectionHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* /*_pAdditionalArg*/, ScriptType /*_nForScriptType*/ ) const
+ void ParagraphDirectionHandler::executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* /*_pAdditionalArg*/, SvtScriptType /*_nForScriptType*/ ) const
{
_rNewAttribs.Put( SvxFrameDirectionItem( m_eParagraphDirection, getWhich() ) );
@@ -434,7 +433,7 @@ namespace frm
}
- void BooleanHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType /*_nForScriptType*/ ) const
+ void BooleanHandler::executeAttribute( const SfxItemSet& /*_rCurrentAttribs*/, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType /*_nForScriptType*/ ) const
{
OSL_ENSURE( _pAdditionalArg && _pAdditionalArg->ISA( SfxBoolItem ), "BooleanHandler::executeAttribute: invalid argument!" );
if ( _pAdditionalArg )
diff --git a/forms/source/richtext/rtattributehandler.hxx b/forms/source/richtext/rtattributehandler.hxx
index 28a17ccbb2f1..15a9b12a867e 100644
--- a/forms/source/richtext/rtattributehandler.hxx
+++ b/forms/source/richtext/rtattributehandler.hxx
@@ -22,6 +22,7 @@
#include "rtattributes.hxx"
#include <rtl/ref.hxx>
+#include <svl/languageoptions.hxx>
#include <editeng/svxenum.hxx>
#include <editeng/frmdir.hxx>
#include <salhelper/simplereferenceobject.hxx>
@@ -38,7 +39,7 @@ namespace frm
public:
virtual AttributeId getAttributeId( ) const = 0;
virtual AttributeState getState( const SfxItemSet& _rAttribs ) const = 0;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const = 0;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const = 0;
protected:
virtual ~IAttributeHandler() {}
@@ -60,14 +61,14 @@ namespace frm
// IAttributeHandler
virtual AttributeId getAttributeId( ) const SAL_OVERRIDE;
virtual AttributeState getState( const SfxItemSet& _rAttribs ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE = 0;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE = 0;
protected:
/// helper method calling implGetCheckState
AttributeCheckState getCheckState( const SfxItemSet& _rAttribs ) const;
/// helper method putting an item into a set, respecting a script type
- void putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, ScriptType _nForScriptType ) const;
+ void putItemForScript( SfxItemSet& _rAttribs, const SfxPoolItem& _rItem, SvtScriptType _nForScriptType ) const;
// pseudo-abstract
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const;
@@ -91,7 +92,7 @@ namespace frm
public:
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
class LineSpacingHandler : public AttributeHandler
@@ -104,7 +105,7 @@ namespace frm
public:
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
class EscapementHandler : public AttributeHandler
@@ -117,7 +118,7 @@ namespace frm
public:
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
class SlotHandler : public AttributeHandler
@@ -130,7 +131,7 @@ namespace frm
public:
virtual AttributeState getState( const SfxItemSet& _rAttribs ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
class BooleanHandler : public AttributeHandler
@@ -140,7 +141,7 @@ namespace frm
public:
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
class FontSizeHandler : public AttributeHandler
@@ -150,7 +151,7 @@ namespace frm
public:
virtual AttributeState getState( const SfxItemSet& _rAttribs ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
class ParagraphDirectionHandler : public AttributeHandler
@@ -165,7 +166,7 @@ namespace frm
public:
virtual AttributeCheckState implGetCheckState( const SfxPoolItem& _rItem ) const SAL_OVERRIDE;
- virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, ScriptType _nForScriptType ) const SAL_OVERRIDE;
+ virtual void executeAttribute( const SfxItemSet& _rCurrentAttribs, SfxItemSet& _rNewAttribs, const SfxPoolItem* _pAdditionalArg, SvtScriptType _nForScriptType ) const SAL_OVERRIDE;
};
diff --git a/forms/source/richtext/rtattributes.hxx b/forms/source/richtext/rtattributes.hxx
index 85f2c742dc76..f8d4f7a98229 100644
--- a/forms/source/richtext/rtattributes.hxx
+++ b/forms/source/richtext/rtattributes.hxx
@@ -32,8 +32,6 @@ namespace frm
typedef sal_uInt16 WhichId;
/// a SFX slot id
typedef sal_uInt16 SfxSlotId;
- /// a script type
- typedef sal_uInt16 ScriptType;
enum AttributeCheckState
{
diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx
index 406de7ae2529..6868237e9fc4 100644
--- a/framework/inc/helper/mischelper.hxx
+++ b/framework/inc/helper/mischelper.hxx
@@ -38,11 +38,6 @@
#include <set>
-// flags for script types in use within selection
-#define LS_SCRIPT_LATIN 0x0001
-#define LS_SCRIPT_ASIAN 0x0002
-#define LS_SCRIPT_COMPLEX 0x0004
-
namespace framework
{
@@ -79,9 +74,9 @@ enum LangMenuIDs
MID_LANG_PARA_MORE,
};
-inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang )
+inline bool IsScriptTypeMatchingToLanguage( SvtScriptType nScriptType, LanguageType nLang )
{
- return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
+ return bool(nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ));
}
inline void RetrieveTypeNameFromResourceURL( const OUString& aResourceURL, OUString& aType, OUString& aName )
@@ -135,7 +130,7 @@ FWI_DLLPUBLIC OUString RetrieveLabelFromCommand( const OUString& aCmdURL
FWI_DLLPUBLIC void FillLangItems( std::set< OUString > &rLangItems,
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame,
const LanguageGuessingHelper & rLangGuessHelper,
- sal_Int16 nScriptType,
+ SvtScriptType nScriptType,
const OUString & rCurLang,
const OUString & rKeyboardLang,
const OUString & rGuessedTextLang );
diff --git a/framework/inc/uielement/langselectionmenucontroller.hxx b/framework/inc/uielement/langselectionmenucontroller.hxx
index 38246ecea298..8a0f46b06a22 100644
--- a/framework/inc/uielement/langselectionmenucontroller.hxx
+++ b/framework/inc/uielement/langselectionmenucontroller.hxx
@@ -84,10 +84,10 @@ namespace framework
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_Font;
OUString m_aMenuCommandURL_CharDlgForParagraph;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > m_xMenuDispatch_CharDlgForParagraph;
- OUString m_aCurLang;
- sal_Int16 m_nScriptType;
- OUString m_aKeyboardLang;
- OUString m_aGuessedTextLang;
+ OUString m_aCurLang;
+ SvtScriptType m_nScriptType;
+ OUString m_aKeyboardLang;
+ OUString m_aGuessedTextLang;
LanguageGuessingHelper m_aLangGuessHelper;
void fillPopupMenu( com::sun::star::uno::Reference< com::sun::star::awt::XPopupMenu >& rPopupMenu, const Mode rMode );
diff --git a/framework/source/fwi/helper/mischelper.cxx b/framework/source/fwi/helper/mischelper.cxx
index ed1bc75a1d1e..a3f09309b51f 100644
--- a/framework/source/fwi/helper/mischelper.cxx
+++ b/framework/source/fwi/helper/mischelper.cxx
@@ -133,7 +133,7 @@ OUString RetrieveLabelFromCommand(
void FillLangItems( std::set< OUString > &rLangItems,
const uno::Reference< frame::XFrame > & rxFrame,
const LanguageGuessingHelper & rLangGuessHelper,
- sal_Int16 nScriptType,
+ SvtScriptType nScriptType,
const OUString & rCurLang,
const OUString & rKeyboardLang,
const OUString & rGuessedTextLang )
@@ -197,7 +197,7 @@ void FillLangItems( std::set< OUString > &rLangItems,
const sal_Int16 nMaxCount = 7;
if ( xDocumentLanguages.is() )
{
- Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount ));
+ Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( static_cast<sal_Int16>(nScriptType), nMaxCount ));
if ( rLocales.getLength() > 0 )
{
for ( sal_uInt16 i = 0; i < rLocales.getLength(); ++i )
diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx
index 0780d0552b47..9e0fbb15219c 100644
--- a/framework/source/uielement/langselectionmenucontroller.cxx
+++ b/framework/source/uielement/langselectionmenucontroller.cxx
@@ -73,7 +73,7 @@ DEFINE_INIT_SERVICE ( LanguageSelectionMenuController, {}
LanguageSelectionMenuController::LanguageSelectionMenuController( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext )
: svt::PopupMenuControllerBase(xContext)
, m_bShowMenu(true)
- , m_nScriptType(LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX)
+ , m_nScriptType(SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX)
, m_aLangGuessHelper(xContext)
{
}
@@ -106,7 +106,7 @@ void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureState
return;
m_bShowMenu = true;
- m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value
+ m_nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX; //set the default value
Sequence< OUString > aSeq;
@@ -117,7 +117,7 @@ void SAL_CALL LanguageSelectionMenuController::statusChanged( const FeatureState
// Retrieve all other values from the sequence and
// store it members!
m_aCurLang = aSeq[0];
- m_nScriptType = static_cast< sal_Int16 >(aSeq[1].toInt32());
+ m_nScriptType = static_cast< SvtScriptType >(aSeq[1].toInt32());
m_aKeyboardLang = aSeq[2];
m_aGuessedTextLang = aSeq[3];
}
diff --git a/framework/source/uielement/langselectionstatusbarcontroller.cxx b/framework/source/uielement/langselectionstatusbarcontroller.cxx
index 41b2c55d8124..e348cb8ddd90 100644
--- a/framework/source/uielement/langselectionstatusbarcontroller.cxx
+++ b/framework/source/uielement/langselectionstatusbarcontroller.cxx
@@ -98,10 +98,10 @@ private:
virtual ~LangSelectionStatusbarController() {}
bool m_bShowMenu; // if the menu is to be displayed or not (depending on the selected object/text)
- sal_Int16 m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004
- OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages
- OUString m_aKeyboardLang; // the keyboard language
- OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed
+ SvtScriptType m_nScriptType; // the flags for the different script types available in the selection, LATIN = 0x0001, ASIAN = 0x0002, COMPLEX = 0x0004
+ OUString m_aCurLang; // the language of the current selection, "*" if there are more than one languages
+ OUString m_aKeyboardLang; // the keyboard language
+ OUString m_aGuessedTextLang; // the 'guessed' language for the selection, "" if none could be guessed
LanguageGuessingHelper m_aLangGuessHelper;
void LangMenu( const css::awt::Point& aPos ) throw (css::uno::RuntimeException);
@@ -110,7 +110,7 @@ private:
LangSelectionStatusbarController::LangSelectionStatusbarController( const uno::Reference< uno::XComponentContext >& xContext ) :
svt::StatusbarController( xContext, uno::Reference< frame::XFrame >(), OUString(), 0 ),
m_bShowMenu( true ),
- m_nScriptType( LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX ),
+ m_nScriptType( SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX ),
m_aLangGuessHelper( xContext )
{
}
@@ -299,7 +299,7 @@ throw ( RuntimeException, std::exception )
return;
m_bShowMenu = true;
- m_nScriptType = LS_SCRIPT_LATIN | LS_SCRIPT_ASIAN | LS_SCRIPT_COMPLEX; //set the default value
+ m_nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX; //set the default value
if ( m_xStatusbarItem.is() )
{
@@ -322,7 +322,7 @@ throw ( RuntimeException, std::exception )
// Retrieve all other values from the sequence and
// store it members!
m_aCurLang = aSeq[0];
- m_nScriptType = static_cast< sal_Int16 >( aSeq[1].toInt32() );
+ m_nScriptType = static_cast< SvtScriptType >( aSeq[1].toInt32() );
m_aKeyboardLang = aSeq[2];
m_aGuessedTextLang = aSeq[3];
}
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index d3ed4b69dcb2..d38536878977 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -37,6 +37,7 @@
#include <editeng/eedata.hxx>
#include <o3tl/typed_flags_set.hxx>
+#include <svl/languageoptions.hxx>
namespace com { namespace sun { namespace star {
namespace linguistic2 {
@@ -243,7 +244,7 @@ public:
void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
- sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ SvtScriptType GetScriptType( const ESelection& rSelection ) const;
LanguageType GetLanguage(const EditPaM& rPaM) const;
LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
@@ -513,7 +514,7 @@ public:
static bool IsSimpleCharInput( const KeyEvent& rKeyEvent );
static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const vcl::Font& rFont );
static void SetFontInfoInItemSet( SfxItemSet& rItemSet, const SvxFont& rFont );
- static vcl::Font CreateFontFromItemSet( const SfxItemSet& rItemSet, sal_uInt16 nScriptType );
+ static vcl::Font CreateFontFromItemSet( const SfxItemSet& rItemSet, SvtScriptType nScriptType );
static SvxFont CreateSvxFontFromItemSet( const SfxItemSet& rItemSet );
static bool IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
static bool HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable );
@@ -573,7 +574,7 @@ public:
OUString GetSelected(const EditSelection& rSel, const LineEnd eParaSep = LINEEND_LF) const;
EditPaM DeleteSelected(const EditSelection& rSel);
- sal_uInt16 GetScriptType(const EditSelection& rSel) const;
+ SvtScriptType GetScriptType(const EditSelection& rSel) const;
void RemoveParaPortion(sal_Int32 nNode);
diff --git a/include/editeng/editobj.hxx b/include/editeng/editobj.hxx
index 09c757402cf8..a11d052bc48d 100644
--- a/include/editeng/editobj.hxx
+++ b/include/editeng/editobj.hxx
@@ -28,6 +28,7 @@
#include <editeng/editdata.hxx>
#include <editeng/editengdllapi.h>
#include <editeng/macros.hxx>
+#include <svl/languageoptions.hxx>
#include <com/sun/star/text/textfield/Type.hpp>
@@ -92,7 +93,7 @@ public:
bool IsVertical() const;
void SetVertical( bool bVertical );
- sal_uInt16 GetScriptType() const;
+ SvtScriptType GetScriptType() const;
EditTextObject* Clone() const;
diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx
index 3e2fb1a4d1f0..aec7f03c9939 100644
--- a/include/editeng/editview.hxx
+++ b/include/editeng/editview.hxx
@@ -28,6 +28,7 @@
#include <tools/gen.hxx>
#include <vcl/cursor.hxx>
#include <editeng/editstat.hxx>
+#include <svl/languageoptions.hxx>
#define LOK_USE_UNSTABLE_API
#include <LibreOfficeKit/LibreOfficeKitTypes.h>
@@ -121,7 +122,7 @@ public:
OUString GetSelected();
void DeleteSelected();
- sal_uInt16 GetSelectedScriptType() const;
+ SvtScriptType GetSelectedScriptType() const;
// VisArea position of the Output window.
// A size change also affects the VisArea
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index cc00d310e555..960caa8752df 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -25,6 +25,7 @@
#include <i18nlangtag/lang.h>
#include <rtl/ustring.hxx>
#include <svl/SfxBroadcaster.hxx>
+#include <svl/languageoptions.hxx>
#include <tools/gen.hxx>
#include <tools/color.hxx>
#include <tools/contnr.hxx>
@@ -302,9 +303,9 @@ public:
void TransliterateText( sal_Int32 nTransliterationMode );
- ESelection GetSelection();
+ ESelection GetSelection();
- sal_uInt16 GetSelectedScriptType() const;
+ SvtScriptType GetSelectedScriptType() const;
void SetVisArea( const Rectangle& rRect );
void SetSelection( const ESelection& );
@@ -689,7 +690,7 @@ public:
void SetDefaultHorizontalTextDirection( EEHorizontalTextDirection eHTextDir );
EEHorizontalTextDirection GetDefaultHorizontalTextDirection() const;
- sal_uInt16 GetScriptType( const ESelection& rSelection ) const;
+ SvtScriptType GetScriptType( const ESelection& rSelection ) const;
LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const;
void SetAsianCompressionMode( sal_uInt16 nCompressionMode );
diff --git a/include/editeng/scripttypeitem.hxx b/include/editeng/scripttypeitem.hxx
index 6e098b05d3e8..f9ab9103a178 100644
--- a/include/editeng/scripttypeitem.hxx
+++ b/include/editeng/scripttypeitem.hxx
@@ -31,16 +31,12 @@
used for the user interface.
*/
-EDITENG_DLLPUBLIC sal_uInt16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
-sal_uInt16 GetItemScriptType( short nI18NType );
-short GetI18NScriptType( sal_uInt16 nItemType );
-
class EDITENG_DLLPUBLIC SvxScriptTypeItem : public SfxUInt16Item
{
public:
TYPEINFO_OVERRIDE();
- explicit SvxScriptTypeItem( sal_uInt16 nType = SCRIPTTYPE_LATIN );
+ explicit SvxScriptTypeItem( SvtScriptType nType = SvtScriptType::LATIN );
virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE;
};
@@ -60,11 +56,11 @@ public:
inline const SfxPoolItem* GetItemOfScriptSet( sal_uInt16 _nWhich ) const
{ return SvxScriptSetItem::GetItemOfScriptSet( GetItemSet(), _nWhich ); }
- static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16 nScript );
+ static const SfxPoolItem* GetItemOfScript( sal_uInt16 nSlotId, const SfxItemSet& rSet, SvtScriptType nScript );
- const SfxPoolItem* GetItemOfScript( sal_uInt16 nScript ) const;
+ const SfxPoolItem* GetItemOfScript( SvtScriptType nScript ) const;
- void PutItemForScriptType( sal_uInt16 nScriptType, const SfxPoolItem& rItem );
+ void PutItemForScriptType( SvtScriptType nScriptType, const SfxPoolItem& rItem );
static void GetWhichIds( sal_uInt16 nSlotId, const SfxItemSet& rSet, sal_uInt16& rLatin, sal_uInt16& rAsian, sal_uInt16& rComplex);
diff --git a/include/svl/languageoptions.hxx b/include/svl/languageoptions.hxx
index 8c0ea1af24e8..693a12407d00 100644
--- a/include/svl/languageoptions.hxx
+++ b/include/svl/languageoptions.hxx
@@ -24,13 +24,24 @@
#include <unotools/configitem.hxx>
#include <unotools/options.hxx>
#include <i18nlangtag/lang.h>
+#include <o3tl/typed_flags_set.hxx>
// class SvtLanguageOptions ----------------------------------------------------
-// these defines can be ored
-#define SCRIPTTYPE_LATIN 0x01
-#define SCRIPTTYPE_ASIAN 0x02
-#define SCRIPTTYPE_COMPLEX 0x04
+// these defines can be ORed
+// note these values DO NOT match the values in com::sun::star::i18n::ScriptType
+enum class SvtScriptType
+{
+ NONE = 0x00,
+ LATIN = 0x01,
+ ASIAN = 0x02,
+ COMPLEX = 0x04,
+ UNKNOWN = 0x08 // (only used in SC) if type has not been determined yet
+};
+namespace o3tl
+{
+ template<> struct typed_flags<SvtScriptType> : is_typed_flags<SvtScriptType, 0x0f> {};
+}
class SvtCJKOptions;
class SvtCTLOptions;
@@ -71,24 +82,33 @@ public:
bool IsVerticalTextEnabled() const;
bool IsAsianTypographyEnabled() const;
bool IsJapaneseFindEnabled() const;
- void SetAll( bool _bSet );
+ void SetAll( bool _bSet );
bool IsAnyEnabled() const;
// CTL options
- void SetCTLFontEnabled( bool _bEnabled );
+ void SetCTLFontEnabled( bool _bEnabled );
bool IsCTLFontEnabled() const;
- void SetCTLSequenceChecking( bool _bEnabled );
+ void SetCTLSequenceChecking( bool _bEnabled );
- void SetCTLSequenceCheckingRestricted( bool _bEnable );
+ void SetCTLSequenceCheckingRestricted( bool _bEnable );
- void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable );
+ void SetCTLSequenceCheckingTypeAndReplace( bool _bEnable );
bool IsReadOnly(EOption eOption) const;
// returns for a language the scripttype
- static sal_uInt16 GetScriptTypeOfLanguage( sal_uInt16 nLang );
+ static SvtScriptType GetScriptTypeOfLanguage( sal_uInt16 nLang );
+
+ // convert from css::i18n::ScriptType constants to SvtScriptType
+ static SvtScriptType FromI18NToSvtScriptType( sal_Int16 nI18NType );
+
+ static sal_Int16 FromSvtScriptTypeToI18N( SvtScriptType nI18NType );
+
+ static sal_Int16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
+
};
+
/** #i42730# Gives access to the Windows 16bit system locale
*/
class SVL_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem
@@ -96,7 +116,7 @@ class SVL_DLLPUBLIC SvtSystemLanguageOptions : public utl::ConfigItem
private:
OUString m_sWin16SystemLocale;
- bool isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) const;
+ bool isKeyboardLayoutTypeInstalled(sal_Int16 scriptType) const;
virtual void ImplCommit() SAL_OVERRIDE;
@@ -106,10 +126,10 @@ public:
virtual void Notify( const com::sun::star::uno::Sequence< OUString >& rPropertyNames ) SAL_OVERRIDE;
- LanguageType GetWin16SystemLanguage() const;
+ LanguageType GetWin16SystemLanguage() const;
- bool isCTLKeyboardLayoutInstalled() const;
- bool isCJKKeyboardLayoutInstalled() const;
+ bool isCTLKeyboardLayoutInstalled() const;
+ bool isCJKKeyboardLayoutInstalled() const;
};
#endif // INCLUDED_SVL_LANGUAGEOPTIONS_HXX
diff --git a/include/svx/svdedxv.hxx b/include/svx/svdedxv.hxx
index fb30ff7a428e..7d848ed55c8f 100644
--- a/include/svx/svdedxv.hxx
+++ b/include/svx/svdedxv.hxx
@@ -21,11 +21,10 @@
#define INCLUDED_SVX_SVDEDXV_HXX
#include <rtl/ref.hxx>
+#include <svl/languageoptions.hxx>
#include <svx/svxdllapi.h>
#include <svx/svdglev.hxx>
-
#include <svx/selectioncontroller.hxx>
-
#include <memory>
class SdrOutliner;
@@ -216,7 +215,7 @@ public:
virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) SAL_OVERRIDE;
// #97766# make virtual to change implementation e.g. for SdOutlineView
- virtual sal_uInt16 GetScriptType() const;
+ virtual SvtScriptType GetScriptType() const;
/* new interface src537 */
bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index b4e8fd307c03..7ba4f1fa8119 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -1173,8 +1173,8 @@ void DrawingML::WriteRunProperties( Reference< XPropertySet > rRun, bool bIsFiel
Reference< XPropertyState > rXPropState( rRun, UNO_QUERY );
OUString usLanguage;
PropertyState eState;
- sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
- bool bComplex = ( nScriptType == ScriptType::COMPLEX );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
+ bool bComplex = ( nScriptType == SvtScriptType::COMPLEX );
const char* bold = NULL;
const char* italic = NULL;
const char* underline = NULL;
diff --git a/sc/inc/celltextattr.hxx b/sc/inc/celltextattr.hxx
index 9e4675d0e3c3..d10274c06f60 100644
--- a/sc/inc/celltextattr.hxx
+++ b/sc/inc/celltextattr.hxx
@@ -11,13 +11,14 @@
#define INCLUDED_SC_CELLTEXTATTR_HXX
#include <sal/types.h>
+#include <svl/languageoptions.hxx>
namespace sc {
struct CellTextAttr
{
- sal_uInt16 mnTextWidth;
- sal_uInt8 mnScriptType;
+ sal_uInt16 mnTextWidth;
+ SvtScriptType mnScriptType;
CellTextAttr();
CellTextAttr(const CellTextAttr& r);
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 8d0db5788669..d7bc4be8a5c7 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -120,7 +120,7 @@ class ScColumn
// must have non-empty elements. For text width, the value should be
// either the real text width, or TEXTWIDTH_DIRTY in case it hasn't been
// calculated yet. For script type, it should be either the real script
- // type value or SC_SCRIPTTYPE_UNKNOWN.
+ // type value or SvtScriptType::UNKNOWN.
sc::CellTextAttrStoreType maCellTextAttrs;
// Cell notes
@@ -544,16 +544,16 @@ public:
sal_uInt16 GetTextWidth(SCROW nRow) const;
void SetTextWidth(SCROW nRow, sal_uInt16 nWidth);
- sal_uInt8 GetScriptType( SCROW nRow ) const;
+ SvtScriptType GetScriptType( SCROW nRow ) const;
/**
* Get combined script types of the specified range. This method may
* update script types on demand if they have not been determined.
*/
- sal_uInt8 GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
+ SvtScriptType GetRangeScriptType( sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2,
const sc::CellStoreType::iterator& itr);
- void SetScriptType( SCROW nRow, sal_uInt8 nType );
+ void SetScriptType( SCROW nRow, SvtScriptType nType );
void UpdateScriptTypes( SCROW nRow1, SCROW nRow2 );
size_t GetFormulaHash( SCROW nRow ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index b88ffecbc56c..bf9f078fbadd 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -50,6 +50,7 @@
#include "markdata.hxx"
+enum class SvtScriptType;
namespace editeng { class SvxBorderLine; }
namespace formula { struct VectorRefArray; }
namespace svl {
@@ -1411,12 +1412,12 @@ public:
SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator();
bool HasStringWeakCharacters( const OUString& rString );
- SC_DLLPUBLIC sal_uInt8 GetStringScriptType( const OUString& rString );
- SC_DLLPUBLIC sal_uInt8 GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
- SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
- sal_uInt8 GetRangeScriptType(
+ SC_DLLPUBLIC SvtScriptType GetStringScriptType( const OUString& rString );
+ SC_DLLPUBLIC SvtScriptType GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat );
+ SC_DLLPUBLIC SvtScriptType GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab );
+ SvtScriptType GetRangeScriptType(
sc::ColumnBlockPosition& rBlockPos, const ScAddress& rPos, SCROW nLength );
- sal_uInt8 GetRangeScriptType( const ScRangeList& rRanges );
+ SvtScriptType GetRangeScriptType( const ScRangeList& rRanges );
bool HasDetectiveOperations() const;
void AddDetectiveOperation( const ScDetOpData& rData );
@@ -2108,8 +2109,8 @@ public:
sal_uInt16 GetTextWidth( const ScAddress& rPos ) const;
- sal_uInt8 GetScriptType( const ScAddress& rPos ) const;
- void SetScriptType( const ScAddress& rPos, sal_uInt8 nType );
+ SvtScriptType GetScriptType( const ScAddress& rPos ) const;
+ void SetScriptType( const ScAddress& rPos, SvtScriptType nType );
void UpdateScriptTypes( const ScAddress& rPos, SCCOL nColSize, SCROW nRowSize );
size_t GetFormulaHash( const ScAddress& rPos ) const;
diff --git a/sc/inc/documentimport.hxx b/sc/inc/documentimport.hxx
index e561fcdb9e34..aa694584216e 100644
--- a/sc/inc/documentimport.hxx
+++ b/sc/inc/documentimport.hxx
@@ -28,6 +28,7 @@ class ScStyleSheet;
struct ScSetStringParam;
struct ScTabOpParam;
struct ScDocumentImportImpl;
+enum class SvtScriptType;
/**
* Accessor class to ScDocument. Its purpose is to allow import filter to
@@ -60,7 +61,7 @@ public:
ScDocument& getDoc();
const ScDocument& getDoc() const;
- void setDefaultNumericScript(sal_uInt16 nScript);
+ void setDefaultNumericScript(SvtScriptType nScript);
/**
* Apply specified cell style to an entire sheet.
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index f8555b4c0609..b95faf5cd305 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -34,6 +34,7 @@ class ImageList;
class Bitmap;
class SfxItemSet;
class Color;
+enum class SvtScriptType;
#define SC_COLLATOR_IGNORES ( \
::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE )
@@ -689,11 +690,11 @@ SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pStri
static bool IsSystemRTL(); // depending on system language
static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage
- SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters
+ SC_DLLPUBLIC static SvtScriptType GetDefaultScriptType(); // for all WEAK characters
/** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs.
- If more than one SCRIPTTYPE_... values are or'ed together, prefers
+ If more than one SvtScriptType::... values are or'ed together, prefers
first COMPLEX, then ASIAN */
- SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich );
+ SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( SvtScriptType nScriptType, sal_uInt16 nWhich );
/** Adds a language item to the item set, if the number format item contains
a language that differs from its parent's language. */
diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx
index dd800aa9d80b..fb4c2dad4e2b 100644
--- a/sc/inc/globalnames.hxx
+++ b/sc/inc/globalnames.hxx
@@ -19,10 +19,6 @@
#define DATE_TIME_FACTOR 86400.0
-// in addition to SCRIPTTYPE_... flags from scripttypeitem.hxx:
-// set (in nScriptType) if type has not been determined yet
-#define SC_SCRIPTTYPE_UNKNOWN 0x08
-
// Device name used to represent the software group interpreter for OpenCL
// mode. This string gets stored in use configuration as the device name.
#define OPENCL_SOFTWARE_DEVICE_CONFIG_NAME "Software"
diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx
index cbc37d1034fe..efb2a67c9ad8 100644
--- a/sc/inc/patattr.hxx
+++ b/sc/inc/patattr.hxx
@@ -22,6 +22,7 @@
#include <svl/poolitem.hxx>
#include <svl/itemset.hxx>
+#include <svl/languageoptions.hxx>
#include <unotools/fontcvt.hxx>
#include <editeng/svxenum.hxx>
#include "scdllapi.h"
@@ -86,16 +87,16 @@ public:
OutputDevice* pOutDev = NULL,
const Fraction* pScale = NULL,
const SfxItemSet* pCondSet = NULL,
- sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
+ SvtScriptType nScript = SvtScriptType::NONE, const Color* pBackConfigColor = NULL,
const Color* pTextConfigColor = NULL );
- static ScDxfFont GetDxfFont(const SfxItemSet& rSet, sal_uInt8 nScript);
+ static ScDxfFont GetDxfFont(const SfxItemSet& rSet, SvtScriptType nScript);
/** Fills a font object from the own item set. */
void GetFont( vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
OutputDevice* pOutDev = NULL,
const Fraction* pScale = NULL,
const SfxItemSet* pCondSet = NULL,
- sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL,
+ SvtScriptType nScript = SvtScriptType::NONE, const Color* pBackConfigColor = NULL,
const Color* pTextConfigColor = NULL ) const;
/** Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet. */
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index e6857f2d1fca..d50bd5bc5995 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -899,11 +899,11 @@ public:
sal_uLong AddCondFormat( ScConditionalFormat* pNew );
- sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow ) const;
- void SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType );
+ SvtScriptType GetScriptType( SCCOL nCol, SCROW nRow ) const;
+ void SetScriptType( SCCOL nCol, SCROW nRow, SvtScriptType nType );
void UpdateScriptTypes( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
- sal_uInt8 GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
+ SvtScriptType GetRangeScriptType( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 );
size_t GetFormulaHash( SCCOL nCol, SCROW nRow ) const;
diff --git a/sc/qa/unit/ucalc_column.cxx b/sc/qa/unit/ucalc_column.cxx
index 394738d29dd5..6b9ca51c2746 100644
--- a/sc/qa/unit/ucalc_column.cxx
+++ b/sc/qa/unit/ucalc_column.cxx
@@ -73,9 +73,9 @@ void Test::testColumnFindEditCells()
m_pDoc->SetString(ScAddress(1,12,0), "Some text");
m_pDoc->SetString(ScAddress(1,13,0), "Other text");
- m_pDoc->SetScriptType(ScAddress(1,11,0), (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN));
- m_pDoc->SetScriptType(ScAddress(1,12,0), (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN));
- m_pDoc->SetScriptType(ScAddress(1,13,0), (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN));
+ m_pDoc->SetScriptType(ScAddress(1,11,0), (SvtScriptType::LATIN | SvtScriptType::ASIAN));
+ m_pDoc->SetScriptType(ScAddress(1,12,0), (SvtScriptType::LATIN | SvtScriptType::ASIAN));
+ m_pDoc->SetScriptType(ScAddress(1,13,0), (SvtScriptType::LATIN | SvtScriptType::ASIAN));
nResRow = m_pDoc->GetFirstEditTextRow(ScAddress(1,11,0));
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(11), nResRow);
@@ -85,7 +85,7 @@ void Test::testColumnFindEditCells()
for (SCROW i = 0; i <= 5; ++i)
m_pDoc->SetString(ScAddress(2,i,0), "Text");
- m_pDoc->SetScriptType(ScAddress(2,5,0), (SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN));
+ m_pDoc->SetScriptType(ScAddress(2,5,0), (SvtScriptType::LATIN | SvtScriptType::ASIAN));
nResRow = m_pDoc->GetFirstEditTextRow(ScAddress(2,1,0));
CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(-1), nResRow);
diff --git a/sc/source/core/data/celltextattr.cxx b/sc/source/core/data/celltextattr.cxx
index 5542813c7dca..5d792442b8af 100644
--- a/sc/source/core/data/celltextattr.cxx
+++ b/sc/source/core/data/celltextattr.cxx
@@ -14,7 +14,7 @@ namespace sc {
CellTextAttr::CellTextAttr() :
mnTextWidth(TEXTWIDTH_DIRTY),
- mnScriptType(SC_SCRIPTTYPE_UNKNOWN) {}
+ mnScriptType(SvtScriptType::UNKNOWN) {}
CellTextAttr::CellTextAttr(const CellTextAttr& r) :
mnTextWidth(r.mnTextWidth),
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 3fcac83163d4..8b6ede97051f 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -64,13 +64,13 @@ using namespace formula;
namespace {
-inline bool IsAmbiguousScriptNonZero( sal_uInt8 nScript )
+inline bool IsAmbiguousScriptNonZero( SvtScriptType nScript )
{
//TODO: move to a header file
- return ( nScript != SCRIPTTYPE_LATIN &&
- nScript != SCRIPTTYPE_ASIAN &&
- nScript != SCRIPTTYPE_COMPLEX &&
- nScript != 0 );
+ return ( nScript != SvtScriptType::LATIN &&
+ nScript != SvtScriptType::ASIAN &&
+ nScript != SvtScriptType::COMPLEX &&
+ nScript != SvtScriptType::NONE );
}
}
@@ -2929,7 +2929,7 @@ public:
{
// With a formula cell, it's considered an edit text cell when either
// the result is multi-line or it has more than one script types.
- sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
+ SvtScriptType nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
if (IsAmbiguousScriptNonZero(nScriptType))
return true;
@@ -2952,7 +2952,7 @@ public:
for (size_t i = 0; i < nDataSize; ++i)
{
SCROW nRow = node.position + i + nOffset;
- sal_uInt8 nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
+ SvtScriptType nScriptType = mrColumn.GetRangeScriptType(miAttrPos, nRow, nRow, miCellPos);
if (IsAmbiguousScriptNonZero(nScriptType))
// Return the offset from the first row.
return RetType(i+nOffset, true);
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index ef6c073f5ecd..930107889bfe 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -71,12 +71,12 @@
// factor from font size to optimal cell height (text width)
#define SC_ROT_BREAK_FACTOR 6
-inline bool IsAmbiguousScript( sal_uInt8 nScript )
+inline bool IsAmbiguousScript( SvtScriptType nScript )
{
//TODO: move to a header file
- return ( nScript != SCRIPTTYPE_LATIN &&
- nScript != SCRIPTTYPE_ASIAN &&
- nScript != SCRIPTTYPE_COMPLEX );
+ return ( nScript != SvtScriptType::LATIN &&
+ nScript != SvtScriptType::ASIAN &&
+ nScript != SvtScriptType::COMPLEX );
}
// Data operations
@@ -233,8 +233,8 @@ long ScColumn::GetNeededSize(
nIndent = static_cast<const SfxUInt16Item&>(pPattern->GetItem(ATTR_INDENT)).GetValue();
}
- sal_uInt8 nScript = pDocument->GetScriptType(nCol, nRow, nTab);
- if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
+ SvtScriptType nScript = pDocument->GetScriptType(nCol, nRow, nTab);
+ if (nScript == SvtScriptType::NONE) nScript = ScGlobal::GetDefaultScriptType();
// also call SetFont for edit cells, because bGetFont may be set only once
// bGetFont is set also if script type changes
@@ -682,7 +682,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
ScNeededSizeOptions aOptions;
aOptions.bFormula = bFormula;
const ScPatternAttr* pOldPattern = NULL;
- sal_uInt8 nOldScript = 0;
+ SvtScriptType nOldScript = SvtScriptType::NONE;
// Go though all non-empty cells within selection.
sc::CellStoreType::const_iterator itPos = maCells.begin();
@@ -704,8 +704,8 @@ sal_uInt16 ScColumn::GetOptimalColWidth(
for (size_t nOffset = aPos.second; nOffset < itPos->size; ++nOffset, ++nRow)
{
- sal_uInt8 nScript = pDocument->GetScriptType(nCol, nRow, nTab);
- if (nScript == 0)
+ SvtScriptType nScript = pDocument->GetScriptType(nCol, nRow, nTab);
+ if (nScript == SvtScriptType::NONE)
nScript = ScGlobal::GetDefaultScriptType();
const ScPatternAttr* pPattern = GetPattern(nRow);
@@ -850,10 +850,10 @@ void ScColumn::GetOptimalHeight(
sal_uInt16 nCjkHeight = 0;
sal_uInt16 nCtlHeight = 0;
sal_uInt16 nDefHeight;
- sal_uInt8 nDefScript = ScGlobal::GetDefaultScriptType();
- if ( nDefScript == SCRIPTTYPE_ASIAN )
+ SvtScriptType nDefScript = ScGlobal::GetDefaultScriptType();
+ if ( nDefScript == SvtScriptType::ASIAN )
nDefHeight = nCjkHeight = lcl_GetAttribHeight( *pPattern, ATTR_CJK_FONT_HEIGHT );
- else if ( nDefScript == SCRIPTTYPE_COMPLEX )
+ else if ( nDefScript == SvtScriptType::COMPLEX )
nDefHeight = nCtlHeight = lcl_GetAttribHeight( *pPattern, ATTR_CTL_FONT_HEIGHT );
else
nDefHeight = nLatHeight = lcl_GetAttribHeight( *pPattern, ATTR_FONT_HEIGHT );
@@ -879,18 +879,18 @@ void ScColumn::GetOptimalHeight(
{
for (SCROW nRow = it->mnRow1; nRow <= it->mnRow2; ++nRow)
{
- sal_uInt8 nScript = GetRangeScriptType(itAttr, nRow, nRow, itCells);
+ SvtScriptType nScript = GetRangeScriptType(itAttr, nRow, nRow, itCells);
if (nScript == nDefScript)
continue;
- if ( nScript == SCRIPTTYPE_ASIAN )
+ if ( nScript == SvtScriptType::ASIAN )
{
if ( nCjkHeight == 0 )
nCjkHeight = lcl_GetAttribHeight( *pPattern, ATTR_CJK_FONT_HEIGHT );
if (nCjkHeight > rHeights[nRow-nStartRow])
rHeights[nRow-nStartRow] = nCjkHeight;
}
- else if ( nScript == SCRIPTTYPE_COMPLEX )
+ else if ( nScript == SvtScriptType::COMPLEX )
{
if ( nCtlHeight == 0 )
nCtlHeight = lcl_GetAttribHeight( *pPattern, ATTR_CTL_FONT_HEIGHT );
@@ -1865,19 +1865,19 @@ void ScColumn::SetTextWidth(SCROW nRow, sal_uInt16 nWidth)
CellStorageModified();
}
-sal_uInt8 ScColumn::GetScriptType( SCROW nRow ) const
+SvtScriptType ScColumn::GetScriptType( SCROW nRow ) const
{
if (!ValidRow(nRow) || maCellTextAttrs.is_empty(nRow))
- return 0;
+ return SvtScriptType::NONE;
return maCellTextAttrs.get<sc::CellTextAttr>(nRow).mnScriptType;
}
-sal_uInt8 ScColumn::GetRangeScriptType(
+SvtScriptType ScColumn::GetRangeScriptType(
sc::CellTextAttrStoreType::iterator& itPos, SCROW nRow1, SCROW nRow2, const sc::CellStoreType::iterator& itrCells )
{
if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2)
- return 0;
+ return SvtScriptType::NONE;
SCROW nRow = nRow1;
std::pair<sc::CellTextAttrStoreType::iterator,size_t> aRet =
@@ -1885,7 +1885,7 @@ sal_uInt8 ScColumn::GetRangeScriptType(
itPos = aRet.first; // Track the position of cell text attribute array.
- sal_uInt8 nScriptType = 0;
+ SvtScriptType nScriptType = SvtScriptType::NONE;
bool bUpdated = false;
if (itPos->type == sc::element_type_celltextattr)
{
@@ -1943,7 +1943,7 @@ sal_uInt8 ScColumn::GetRangeScriptType(
return nScriptType;
}
-void ScColumn::SetScriptType( SCROW nRow, sal_uInt8 nType )
+void ScColumn::SetScriptType( SCROW nRow, SvtScriptType nType )
{
if (!ValidRow(nRow))
return;
diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx
index 4c0bf2a51249..890a1dbc429a 100644
--- a/sc/source/core/data/column3.cxx
+++ b/sc/source/core/data/column3.cxx
@@ -492,7 +492,7 @@ void ScColumn::BroadcastNewCell( SCROW nRow )
bool ScColumn::UpdateScriptType( sc::CellTextAttr& rAttr, SCROW nRow, const sc::CellStoreType::iterator& itr )
{
- if (rAttr.mnScriptType != SC_SCRIPTTYPE_UNKNOWN)
+ if (rAttr.mnScriptType != SvtScriptType::UNKNOWN)
// Already updated. Nothing to do.
return false;
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index d8c10abcc49e..46b59c04b6a0 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -904,7 +904,7 @@ private:
return;
sc::CellTextAttr& rAttr = sc::celltextattr_block::at(*aAttrPos.first->data, aAttrPos.second);
- if (rAttr.mnScriptType != SC_SCRIPTTYPE_UNKNOWN)
+ if (rAttr.mnScriptType != SvtScriptType::UNKNOWN)
// Script type already deteremined. Skip it.
return;
diff --git a/sc/source/core/data/documen6.cxx b/sc/source/core/data/documen6.cxx
index 772b8b8e6068..8b6009df4b05 100644
--- a/sc/source/core/data/documen6.cxx
+++ b/sc/source/core/data/documen6.cxx
@@ -76,10 +76,9 @@ bool ScDocument::HasStringWeakCharacters( const OUString& rString )
return false; // none found
}
-sal_uInt8 ScDocument::GetStringScriptType( const OUString& rString )
+SvtScriptType ScDocument::GetStringScriptType( const OUString& rString )
{
-
- sal_uInt8 nRet = 0;
+ SvtScriptType nRet = SvtScriptType::NONE;
if (!rString.isEmpty())
{
uno::Reference<i18n::XBreakIterator> xBreakIter = GetBreakIterator();
@@ -94,13 +93,13 @@ sal_uInt8 ScDocument::GetStringScriptType( const OUString& rString )
switch ( nType )
{
case i18n::ScriptType::LATIN:
- nRet |= SCRIPTTYPE_LATIN;
+ nRet |= SvtScriptType::LATIN;
break;
case i18n::ScriptType::ASIAN:
- nRet |= SCRIPTTYPE_ASIAN;
+ nRet |= SvtScriptType::ASIAN;
break;
case i18n::ScriptType::COMPLEX:
- nRet |= SCRIPTTYPE_COMPLEX;
+ nRet |= SvtScriptType::COMPLEX;
break;
// WEAK is ignored
}
@@ -112,35 +111,35 @@ sal_uInt8 ScDocument::GetStringScriptType( const OUString& rString )
return nRet;
}
-sal_uInt8 ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat )
+SvtScriptType ScDocument::GetCellScriptType( const ScAddress& rPos, sal_uLong nNumberFormat )
{
- sal_uInt8 nStored = GetScriptType(rPos);
- if ( nStored != SC_SCRIPTTYPE_UNKNOWN ) // stored value valid?
+ SvtScriptType nStored = GetScriptType(rPos);
+ if ( nStored != SvtScriptType::UNKNOWN ) // stored value valid?
return nStored; // use stored value
Color* pColor;
OUString aStr = ScCellFormat::GetString(*this, rPos, nNumberFormat, &pColor, *xPoolHelper->GetFormTable());
- sal_uInt8 nRet = GetStringScriptType( aStr );
+ SvtScriptType nRet = GetStringScriptType( aStr );
SetScriptType(rPos, nRet); // store for later calls
return nRet;
}
-sal_uInt8 ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab )
+SvtScriptType ScDocument::GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab )
{
// if script type is set, don't have to get number formats
ScAddress aPos(nCol, nRow, nTab);
- sal_uInt8 nStored = GetScriptType(aPos);
- if ( nStored != SC_SCRIPTTYPE_UNKNOWN ) // stored value valid?
+ SvtScriptType nStored = GetScriptType(aPos);
+ if ( nStored != SvtScriptType::UNKNOWN ) // stored value valid?
return nStored; // use stored value
// include number formats from conditional formatting
const ScPatternAttr* pPattern = GetPattern( nCol, nRow, nTab );
- if (!pPattern) return 0;
+ if (!pPattern) return SvtScriptType::NONE;
const SfxItemSet* pCondSet = NULL;
if ( !static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData().empty() )
pCondSet = GetCondResult( nCol, nRow, nTab );
@@ -156,10 +155,10 @@ class ScriptTypeAggregator : public sc::ColumnSpanSet::Action
{
ScDocument& mrDoc;
sc::ColumnBlockPosition maBlockPos;
- sal_uInt8 mnScriptType;
+ SvtScriptType mnScriptType;
public:
- ScriptTypeAggregator(ScDocument& rDoc) : mrDoc(rDoc), mnScriptType(0) {}
+ ScriptTypeAggregator(ScDocument& rDoc) : mrDoc(rDoc), mnScriptType(SvtScriptType::NONE) {}
virtual void startColumn(SCTAB nTab, SCCOL nCol) SAL_OVERRIDE
{
@@ -174,21 +173,21 @@ public:
mnScriptType |= mrDoc.GetRangeScriptType(maBlockPos, rPos, nLength);
};
- sal_uInt8 getScriptType() const { return mnScriptType; }
+ SvtScriptType getScriptType() const { return mnScriptType; }
};
}
-sal_uInt8 ScDocument::GetRangeScriptType(
+SvtScriptType ScDocument::GetRangeScriptType(
sc::ColumnBlockPosition& rBlockPos, const ScAddress& rPos, SCROW nLength )
{
if (!TableExists(rPos.Tab()))
- return 0;
+ return SvtScriptType::NONE;
return maTabs[rPos.Tab()]->GetRangeScriptType(rBlockPos, rPos.Col(), rPos.Row(), rPos.Row()+nLength-1);
}
-sal_uInt8 ScDocument::GetRangeScriptType( const ScRangeList& rRanges )
+SvtScriptType ScDocument::GetRangeScriptType( const ScRangeList& rRanges )
{
sc::ColumnSpanSet aSet(false);
for (size_t i = 0, n = rRanges.size(); i < n; ++i)
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index dc023bb7ad21..3c82d65eccd7 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -1294,9 +1294,9 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
if ( bConsiderLanguage )
{
- sal_uInt8 nScript = GetStringScriptType( aOldStr ); //TODO: cell script type?
- sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
- ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE :
+ SvtScriptType nScript = GetStringScriptType( aOldStr ); //TODO: cell script type?
+ sal_uInt16 nWhich = ( nScript == SvtScriptType::ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
+ ( ( nScript == SvtScriptType::COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE :
ATTR_FONT_LANGUAGE );
nLanguage = static_cast<const SvxLanguageItem*>(GetAttr( nCol, nRow, nTab, nWhich ))->GetValue();
}
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 170d202bc265..9293b87a39e2 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -6030,16 +6030,16 @@ sal_uInt16 ScDocument::GetTextWidth( const ScAddress& rPos ) const
return 0;
}
-sal_uInt8 ScDocument::GetScriptType( const ScAddress& rPos ) const
+SvtScriptType ScDocument::GetScriptType( const ScAddress& rPos ) const
{
SCTAB nTab = rPos.Tab();
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
return maTabs[nTab]->GetScriptType(rPos.Col(), rPos.Row());
- return 0;
+ return SvtScriptType::NONE;
}
-void ScDocument::SetScriptType( const ScAddress& rPos, sal_uInt8 nType )
+void ScDocument::SetScriptType( const ScAddress& rPos, SvtScriptType nType )
{
SCTAB nTab = rPos.Tab();
if (ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
diff --git a/sc/source/core/data/documentimport.cxx b/sc/source/core/data/documentimport.cxx
index 4191642a44c4..18346fae2a52 100644
--- a/sc/source/core/data/documentimport.cxx
+++ b/sc/source/core/data/documentimport.cxx
@@ -51,7 +51,7 @@ struct ScDocumentImportImpl
ScDocument& mrDoc;
sc::StartListeningContext maListenCxt;
sc::ColumnBlockPositionSet maBlockPosSet;
- sal_uInt16 mnDefaultScriptNumeric;
+ SvtScriptType mnDefaultScriptNumeric;
TabAttrsType maTabAttrs;
@@ -59,7 +59,7 @@ struct ScDocumentImportImpl
mrDoc(rDoc),
maListenCxt(rDoc),
maBlockPosSet(rDoc),
- mnDefaultScriptNumeric(SC_SCRIPTTYPE_UNKNOWN) {}
+ mnDefaultScriptNumeric(SvtScriptType::UNKNOWN) {}
ColAttr* getColAttr( size_t nTab, size_t nCol )
{
@@ -95,7 +95,7 @@ const ScDocument& ScDocumentImport::getDoc() const
return mpImpl->mrDoc;
}
-void ScDocumentImport::setDefaultNumericScript(sal_uInt16 nScript)
+void ScDocumentImport::setDefaultNumericScript(SvtScriptType nScript)
{
mpImpl->mnDefaultScriptNumeric = nScript;
}
@@ -487,9 +487,9 @@ class CellStoreInitializer
{
sc::CellTextAttrStoreType maAttrs;
sc::CellTextAttrStoreType::iterator miPos;
- sal_uInt16 mnScriptNumeric;
+ SvtScriptType mnScriptNumeric;
- Impl(const sal_uInt32 nMaxRowCount, const sal_uInt16 nScriptNumeric)
+ Impl(const sal_uInt32 nMaxRowCount, const SvtScriptType nScriptNumeric)
: maAttrs(nMaxRowCount), miPos(maAttrs.begin()), mnScriptNumeric(nScriptNumeric)
{}
};
@@ -522,7 +522,7 @@ public:
aDefault.mnScriptType = mpImpl->mnScriptNumeric;
const ColAttr* p = mrDocImpl.getColAttr(mnTab, mnCol);
if (p && p->mbLatinNumFmtOnly)
- aDefault.mnScriptType = SCRIPTTYPE_LATIN;
+ aDefault.mnScriptType = SvtScriptType::LATIN;
}
break;
case sc::element_type_formula:
@@ -546,7 +546,7 @@ public:
}
if (bNumResOnly)
- aDefault.mnScriptType = SCRIPTTYPE_LATIN;
+ aDefault.mnScriptType = SvtScriptType::LATIN;
}
}
break;
diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx
index d71154dbecd6..b7145d569445 100644
--- a/sc/source/core/data/global.cxx
+++ b/sc/source/core/data/global.cxx
@@ -928,13 +928,13 @@ bool ScGlobal::IsSystemRTL()
return MsLangId::isRightToLeft( Application::GetSettings().GetLanguageTag().getLanguageType() );
}
-sal_uInt8 ScGlobal::GetDefaultScriptType()
+SvtScriptType ScGlobal::GetDefaultScriptType()
{
// Used when text contains only WEAK characters.
// Script type of office language is used then (same as GetEditDefaultLanguage,
// to get consistent behavior of text in simple cells and EditEngine,
// also same as GetAppLanguage() in Writer)
- return (sal_uInt8) SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
+ return SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
}
LanguageType ScGlobal::GetEditDefaultLanguage()
@@ -943,23 +943,23 @@ LanguageType ScGlobal::GetEditDefaultLanguage()
return Application::GetSettings().GetLanguageTag().getLanguageType();
}
-sal_uInt16 ScGlobal::GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich )
+sal_uInt16 ScGlobal::GetScriptedWhichID( SvtScriptType nScriptType, sal_uInt16 nWhich )
{
switch ( nScriptType )
{
- case SCRIPTTYPE_LATIN:
- case SCRIPTTYPE_ASIAN:
- case SCRIPTTYPE_COMPLEX:
+ case SvtScriptType::LATIN:
+ case SvtScriptType::ASIAN:
+ case SvtScriptType::COMPLEX:
break; // take exact matches
default: // prefer one, first COMPLEX, then ASIAN
- if ( nScriptType & SCRIPTTYPE_COMPLEX )
- nScriptType = SCRIPTTYPE_COMPLEX;
- else if ( nScriptType & SCRIPTTYPE_ASIAN )
- nScriptType = SCRIPTTYPE_ASIAN;
+ if ( nScriptType & SvtScriptType::COMPLEX )
+ nScriptType = SvtScriptType::COMPLEX;
+ else if ( nScriptType & SvtScriptType::ASIAN )
+ nScriptType = SvtScriptType::ASIAN;
}
switch ( nScriptType )
{
- case SCRIPTTYPE_COMPLEX:
+ case SvtScriptType::COMPLEX:
{
switch ( nWhich )
{
@@ -982,7 +982,7 @@ sal_uInt16 ScGlobal::GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhic
}
}
break;
- case SCRIPTTYPE_ASIAN:
+ case SvtScriptType::ASIAN:
{
switch ( nWhich )
{
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 878f8afd3af9..0dfc3690663c 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -217,10 +217,10 @@ SvxCellOrientation ScPatternAttr::GetCellOrientation( const SfxItemSet* pCondSet
namespace {
-void getFontIDsByScriptType(sal_uInt8 nScript,
+void getFontIDsByScriptType(SvtScriptType nScript,
sal_uInt16& nFontId, sal_uInt16& nHeightId, sal_uInt16& nWeightId, sal_uInt16& nPostureId, sal_uInt16& nLangId)
{
- if ( nScript == SCRIPTTYPE_ASIAN )
+ if ( nScript == SvtScriptType::ASIAN )
{
nFontId = ATTR_CJK_FONT;
nHeightId = ATTR_CJK_FONT_HEIGHT;
@@ -228,7 +228,7 @@ sal_uInt16& nFontId, sal_uInt16& nHeightId, sal_uInt16& nWeightId, sal_uInt16& n
nPostureId = ATTR_CJK_FONT_POSTURE;
nLangId = ATTR_CJK_FONT_LANGUAGE;
}
- else if ( nScript == SCRIPTTYPE_COMPLEX )
+ else if ( nScript == SvtScriptType::COMPLEX )
{
nFontId = ATTR_CTL_FONT;
nHeightId = ATTR_CTL_FONT_HEIGHT;
@@ -251,7 +251,7 @@ sal_uInt16& nFontId, sal_uInt16& nHeightId, sal_uInt16& nWeightId, sal_uInt16& n
void ScPatternAttr::GetFont(
vcl::Font& rFont, const SfxItemSet& rItemSet, ScAutoFontColorMode eAutoMode,
OutputDevice* pOutDev, const Fraction* pScale,
- const SfxItemSet* pCondSet, sal_uInt8 nScript,
+ const SfxItemSet* pCondSet, SvtScriptType nScript,
const Color* pBackConfigColor, const Color* pTextConfigColor )
{
// Read items
@@ -493,13 +493,13 @@ void ScPatternAttr::GetFont(
void ScPatternAttr::GetFont(
vcl::Font& rFont, ScAutoFontColorMode eAutoMode,
OutputDevice* pOutDev, const Fraction* pScale,
- const SfxItemSet* pCondSet, sal_uInt8 nScript,
+ const SfxItemSet* pCondSet, SvtScriptType nScript,
const Color* pBackConfigColor, const Color* pTextConfigColor ) const
{
GetFont( rFont, GetItemSet(), eAutoMode, pOutDev, pScale, pCondSet, nScript, pBackConfigColor, pTextConfigColor );
}
-ScDxfFont ScPatternAttr::GetDxfFont(const SfxItemSet& rItemSet, sal_uInt8 nScript)
+ScDxfFont ScPatternAttr::GetDxfFont(const SfxItemSet& rItemSet, SvtScriptType nScript)
{
sal_uInt16 nFontId, nHeightId, nWeightId, nPostureId, nLangId;
getFontIDsByScriptType(nScript, nFontId, nHeightId, nWeightId, nPostureId, nLangId);
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 7ace7b5f8f77..2d45dab8f9de 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -2105,15 +2105,15 @@ sal_uLong ScTable::AddCondFormat( ScConditionalFormat* pNew )
return nMax + 1;
}
-sal_uInt8 ScTable::GetScriptType( SCCOL nCol, SCROW nRow ) const
+SvtScriptType ScTable::GetScriptType( SCCOL nCol, SCROW nRow ) const
{
if (!ValidCol(nCol))
- return 0;
+ return SvtScriptType::NONE;
return aCol[nCol].GetScriptType(nRow);
}
-void ScTable::SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType )
+void ScTable::SetScriptType( SCCOL nCol, SCROW nRow, SvtScriptType nType )
{
if (!ValidCol(nCol))
return;
@@ -2121,11 +2121,11 @@ void ScTable::SetScriptType( SCCOL nCol, SCROW nRow, sal_uInt8 nType )
aCol[nCol].SetScriptType(nRow, nType);
}
-sal_uInt8 ScTable::GetRangeScriptType(
+SvtScriptType ScTable::GetRangeScriptType(
sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SCROW nRow1, SCROW nRow2 )
{
if (!ValidCol(nCol))
- return 0;
+ return SvtScriptType::NONE;
sc::CellStoreType::iterator itr = aCol[nCol].maCells.begin();
return aCol[nCol].GetRangeScriptType(rBlockPos.miCellTextAttrPos, nRow1, nRow2, itr);
diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index 2d45f1af51b2..5924d3ec4305 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -1181,7 +1181,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
rCol.SetTextWidth(nRow, TEXTWIDTH_DIRTY);
if ( bNumFormatChanged )
- rCol.SetScriptType(nRow, SC_SCRIPTTYPE_UNKNOWN);
+ rCol.SetScriptType(nRow, SvtScriptType::UNKNOWN);
if ( bBroadcast )
{ // Only with CalcAsShown
@@ -1221,7 +1221,7 @@ void ScTable::InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* p
continue;
if ( bNumFormatChanged )
- aCol[nCol].SetScriptType(nRow, SC_SCRIPTTYPE_UNKNOWN);
+ aCol[nCol].SetScriptType(nRow, SvtScriptType::UNKNOWN);
if ( bBroadcast )
{ // Only with CalcAsShown
diff --git a/sc/source/core/tool/numformat.cxx b/sc/source/core/tool/numformat.cxx
index 8b1779b1a9fe..4d18dc4811a3 100644
--- a/sc/source/core/tool/numformat.cxx
+++ b/sc/source/core/tool/numformat.cxx
@@ -57,8 +57,8 @@ bool NumFmtUtil::isLatinScript( sal_uLong nFormat, ScDocument& rDoc )
aDecSep = aLocaleData.getNumDecimalSep();
}
- sal_uInt8 nScript = rDoc.GetStringScriptType(aDecSep);
- return (nScript == 0 || nScript == SCRIPTTYPE_LATIN);
+ SvtScriptType nScript = rDoc.GetStringScriptType(aDecSep);
+ return (nScript == SvtScriptType::NONE || nScript == SvtScriptType::LATIN);
}
}
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 078a0ef4ff26..2ecc39d0afd8 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -877,36 +877,14 @@ sal_Int16 XclExpFontHelper::GetFirstUsedScript( const XclExpRoot& rRoot, const S
return nScript;
}
-namespace {
-
-sal_uInt8 getCoreScriptType(sal_Int16 nScript)
-{
- namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
-
- sal_uInt8 nScScript = SCRIPTTYPE_LATIN;
- switch( nScript )
- {
- case ApiScriptType::LATIN: nScScript = SCRIPTTYPE_LATIN; break;
- case ApiScriptType::ASIAN: nScScript = SCRIPTTYPE_ASIAN; break;
- case ApiScriptType::COMPLEX: nScScript = SCRIPTTYPE_COMPLEX; break;
- default: OSL_FAIL( "XclExpFontHelper::GetFontFromItemSet - unknown script type" );
- }
-
- return nScScript;
-}
-
-}
-
vcl::Font XclExpFontHelper::GetFontFromItemSet( const XclExpRoot& rRoot, const SfxItemSet& rItemSet, sal_Int16 nScript )
{
- namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
-
// if WEAK is passed, guess script type from existing items in the item set
- if( nScript == ApiScriptType::WEAK )
+ if( nScript == css::i18n::ScriptType::WEAK )
nScript = GetFirstUsedScript( rRoot, rItemSet );
// convert to core script type constants
- sal_uInt8 nScScript = getCoreScriptType(nScript);
+ SvtScriptType nScScript = SvtLanguageOptions::FromI18NToSvtScriptType(nScript);
// fill the font object
vcl::Font aFont;
@@ -919,7 +897,7 @@ ScDxfFont XclExpFontHelper::GetDxfFontFromItemSet(const XclExpRoot& rRoot, const
sal_Int16 nScript = GetFirstUsedScript(rRoot, rItemSet);
// convert to core script type constants
- sal_uInt8 nScScript = getCoreScriptType(nScript);
+ SvtScriptType nScScript = SvtLanguageOptions::FromI18NToSvtScriptType(nScript);
return ScPatternAttr::GetDxfFont(rItemSet, nScScript);
}
diff --git a/sc/source/filter/excel/xlroot.cxx b/sc/source/filter/excel/xlroot.cxx
index c3ea29bafff8..56f6053149a1 100644
--- a/sc/source/filter/excel/xlroot.cxx
+++ b/sc/source/filter/excel/xlroot.cxx
@@ -107,9 +107,9 @@ XclRootData::XclRootData( XclBiff eBiff, SfxMedium& rMedium,
switch( ScGlobal::GetDefaultScriptType() )
{
- case SCRIPTTYPE_LATIN: mnDefApiScript = ApiScriptType::LATIN; break;
- case SCRIPTTYPE_ASIAN: mnDefApiScript = ApiScriptType::ASIAN; break;
- case SCRIPTTYPE_COMPLEX: mnDefApiScript = ApiScriptType::COMPLEX; break;
+ case SvtScriptType::LATIN: mnDefApiScript = ApiScriptType::LATIN; break;
+ case SvtScriptType::ASIAN: mnDefApiScript = ApiScriptType::ASIAN; break;
+ case SvtScriptType::COMPLEX: mnDefApiScript = ApiScriptType::COMPLEX; break;
default: SAL_WARN( "sc", "XclRootData::XclRootData - unknown script type" );
}
diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx
index 75fab085842a..94c1cc069408 100644
--- a/sc/source/filter/html/htmlexp.cxx
+++ b/sc/source/filter/html/htmlexp.cxx
@@ -864,11 +864,11 @@ void ScHTMLExport::WriteCell( SCCOL nCol, SCROW nRow, SCTAB nTab )
sal_uLong nFormat = pAttr->GetNumberFormat( pFormatter );
bool bValueData = aCell.hasNumeric();
- sal_uInt8 nScriptType = 0;
+ SvtScriptType nScriptType = SvtScriptType::NONE;
if (!aCell.isEmpty())
nScriptType = pDoc->GetScriptType(nCol, nRow, nTab);
- if ( nScriptType == 0 )
+ if ( nScriptType == SvtScriptType::NONE )
nScriptType = aHTMLStyle.nDefaultScriptType;
OStringBuffer aStrTD(OOO_STRING_SVTOOLS_HTML_tabledata);
diff --git a/sc/source/filter/inc/htmlexp.hxx b/sc/source/filter/inc/htmlexp.hxx
index c895d036e2a0..3403d4c670a6 100644
--- a/sc/source/filter/inc/htmlexp.hxx
+++ b/sc/source/filter/inc/htmlexp.hxx
@@ -37,7 +37,7 @@ class SdrObject;
class OutputDevice;
class ScDrawLayer;
class EditTextObject;
-
+enum class SvtScriptType;
namespace editeng { class SvxBorderLine; }
struct ScHTMLStyle
@@ -46,7 +46,7 @@ struct ScHTMLStyle
OUString aFontFamilyName;
sal_uInt32 nFontHeight; // Item-Value
sal_uInt16 nFontSizeNumber; // HTML value 1-7
- sal_uInt8 nDefaultScriptType; // Font values are valid for the default script type
+ SvtScriptType nDefaultScriptType; // Font values are valid for the default script type
bool bInitialized;
ScHTMLStyle() :
diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx
index 051b8787210e..973446dfc3af 100644
--- a/sc/source/filter/rtf/eeimpars.cxx
+++ b/sc/source/filter/rtf/eeimpars.cxx
@@ -259,9 +259,9 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu
if ( pFont || pHeight || pWeight || pPosture )
{
OUString aStr( mpEngine->GetText( pE->aSel ) );
- sal_uInt8 nScriptType = mpDoc->GetStringScriptType( aStr );
- const sal_uInt8 nScripts[3] = { SCRIPTTYPE_LATIN,
- SCRIPTTYPE_ASIAN, SCRIPTTYPE_COMPLEX };
+ SvtScriptType nScriptType = mpDoc->GetStringScriptType( aStr );
+ const SvtScriptType nScripts[3] = { SvtScriptType::LATIN,
+ SvtScriptType::ASIAN, SvtScriptType::COMPLEX };
for ( sal_uInt8 j=0; j<3; ++j )
{
if ( nScriptType & nScripts[j] )
diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx
index b8e58b6257fd..72fd4fbe84f0 100644
--- a/sc/source/filter/xml/xmlimprt.cxx
+++ b/sc/source/filter/xml/xmlimprt.cxx
@@ -2447,7 +2447,7 @@ void ScXMLImport::ExamineDefaultStyle()
const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
if (pDefPattern && sc::NumFmtUtil::isLatinScript(*pDefPattern, *pDoc))
- mpDocImport->setDefaultNumericScript(SCRIPTTYPE_LATIN);
+ mpDocImport->setDefaultNumericScript(SvtScriptType::LATIN);
}
}
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index a70b0697404c..bbc73c94126e 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1410,8 +1410,8 @@ void ScMultiTextWnd::InitEditEngine()
if (pDocSh)
{
ScDocument& rDoc = pDocSh->GetDocument(); // any document
- sal_uInt8 nScript = rDoc.GetStringScriptType( aString );
- if ( nScript & SCRIPTTYPE_COMPLEX )
+ SvtScriptType nScript = rDoc.GetStringScriptType( aString );
+ if ( nScript & SvtScriptType::COMPLEX )
Invalidate();
}
}
@@ -1783,8 +1783,8 @@ void ScTextWnd::StartEditEngine()
if ( pObjSh && pObjSh->ISA(ScDocShell) )
{
ScDocument& rDoc = static_cast<ScDocShell*>(pObjSh)->GetDocument(); // any document
- sal_uInt8 nScript = rDoc.GetStringScriptType( aString );
- if ( nScript & SCRIPTTYPE_COMPLEX )
+ SvtScriptType nScript = rDoc.GetStringScriptType( aString );
+ if ( nScript & SvtScriptType::COMPLEX )
Invalidate();
}
}
@@ -1876,8 +1876,8 @@ void ScTextWnd::SetTextString( const OUString& rNewString )
else
{
// test if CTL script type is involved
- sal_uInt8 nOldScript = 0;
- sal_uInt8 nNewScript = 0;
+ SvtScriptType nOldScript = SvtScriptType::NONE;
+ SvtScriptType nNewScript = SvtScriptType::NONE;
SfxObjectShell* pObjSh = SfxObjectShell::Current();
if ( pObjSh && pObjSh->ISA(ScDocShell) )
{
@@ -1886,7 +1886,7 @@ void ScTextWnd::SetTextString( const OUString& rNewString )
nOldScript = rDoc.GetStringScriptType( aString );
nNewScript = rDoc.GetStringScriptType( rNewString );
}
- bPaintAll = ( nOldScript & SCRIPTTYPE_COMPLEX ) || ( nNewScript & SCRIPTTYPE_COMPLEX );
+ bPaintAll = ( nOldScript & SvtScriptType::COMPLEX ) || ( nNewScript & SvtScriptType::COMPLEX );
}
if ( bPaintAll )
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index aa17857dbdc5..ce261fb3aa8f 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -894,7 +894,7 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq )
// font items from toolbox controller have to be applied for the right script type
// #i78017 establish the same behaviour as in Writer
- sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
if (nSlot == SID_ATTR_CHAR_FONT)
nScript = pView->GetScriptType();
@@ -965,10 +965,10 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet )
// choose font info according to selection script type
- sal_uInt16 nScript = pView->GetScriptType();
+ SvtScriptType nScript = pView->GetScriptType();
// #i55929# input-language-dependent script type (depends on input language if nothing selected)
- sal_uInt16 nInputScript = nScript;
+ SvtScriptType nInputScript = nScript;
OutlinerView* pOutView = pView->GetTextEditOutlinerView();
if (pOutView && !pOutView->GetSelection().HasRange())
{
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 0221e601b8ae..a9d54d0e7426 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -161,7 +161,7 @@ class ScGridWindow : public vcl::Window, public DropTargetHelper, public DragSou
ScRange aPagebreakSource;
ScRange aPagebreakDrag;
- sal_uInt8 nPageScript;
+ SvtScriptType nPageScript;
long nLastClickX;
long nLastClickY;
diff --git a/sc/source/ui/inc/viewfunc.hxx b/sc/source/ui/inc/viewfunc.hxx
index a032722ff9a5..1c90a1e7a4b3 100644
--- a/sc/source/ui/inc/viewfunc.hxx
+++ b/sc/source/ui/inc/viewfunc.hxx
@@ -75,7 +75,7 @@ public:
void GetSelectionFrame ( SvxBoxItem& rLineOuter,
SvxBoxInfoItem& rLineInner );
- sal_uInt8 GetSelectionScriptType();
+ SvtScriptType GetSelectionScriptType();
bool GetAutoSumArea(ScRangeList& rRangeList);
void EnterAutoSum(const ScRangeList& rRangeList, bool bSubTotal, const ScAddress& rAddr);
diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx
index 63e2ef03e5bc..bbccd75827d2 100644
--- a/sc/source/ui/inc/viewutil.hxx
+++ b/sc/source/ui/inc/viewutil.hxx
@@ -34,7 +34,7 @@ class ScDocument;
class ScAddress;
class ScRange;
class ScMarkData;
-
+enum class SvtScriptType;
enum ScUpdateMode { SC_UPDATE_ALL, SC_UPDATE_CHANGED, SC_UPDATE_MARKS };
class SC_DLLPUBLIC ScViewUtil
@@ -50,7 +50,7 @@ public:
ScDocument& rDocument );
static void PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSet,
- sal_uInt16 nWhichId, sal_uInt16 nScript );
+ sal_uInt16 nWhichId, SvtScriptType nScript );
static sal_uInt16 GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos );
diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx
index bceac51de6a2..21194f6c51ab 100644
--- a/sc/source/ui/view/editsh.cxx
+++ b/sc/source/ui/view/editsh.cxx
@@ -333,9 +333,9 @@ void ScEditShell::Execute( SfxRequest& rReq )
case SID_CHARMAP:
{
- sal_uInt16 nScript = pTableView->GetSelectedScriptType();
- sal_uInt16 nFontWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? EE_CHAR_FONTINFO_CJK :
- ( ( nScript == SCRIPTTYPE_COMPLEX ) ? EE_CHAR_FONTINFO_CTL :
+ SvtScriptType nScript = pTableView->GetSelectedScriptType();
+ sal_uInt16 nFontWhich = ( nScript == SvtScriptType::ASIAN ) ? EE_CHAR_FONTINFO_CJK :
+ ( ( nScript == SvtScriptType::COMPLEX ) ? EE_CHAR_FONTINFO_CTL :
EE_CHAR_FONTINFO );
const SvxFontItem& rItem = static_cast<const SvxFontItem&>(
pTableView->GetAttribs().Get(nFontWhich));
@@ -377,10 +377,10 @@ void ScEditShell::Execute( SfxRequest& rReq )
if ( !aString.isEmpty() )
{
// if string contains WEAK characters, set all fonts
- sal_uInt8 nSetScript;
+ SvtScriptType nSetScript;
ScDocument* pDoc = pViewData->GetDocument();
if ( pDoc->HasStringWeakCharacters( aString ) )
- nSetScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ nSetScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
else
nSetScript = pDoc->GetStringScriptType( aString );
@@ -844,11 +844,11 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
if (pArgs)
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
if (nSlot == SID_ATTR_CHAR_FONT)
{
nScript = pEditView->GetSelectedScriptType();
- if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
+ if (nScript == SvtScriptType::NONE) nScript = ScGlobal::GetDefaultScriptType();
}
SfxItemPool& rPool = GetPool();
@@ -876,7 +876,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
case SID_ATTR_CHAR_WEIGHT:
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
SfxItemPool& rPool = GetPool();
@@ -899,7 +899,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq)
case SID_ATTR_CHAR_POSTURE:
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt16 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
SfxItemPool& rPool = GetPool();
@@ -1058,11 +1058,11 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet)
// choose font info according to selection script type
- sal_uInt16 nScript = pEditView->GetSelectedScriptType();
- if (nScript == 0) nScript = ScGlobal::GetDefaultScriptType();
+ SvtScriptType nScript = pEditView->GetSelectedScriptType();
+ if (nScript == SvtScriptType::NONE) nScript = ScGlobal::GetDefaultScriptType();
// #i55929# input-language-dependent script type (depends on input language if nothing selected)
- sal_uInt16 nInputScript = nScript;
+ SvtScriptType nInputScript = nScript;
if ( !pEditView->GetSelection().HasRange() )
{
LanguageType nInputLang = pViewData->GetActiveWin()->GetInputLanguage();
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 706b0da2f28c..056d2ca5d3b5 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -1370,7 +1370,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
case SID_ATTR_CHAR_WEIGHT:
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt8 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
SfxItemPool& rPool = GetPool();
SvxScriptSetItem aSetItem( nSlot, rPool );
@@ -1397,7 +1397,7 @@ void ScFormatShell::ExecuteTextAttr( SfxRequest& rReq )
case SID_ATTR_CHAR_POSTURE:
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt8 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
SfxItemPool& rPool = GetPool();
SvxScriptSetItem aSetItem( nSlot, rPool );
@@ -1654,7 +1654,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
sal_uInt16 nWhich = rPool.GetWhich( nSlot );
const SvxFontItem& rFont = static_cast<const SvxFontItem&>(pNewAttrs->Get( nWhich ));
SvxScriptSetItem aSetItem( SID_ATTR_CHAR_FONT, rPool );
- sal_uInt8 nScript = pTabViewShell->GetSelectionScriptType();
+ SvtScriptType nScript = pTabViewShell->GetSelectionScriptType();
aSetItem.PutItemForScriptType( nScript, rFont );
ScMarkData aFuncMark( pViewData->GetMarkData() );
@@ -1691,7 +1691,7 @@ void ScFormatShell::ExecuteAttr( SfxRequest& rReq )
case SID_ATTR_CHAR_FONTHEIGHT:
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt8 nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
if (nSlot == SID_ATTR_CHAR_FONT)
nScript = pTabViewShell->GetSelectionScriptType();
@@ -1928,15 +1928,15 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet )
rSet.Put( rAttrSet, false );
// choose font info according to selection script type
- sal_uInt8 nScript = 0; // GetSelectionScriptType never returns 0
+ SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
if ( rSet.GetItemState( ATTR_FONT ) != SfxItemState::UNKNOWN )
{
- if (!nScript) nScript = pTabViewShell->GetSelectionScriptType();
+ if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT, nScript );
}
if ( rSet.GetItemState( ATTR_FONT_HEIGHT ) != SfxItemState::UNKNOWN )
{
- if (!nScript) nScript = pTabViewShell->GetSelectionScriptType();
+ if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_HEIGHT, nScript );
}
@@ -2139,15 +2139,15 @@ void ScFormatShell::GetTextAttrState( SfxItemSet& rSet )
rSet.Put( rAttrSet, false ); // ItemStates mitkopieren
// choose font info according to selection script type
- sal_uInt8 nScript = 0; // GetSelectionScriptType never returns 0
+ SvtScriptType nScript = SvtScriptType::NONE; // GetSelectionScriptType never returns 0
if ( rSet.GetItemState( ATTR_FONT_WEIGHT ) != SfxItemState::UNKNOWN )
{
- if (!nScript) nScript = pTabViewShell->GetSelectionScriptType();
+ if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_WEIGHT, nScript );
}
if ( rSet.GetItemState( ATTR_FONT_POSTURE ) != SfxItemState::UNKNOWN )
{
- if (!nScript) nScript = pTabViewShell->GetSelectionScriptType();
+ if (nScript == SvtScriptType::NONE) nScript = pTabViewShell->GetSelectionScriptType();
ScViewUtil::PutItemScript( rSet, rAttrSet, ATTR_FONT_POSTURE, nScript );
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 54d7d81e9de3..a39603115070 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -460,7 +460,7 @@ ScGridWindow::ScGridWindow( vcl::Window* pParent, ScViewData* pData, ScSplitPos
nPagebreakMouse( SC_PD_NONE ),
nPagebreakBreak( 0 ),
nPagebreakPrev( 0 ),
- nPageScript( 0 ),
+ nPageScript( SvtScriptType::NONE ),
nLastClickX( 0 ),
nLastClickY( 0 ),
nDragStartX( -1 ),
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index e9d21852fc49..9a78d1067690 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -1110,18 +1110,18 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
Color aAutomatic( rColorCfg.GetColorValue(svtools::CALCPAGEBREAK).nColor );
OUString aPageStr = ScGlobal::GetRscString( STR_PGNUM );
- if ( nPageScript == 0 )
+ if ( nPageScript == SvtScriptType::NONE )
{
// get script type of translated "Page" string only once
nPageScript = pDoc->GetStringScriptType( aPageStr );
- if (nPageScript == 0)
+ if (nPageScript == SvtScriptType::NONE)
nPageScript = ScGlobal::GetDefaultScriptType();
}
vcl::Font aFont;
std::unique_ptr<ScEditEngineDefaulter> pEditEng;
const ScPatternAttr& rDefPattern = static_cast<const ScPatternAttr&>(pDoc->GetPool()->GetDefaultItem(ATTR_PATTERN));
- if ( nPageScript == SCRIPTTYPE_LATIN )
+ if ( nPageScript == SvtScriptType::LATIN )
{
// use single font and call DrawText directly
rDefPattern.GetFont( aFont, SC_AUTOCOL_BLACK );
diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx
index 6ffe033effdc..5f43c75e9101 100644
--- a/sc/source/ui/view/output2.cxx
+++ b/sc/source/ui/view/output2.cxx
@@ -132,7 +132,7 @@ public:
void SetPattern(
const ScPatternAttr* pNew, const SfxItemSet* pSet, const ScRefCellValue& rCell,
- sal_uInt8 nScript );
+ SvtScriptType nScript );
void SetPatternSimple( const ScPatternAttr* pNew, const SfxItemSet* pSet );
@@ -167,7 +167,7 @@ public:
long GetAscent() const { return nAscentPixel; }
bool IsRotated() const { return bRotated; }
- void SetShrinkScale( long nScale, sal_uInt8 nScript );
+ void SetShrinkScale( long nScale, SvtScriptType nScript );
bool HasCondHeight() const { return pCondSet && SfxItemState::SET ==
pCondSet->GetItemState( ATTR_FONT_HEIGHT, true ); }
@@ -221,7 +221,7 @@ ScDrawStringsVars::~ScDrawStringsVars()
{
}
-void ScDrawStringsVars::SetShrinkScale( long nScale, sal_uInt8 nScript )
+void ScDrawStringsVars::SetShrinkScale( long nScale, SvtScriptType nScript )
{
// text remains valid, size is updated
@@ -281,7 +281,7 @@ bool lcl_GetBoolValue(const ScPatternAttr& rPattern, sal_uInt16 nWhich, const Sf
void ScDrawStringsVars::SetPattern(
const ScPatternAttr* pNew, const SfxItemSet* pSet, const ScRefCellValue& rCell,
- sal_uInt8 nScript )
+ SvtScriptType nScript )
{
nMaxDigitWidth = 0;
nSignWidth = 0;
@@ -1053,11 +1053,11 @@ static inline void lcl_CreateInterpretProgress( bool& bProgress, ScDocument* pDo
}
}
-inline bool IsAmbiguousScript( sal_uInt8 nScript )
+inline bool IsAmbiguousScript( SvtScriptType nScript )
{
- return ( nScript != SCRIPTTYPE_LATIN &&
- nScript != SCRIPTTYPE_ASIAN &&
- nScript != SCRIPTTYPE_COMPLEX );
+ return ( nScript != SvtScriptType::LATIN &&
+ nScript != SvtScriptType::ASIAN &&
+ nScript != SvtScriptType::COMPLEX );
}
bool ScOutputData::IsEmptyCellText( RowInfo* pThisRowInfo, SCCOL nX, SCROW nY )
@@ -1463,7 +1463,7 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA
const SfxItemSet* pCondSet = NULL;
const ScPatternAttr* pOldPattern = NULL;
const SfxItemSet* pOldCondSet = NULL;
- sal_uInt8 nOldScript = 0;
+ SvtScriptType nOldScript = SvtScriptType::NONE;
// alternative pattern instances in case we need to modify the pattern
// before processing the cell value.
@@ -1642,11 +1642,11 @@ Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, const ScA
pPattern = pAltPattern;
}
- sal_uInt8 nScript = mpDoc->GetCellScriptType(
+ SvtScriptType nScript = mpDoc->GetCellScriptType(
ScAddress(nCellX, nCellY, nTab),
pPattern->GetNumberFormat(mpDoc->GetFormatTable(), pCondSet));
- if (nScript == 0)
+ if (nScript == SvtScriptType::NONE)
nScript = ScGlobal::GetDefaultScriptType();
if ( pPattern != pOldPattern || pCondSet != pOldCondSet ||
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 4b21f410f989..1c647ab42fa7 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -2782,10 +2782,10 @@ void ScViewFunc::InsertSpecialChar( const OUString& rStr, const vcl::Font& rFont
ATTR_FONT );
// if string contains WEAK characters, set all fonts
- sal_uInt8 nScript;
+ SvtScriptType nScript;
ScDocument* pDoc = GetViewData().GetDocument();
if ( pDoc->HasStringWeakCharacters( rStr ) )
- nScript = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ nScript = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
else
nScript = pDoc->GetStringScriptType( rStr );
diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx
index 9e1a7e143c4c..92ddab74a3b1 100644
--- a/sc/source/ui/view/viewfunc.cxx
+++ b/sc/source/ui/view/viewfunc.cxx
@@ -782,9 +782,9 @@ void ScViewFunc::EnterMatrix( const OUString& rString, ::formula::FormulaGrammar
ErrorMessage(STR_NOMULTISELECT);
}
-sal_uInt8 ScViewFunc::GetSelectionScriptType()
+SvtScriptType ScViewFunc::GetSelectionScriptType()
{
- sal_uInt8 nScript = 0;
+ SvtScriptType nScript = SvtScriptType::NONE;
ScDocument* pDoc = GetViewData().GetDocument();
const ScMarkData& rMark = GetViewData().GetMarkData();
@@ -802,7 +802,7 @@ sal_uInt8 ScViewFunc::GetSelectionScriptType()
nScript = pDoc->GetRangeScriptType(aRanges);
}
- if (nScript == 0)
+ if (nScript == SvtScriptType::NONE)
nScript = ScGlobal::GetDefaultScriptType();
return nScript;
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 8b245fb39bca..4c82a4f49c24 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -52,7 +52,7 @@
#include <boost/scoped_ptr.hpp>
void ScViewUtil::PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSet,
- sal_uInt16 nWhichId, sal_uInt16 nScript )
+ sal_uInt16 nWhichId, SvtScriptType nScript )
{
// take the effective item from rCoreSet according to nScript
// and put in rShellSet under the (base) nWhichId
@@ -73,9 +73,9 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
{
// used for thesaurus
- sal_uInt8 nScript = pDoc->GetScriptType(rPos.Col(), rPos.Row(), rPos.Tab());
- sal_uInt16 nWhich = ( nScript == SCRIPTTYPE_ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
- ( ( nScript == SCRIPTTYPE_COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE );
+ SvtScriptType nScript = pDoc->GetScriptType(rPos.Col(), rPos.Row(), rPos.Tab());
+ sal_uInt16 nWhich = ( nScript == SvtScriptType::ASIAN ) ? ATTR_CJK_FONT_LANGUAGE :
+ ( ( nScript == SvtScriptType::COMPLEX ) ? ATTR_CTL_FONT_LANGUAGE : ATTR_FONT_LANGUAGE );
const SfxPoolItem* pItem = pDoc->GetAttr( rPos.Col(), rPos.Row(), rPos.Tab(), nWhich);
const SvxLanguageItem* pLangIt = PTR_CAST( SvxLanguageItem, pItem );
LanguageType eLnge;
@@ -86,8 +86,8 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
{
LanguageType eLatin, eCjk, eCtl;
pDoc->GetLanguage( eLatin, eCjk, eCtl );
- eLnge = ( nScript == SCRIPTTYPE_ASIAN ) ? eCjk :
- ( ( nScript == SCRIPTTYPE_COMPLEX ) ? eCtl : eLatin );
+ eLnge = ( nScript == SvtScriptType::ASIAN ) ? eCjk :
+ ( ( nScript == SvtScriptType::COMPLEX ) ? eCtl : eLatin );
}
}
else
diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx
index faf30f3418e3..261dcbf60ac9 100644
--- a/sd/source/core/sdpage.cxx
+++ b/sd/source/core/sdpage.cxx
@@ -2028,11 +2028,11 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const Rectangle& rNewBorderR
/******************************************************
* normal text object: adjust text height
******************************************************/
- sal_uLong nScriptType = pObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
+ SvtScriptType nScriptType = pObj->GetOutlinerParaObject()->GetTextObject().GetScriptType();
sal_uInt16 nWhich = EE_CHAR_FONTHEIGHT;
- if ( nScriptType == SCRIPTTYPE_ASIAN )
+ if ( nScriptType == SvtScriptType::ASIAN )
nWhich = EE_CHAR_FONTHEIGHT_CJK;
- else if ( nScriptType == SCRIPTTYPE_COMPLEX )
+ else if ( nScriptType == SvtScriptType::COMPLEX )
nWhich = EE_CHAR_FONTHEIGHT_CTL;
// use more modern method to scale the text height
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index 4bce7232fc2a..192d4eb31384 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -249,7 +249,7 @@ void PortionObj::ImplGetPortionValues( FontCollection& rFontCollection, bool bGe
}
}
- sal_Int16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() );
+ sal_Int16 nScriptType = SvtLanguageOptions::FromSvtScriptTypeToI18N( SvtLanguageOptions::GetScriptTypeOfLanguage( Application::GetSettings().GetLanguageTag().getLanguageType() ) );
if ( mpText && mnTextSize && xPPTBreakIter.is() )
{
OUString sT( mpText, mnTextSize );
diff --git a/sd/source/ui/docshell/docshel3.cxx b/sd/source/ui/docshell/docshel3.cxx
index 87783e8a7f2f..0b5c2c66a156 100644
--- a/sd/source/ui/docshell/docshel3.cxx
+++ b/sd/source/ui/docshell/docshel3.cxx
@@ -86,12 +86,12 @@ static void lcl_setLanguageForObj( SdrObject *pObj, LanguageType nLang, bool bLa
else
{
sal_uInt16 nLangWhichId = 0;
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang );
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage( nLang );
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("unexpected case" );
return;
diff --git a/sd/source/ui/inc/OutlineView.hxx b/sd/source/ui/inc/OutlineView.hxx
index 8d0cfbd1ba2f..e5002ec52fe2 100644
--- a/sd/source/ui/inc/OutlineView.hxx
+++ b/sd/source/ui/inc/OutlineView.hxx
@@ -136,7 +136,7 @@ public:
sal_uInt16 nLayer = SDRPAGE_NOTFOUND) SAL_OVERRIDE;
// Re-implement GetScriptType for this view to get correct results
- virtual sal_uInt16 GetScriptType() const SAL_OVERRIDE;
+ virtual SvtScriptType GetScriptType() const SAL_OVERRIDE;
/** After this method has been called with <TRUE/> following changes of
the current page are ignored in that the corresponding text is not
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 6a6297d32754..25913dd91ad6 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -179,7 +179,7 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
SvxScriptSetItem aSetItem( nSlotId, GetPool() );
aSetItem.GetItemSet().Put( aAttrSet, false );
- sal_uInt16 nScriptType = mpView->GetScriptType();
+ SvtScriptType nScriptType = mpView->GetScriptType();
if( (nSlotId == SID_ATTR_CHAR_FONT) || (nSlotId == SID_ATTR_CHAR_FONTHEIGHT) )
{
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 7b5460d1c4fc..f65ac7f747de 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -618,7 +618,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
nSlot == SID_ATTR_CHAR_WEIGHT )
{
// #i78017 establish the same behaviour as in Writer
- sal_uInt16 nScriptType = SCRIPTTYPE_LATIN | SCRIPTTYPE_ASIAN | SCRIPTTYPE_COMPLEX;
+ SvtScriptType nScriptType = SvtScriptType::LATIN | SvtScriptType::ASIAN | SvtScriptType::COMPLEX;
if (nSlot == SID_ATTR_CHAR_FONT)
nScriptType = mpView->GetScriptType();
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 669106eb9e56..03223da468ce 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -1404,9 +1404,9 @@ sal_Int8 OutlineView::ExecuteDrop( const ExecuteDropEvent&, DropTargetHelper&, :
}
// Re-implement GetScriptType for this view to get correct results
-sal_uInt16 OutlineView::GetScriptType() const
+SvtScriptType OutlineView::GetScriptType() const
{
- sal_uInt16 nScriptType = ::sd::View::GetScriptType();
+ SvtScriptType nScriptType = ::sd::View::GetScriptType();
OutlinerParaObject* pTempOPObj = mrOutliner.CreateParaObject();
if(pTempOPObj)
diff --git a/starmath/source/format.cxx b/starmath/source/format.cxx
index 1bc95d0d4445..76007fc2b08c 100644
--- a/starmath/source/format.cxx
+++ b/starmath/source/format.cxx
@@ -79,9 +79,9 @@ OUString GetDefaultFontName( LanguageType nLang, sal_uInt16 nIdent )
const sal_uInt16 *pTable;
switch ( SvtLanguageOptions::GetScriptTypeOfLanguage( nLang ) )
{
- case SCRIPTTYPE_LATIN : pTable = aLatinDefFnts; break;
- case SCRIPTTYPE_ASIAN : pTable = aCJKDefFnts; break;
- case SCRIPTTYPE_COMPLEX : pTable = aCTLDefFnts; break;
+ case SvtScriptType::LATIN : pTable = aLatinDefFnts; break;
+ case SvtScriptType::ASIAN : pTable = aCJKDefFnts; break;
+ case SvtScriptType::COMPLEX : pTable = aCTLDefFnts; break;
default :
pTable = aLatinDefFnts;
SAL_WARN("starmath", "unknown script-type");
diff --git a/svl/source/config/cjkoptions.cxx b/svl/source/config/cjkoptions.cxx
index c396251dbbdc..3f61dcaaa2b9 100644
--- a/svl/source/config/cjkoptions.cxx
+++ b/svl/source/config/cjkoptions.cxx
@@ -198,9 +198,9 @@ void SvtCJKOptions_Impl::Load()
if (!bCJKFont)
{
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
//system locale is CJK
- bool bAutoEnableCJK = (nScriptType & SCRIPTTYPE_ASIAN);
+ bool bAutoEnableCJK = bool(nScriptType & SvtScriptType::ASIAN);
if (!bAutoEnableCJK)
{
@@ -210,8 +210,8 @@ void SvtCJKOptions_Impl::Load()
LanguageType eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage();
if (eSystemLanguage != LANGUAGE_SYSTEM)
{
- sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
- bAutoEnableCJK = (nWinScript & SCRIPTTYPE_ASIAN);
+ SvtScriptType nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
+ bAutoEnableCJK = bool(nWinScript & SvtScriptType::ASIAN);
}
//CJK keyboard is installed
diff --git a/svl/source/config/ctloptions.cxx b/svl/source/config/ctloptions.cxx
index 1aaab84ef676..170052c1b867 100644
--- a/svl/source/config/ctloptions.cxx
+++ b/svl/source/config/ctloptions.cxx
@@ -283,9 +283,9 @@ void SvtCTLOptions_Impl::Load()
if (!m_bCTLFontEnabled)
{
- sal_uInt16 nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
+ SvtScriptType nScriptType = SvtLanguageOptions::GetScriptTypeOfLanguage(LANGUAGE_SYSTEM);
//system locale is CTL
- bool bAutoEnableCTL = (nScriptType & SCRIPTTYPE_COMPLEX);
+ bool bAutoEnableCTL = bool(nScriptType & SvtScriptType::COMPLEX);
LanguageType eSystemLanguage = LANGUAGE_SYSTEM;
@@ -297,8 +297,8 @@ void SvtCTLOptions_Impl::Load()
eSystemLanguage = aSystemLocaleSettings.GetWin16SystemLanguage();
if (eSystemLanguage != LANGUAGE_SYSTEM)
{
- sal_uInt16 nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
- bAutoEnableCTL = (nWinScript & SCRIPTTYPE_COMPLEX);
+ SvtScriptType nWinScript = SvtLanguageOptions::GetScriptTypeOfLanguage( eSystemLanguage );
+ bAutoEnableCTL = bool(nWinScript & SvtScriptType::COMPLEX);
}
//CTL keyboard is installed
diff --git a/svl/source/config/languageoptions.cxx b/svl/source/config/languageoptions.cxx
index 390875ffd798..2022cbe551e0 100644
--- a/svl/source/config/languageoptions.cxx
+++ b/svl/source/config/languageoptions.cxx
@@ -133,7 +133,7 @@ bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) const
}
// returns for a language the scripttype
-sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang )
+SvtScriptType SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang )
{
if( LANGUAGE_DONTKNOW == nLang )
nLang = LANGUAGE_ENGLISH_US;
@@ -141,21 +141,52 @@ sal_uInt16 SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang )
nLang = SvtSysLocale().GetLanguageTag().getLanguageType();
sal_Int16 nScriptType = MsLangId::getScriptType( nLang );
- sal_uInt16 nScript;
+ SvtScriptType nScript;
switch (nScriptType)
{
case ::com::sun::star::i18n::ScriptType::ASIAN:
- nScript = SCRIPTTYPE_ASIAN;
+ nScript = SvtScriptType::ASIAN;
break;
case ::com::sun::star::i18n::ScriptType::COMPLEX:
- nScript = SCRIPTTYPE_COMPLEX;
+ nScript = SvtScriptType::COMPLEX;
break;
default:
- nScript = SCRIPTTYPE_LATIN;
+ nScript = SvtScriptType::LATIN;
}
return nScript;
}
+SvtScriptType SvtLanguageOptions::FromI18NToSvtScriptType( sal_Int16 nI18NType )
+{
+ switch ( nI18NType )
+ {
+ case i18n::ScriptType::LATIN: return SvtScriptType::LATIN;
+ case i18n::ScriptType::ASIAN: return SvtScriptType::ASIAN;
+ case i18n::ScriptType::COMPLEX: return SvtScriptType::COMPLEX;
+ case i18n::ScriptType::WEAK: return SvtScriptType::NONE; // no mapping
+ default: assert(false && nI18NType && "Unknown i18n::ScriptType"); break;
+ }
+ return SvtScriptType::NONE;
+}
+
+sal_Int16 SvtLanguageOptions::FromSvtScriptTypeToI18N( SvtScriptType nItemType )
+{
+ switch ( nItemType )
+ {
+ case SvtScriptType::NONE: return 0;
+ case SvtScriptType::LATIN: return i18n::ScriptType::LATIN;
+ case SvtScriptType::ASIAN: return i18n::ScriptType::ASIAN;
+ case SvtScriptType::COMPLEX: return i18n::ScriptType::COMPLEX;
+ case SvtScriptType::UNKNOWN: return 0; // no mapping
+ default: assert(false && static_cast<int>(nItemType) && "unknown SvtScriptType"); break;
+ }
+ return 0;
+}
+
+sal_Int16 SvtLanguageOptions::GetI18NScriptTypeOfLanguage( sal_uInt16 nLang )
+{
+ return FromSvtScriptTypeToI18N( GetScriptTypeOfLanguage( nLang ) );
+}
SvtSystemLanguageOptions::SvtSystemLanguageOptions() :
utl::ConfigItem( "System/L10N")
diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx
index 7606ee3a6dd8..40ce13a0c0ad 100644
--- a/svx/source/dialog/langbox.cxx
+++ b/svx/source/dialog/langbox.cxx
@@ -269,13 +269,13 @@ void SvxLanguageBoxBase::SetLanguageList( sal_Int16 nLangList,
((nLangList & LANG_LIST_ALL) != 0 ||
((nLangList & LANG_LIST_WESTERN) != 0 &&
(SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
- SCRIPTTYPE_LATIN)) ||
+ SvtScriptType::LATIN)) ||
((nLangList & LANG_LIST_CTL) != 0 &&
(SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
- SCRIPTTYPE_COMPLEX)) ||
+ SvtScriptType::COMPLEX)) ||
((nLangList & LANG_LIST_CJK) != 0 &&
(SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) ==
- SCRIPTTYPE_ASIAN)) ||
+ SvtScriptType::ASIAN)) ||
((nLangList & LANG_LIST_FBD_CHARS) != 0 &&
MsLangId::hasForbiddenCharacters(nLangType)) ||
((nLangList & LANG_LIST_SPELL_AVAIL) != 0 &&
diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index 367cd8fbedea..3a7c78965d2b 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1403,9 +1403,9 @@ void SdrObjEditView::ImpMakeTextCursorAreaVisible()
}
}
-sal_uInt16 SdrObjEditView::GetScriptType() const
+SvtScriptType SdrObjEditView::GetScriptType() const
{
- sal_uInt16 nScriptType = 0;
+ SvtScriptType nScriptType = SvtScriptType::NONE;
if( IsTextEdit() )
{
@@ -1430,8 +1430,8 @@ sal_uInt16 SdrObjEditView::GetScriptType() const
}
}
- if( nScriptType == 0 )
- nScriptType = SCRIPTTYPE_LATIN;
+ if( nScriptType == SvtScriptType::NONE )
+ nScriptType = SvtScriptType::LATIN;
return nScriptType;
}
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;