cui/source/options/optgdlg.cxx | 10 - desktop/source/app/langselect.cxx | 4 editeng/source/editeng/editdoc.cxx | 18 +- editeng/source/editeng/editdoc.hxx | 5 editeng/source/editeng/editeng.cxx | 6 editeng/source/editeng/editobj.cxx | 12 - editeng/source/editeng/editobj2.hxx | 13 - editeng/source/editeng/editview.cxx | 10 - editeng/source/editeng/impedit.hxx | 7 editeng/source/editeng/impedit2.cxx | 12 - editeng/source/editeng/impedit3.cxx | 9 - editeng/source/editeng/impedit4.cxx | 22 +- editeng/source/items/textitem.cxx | 80 ++-------- editeng/source/outliner/outlin2.cxx | 2 editeng/source/outliner/outlvw.cxx | 10 - forms/source/richtext/richtextimplcontrol.cxx | 8 - forms/source/richtext/richtextimplcontrol.hxx | 4 forms/source/richtext/rtattributehandler.cxx | 19 +- forms/source/richtext/rtattributehandler.hxx | 21 +- forms/source/richtext/rtattributes.hxx | 2 framework/inc/helper/mischelper.hxx | 11 - framework/inc/uielement/langselectionmenucontroller.hxx | 8 - framework/source/fwi/helper/mischelper.cxx | 4 framework/source/uielement/langselectionmenucontroller.cxx | 6 framework/source/uielement/langselectionstatusbarcontroller.cxx | 14 - include/editeng/editeng.hxx | 7 include/editeng/editobj.hxx | 3 include/editeng/editview.hxx | 3 include/editeng/outliner.hxx | 7 include/editeng/scripttypeitem.hxx | 12 - include/svl/languageoptions.hxx | 48 ++++-- include/svx/svdedxv.hxx | 5 oox/source/export/drawingml.cxx | 4 sc/inc/celltextattr.hxx | 5 sc/inc/column.hxx | 8 - sc/inc/document.hxx | 15 + sc/inc/documentimport.hxx | 3 sc/inc/global.hxx | 7 sc/inc/globalnames.hxx | 4 sc/inc/patattr.hxx | 7 sc/inc/table.hxx | 6 sc/qa/unit/ucalc_column.cxx | 8 - sc/source/core/data/celltextattr.cxx | 2 sc/source/core/data/column.cxx | 14 - sc/source/core/data/column2.cxx | 42 ++--- sc/source/core/data/column3.cxx | 2 sc/source/core/data/column4.cxx | 2 sc/source/core/data/documen6.cxx | 39 ++-- sc/source/core/data/documen8.cxx | 6 sc/source/core/data/document.cxx | 6 sc/source/core/data/documentimport.cxx | 14 - sc/source/core/data/global.cxx | 24 +-- sc/source/core/data/patattr.cxx | 12 - sc/source/core/data/table1.cxx | 10 - sc/source/core/data/table5.cxx | 4 sc/source/core/tool/numformat.cxx | 4 sc/source/filter/excel/xestyle.cxx | 28 --- sc/source/filter/excel/xlroot.cxx | 6 sc/source/filter/html/htmlexp.cxx | 4 sc/source/filter/inc/htmlexp.hxx | 4 sc/source/filter/rtf/eeimpars.cxx | 6 sc/source/filter/xml/xmlimprt.cxx | 2 sc/source/ui/app/inputwin.cxx | 14 - sc/source/ui/drawfunc/drtxtob.cxx | 6 sc/source/ui/inc/gridwin.hxx | 2 sc/source/ui/inc/viewfunc.hxx | 2 sc/source/ui/inc/viewutil.hxx | 4 sc/source/ui/view/editsh.cxx | 24 +-- sc/source/ui/view/formatsh.cxx | 20 +- sc/source/ui/view/gridwin.cxx | 2 sc/source/ui/view/gridwin4.cxx | 6 sc/source/ui/view/output2.cxx | 22 +- sc/source/ui/view/viewfun2.cxx | 4 sc/source/ui/view/viewfunc.cxx | 6 sc/source/ui/view/viewutil.cxx | 12 - sd/source/core/sdpage.cxx | 6 sd/source/filter/eppt/pptx-text.cxx | 2 sd/source/ui/docshell/docshel3.cxx | 8 - sd/source/ui/inc/OutlineView.hxx | 2 sd/source/ui/view/drtxtob.cxx | 2 sd/source/ui/view/drtxtob1.cxx | 2 sd/source/ui/view/outlview.cxx | 4 starmath/source/format.cxx | 6 svl/source/config/cjkoptions.cxx | 8 - svl/source/config/ctloptions.cxx | 8 - svl/source/config/languageoptions.cxx | 41 ++++- svx/source/dialog/langbox.cxx | 6 svx/source/svdraw/svdedxv.cxx | 8 - sw/inc/breakit.hxx | 4 sw/inc/editsh.hxx | 4 sw/qa/extras/uiwriter/uiwriter.cxx | 2 sw/source/core/attr/hints.cxx | 2 sw/source/core/bastyp/breakit.cxx | 21 +- sw/source/core/bastyp/calc.cxx | 2 sw/source/core/doc/extinput.cxx | 2 sw/source/core/edit/edattr.cxx | 32 ++-- sw/source/core/edit/edlingu.cxx | 21 +- sw/source/core/inc/scriptinfo.hxx | 2 sw/source/core/text/EnhancedPDFExportHelper.cxx | 2 sw/source/core/text/porlay.cxx | 8 - sw/source/core/txtnode/txtedt.cxx | 2 sw/source/filter/ascii/parasc.cxx | 16 +- sw/source/filter/html/htmlgrin.cxx | 7 sw/source/filter/html/wrthtml.cxx | 6 sw/source/ui/dbui/mmoutputpage.cxx | 2 sw/source/ui/dialog/ascfldlg.cxx | 14 - sw/source/ui/index/swuiidxmrk.cxx | 4 sw/source/uibase/docvw/AnnotationWin.cxx | 8 - sw/source/uibase/docvw/PostItMgr.cxx | 9 - sw/source/uibase/docvw/edtwin.cxx | 2 sw/source/uibase/inc/langhelper.hxx | 3 sw/source/uibase/lingu/olmenu.cxx | 12 - sw/source/uibase/shells/annotsh.cxx | 16 +- sw/source/uibase/shells/basesh.cxx | 11 - sw/source/uibase/shells/drwtxtex.cxx | 8 - sw/source/uibase/shells/drwtxtsh.cxx | 10 - sw/source/uibase/shells/langhelper.cxx | 24 +-- sw/source/uibase/shells/textsh.cxx | 12 - sw/source/uibase/shells/textsh1.cxx | 2 sw/source/uibase/shells/txtattr.cxx | 2 120 files changed, 603 insertions(+), 596 deletions(-)
New commits: commit a7b7c64afc523cfd9ff4e724b3efbec6567fc1c8 Author: Noel Grandin <[email protected]> Date: Wed Apr 15 09:36:39 2015 +0200 convert SCRIPTTYPE_ constants to scoped enum Change-Id: I5be3980ac865162d8d7626556ca47eca4b0ee433 Reviewed-on: https://gerrit.libreoffice.org/15344 Reviewed-by: Noel Grandin <[email protected]> Tested-by: Noel Grandin <[email protected]> diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 75869bc..107f3f1 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 a3f9479..d57a68f 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 faa6825..a1651ab 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 5d12097..61e8a34 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 eec5cb9..70a012b 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 03b7f04..2f4c3d4 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 57725bc..fe1fcf3 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 d407e4e..4d96e64 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 92e7f27..45dc28a 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 7d4f1c8..b0593cd 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 5157b8b..eb9f2eb 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 37d0b20..6067a90 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 5209e55..7b3f647 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 9f3defc..13b1744 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 09d1341..a410595 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 1d1efb2..a29f626 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 5c6c448..0b6c42c 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 c9b90c0..6698de7 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 28a17cc..15a9b12 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 85f2c74..f8d4f7a 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 406de7a..6868237 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 38246ec..8a0f46b 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 ed1bc75..a3f0930 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 0780d05..9e0fbb1 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 41b2c55..e348cb8 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 d3ed4b6..d385368 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 09c7574..a11d052 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 3e2fb1a..aec7f03 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 cc00d31..960caa8 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 6e098b0..f9ab910 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 8c0ea1a..693a124 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 fb30ff7..7d848ed 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 b4e8fd3..7ba4f1f 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 9e4675d..d10274c 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 8d0db57..d7bc4be 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 b88ffec..bf9f078 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 e561fcd..aa69458 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 f8555b4..b95faf5 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 dd800aa..fb4c2da 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 cbc37d1..efb2a67 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 e6857f2..d50bd5b 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 394738d..6b9ca51 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 5542813..5d79244 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 3fcac83..8b6ede9 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 ef6c073..9301078 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 4c0bf2a..890a1db 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 d8c10ab..46b59c0 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 772b8b8..8b6009d 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 dc023bb..3c82d65 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 170d202..9293b87 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 4191642..18346fa 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 d71154d..b7145d5 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 878f8af..0dfc369 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( ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
