diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-13 08:17:10 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-13 08:17:42 +0200 |
commit | b8d977c0178f8ac4ee299722d50c1481a15b45c8 (patch) | |
tree | 6cd8560661bb8b713e4373379052e85ab30598dd | |
parent | 80d2fa87fdaf67615d7b8128f3c05b239a1f1c05 (diff) |
convert CharCompressType to scoped enum
and move it to svl, where it belongs
Change-Id: Ic4d846419dfe2dd85de5ade8ed1a041867bbf1dc
31 files changed, 100 insertions, 105 deletions
diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index 71e50780a5ff..5509f0c526f1 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -187,13 +187,14 @@ bool SvxAsianLayoutPage::FillItemSet( SfxItemSet* ) if(m_pNoCompressionRB->IsValueChangedFromSaved() || m_pPunctCompressionRB->IsValueChangedFromSaved()) { - sal_Int16 nSet = m_pNoCompressionRB->IsChecked() ? 0 : - m_pPunctCompressionRB->IsChecked() ? 1 : 2; + CharCompressType nSet = m_pNoCompressionRB->IsChecked() ? CharCompressType::NONE : + m_pPunctCompressionRB->IsChecked() ? CharCompressType::PunctuationOnly : + CharCompressType::PunctuationAndKana; pImpl->aConfig.SetCharDistanceCompression(nSet); OUString sCompress(cCharacterCompressionType); if(pImpl->xPrSetInfo.is() && pImpl->xPrSetInfo->hasPropertyByName(sCompress)) { - pImpl->xPrSet->setPropertyValue(sCompress, Any(nSet)); + pImpl->xPrSet->setPropertyValue(sCompress, Any((sal_uInt16)nSet)); } } pImpl->aConfig.Commit(); @@ -238,7 +239,7 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* ) pImpl->xPrSetInfo = pImpl->xPrSet->getPropertySetInfo(); OUString sForbidden("ForbiddenCharacters"); bool bKernWesternText = pImpl->aConfig.IsKerningWesternTextOnly(); - sal_Int16 nCompress = pImpl->aConfig.GetCharDistanceCompression(); + CharCompressType nCompress = pImpl->aConfig.GetCharDistanceCompression(); if(pImpl->xPrSetInfo.is()) { if(pImpl->xPrSetInfo->hasPropertyByName(sForbidden)) @@ -250,7 +251,9 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* ) if(pImpl->xPrSetInfo->hasPropertyByName(sCompress)) { Any aVal = pImpl->xPrSet->getPropertyValue(sCompress); - aVal >>= nCompress; + sal_uInt16 nTmp; + if (aVal >>= nTmp) + nCompress = (CharCompressType)nTmp; } OUString sPunct(cIsKernAsianPunctuation); if(pImpl->xPrSetInfo->hasPropertyByName(sPunct)) @@ -276,8 +279,8 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* ) m_pCharPunctKerningRB->Check(); switch(nCompress) { - case 0 : m_pNoCompressionRB->Check(); break; - case 1 : m_pPunctCompressionRB->Check(); break; + case CharCompressType::NONE : m_pNoCompressionRB->Check(); break; + case CharCompressType::PunctuationOnly : m_pPunctCompressionRB->Check(); break; default: m_pPunctKanaCompressionRB->Check(); } m_pCharKerningRB->SaveValue(); diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 6619f6e06e5c..d3bf03f7dd92 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -482,7 +482,7 @@ EditSelection EditEngine::TransliterateText(const EditSelection& rSelection, sal return pImpEditEngine->TransliterateText(rSelection, nTransliterationMode); } -void EditEngine::SetAsianCompressionMode( sal_uInt16 n ) +void EditEngine::SetAsianCompressionMode( CharCompressType n ) { pImpEditEngine->SetAsianCompressionMode( n ); } diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index ffcda876992d..bc42f55d45af 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -444,7 +444,7 @@ private: sal_uInt16 nStretchX; sal_uInt16 nStretchY; - sal_uInt16 nAsianCompressionMode; + CharCompressType nAsianCompressionMode; EEHorizontalTextDirection eDefaultHorizontalTextDirection; @@ -998,8 +998,8 @@ public: EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); short ReplaceTextOnly( ContentNode* pNode, sal_Int32 nCurrentStart, sal_Int32 nLen, const OUString& rText, const css::uno::Sequence< sal_Int32 >& rOffsets ); - void SetAsianCompressionMode( sal_uInt16 n ); - sal_uInt16 GetAsianCompressionMode() const { return nAsianCompressionMode; } + void SetAsianCompressionMode( CharCompressType n ); + CharCompressType GetAsianCompressionMode() const { return nAsianCompressionMode; } void SetKernAsianPunctuation( bool b ); bool IsKernAsianPunctuation() const { return bKernAsianPunctuation; } diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 0a6a0bdebf71..20e2f9ba8432 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -61,6 +61,7 @@ #include <sot/exchange.hxx> #include <sot/formats.hxx> +#include <svl/asiancfg.hxx> #include <o3tl/make_unique.hxx> #include <comphelper/lok.hxx> @@ -131,7 +132,7 @@ ImpEditEngine::ImpEditEngine( EditEngine* pEE, SfxItemPool* pItemPool ) : eDefLanguage = LANGUAGE_DONTKNOW; maBackgroundColor = COL_AUTO; - nAsianCompressionMode = text::CharacterCompressionType::NONE; + nAsianCompressionMode = CharCompressType::NONE; eDefaultHorizontalTextDirection = EE_HTEXTDIR_DEFAULT; diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index c6f4e4d3e1fd..9247b1a7651f 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -52,6 +52,7 @@ #include <svtools/colorcfg.hxx> #include <svl/ctloptions.hxx> +#include <svl/asiancfg.hxx> #include <editeng/forbiddencharacterstable.hxx> @@ -1140,7 +1141,7 @@ bool ImpEditEngine::CreateLines( sal_Int32 nPara, sal_uInt32 nStartPosY ) } // And now check for Compression: - if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() ) + if ( !bContinueLastPortion && nPortionLen && GetAsianCompressionMode() != CharCompressType::NONE ) { EditLine::CharPosArrayType& rArray = pLine->GetCharPosArray(); long* pDXArray = rArray.data() + nTmpPos - pLine->GetStart(); @@ -4315,7 +4316,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, long* pDXArray, sal_uInt16 n100thPercentFromMax, bool bManipulateDXArray) { - DBG_ASSERT( GetAsianCompressionMode(), "ImplCalcAsianCompression - Why?" ); + DBG_ASSERT( GetAsianCompressionMode() != CharCompressType::NONE, "ImplCalcAsianCompression - Why?" ); DBG_ASSERT( pTextPortion->GetLen(), "ImplCalcAsianCompression - Empty Portion?" ); // Percent is 1/100 Percent... @@ -4333,7 +4334,7 @@ bool ImpEditEngine::ImplCalcAsianCompression(ContentNode* pNode, AsianCompressionFlags nType = GetCharTypeForCompression( pNode->GetChar( n+nStartPos ) ); bool bCompressPunctuation = ( nType == AsianCompressionFlags::PunctuationLeft ) || ( nType == AsianCompressionFlags::PunctuationRight ); - bool bCompressKana = ( nType == AsianCompressionFlags::Kana ) && ( GetAsianCompressionMode() == text::CharacterCompressionType::PUNCTUATION_AND_KANA ); + bool bCompressKana = ( nType == AsianCompressionFlags::Kana ) && ( GetAsianCompressionMode() == CharCompressType::PunctuationAndKana ); // create Extra infos only if needed... if ( bCompressPunctuation || bCompressKana ) diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index dde54ad48dc4..55e175cf0474 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -3064,7 +3064,7 @@ short ImpEditEngine::ReplaceTextOnly( } -void ImpEditEngine::SetAsianCompressionMode( sal_uInt16 n ) +void ImpEditEngine::SetAsianCompressionMode( CharCompressType n ) { if ( n != nAsianCompressionMode ) { diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index 3248ba34f51e..2f6d8a3d608d 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -283,7 +283,7 @@ EEControlBits Outliner::GetControlWord() const return pEditEngine->GetControlWord(); } -void Outliner::SetAsianCompressionMode( sal_uInt16 n ) +void Outliner::SetAsianCompressionMode( CharCompressType n ) { pEditEngine->SetAsianCompressionMode( n ); } diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 38dbad12c65c..4742a607b349 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -109,6 +109,7 @@ class Range; struct EPaM; class DeletedNodeInfo; class ParaPortionList; +enum class CharCompressType; /** values for: @@ -256,7 +257,7 @@ public: void TransliterateText( const ESelection& rSelection, sal_Int32 nTransliterationMode ); EditSelection TransliterateText( const EditSelection& rSelection, sal_Int32 nTransliterationMode ); - void SetAsianCompressionMode( sal_uInt16 nCompression ); + void SetAsianCompressionMode( CharCompressType nCompression ); void SetKernAsianPunctuation( bool bEnabled ); diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index ef1540e17a0d..2c1f7810e85e 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -83,6 +83,7 @@ class SvxForbiddenCharactersTable; class OverflowingText; class NonOverflowingText; class OutlinerViewShell; +enum class CharCompressType; namespace svl { @@ -694,7 +695,7 @@ public: LanguageType GetLanguage( sal_Int32 nPara, sal_Int32 nPos ) const; - void SetAsianCompressionMode( sal_uInt16 nCompressionMode ); + void SetAsianCompressionMode( CharCompressType nCompressionMode ); void SetKernAsianPunctuation( bool bEnabled ); diff --git a/include/svl/asiancfg.hxx b/include/svl/asiancfg.hxx index 71662c4a57f7..cef636155519 100644 --- a/include/svl/asiancfg.hxx +++ b/include/svl/asiancfg.hxx @@ -31,6 +31,16 @@ namespace com { namespace sun { namespace star { namespace lang { struct Locale; } } } } +/// These constants define character compression in Asian text. +/// Must match the values in com::sun::star::text::CharacterCompressionType. +/// For bonus points, also appears to be directly stored in the ww8 file format. +enum class CharCompressType { + NONE, /// No Compression + PunctuationOnly, /// Only punctuation is compressed + PunctuationAndKana, /// Punctuation and Japanese Kana are compressed. + Invalid = 0xff /// only used in SC +}; + class SVL_DLLPUBLIC SvxAsianConfig { public: SvxAsianConfig(); @@ -44,9 +54,9 @@ public: void SetKerningWesternTextOnly(bool value); - sal_Int16 GetCharDistanceCompression() const; + CharCompressType GetCharDistanceCompression() const; - void SetCharDistanceCompression(sal_Int16 value); + void SetCharDistanceCompression(CharCompressType value); css::uno::Sequence< css::lang::Locale > GetStartEndCharLocales() const; diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx index 4cad2a4cf17b..d2b4ef8a2f87 100644 --- a/include/svx/svdmodel.hxx +++ b/include/svx/svdmodel.hxx @@ -78,6 +78,7 @@ class SdrOutlinerCache; class SdrUndoFactory; class ImageMap; class TextChain; +enum class CharCompressType; namespace comphelper { class IEmbeddedHelper; @@ -203,7 +204,7 @@ public: //get a vector of all the SdrOutliner belonging to the model std::vector<SdrOutliner*> GetActiveOutliners() const; std::unique_ptr<SdrModelImpl> mpImpl; - sal_uInt16 mnCharCompressType; + CharCompressType mnCharCompressType; sal_uInt16 mnHandoutPageCount; bool mbModelLocked; bool mbKernAsianPunctuation; @@ -532,8 +533,8 @@ public: void SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars ); const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;} - void SetCharCompressType( sal_uInt16 nType ); - sal_uInt16 GetCharCompressType() const { return mnCharCompressType; } + void SetCharCompressType( CharCompressType nType ); + CharCompressType GetCharCompressType() const { return mnCharCompressType; } void SetKernAsianPunctuation( bool bEnabled ); bool IsKernAsianPunctuation() const { return mbKernAsianPunctuation; } diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index da2a982d2822..e93e88249e7a 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -50,6 +50,7 @@ enum class SvtScriptType; enum class ScMF; enum class FormulaError : sal_uInt16; +enum class CharCompressType; namespace editeng { class SvxBorderLine; } namespace formula { struct VectorRefArray; } namespace svl { @@ -228,7 +229,6 @@ namespace com { namespace sun { namespace star { #define SC_MACROCALL_ALLOWED 0 -#define SC_ASIANCOMPRESSION_INVALID 0xff #define SC_ASIANKERNING_INVALID 0xff enum ScDocumentMode @@ -452,12 +452,12 @@ private: bool bHasMacroFunc; // valid only after loading - sal_uInt8 nAsianCompression; - sal_uInt8 nAsianKerning; + CharCompressType nAsianCompression; + sal_uInt8 nAsianKerning; bool bPastingDrawFromOtherDoc; - sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool) + sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool) bool bInUnoBroadcast; bool bInUnoListenerCall; @@ -1964,16 +1964,16 @@ public: const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharacters(); void SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharactersTable>& rNew); - sal_uInt8 GetAsianCompression() const; // CharacterCompressionType values + CharCompressType GetAsianCompression() const; bool IsValidAsianCompression() const; - void SetAsianCompression(sal_uInt8 nNew); + void SetAsianCompression(CharCompressType nNew); bool GetAsianKerning() const; bool IsValidAsianKerning() const; void SetAsianKerning(bool bNew); void ApplyAsianEditSettings(ScEditEngineDefaulter& rEngine); - sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values + sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;} void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;} diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 884ae3f2793d..cc7a9c3d8532 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -14,6 +14,7 @@ #include <rtl/strbuf.hxx> #include <osl/file.hxx> #include <osl/time.h> +#include <svl/asiancfg.hxx> #include "scdll.hxx" #include "formulacell.hxx" @@ -6364,7 +6365,7 @@ void Test::testEmptyCalcDocDefaults() CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetCellCount() ); CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetFormulaGroupCount() ); CPPUNIT_ASSERT_EQUAL( (sal_uLong) 0, m_pDoc->GetCodeCount() ); - CPPUNIT_ASSERT_EQUAL( (sal_uInt8) 0, m_pDoc->GetAsianCompression() ); + CPPUNIT_ASSERT_EQUAL( (int)CharCompressType::NONE, (int)m_pDoc->GetAsianCompression() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasPrintRange() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInVBAMode() ); diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx index 92d2c4abed54..9554306f2b16 100644 --- a/sc/source/core/data/documen2.cxx +++ b/sc/source/core/data/documen2.cxx @@ -31,6 +31,7 @@ #include <sfx2/objsh.hxx> #include <sfx2/docfile.hxx> #include <sfx2/printer.hxx> +#include <svl/asiancfg.hxx> #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <vcl/virdev.hxx> @@ -201,7 +202,7 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) : bExpandRefs( false ), bDetectiveDirty( false ), bHasMacroFunc( false ), - nAsianCompression(SC_ASIANCOMPRESSION_INVALID), + nAsianCompression(CharCompressType::Invalid), nAsianKerning(SC_ASIANKERNING_INVALID), bPastingDrawFromOtherDoc( false ), nInDdeLinkUpdate( 0 ), diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index 96fd241c3610..339c75b24a3d 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -26,6 +26,7 @@ #include <editeng/forbiddencharacterstable.hxx> #include <editeng/langitem.hxx> #include <osl/thread.h> +#include <svl/asiancfg.hxx> #include <svx/svdetc.hxx> #include <svx/svditer.hxx> #include <svx/svdocapt.hxx> @@ -641,18 +642,18 @@ void ScDocument::SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharact bool ScDocument::IsValidAsianCompression() const { - return ( nAsianCompression != SC_ASIANCOMPRESSION_INVALID ); + return nAsianCompression != CharCompressType::Invalid; } -sal_uInt8 ScDocument::GetAsianCompression() const +CharCompressType ScDocument::GetAsianCompression() const { - if ( nAsianCompression == SC_ASIANCOMPRESSION_INVALID ) - return 0; + if ( nAsianCompression == CharCompressType::Invalid ) + return CharCompressType::NONE; else return nAsianCompression; } -void ScDocument::SetAsianCompression(sal_uInt8 nNew) +void ScDocument::SetAsianCompression(CharCompressType nNew) { nAsianCompression = nNew; if ( pEditEngine ) diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index f9b006c184c6..4aaa39a29403 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -144,7 +144,7 @@ void ScDocShell::InitItems() if ( !aDocument.IsValidAsianCompression() ) { // set compression mode from configuration if not already set (e.g. XML import) - aDocument.SetAsianCompression( sal::static_int_cast<sal_uInt8>( aAsian.GetCharDistanceCompression() ) ); + aDocument.SetAsianCompression( aAsian.GetCharDistanceCompression() ); } if ( !aDocument.IsValidAsianKerning() ) diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 796494ecd2dc..2918c8601d83 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -256,7 +256,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( { // Int16 contains CharacterCompressionType values sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue ); - rDoc.SetAsianCompression( (sal_uInt8) nUno ); + rDoc.SetAsianCompression( (CharCompressType) nUno ); bUpdateHeights = true; } else if ( aPropertyName == SC_UNO_ASIANKERN ) diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 33261327487a..aacfa2b133c8 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -812,19 +812,19 @@ DocumentSettings::_setPropertyValues(const PropertyMapEntry** ppEntries, { bOk = true; - pDoc->SetCharCompressType( (sal_uInt16)nCharCompressType ); + pDoc->SetCharCompressType( (CharCompressType)nCharCompressType ); SdDrawDocument* pDocument = pDocSh->GetDoc(); SdrOutliner& rOutl = pDocument->GetDrawOutliner(); - rOutl.SetAsianCompressionMode( (sal_uInt16)nCharCompressType ); + rOutl.SetAsianCompressionMode( (CharCompressType)nCharCompressType ); SdOutliner* pOutl = pDocument->GetOutliner( false ); if( pOutl ) { - pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType ); + pOutl->SetAsianCompressionMode( (CharCompressType)nCharCompressType ); } pOutl = pDocument->GetInternalOutliner( false ); if( pOutl ) { - pOutl->SetAsianCompressionMode( (sal_uInt16)nCharCompressType ); + pOutl->SetAsianCompressionMode( (CharCompressType)nCharCompressType ); } } break; diff --git a/svl/source/config/asiancfg.cxx b/svl/source/config/asiancfg.cxx index 209771a15720..3e77bc6ff14d 100644 --- a/svl/source/config/asiancfg.cxx +++ b/svl/source/config/asiancfg.cxx @@ -87,15 +87,15 @@ void SvxAsianConfig::SetKerningWesternTextOnly(bool value) { value, impl_->batch); } -sal_Int16 SvxAsianConfig::GetCharDistanceCompression() const { - return +CharCompressType SvxAsianConfig::GetCharDistanceCompression() const { + return (CharCompressType) officecfg::Office::Common::AsianLayout::CompressCharacterDistance::get( impl_->context); } -void SvxAsianConfig::SetCharDistanceCompression(sal_Int16 value) { +void SvxAsianConfig::SetCharDistanceCompression(CharCompressType value) { officecfg::Office::Common::AsianLayout::CompressCharacterDistance::set( - value, impl_->batch); + (sal_uInt16)value, impl_->batch); } css::uno::Sequence< css::lang::Locale > SvxAsianConfig::GetStartEndCharLocales() diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index cb3ed8642545..c95c018cd86d 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -35,6 +35,7 @@ #include <unotools/configmgr.hxx> #include <svl/whiter.hxx> +#include <svl/asiancfg.hxx> #include <svx/xit.hxx> #include <svx/xbtmpit.hxx> #include <svx/xlndsit.hxx> @@ -165,11 +166,11 @@ void SdrModel::ImpCtor(SfxItemPool* pPool, ::comphelper::IEmbeddedHelper* _pEmbe mbDisableTextEditUsesCommonUndoManager = false; if (!utl::ConfigManager::IsAvoidConfig()) - mnCharCompressType = + mnCharCompressType = (CharCompressType) officecfg::Office::Common::AsianLayout::CompressCharacterDistance:: get(); else - mnCharCompressType = 0; + mnCharCompressType = CharCompressType::NONE; #ifdef OSL_LITENDIAN nStreamNumberFormat=SvStreamEndian::LITTLE; @@ -1865,7 +1866,7 @@ void SdrModel::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharacte } -void SdrModel::SetCharCompressType( sal_uInt16 nType ) +void SdrModel::SetCharCompressType( CharCompressType nType ) { if( nType != mnCharCompressType ) { diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index ed7da1216f2a..cc0466b85da4 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -22,11 +22,11 @@ #include <tools/solar.h> #include <rtl/ref.hxx> -#include <chcmprse.hxx> #include <fldupde.hxx> class SvxForbiddenCharactersTable; namespace com { namespace sun { namespace star { namespace i18n { struct ForbiddenCharacters; } } } } +enum class CharCompressType; enum class DocumentSettingId { @@ -204,14 +204,14 @@ enum class DocumentSettingId @returns the current character compression mode. */ - virtual SwCharCompressType getCharacterCompressionType() const = 0; + virtual CharCompressType getCharacterCompressionType() const = 0; /** Set the character compression type for Asian characters. @param nMode [in] the new character compression type. */ - virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType ) = 0; + virtual void setCharacterCompressionType( /*[in]*/CharCompressType nType ) = 0; /** Get the n32DummyCompatabilityOptions1 */ diff --git a/sw/inc/chcmprse.hxx b/sw/inc/chcmprse.hxx deleted file mode 100644 index 37574b3856c6..000000000000 --- a/sw/inc/chcmprse.hxx +++ /dev/null @@ -1,28 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_SW_INC_CHCMPRSE_HXX -#define INCLUDED_SW_INC_CHCMPRSE_HXX - -enum SwCharCompressType{ CHARCOMPRESS_NONE, - CHARCOMPRESS_PUNCTUATION, - CHARCOMPRESS_PUNCTUATION_KANA }; - -#endif -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index d8c2ba38118d..458d3bda4578 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -35,7 +35,6 @@ #include <flypos.hxx> #include <itabenum.hxx> #include <swdbdata.hxx> -#include <chcmprse.hxx> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/linguistic2/XHyphenatedWord.hpp> #include <sfx2/objsh.hxx> diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index ec0eb827e701..1103cf441bd3 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -25,6 +25,7 @@ #include <comphelper/processfactory.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svx/svdmodel.hxx> +#include <svl/asiancfg.hxx> #include <unotools/compatibility.hxx> #include <unotools/configmgr.hxx> #include <drawdoc.hxx> @@ -41,7 +42,7 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) :m_rDoc(rDoc), mnLinkUpdMode( GLOBALSETTING ), meFieldUpdMode( AUTOUPD_GLOBALSETTING ), - meChrCmprType( CHARCOMPRESS_NONE ), + meChrCmprType( CharCompressType::NONE ), mn32DummyCompatibilityOptions1(0), mn32DummyCompatibilityOptions2(0), mbHTMLMode(false), @@ -495,12 +496,12 @@ void sw::DocumentSettingManager::setFieldUpdateFlags(/*[in]*/SwFieldUpdateFlags meFieldUpdMode = eMode; } -SwCharCompressType sw::DocumentSettingManager::getCharacterCompressionType() const +CharCompressType sw::DocumentSettingManager::getCharacterCompressionType() const { return meChrCmprType; } -void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharCompressType n ) +void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/CharCompressType n ) { if( meChrCmprType != n ) { @@ -509,7 +510,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel(); if( pDrawModel ) { - pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) ); + pDrawModel->SetCharCompressType( n ); if( !m_rDoc.IsInReading() ) pDrawModel->ReformatAllTextObjects(); } diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx index 53ea2abe3ea3..b1dd50b45bc5 100644 --- a/sw/source/core/draw/drawdoc.cxx +++ b/sw/source/core/draw/drawdoc.cxx @@ -96,8 +96,7 @@ SwDrawModel::SwDrawModel(SwDoc *const pDoc) SetForbiddenCharsTable(m_pDoc->GetDocumentSettingManager().getForbiddenCharacterTable()); // Implementation for asian compression - SetCharCompressType( static_cast<sal_uInt16>( - m_pDoc->GetDocumentSettingManager().getCharacterCompressionType())); + SetCharCompressType( m_pDoc->GetDocumentSettingManager().getCharacterCompressionType() ); } // Destructor diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index ae835d7d64e6..a71966d4c3a0 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -32,7 +32,7 @@ class DocumentSettingManager : sal_uInt16 mnLinkUpdMode; //< UpdateMode for links. SwFieldUpdateFlags meFieldUpdMode;//< Automatically Update Mode for fields/charts. - SwCharCompressType meChrCmprType;//< for ASIAN: compress punctuation/kana + CharCompressType meChrCmprType;//< for ASIAN: compress punctuation/kana sal_uInt32 mn32DummyCompatibilityOptions1; sal_uInt32 mn32DummyCompatibilityOptions2; @@ -171,8 +171,8 @@ public: virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode ) override; virtual SwFieldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const override; virtual void setFieldUpdateFlags( /*[in]*/ SwFieldUpdateFlags eMode ) override; - virtual SwCharCompressType getCharacterCompressionType() const override; - virtual void setCharacterCompressionType( /*[in]*/SwCharCompressType nType ) override; + virtual CharCompressType getCharacterCompressionType() const override; + virtual void setCharacterCompressionType( /*[in]*/CharCompressType nType ) override; // Replace all compatibility options with those from rSource. diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index f2a3247e0745..c37319d06b62 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -38,6 +38,7 @@ #include <editeng/scripttypeitem.hxx> #include <editeng/charhiddenitem.hxx> #include <vcl/outdev.hxx> +#include <svl/asiancfg.hxx> #include <editeng/blinkitem.hxx> #include <tools/multisel.hxx> #include <unotools/charclass.hxx> @@ -739,7 +740,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL ) sal_Int16 nScript = i18n::ScriptType::LATIN; // compression type - const SwCharCompressType aCompEnum = rNode.getIDocumentSettingAccess()->getCharacterCompressionType(); + const CharCompressType aCompEnum = rNode.getIDocumentSettingAccess()->getCharacterCompressionType(); // justification type const bool bAdjustBlock = SVX_ADJUST_BLOCK == @@ -763,7 +764,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL ) break; } } - if( CHARCOMPRESS_NONE != aCompEnum ) + if( CharCompressType::NONE != aCompEnum ) { while( nCntComp < CountCompChg() ) { @@ -926,7 +927,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL ) // if current script is asian, we search for compressable characters // in this range - if ( CHARCOMPRESS_NONE != aCompEnum && + if ( CharCompressType::NONE != aCompEnum && i18n::ScriptType::ASIAN == nScript ) { CompType ePrevState = NONE; @@ -966,7 +967,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL ) if ( ePrevState != NONE ) { // insert start and type - if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum || + if ( CharCompressType::PunctuationAndKana == aCompEnum || ePrevState != KANA ) { aCompressionChanges.push_back( CompressionChangeInfo(nPrevChg, nLastCompression - nPrevChg, ePrevState) ); @@ -984,7 +985,7 @@ void SwScriptInfo::InitScriptInfo( const SwTextNode& rNode, bool bRTL ) if ( ePrevState != NONE ) { // insert start and type - if ( CHARCOMPRESS_PUNCTUATION_KANA == aCompEnum || + if ( CharCompressType::PunctuationAndKana == aCompEnum || ePrevState != KANA ) { aCompressionChanges.push_back( CompressionChangeInfo(nPrevChg, nLastCompression - nPrevChg, ePrevState) ); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 7994b3d9b73e..11115fab62ba 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -763,7 +763,7 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo) const IDocumentSettingAccess& rIDocumentSettingAccess = GetWriter().getIDocumentSettingAccess(); rTypo.fKerningPunct = sal_uInt16(rIDocumentSettingAccess.get(DocumentSettingId::KERN_ASIAN_PUNCTUATION)); - rTypo.iJustification = m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType(); + rTypo.iJustification = sal_uInt16(m_pDoc->getIDocumentSettingAccess().getCharacterCompressionType()); } // It can only be found something with this method, if it is used within diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 6bec800c8bce..29c0a35a7580 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2030,7 +2030,7 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo) } m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, rTypo.fKerningPunct); - m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType(static_cast<SwCharCompressType>(rTypo.iJustification)); + m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType((CharCompressType)rTypo.iJustification); } /** diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx index 23361fcff200..a547c945bb92 100644 --- a/sw/source/uibase/app/docshini.cxx +++ b/sw/source/uibase/app/docshini.cxx @@ -138,7 +138,7 @@ bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) } m_pDoc->getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, !aAsian.IsKerningWesternTextOnly()); - m_pDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<SwCharCompressType>(aAsian.GetCharDistanceCompression())); + m_pDoc->getIDocumentSettingAccess().setCharacterCompressionType(aAsian.GetCharDistanceCompression()); m_pDoc->getIDocumentDeviceAccess().setPrintData(*SW_MOD()->GetPrtOptions(bWeb)); } diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index f207b3a205b8..660046dc3288 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -44,6 +44,7 @@ #include <sfx2/zoomitem.hxx> #include <unomod.hxx> #include <vcl/svapp.hxx> +#include <svl/asiancfg.hxx> #include <comphelper/servicehelper.hxx> #include "swmodule.hxx" @@ -449,16 +450,16 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf { sal_Int16 nMode = 0; rValue >>= nMode; - switch (nMode) + switch ((CharCompressType)nMode) { - case CHARCOMPRESS_NONE: - case CHARCOMPRESS_PUNCTUATION: - case CHARCOMPRESS_PUNCTUATION_KANA: + case CharCompressType::NONE: + case CharCompressType::PunctuationOnly: + case CharCompressType::PunctuationAndKana: break; default: throw IllegalArgumentException(); } - mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast < SwCharCompressType > (nMode) ); + mpDoc->getIDocumentSettingAccess().setCharacterCompressionType((CharCompressType)nMode); } break; case HANDLE_APPLY_USER_DATA: |