summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-13 08:17:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-13 08:17:42 +0200
commitb8d977c0178f8ac4ee299722d50c1481a15b45c8 (patch)
tree6cd8560661bb8b713e4373379052e85ab30598dd /sw
parent80d2fa87fdaf67615d7b8128f3c05b239a1f1c05 (diff)
convert CharCompressType to scoped enum
and move it to svl, where it belongs Change-Id: Ic4d846419dfe2dd85de5ade8ed1a041867bbf1dc
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/IDocumentSettingAccess.hxx6
-rw-r--r--sw/inc/chcmprse.hxx28
-rw-r--r--sw/inc/doc.hxx1
-rw-r--r--sw/source/core/doc/DocumentSettingManager.cxx9
-rw-r--r--sw/source/core/draw/drawdoc.cxx3
-rw-r--r--sw/source/core/inc/DocumentSettingManager.hxx6
-rw-r--r--sw/source/core/text/porlay.cxx11
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par.cxx2
-rw-r--r--sw/source/uibase/app/docshini.cxx2
-rw-r--r--sw/source/uibase/uno/SwXDocumentSettings.cxx11
11 files changed, 27 insertions, 54 deletions
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: