[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Sep 20 16:23:08 UTC 2019
sw/inc/docufld.hxx | 6
sw/inc/fldbas.hxx | 101 +++----
sw/source/core/bastyp/calc.cxx | 4
sw/source/core/doc/DocumentFieldsManager.cxx | 4
sw/source/core/fields/docufld.cxx | 18 -
sw/source/core/fields/expfld.cxx | 16 -
sw/source/core/fields/fldbas.cxx | 130 ++++-----
sw/source/core/fields/usrfld.cxx | 2
sw/source/core/frmedt/fefly1.cxx | 2
sw/source/core/table/swtable.cxx | 2
sw/source/core/unocore/unofield.cxx | 6
sw/source/filter/ww8/ww8par5.cxx | 2
sw/source/ui/config/optload.cxx | 6
sw/source/ui/dbui/mmlayoutpage.cxx | 16 -
sw/source/ui/fldui/flddb.cxx | 54 ++--
sw/source/ui/fldui/flddinf.cxx | 6
sw/source/ui/fldui/flddok.cxx | 127 ++++-----
sw/source/ui/fldui/flddok.hxx | 4
sw/source/ui/fldui/fldedt.cxx | 4
sw/source/ui/fldui/fldfunc.cxx | 56 ++--
sw/source/ui/fldui/fldpage.cxx | 42 +--
sw/source/ui/fldui/fldpage.hxx | 2
sw/source/ui/fldui/fldref.cxx | 97 +++----
sw/source/ui/fldui/fldvar.cxx | 142 +++++-----
sw/source/ui/fldui/fldvar.hxx | 2
sw/source/ui/frmdlg/cption.cxx | 6
sw/source/ui/index/swuiidxmrk.cxx | 2
sw/source/uibase/app/appenv.cxx | 2
sw/source/uibase/app/applab.cxx | 2
sw/source/uibase/dbui/dbmgr.cxx | 2
sw/source/uibase/docvw/edtwin.cxx | 16 -
sw/source/uibase/fldui/fldmgr.cxx | 353 +++++++++++++--------------
sw/source/uibase/inc/fldmgr.hxx | 22 -
sw/source/uibase/ribbar/inputwin.cxx | 2
sw/source/uibase/shells/textfld.cxx | 28 +-
sw/source/uibase/shells/textsh1.cxx | 8
sw/source/uibase/shells/textsh2.cxx | 4
sw/source/uibase/wrtsh/wrtsh1.cxx | 2
38 files changed, 658 insertions(+), 642 deletions(-)
New commits:
commit ebdf70cc68989d209965768edc8a3bdf27543c48
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Sep 20 15:18:01 2019 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 20 18:21:50 2019 +0200
convert SwFieldTypesEnum to scoped enum
clamp it to sal_uInt16 since we convert it that type when passing
it via SfxItemSet
Change-Id: I4b7bd4ba5e19015af357d5a81a629239451d71e4
Reviewed-on: https://gerrit.libreoffice.org/79289
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index e6afd73af156..cb6f0c2159c2 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -295,7 +295,7 @@ class SW_DLLPUBLIC SwHiddenTextField : public SwField
OUString m_aContent; ///< Evaluated DB-text.
OUString m_aCond; ///< Condition.
- sal_uInt16 m_nSubType;
+ SwFieldTypesEnum m_nSubType;
bool m_bCanToggle : 1; ///< Can field be toggled alone?
bool m_bIsHidden : 1; ///< Is it not visible?
@@ -310,13 +310,13 @@ public:
const OUString& rCond,
const OUString& rText,
bool bHidden,
- sal_uInt16 nSubType = TYP_HIDDENTXTFLD);
+ SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
SwHiddenTextField( SwHiddenTextFieldType*,
const OUString& rCond,
const OUString& rTrue,
const OUString& rFalse,
- sal_uInt16 nSubType = TYP_HIDDENTXTFLD);
+ SwFieldTypesEnum nSubType = SwFieldTypesEnum::HiddenText);
virtual OUString GetFieldName() const override;
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index aafce0c4c718..664f74b45242 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -84,54 +84,55 @@ enum class SwFieldIds : sal_uInt16 {
};
/// List of FieldTypes at UI.
-enum SwFieldTypesEnum {
- TYP_BEGIN,
- TYP_DATEFLD = TYP_BEGIN, // 0
- TYP_TIMEFLD,
- TYP_FILENAMEFLD,
- TYP_DBNAMEFLD,
- TYP_CHAPTERFLD,
- TYP_PAGENUMBERFLD,
- TYP_DOCSTATFLD,
- TYP_AUTHORFLD,
- TYP_SETFLD,
- TYP_GETFLD,
- TYP_FORMELFLD, // 10
- TYP_HIDDENTXTFLD,
- TYP_SETREFFLD,
- TYP_GETREFFLD,
- TYP_DDEFLD,
- TYP_MACROFLD,
- TYP_INPUTFLD,
- TYP_HIDDENPARAFLD,
- TYP_DOCINFOFLD,
- TYP_DBFLD,
- TYP_USERFLD, // 20
- TYP_POSTITFLD,
- TYP_TEMPLNAMEFLD,
- TYP_SEQFLD,
- TYP_DBNEXTSETFLD,
- TYP_DBNUMSETFLD,
- TYP_DBSETNUMBERFLD,
- TYP_CONDTXTFLD,
- TYP_NEXTPAGEFLD,
- TYP_PREVPAGEFLD,
- TYP_EXTUSERFLD, // 30
- TYP_FIXDATEFLD,
- TYP_FIXTIMEFLD,
- TYP_SETINPFLD,
- TYP_USRINPFLD,
- TYP_SETREFPAGEFLD,
- TYP_GETREFPAGEFLD,
- TYP_INTERNETFLD,
- TYP_JUMPEDITFLD,
- TYP_SCRIPTFLD,
- TYP_AUTHORITY, // 40
- TYP_COMBINED_CHARS,
- TYP_DROPDOWN,
- TYP_CUSTOM, // Unused - necessary for alignment with aSwFields in fldmgr.cxx
- TYP_PARAGRAPHSIGFLD,
- TYP_END
+enum class SwFieldTypesEnum : sal_uInt16 {
+ Begin,
+ Date = Begin, // 0
+ Time,
+ Filename,
+ DatabaseName,
+ Chapter,
+ PageNumber,
+ DocumentStatistics,
+ Author,
+ Set,
+ Get,
+ Formel, // 10
+ HiddenText,
+ SetRef,
+ GetRef,
+ DDE,
+ Macro,
+ Input,
+ HiddenParagraph,
+ DocumentInfo,
+ Database,
+ User, // 20
+ Postit,
+ TemplateName,
+ Sequence,
+ DatabaseNextSet,
+ DatabaseNumberSet,
+ DatabaseSetNumber,
+ ConditionalText,
+ NextPage,
+ PreviousPage,
+ ExtendedUser, // 30
+ FixedDate,
+ FixedTime,
+ SetInput,
+ UserInput,
+ SetRefPage,
+ GetRefPage,
+ Internet,
+ JumpEdit,
+ Script,
+ Authority, // 40
+ CombinedChars,
+ Dropdown,
+ Custom, // Unused - necessary for alignment with aSwFields in fldmgr.cxx
+ ParagraphSignature,
+ LAST,
+ Unknown = USHRT_MAX // used by SwFieldMgr::GetCurTypeId
};
enum SwAttrFieldType {
ATTR_NONE,
@@ -254,7 +255,7 @@ public:
m_wXFieldMaster = xFieldMaster;
}
- static OUString GetTypeStr( sal_uInt16 nTypeId );
+ static OUString GetTypeStr( SwFieldTypesEnum nTypeId );
/// Only in derived classes.
virtual OUString GetName() const;
@@ -340,7 +341,7 @@ public:
#endif
// TYP_ID
- sal_uInt16 GetTypeId() const;
+ SwFieldTypesEnum GetTypeId() const;
virtual sal_uInt16 GetSubType() const;
virtual void SetSubType(sal_uInt16);
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index a2140e497ce2..41b4352eee7a 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -496,7 +496,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns )
OUString sColumnName( GetColumnName( sTmpName ));
OSL_ENSURE(!sColumnName.isEmpty(), "Missing DB column name");
- OUString sDBNum( SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD) );
+ OUString sDBNum( SwFieldType::GetTypeStr(SwFieldTypesEnum::DatabaseSetNumber) );
sDBNum = m_pCharClass->lowercase(sDBNum);
// Initialize again because this doesn't happen in docfld anymore for
@@ -543,7 +543,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns )
OUString sColumnName( GetColumnName( sTmpName ));
OSL_ENSURE( !sColumnName.isEmpty(), "Missing DB column name" );
if( sColumnName.equalsIgnoreAsciiCase(
- SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) ))
+ SwFieldType::GetTypeStr( SwFieldTypesEnum::DatabaseSetNumber ) ))
{
#if HAVE_FEATURE_DBCONNECTIVITY
SwDBManager *pMgr = m_rDoc.GetDBManager();
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 7f7a5b9e1c74..a76701348a1d 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -90,7 +90,7 @@ namespace
sDBNumNm = aDBData.sDataSource + OUStringLiteral1(DB_DELIM)
+ aDBData.sCommand + OUStringLiteral1(DB_DELIM);
}
- sDBNumNm += SwFieldType::GetTypeStr(TYP_DBSETNUMBERFLD);
+ sDBNumNm += SwFieldType::GetTypeStr(SwFieldTypesEnum::DatabaseSetNumber);
return sDBNumNm;
}
@@ -981,7 +981,7 @@ void DocumentFieldsManager::UpdateExpFieldsImpl(
SwCalc aCalc( m_rDoc );
#if HAVE_FEATURE_DBCONNECTIVITY
- OUString sDBNumNm( SwFieldType::GetTypeStr( TYP_DBSETNUMBERFLD ) );
+ OUString sDBNumNm( SwFieldType::GetTypeStr( SwFieldTypesEnum::DatabaseSetNumber ) );
// already set the current record number
SwDBManager* pMgr = m_rDoc.GetDBManager();
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 19da42aa5cf8..0a7fa64efd7b 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -1270,11 +1270,11 @@ SwHiddenTextField::SwHiddenTextField( SwHiddenTextFieldType* pFieldType,
const OUString& rCond,
const OUString& rStr,
bool bHidden,
- sal_uInt16 nSub) :
+ SwFieldTypesEnum nSub) :
SwField( pFieldType ), m_aCond(rCond), m_nSubType(nSub),
m_bCanToggle(bConditional), m_bIsHidden(bHidden), m_bValid(false)
{
- if(m_nSubType == TYP_CONDTXTFLD)
+ if(m_nSubType == SwFieldTypesEnum::ConditionalText)
{
sal_Int32 nPos = 0;
m_aTRUEText = rStr.getToken(0, '|', nPos);
@@ -1297,7 +1297,7 @@ SwHiddenTextField::SwHiddenTextField( SwHiddenTextFieldType* pFieldType,
const OUString& rCond,
const OUString& rTrue,
const OUString& rFalse,
- sal_uInt16 nSub)
+ SwFieldTypesEnum nSub)
: SwField( pFieldType ), m_aTRUEText(rTrue), m_aFALSEText(rFalse), m_aCond(rCond), m_nSubType(nSub),
m_bIsHidden(true), m_bValid(false)
{
@@ -1309,7 +1309,7 @@ OUString SwHiddenTextField::ExpandImpl(SwRootFrame const*const) const
// Type: !Hidden -> show always
// Hide -> evaluate condition
- if( TYP_CONDTXTFLD == m_nSubType )
+ if( SwFieldTypesEnum::ConditionalText == m_nSubType )
{
if( m_bValid )
return m_aContent;
@@ -1329,7 +1329,7 @@ void SwHiddenTextField::Evaluate(SwDoc* pDoc)
{
OSL_ENSURE(pDoc, "got no document");
- if( TYP_CONDTXTFLD == m_nSubType )
+ if( SwFieldTypesEnum::ConditionalText == m_nSubType )
{
#if !HAVE_FEATURE_DBCONNECTIVITY
(void) pDoc;
@@ -1387,7 +1387,7 @@ OUString SwHiddenTextField::GetFieldName() const
OUString aStr = SwFieldType::GetTypeStr(m_nSubType) +
" " + m_aCond + " " + m_aTRUEText;
- if (m_nSubType == TYP_CONDTXTFLD)
+ if (m_nSubType == SwFieldTypesEnum::ConditionalText)
{
aStr += " : " + m_aFALSEText;
}
@@ -1422,7 +1422,7 @@ OUString SwHiddenTextField::GetPar1() const
/// set True/False text
void SwHiddenTextField::SetPar2(const OUString& rStr)
{
- if (m_nSubType == TYP_CONDTXTFLD)
+ if (m_nSubType == SwFieldTypesEnum::ConditionalText)
{
sal_Int32 nPos = rStr.indexOf('|');
if (nPos == -1)
@@ -1440,7 +1440,7 @@ void SwHiddenTextField::SetPar2(const OUString& rStr)
/// get True/False text
OUString SwHiddenTextField::GetPar2() const
{
- if(m_nSubType != TYP_CONDTXTFLD)
+ if(m_nSubType != SwFieldTypesEnum::ConditionalText)
{
return m_aTRUEText;
}
@@ -1449,7 +1449,7 @@ OUString SwHiddenTextField::GetPar2() const
sal_uInt16 SwHiddenTextField::GetSubType() const
{
- return m_nSubType;
+ return static_cast<sal_uInt16>(m_nSubType);
}
bool SwHiddenTextField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index 9c90867d5924..3490d548ad1b 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -315,10 +315,10 @@ OUString SwGetExpField::ExpandImpl(SwRootFrame const*const pLayout) const
OUString SwGetExpField::GetFieldName() const
{
- const sal_uInt16 nType = static_cast<sal_uInt16>(
+ const SwFieldTypesEnum nType =
(nsSwGetSetExpType::GSE_FORMULA & m_nSubType)
- ? TYP_FORMELFLD
- : TYP_GETFLD);
+ ? SwFieldTypesEnum::Formel
+ : SwFieldTypesEnum::Get;
return SwFieldType::GetTypeStr(nType) + " " + GetFormula();
}
@@ -855,18 +855,18 @@ OUString SwSetExpField::ExpandImpl(SwRootFrame const*const pLayout) const
OUString SwSetExpField::GetFieldName() const
{
SwFieldTypesEnum const nStrType( (IsSequenceField())
- ? TYP_SEQFLD
+ ? SwFieldTypesEnum::Sequence
: mbInput
- ? TYP_SETINPFLD
- : TYP_SETFLD );
+ ? SwFieldTypesEnum::SetInput
+ : SwFieldTypesEnum::Set );
OUString aStr(
- SwFieldType::GetTypeStr( static_cast<sal_uInt16>(nStrType) )
+ SwFieldType::GetTypeStr( nStrType )
+ " "
+ GetTyp()->GetName() );
// Sequence: without formula
- if (TYP_SEQFLD != nStrType)
+ if (SwFieldTypesEnum::Sequence != nStrType)
{
aStr += " = " + GetFormula();
}
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index a5008b4c4e3a..c46e5bfd3824 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -80,59 +80,57 @@ namespace
{
const o3tl::enumarray<SwFieldIds,SwFieldTypesEnum> aTypeTab {
- /* SwFieldIds::Database */ TYP_DBFLD,
- /* SwFieldIds::User */ TYP_USERFLD,
- /* SwFieldIds::Filename */ TYP_FILENAMEFLD,
- /* SwFieldIds::DatabaseName */ TYP_DBNAMEFLD,
- /* SwFieldIds::Date */ TYP_DATEFLD,
- /* SwFieldIds::Time */ TYP_TIMEFLD,
- /* SwFieldIds::PageNumber */ TYP_PAGENUMBERFLD, // dynamic
- /* SwFieldIds::Author */ TYP_AUTHORFLD,
- /* SwFieldIds::Chapter */ TYP_CHAPTERFLD,
- /* SwFieldIds::DocStat */ TYP_DOCSTATFLD,
- /* SwFieldIds::GetExp */ TYP_GETFLD, // dynamic
- /* SwFieldIds::SetExp */ TYP_SETFLD, // dynamic
- /* SwFieldIds::GetRef */ TYP_GETREFFLD,
- /* SwFieldIds::HiddenText */ TYP_HIDDENTXTFLD,
- /* SwFieldIds::Postit */ TYP_POSTITFLD,
- /* SwFieldIds::FixDate */ TYP_FIXDATEFLD,
- /* SwFieldIds::FixTime */ TYP_FIXTIMEFLD,
- /* SwFieldIds::Reg */ TYP_BEGIN, // old (no change since 2000)
- /* SwFieldIds::VarReg */ TYP_BEGIN, // old (no change since 2000)
- /* SwFieldIds::SetRef */ TYP_SETREFFLD,
- /* SwFieldIds::Input */ TYP_INPUTFLD,
- /* SwFieldIds::Macro */ TYP_MACROFLD,
- /* SwFieldIds::Dde */ TYP_DDEFLD,
- /* SwFieldIds::Table */ TYP_FORMELFLD,
- /* SwFieldIds::HiddenPara */ TYP_HIDDENPARAFLD,
- /* SwFieldIds::DocInfo */ TYP_DOCINFOFLD,
- /* SwFieldIds::TemplateName */ TYP_TEMPLNAMEFLD,
- /* SwFieldIds::DbNextSet */ TYP_DBNEXTSETFLD,
- /* SwFieldIds::DbNumSet */ TYP_DBNUMSETFLD,
- /* SwFieldIds::DbSetNumber */ TYP_DBSETNUMBERFLD,
- /* SwFieldIds::ExtUser */ TYP_EXTUSERFLD,
- /* SwFieldIds::RefPageSet */ TYP_SETREFPAGEFLD,
- /* SwFieldIds::RefPageGet */ TYP_GETREFPAGEFLD,
- /* SwFieldIds::Internet */ TYP_INTERNETFLD,
- /* SwFieldIds::JumpEdit */ TYP_JUMPEDITFLD,
- /* SwFieldIds::Script */ TYP_SCRIPTFLD,
- /* SwFieldIds::DateTime */ TYP_BEGIN, // dynamic
- /* SwFieldIds::TableOfAuthorities*/ TYP_AUTHORITY,
- /* SwFieldIds::CombinedChars */ TYP_COMBINED_CHARS,
- /* SwFieldIds::Dropdown */ TYP_DROPDOWN,
- /* SwFieldIds::ParagraphSignature */ TYP_PARAGRAPHSIGFLD
+ /* SwFieldIds::Database */ SwFieldTypesEnum::Database,
+ /* SwFieldIds::User */ SwFieldTypesEnum::User,
+ /* SwFieldIds::Filename */ SwFieldTypesEnum::Filename,
+ /* SwFieldIds::DatabaseName */ SwFieldTypesEnum::DatabaseName,
+ /* SwFieldIds::Date */ SwFieldTypesEnum::Date,
+ /* SwFieldIds::Time */ SwFieldTypesEnum::Time,
+ /* SwFieldIds::PageNumber */ SwFieldTypesEnum::PageNumber, // dynamic
+ /* SwFieldIds::Author */ SwFieldTypesEnum::Author,
+ /* SwFieldIds::Chapter */ SwFieldTypesEnum::Chapter,
+ /* SwFieldIds::DocStat */ SwFieldTypesEnum::DocumentStatistics,
+ /* SwFieldIds::GetExp */ SwFieldTypesEnum::Get, // dynamic
+ /* SwFieldIds::SetExp */ SwFieldTypesEnum::Set, // dynamic
+ /* SwFieldIds::GetRef */ SwFieldTypesEnum::GetRef,
+ /* SwFieldIds::HiddenText */ SwFieldTypesEnum::HiddenText,
+ /* SwFieldIds::Postit */ SwFieldTypesEnum::Postit,
+ /* SwFieldIds::FixDate */ SwFieldTypesEnum::FixedDate,
+ /* SwFieldIds::FixTime */ SwFieldTypesEnum::FixedTime,
+ /* SwFieldIds::Reg */ SwFieldTypesEnum::Begin, // old (no change since 2000)
+ /* SwFieldIds::VarReg */ SwFieldTypesEnum::Begin, // old (no change since 2000)
+ /* SwFieldIds::SetRef */ SwFieldTypesEnum::SetRef,
+ /* SwFieldIds::Input */ SwFieldTypesEnum::Input,
+ /* SwFieldIds::Macro */ SwFieldTypesEnum::Macro,
+ /* SwFieldIds::Dde */ SwFieldTypesEnum::DDE,
+ /* SwFieldIds::Table */ SwFieldTypesEnum::Formel,
+ /* SwFieldIds::HiddenPara */ SwFieldTypesEnum::HiddenParagraph,
+ /* SwFieldIds::DocInfo */ SwFieldTypesEnum::DocumentInfo,
+ /* SwFieldIds::TemplateName */ SwFieldTypesEnum::TemplateName,
+ /* SwFieldIds::DbNextSet */ SwFieldTypesEnum::DatabaseNextSet,
+ /* SwFieldIds::DbNumSet */ SwFieldTypesEnum::DatabaseNumberSet,
+ /* SwFieldIds::DbSetNumber */ SwFieldTypesEnum::DatabaseSetNumber,
+ /* SwFieldIds::ExtUser */ SwFieldTypesEnum::ExtendedUser,
+ /* SwFieldIds::RefPageSet */ SwFieldTypesEnum::SetRefPage,
+ /* SwFieldIds::RefPageGet */ SwFieldTypesEnum::GetRefPage,
+ /* SwFieldIds::Internet */ SwFieldTypesEnum::Internet,
+ /* SwFieldIds::JumpEdit */ SwFieldTypesEnum::JumpEdit,
+ /* SwFieldIds::Script */ SwFieldTypesEnum::Script,
+ /* SwFieldIds::DateTime */ SwFieldTypesEnum::Begin, // dynamic
+ /* SwFieldIds::TableOfAuthorities*/ SwFieldTypesEnum::Authority,
+ /* SwFieldIds::CombinedChars */ SwFieldTypesEnum::CombinedChars,
+ /* SwFieldIds::Dropdown */ SwFieldTypesEnum::Dropdown,
+ /* SwFieldIds::ParagraphSignature */ SwFieldTypesEnum::ParagraphSignature
};
}
-OUString SwFieldType::GetTypeStr(sal_uInt16 nTypeId)
+OUString SwFieldType::GetTypeStr(SwFieldTypesEnum nTypeId)
{
if (!s_pFieldNames)
GetFieldName_();
- if (nTypeId < SwFieldType::s_pFieldNames->size())
- return (*SwFieldType::s_pFieldNames)[nTypeId];
- return OUString();
+ return (*SwFieldType::s_pFieldNames)[static_cast<int>(nTypeId)];
}
// each field references a field type that is unique for each document
@@ -206,43 +204,45 @@ SwFieldIds SwField::Which() const
}
#endif
-sal_uInt16 SwField::GetTypeId() const
+SwFieldTypesEnum SwField::GetTypeId() const
{
- sal_uInt16 nRet;
+ SwFieldTypesEnum nRet;
switch (m_pType->Which())
{
case SwFieldIds::DateTime:
if (GetSubType() & FIXEDFLD)
- nRet = static_cast<sal_uInt16>(GetSubType() & DATEFLD ? TYP_FIXDATEFLD : TYP_FIXTIMEFLD);
+ nRet = GetSubType() & DATEFLD ? SwFieldTypesEnum::FixedDate : SwFieldTypesEnum::FixedTime;
else
- nRet = static_cast<sal_uInt16>(GetSubType() & DATEFLD ? TYP_DATEFLD : TYP_TIMEFLD);
+ nRet = GetSubType() & DATEFLD ? SwFieldTypesEnum::Date : SwFieldTypesEnum::Time;
break;
case SwFieldIds::GetExp:
- nRet = static_cast<sal_uInt16>(nsSwGetSetExpType::GSE_FORMULA & GetSubType() ? TYP_FORMELFLD : TYP_GETFLD);
+ nRet = nsSwGetSetExpType::GSE_FORMULA & GetSubType() ? SwFieldTypesEnum::Formel : SwFieldTypesEnum::Get;
break;
case SwFieldIds::HiddenText:
- nRet = GetSubType();
+ nRet = static_cast<SwFieldTypesEnum>(GetSubType());
break;
case SwFieldIds::SetExp:
if( nsSwGetSetExpType::GSE_SEQ & GetSubType() )
- nRet = TYP_SEQFLD;
+ nRet = SwFieldTypesEnum::Sequence;
else if( static_cast<const SwSetExpField*>(this)->GetInputFlag() )
- nRet = TYP_SETINPFLD;
+ nRet = SwFieldTypesEnum::SetInput;
else
- nRet = TYP_SETFLD;
+ nRet = SwFieldTypesEnum::Set;
break;
case SwFieldIds::PageNumber:
- nRet = GetSubType();
- if( PG_NEXT == nRet )
- nRet = TYP_NEXTPAGEFLD;
- else if( PG_PREV == nRet )
- nRet = TYP_PREVPAGEFLD;
- else
- nRet = TYP_PAGENUMBERFLD;
+ {
+ auto nSubType = GetSubType();
+ if( PG_NEXT == nSubType )
+ nRet = SwFieldTypesEnum::NextPage;
+ else if( PG_PREV == nSubType )
+ nRet = SwFieldTypesEnum::PreviousPage;
+ else
+ nRet = SwFieldTypesEnum::PageNumber;
+ }
break;
default:
@@ -254,11 +254,11 @@ sal_uInt16 SwField::GetTypeId() const
/// get name or content
OUString SwField::GetFieldName() const
{
- sal_uInt16 nTypeId = GetTypeId();
+ SwFieldTypesEnum nTypeId = GetTypeId();
if (SwFieldIds::DateTime == GetTyp()->Which())
{
- nTypeId = static_cast<sal_uInt16>(
- ((GetSubType() & DATEFLD) != 0) ? TYP_DATEFLD : TYP_TIMEFLD);
+ nTypeId =
+ ((GetSubType() & DATEFLD) != 0) ? SwFieldTypesEnum::Date : SwFieldTypesEnum::Time;
}
OUString sRet = SwFieldType::GetTypeStr( nTypeId );
if (IsFixed())
@@ -415,7 +415,7 @@ SwField::ExpandField(bool const bCached, SwRootFrame const*const pLayout) const
{
if (!bCached) // #i85766# do not expand fields in clipboard documents
{
- if (GetTypeId() == TYP_AUTHORITY)
+ if (GetTypeId() == SwFieldTypesEnum::Authority)
{
const SwAuthorityField* pAuthorityField = static_cast<const SwAuthorityField*>(this);
m_Cache = pAuthorityField->ConditionalExpandAuthIdentifier(pLayout);
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 89ef18611115..56c8ff44b318 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -79,7 +79,7 @@ std::unique_ptr<SwField> SwUserField::Copy() const
OUString SwUserField::GetFieldName() const
{
- return SwFieldType::GetTypeStr(TYP_USERFLD) +
+ return SwFieldType::GetTypeStr(SwFieldTypesEnum::User) +
" " + GetTyp()->GetName() + " = " +
static_cast<SwUserFieldType*>(GetTyp())->GetContent();
}
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 9e7644dd7f8e..622eaf732c76 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1324,7 +1324,7 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference <
{
const SfxPoolItem* pItem = &pHint->GetAttr();
if( RES_TXTATR_FIELD == pItem->Which()
- && TYP_SEQFLD == static_cast<const SwFormatField*>(pItem)->GetField()->GetTypeId() )
+ && SwFieldTypesEnum::Sequence == static_cast<const SwFormatField*>(pItem)->GetField()->GetTypeId() )
{
// sequence field found
SwFlyFrame* pChgFly = const_cast<SwFlyFrame*>(static_cast<const SwFlyFrame*>(pAnchor->GetUpper()));
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index f550aed40da8..4723ba3e5fe6 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -2518,7 +2518,7 @@ sal_uLong SwTableBox::IsValidNumTextNd( bool bCheckAttr ) const
// should not turn cell into text cell
const SwField* pField = pAttr->GetFormatField().GetField();
if (pField &&
- (pField->GetTypeId() == TYP_SETFLD) &&
+ (pField->GetTypeId() == SwFieldTypesEnum::Set) &&
(0 != (static_cast<SwSetExpField const*>
(pField)->GetSubType() &
nsSwExtendedSubType::SUB_INVISIBLE)))
diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index a23a88b85121..cbf34d1ffb5d 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -245,7 +245,7 @@ static SwServiceType lcl_GetServiceForField( const SwField& rField )
break;
case SwFieldIds::HiddenText:
- nSrvId = TYP_CONDTXTFLD == rField.GetSubType()
+ nSrvId = SwFieldTypesEnum::ConditionalText == static_cast<SwFieldTypesEnum>(rField.GetSubType())
? SwServiceType::FieldTypeConditionedText
: SwServiceType::FieldTypeHiddenText;
break;
@@ -1534,8 +1534,8 @@ void SAL_CALL SwXTextField::attach(
static_cast<SwHiddenTextFieldType*>(pFieldType),
m_pImpl->m_pProps->sPar1,
m_pImpl->m_pProps->sPar2, m_pImpl->m_pProps->sPar3,
- static_cast<sal_uInt16>(SwServiceType::FieldTypeHiddenText == m_pImpl->m_nServiceId ?
- TYP_HIDDENTXTFLD : TYP_CONDTXTFLD));
+ SwServiceType::FieldTypeHiddenText == m_pImpl->m_nServiceId ?
+ SwFieldTypesEnum::HiddenText : SwFieldTypesEnum::ConditionalText);
xField.reset(pHTField);
pHTField->SetValue(m_pImpl->m_pProps->bBool1);
uno::Any aVal;
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index b44ad01485bc..cddefb0002da 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -610,7 +610,7 @@ sal_uInt16 SwWW8ImplReader::End_Field()
paramCondition,
paramTrue,
paramFalse,
- static_cast<sal_uInt16>(TYP_CONDTXTFLD));
+ SwFieldTypesEnum::ConditionalText);
// insert new field into document
m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aHTField));
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index b932724bd5b2..0af4778387fe 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -495,11 +495,11 @@ SwCaptionOptPage::SwCaptionOptPage(TabPageParent pParent, const SfxItemSet& rSet
::FillCharStyleListBox( *m_xCharStyleLB, pSh->GetView().GetDocShell(), true, true );
}
- const sal_uInt16 nCount = pMgr->GetFormatCount(TYP_SEQFLD, false);
+ const sal_uInt16 nCount = pMgr->GetFormatCount(SwFieldTypesEnum::Sequence, false);
for ( sal_uInt16 i = 0; i < nCount; ++i )
{
- const sal_uInt16 nFormatId = pMgr->GetFormatId(TYP_SEQFLD, i);
- m_xFormatBox->append(OUString::number(nFormatId), pMgr->GetFormatStr(TYP_SEQFLD, i));
+ const sal_uInt16 nFormatId = pMgr->GetFormatId(SwFieldTypesEnum::Sequence, i);
+ m_xFormatBox->append(OUString::number(nFormatId), pMgr->GetFormatStr(SwFieldTypesEnum::Sequence, i));
if (nFormatId == nSelFormat)
m_xFormatBox->set_active(i);
}
diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx
index 95a27bf16615..83e4f1f0868d 100644
--- a/sw/source/ui/dbui/mmlayoutpage.cxx
+++ b/sw/source/ui/dbui/mmlayoutpage.cxx
@@ -356,7 +356,7 @@ SwFrameFormat* SwMailMergeLayoutPage::InsertAddressFrame(
if( !rExcludeCountry.isEmpty() )
{
const OUString sExpression("[" + sDatabaseConditionPrefix + sCountryColumn + "]");
- SwInsertField_Data aData(TYP_CONDTXTFLD, 0,
+ SwInsertField_Data aData(SwFieldTypesEnum::ConditionalText, 0,
sExpression + " != \"" + rExcludeCountry + "\"",
sExpression,
0, &rShell );
@@ -364,13 +364,13 @@ SwFrameFormat* SwMailMergeLayoutPage::InsertAddressFrame(
}
else
{
- SwInsertField_Data aData(TYP_HIDDENPARAFLD, 0, "", "", 0, &rShell );
+ SwInsertField_Data aData(SwFieldTypesEnum::HiddenParagraph, 0, "", "", 0, &rShell );
aFieldMgr.InsertField( aData );
}
}
else
{
- SwInsertField_Data aData(TYP_DBFLD, 0, sDB, OUString(), 0, &rShell);
+ SwInsertField_Data aData(SwFieldTypesEnum::Database, 0, sDB, OUString(), 0, &rShell);
aFieldMgr.InsertField( aData );
}
}
@@ -382,7 +382,7 @@ SwFrameFormat* SwMailMergeLayoutPage::InsertAddressFrame(
{
if(bHideEmptyParagraphs)
{
- SwInsertField_Data aData(TYP_HIDDENPARAFLD, 0, sHideParagraphsExpression, OUString(), 0, &rShell);
+ SwInsertField_Data aData(SwFieldTypesEnum::HiddenParagraph, 0, sHideParagraphsExpression, OUString(), 0, &rShell);
aFieldMgr.InsertField( aData );
}
sHideParagraphsExpression.clear();
@@ -392,7 +392,7 @@ SwFrameFormat* SwMailMergeLayoutPage::InsertAddressFrame(
}
if(bHideEmptyParagraphs && !sHideParagraphsExpression.isEmpty())
{
- SwInsertField_Data aData(TYP_HIDDENPARAFLD, 0, sHideParagraphsExpression, OUString(), 0, &rShell);
+ SwInsertField_Data aData(SwFieldTypesEnum::HiddenParagraph, 0, sHideParagraphsExpression, OUString(), 0, &rShell);
aFieldMgr.InsertField( aData );
}
}
@@ -532,12 +532,12 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
if(bHideEmptyParagraphs && !sHideParagraphsExpression.isEmpty())
{
OUString sComplete = "(" + sCondition + ") OR (" + sHideParagraphsExpression + ")";
- SwInsertField_Data aData(TYP_HIDDENPARAFLD, 0, sComplete, OUString(), 0, &rShell);
+ SwInsertField_Data aData(SwFieldTypesEnum::HiddenParagraph, 0, sComplete, OUString(), 0, &rShell);
aFieldMgr.InsertField( aData );
}
else
{
- SwInsertField_Data aData(TYP_HIDDENPARAFLD, 0, sCondition, OUString(), 0, &rShell);
+ SwInsertField_Data aData(SwFieldTypesEnum::HiddenParagraph, 0, sCondition, OUString(), 0, &rShell);
aFieldMgr.InsertField( aData );
}
//now the text has to be inserted
@@ -563,7 +563,7 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig
break;
}
}
- SwInsertField_Data aData(TYP_DBFLD, 0,
+ SwInsertField_Data aData(SwFieldTypesEnum::Database, 0,
sDBName + sConvertedColumn,
OUString(), 0, &rShell);
aFieldMgr.InsertField( aData );
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index cca2f31abaeb..b8a1cff07158 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -104,14 +104,14 @@ void SwFieldDBPage::Reset(const SfxItemSet*)
for(sal_uInt16 i = rRg.nStart; i < rRg.nEnd; ++i)
{
- const sal_uInt16 nTypeId = SwFieldMgr::GetTypeId(i);
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
+ const SwFieldTypesEnum nTypeId = SwFieldMgr::GetTypeId(i);
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(i));
}
}
else
{
- const sal_uInt16 nTypeId = GetCurField()->GetTypeId();
- m_xTypeLB->append(OUString::number(nTypeId),
+ const SwFieldTypesEnum nTypeId = GetCurField()->GetTypeId();
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)),
SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
}
@@ -123,12 +123,12 @@ void SwFieldDBPage::Reset(const SfxItemSet*)
m_xFormatLB->clear();
- const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(TYP_DBSETNUMBERFLD, IsFieldDlgHtmlMode());
+ const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(SwFieldTypesEnum::DatabaseSetNumber, IsFieldDlgHtmlMode());
for( sal_uInt16 i = 0; i < nSize; ++i )
{
- const sal_uInt16 nFormatId = GetFieldMgr().GetFormatId( TYP_DBSETNUMBERFLD, i );
+ const sal_uInt16 nFormatId = GetFieldMgr().GetFormatId( SwFieldTypesEnum::DatabaseSetNumber, i );
OUString sId(OUString::number(nFormatId));
- m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(TYP_DBSETNUMBERFLD, i));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(SwFieldTypesEnum::DatabaseSetNumber, i));
if (SVX_NUM_ARABIC == nFormatId)
m_xFormatLB->set_active_id(sId);
}
@@ -212,7 +212,7 @@ bool SwFieldDBPage::FillItemSet(SfxItemSet* )
if(!aData.sDataSource.isEmpty()) // without database no new field command
{
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
sal_uLong nFormat = 0;
sal_uInt16 nSubType = 0;
@@ -230,16 +230,17 @@ bool SwFieldDBPage::FillItemSet(SfxItemSet* )
switch (nTypeId)
{
- case TYP_DBFLD:
+ case SwFieldTypesEnum::Database:
nFormat = m_xNumFormatLB->GetFormat();
if (m_xNewFormatRB->get_sensitive() && m_xNewFormatRB->get_active())
nSubType = nsSwExtendedSubType::SUB_OWN_FMT;
aName = sDBName;
break;
- case TYP_DBSETNUMBERFLD:
+ case SwFieldTypesEnum::DatabaseSetNumber:
nFormat = m_xFormatLB->get_active_id().toUInt32();
break;
+ default: break;
}
const OUString aVal(m_xValueED->get_text());
@@ -298,15 +299,15 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox)
if(!pSh)
pSh = ::GetActiveWrtShell();
bool bCond = false, bSetNo = false, bFormat = false, bDBFormat = false;
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
- m_xDatabaseTLB->ShowColumns(nTypeId == TYP_DBFLD);
+ m_xDatabaseTLB->ShowColumns(nTypeId == SwFieldTypesEnum::Database);
if (IsFieldEdit())
{
SwDBData aData;
OUString sColumnName;
- if (nTypeId == TYP_DBFLD)
+ if (nTypeId == SwFieldTypesEnum::Database)
{
aData = static_cast<SwDBField*>(GetCurField())->GetDBData();
sColumnName = static_cast<SwDBFieldType*>(GetCurField()->GetTyp())->GetColumnName();
@@ -320,7 +321,7 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox)
switch (nTypeId)
{
- case TYP_DBFLD:
+ case SwFieldTypesEnum::Database:
{
bFormat = true;
bDBFormat = true;
@@ -347,10 +348,10 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox)
}
break;
}
- case TYP_DBNUMSETFLD:
+ case SwFieldTypesEnum::DatabaseNumberSet:
bSetNo = true;
[[fallthrough]];
- case TYP_DBNEXTSETFLD:
+ case SwFieldTypesEnum::DatabaseNextSet:
bCond = true;
if (IsFieldEdit())
{
@@ -359,10 +360,10 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox)
}
break;
- case TYP_DBNAMEFLD:
+ case SwFieldTypesEnum::DatabaseName:
break;
- case TYP_DBSETNUMBERFLD:
+ case SwFieldTypesEnum::DatabaseSetNumber:
{
bFormat = true;
m_xNewFormatRB->set_active(true);
@@ -387,11 +388,12 @@ void SwFieldDBPage::TypeHdl(const weld::TreeView* pBox)
}
break;
}
+ default: break;
}
m_xCondition->set_sensitive(bCond);
m_xValue->set_sensitive(bSetNo);
- if (nTypeId != TYP_DBFLD)
+ if (nTypeId != SwFieldTypesEnum::Database)
{
m_xDBFormatRB->set_sensitive(bDBFormat);
m_xNewFormatRB->set_sensitive(bDBFormat || bFormat);
@@ -421,14 +423,14 @@ IMPL_LINK_NOARG(SwFieldDBPage, NumSelectHdl, weld::ComboBox&, void)
void SwFieldDBPage::CheckInsert()
{
bool bInsert = true;
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
std::unique_ptr<weld::TreeIter> xIter(m_xDatabaseTLB->make_iterator());
if (m_xDatabaseTLB->get_selected(xIter.get()))
{
bool bEntry = m_xDatabaseTLB->iter_parent(*xIter);
- if (nTypeId == TYP_DBFLD && bEntry)
+ if (nTypeId == SwFieldTypesEnum::Database && bEntry)
bEntry = m_xDatabaseTLB->iter_parent(*xIter);
bInsert &= bEntry;
@@ -436,7 +438,7 @@ void SwFieldDBPage::CheckInsert()
else
bInsert = false;
- if (nTypeId == TYP_DBNUMSETFLD)
+ if (nTypeId == SwFieldTypesEnum::DatabaseNumberSet)
{
bool bHasValue = !m_xValueED->get_text().isEmpty();
@@ -451,16 +453,16 @@ IMPL_LINK(SwFieldDBPage, TreeSelectHdl, weld::TreeView&, rBox, void)
std::unique_ptr<weld::TreeIter> xIter(rBox.make_iterator());
if (rBox.get_selected(xIter.get()))
{
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
bool bEntry = m_xDatabaseTLB->iter_parent(*xIter);
- if (nTypeId == TYP_DBFLD && bEntry)
+ if (nTypeId == SwFieldTypesEnum::Database && bEntry)
bEntry = m_xDatabaseTLB->iter_parent(*xIter);
CheckInsert();
- if (nTypeId == TYP_DBFLD)
+ if (nTypeId == SwFieldTypesEnum::Database)
{
bool bNumFormat = false;
@@ -516,7 +518,7 @@ void SwFieldDBPage::FillUserData()
void SwFieldDBPage::ActivateMailMergeAddress()
{
- m_xTypeLB->select_id(OUString::number(TYP_DBFLD));
+ m_xTypeLB->select_id(OUString::number(static_cast<sal_uInt16>(SwFieldTypesEnum::Database)));
TypeListBoxHdl(*m_xTypeLB);
const SwDBData& rData = SW_MOD()->GetDBConfig()->GetAddressSource();
m_xDatabaseTLB->Select(rData.sDataSource, rData.sCommand, OUString());
diff --git a/sw/source/ui/fldui/flddinf.cxx b/sw/source/ui/fldui/flddinf.cxx
index 3c29bd911a43..1e4a70f9c5cb 100644
--- a/sw/source/ui/fldui/flddinf.cxx
+++ b/sw/source/ui/fldui/flddinf.cxx
@@ -124,7 +124,7 @@ void SwFieldDokInfPage::Reset(const SfxItemSet* )
}
std::vector<OUString> aLst;
- GetFieldMgr().GetSubTypes(TYP_DOCINFOFLD, aLst);
+ GetFieldMgr().GetSubTypes(SwFieldTypesEnum::DocumentInfo, aLst);
std::unique_ptr<weld::TreeIter> xEntry(m_xTypeTLB->make_iterator());
std::unique_ptr<weld::TreeIter> xExpandEntry;
for(size_t i = 0; i < aLst.size(); ++i)
@@ -357,7 +357,7 @@ IMPL_LINK_NOARG(SwFieldDokInfPage, SubTypeHdl, weld::TreeView&, void)
sal_Int32 SwFieldDokInfPage::FillSelectionLB(sal_uInt16 nSubType)
{
// fill Format-Listbox
- sal_uInt16 nTypeId = TYP_DOCINFOFLD;
+ SwFieldTypesEnum nTypeId = SwFieldTypesEnum::DocumentInfo;
EnableInsert(nSubType != USHRT_MAX);
@@ -437,7 +437,7 @@ bool SwFieldDokInfPage::FillItemSet(SfxItemSet* )
nOldFormat != nFormat || m_xFixedCB->get_state_changed_from_saved()
|| (DI_CUSTOM == nSubType && aName != m_sOldCustomFieldName ))
{
- InsertField(TYP_DOCINFOFLD, nSubType, aName, OUString(), nFormat,
+ InsertField(SwFieldTypesEnum::DocumentInfo, nSubType, aName, OUString(), nFormat,
' ', m_xFormatLB->IsAutomaticLanguage());
}
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 7cee887a6687..1744b6d19f67 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -94,13 +94,13 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
// fill Type-Listbox
for(sal_uInt16 i = rRg.nStart; i < rRg.nEnd; ++i)
{
- const sal_uInt16 nTypeId = SwFieldMgr::GetTypeId(i);
+ const SwFieldTypesEnum nTypeId = SwFieldMgr::GetTypeId(i);
switch (nTypeId)
{
- case TYP_PREVPAGEFLD:
- case TYP_NEXTPAGEFLD:
- case TYP_PAGENUMBERFLD:
+ case SwFieldTypesEnum::PreviousPage:
+ case SwFieldTypesEnum::NextPage:
+ case SwFieldTypesEnum::PageNumber:
if (!bPage)
{
m_xTypeLB->append(OUString::number(USHRT_MAX), SwResId(FMT_REF_PAGE));
@@ -109,7 +109,7 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
break;
default:
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(i));
break;
}
}
@@ -117,12 +117,12 @@ void SwFieldDokPage::Reset(const SfxItemSet* )
else
{
const SwField* pCurField = GetCurField();
- sal_uInt16 nTypeId = pCurField->GetTypeId();
- if (nTypeId == TYP_FIXDATEFLD)
- nTypeId = TYP_DATEFLD;
- if (nTypeId == TYP_FIXTIMEFLD)
- nTypeId = TYP_TIMEFLD;
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
+ SwFieldTypesEnum nTypeId = pCurField->GetTypeId();
+ if (nTypeId == SwFieldTypesEnum::FixedDate)
+ nTypeId = SwFieldTypesEnum::Date;
+ if (nTypeId == SwFieldTypesEnum::FixedTime)
+ nTypeId = SwFieldTypesEnum::Time;
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
m_xNumFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
SwWrtShell *pSh = GetWrtShell();
if(!pSh)
@@ -200,17 +200,17 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
m_xDateFT->hide();
m_xTimeFT->hide();
- sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
// fill Selection-Listbox
m_xSelectionLB->clear();
- if (nTypeId != USHRT_MAX)
+ if (nTypeId != SwFieldTypesEnum::Unknown)
{
std::vector<OUString> aLst;
GetFieldMgr().GetSubTypes(nTypeId, aLst);
- if (nTypeId != TYP_AUTHORFLD)
+ if (nTypeId != SwFieldTypesEnum::Author)
nCount = aLst.size();
else
nCount = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
@@ -220,7 +220,7 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
if (!IsFieldEdit())
{
OUString sId(OUString::number(i));
- if (nTypeId != TYP_AUTHORFLD)
+ if (nTypeId != SwFieldTypesEnum::Author)
m_xSelectionLB->append(sId, aLst[i]);
else
m_xSelectionLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
@@ -233,22 +233,22 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
switch (nTypeId)
{
- case TYP_DATEFLD:
- case TYP_TIMEFLD:
+ case SwFieldTypesEnum::Date:
+ case SwFieldTypesEnum::Time:
m_xSelectionLB->append(sId, aLst[i]);
if (static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && !i)
m_xSelectionLB->select_id(sId);
if (!static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && i)
m_xSelectionLB->select_id(sId);
break;
- case TYP_EXTUSERFLD:
- case TYP_DOCSTATFLD:
+ case SwFieldTypesEnum::ExtendedUser:
+ case SwFieldTypesEnum::DocumentStatistics:
m_xSelectionLB->append(sId, aLst[i]);
if (GetCurField()->GetSubType() == i)
m_xSelectionLB->select_id(sId);
break;
- case TYP_AUTHORFLD:
+ case SwFieldTypesEnum::Author:
{
const OUString sFormat(GetFieldMgr().GetFormatStr(nTypeId, i));
m_xSelectionLB->append(sId, sFormat);
@@ -272,10 +272,10 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
}
else
{
- AddSubType(TYP_PAGENUMBERFLD);
- AddSubType(TYP_PREVPAGEFLD);
- AddSubType(TYP_NEXTPAGEFLD);
- nTypeId = m_xSelectionLB->get_id(0).toUInt32();
+ AddSubType(SwFieldTypesEnum::PageNumber);
+ AddSubType(SwFieldTypesEnum::PreviousPage);
+ AddSubType(SwFieldTypesEnum::NextPage);
+ nTypeId = static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(0).toUInt32());
nCount = 3;
m_xSelectionLB->connect_changed(LINK(this, SwFieldDokPage, SubTypeHdl));
}
@@ -298,7 +298,7 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
switch (nTypeId)
{
- case TYP_DATEFLD:
+ case SwFieldTypesEnum::Date:
bFormat = bNumFormat = bOneArea = bOffset = true;
nFormatType = SvNumFormatType::DATE;
@@ -311,7 +311,7 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
m_xDateOffsetED->set_value( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() / 24 / 60);
break;
- case TYP_TIMEFLD:
+ case SwFieldTypesEnum::Time:
bFormat = bNumFormat = bOneArea = bOffset = true;
nFormatType = SvNumFormatType::TIME;
@@ -324,8 +324,8 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
m_xDateOffsetED->set_value( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() );
break;
- case TYP_PREVPAGEFLD:
- case TYP_NEXTPAGEFLD:
+ case SwFieldTypesEnum::PreviousPage:
+ case SwFieldTypesEnum::NextPage:
if (IsFieldEdit())
{
const sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
@@ -333,10 +333,10 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
if(SVX_NUM_CHAR_SPECIAL != nTmp)
{
sal_Int32 nOff = GetCurField()->GetPar2().toInt32();
- if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
+ if( SwFieldTypesEnum::NextPage == nTypeId && 1 != nOff )
m_xValueED->set_text(
OUString::number(nOff - 1) );
- else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
+ else if( SwFieldTypesEnum::PreviousPage == nTypeId && -1 != nOff )
m_xValueED->set_text(
OUString::number(nOff + 1) );
else
@@ -348,23 +348,23 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
bValue = true;
break;
- case TYP_CHAPTERFLD:
+ case SwFieldTypesEnum::Chapter:
m_xValueFT->set_label(SwResId(STR_LEVEL));
if (IsFieldEdit())
m_xLevelED->set_text(OUString::number(static_cast<SwChapterField*>(GetCurField())->GetLevel(GetWrtShell()->GetLayout()) + 1));
bLevel = true;
break;
- case TYP_PAGENUMBERFLD:
+ case SwFieldTypesEnum::PageNumber:
m_xValueFT->set_label( SwResId( STR_OFFSET ));
if (IsFieldEdit())
m_xValueED->set_text(GetCurField()->GetPar2());
bValue = true;
break;
- case TYP_EXTUSERFLD:
- case TYP_AUTHORFLD:
- case TYP_FILENAMEFLD:
+ case SwFieldTypesEnum::ExtendedUser:
+ case SwFieldTypesEnum::Author:
+ case SwFieldTypesEnum::Filename:
bFixed = true;
break;
@@ -416,9 +416,9 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, void)
m_xValueED->set_sensitive(bValue);
}
-void SwFieldDokPage::AddSubType(sal_uInt16 nTypeId)
+void SwFieldDokPage::AddSubType(SwFieldTypesEnum nTypeId)
{
- m_xSelectionLB->append(OUString::number(nTypeId), SwFieldType::GetTypeStr(nTypeId));
+ m_xSelectionLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldType::GetTypeStr(nTypeId));
}
IMPL_LINK_NOARG(SwFieldDokPage, SubTypeHdl, weld::TreeView&, void)
@@ -427,37 +427,38 @@ IMPL_LINK_NOARG(SwFieldDokPage, SubTypeHdl, weld::TreeView&, void)
if(nPos == -1)
nPos = 0;
- const sal_uInt16 nTypeId = m_xSelectionLB->get_id(nPos).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(nPos).toUInt32());
FillFormatLB(nTypeId);
const char* pTextRes = nullptr;
switch (nTypeId)
{
- case TYP_CHAPTERFLD:
+ case SwFieldTypesEnum::Chapter:
pTextRes = STR_LEVEL;
break;
- case TYP_PREVPAGEFLD:
- case TYP_NEXTPAGEFLD:
+ case SwFieldTypesEnum::PreviousPage:
+ case SwFieldTypesEnum::NextPage:
pTextRes = SVX_NUM_CHAR_SPECIAL == m_xFormatLB->get_selected_id().toUInt32()
? STR_VALUE : STR_OFFSET;
break;
- case TYP_PAGENUMBERFLD:
+ case SwFieldTypesEnum::PageNumber:
pTextRes = STR_OFFSET;
break;
+ default: break;
}
if (pTextRes)
m_xValueFT->set_label(SwResId(pTextRes));
}
-sal_Int32 SwFieldDokPage::FillFormatLB(sal_uInt16 nTypeId)
+sal_Int32 SwFieldDokPage::FillFormatLB(SwFieldTypesEnum nTypeId)
{
// fill Format-Listbox
m_xFormatLB->clear();
- if (nTypeId == TYP_AUTHORFLD)
+ if (nTypeId == SwFieldTypesEnum::Author)
return m_xFormatLB->n_children();
const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
@@ -489,18 +490,18 @@ sal_Int32 SwFieldDokPage::FillFormatLB(sal_uInt16 nTypeId)
IMPL_LINK_NOARG(SwFieldDokPage, FormatHdl, weld::TreeView&, void)
{
- sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
- if (nTypeId == USHRT_MAX)
+ if (nTypeId == SwFieldTypesEnum::Unknown)
{
sal_Int32 nPos = m_xSelectionLB->get_selected_index();
if(nPos == -1)
nPos = 0;
- nTypeId = m_xSelectionLB->get_id(nPos).toUInt32();
+ nTypeId = static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(nPos).toUInt32());
}
- if (nTypeId == TYP_NEXTPAGEFLD || nTypeId == TYP_PREVPAGEFLD)
+ if (nTypeId == SwFieldTypesEnum::NextPage || nTypeId == SwFieldTypesEnum::PreviousPage)
{
// Prev/Next - PageNumFields special treatment:
sal_uInt16 nTmp = m_xFormatLB->get_selected_id().toUInt32();
@@ -518,14 +519,14 @@ IMPL_LINK_NOARG(SwFieldDokPage, FormatHdl, weld::TreeView&, void)
bool SwFieldDokPage::FillItemSet(SfxItemSet* )
{
- sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
- if (nTypeId == USHRT_MAX)
+ if (nTypeId == SwFieldTypesEnum::Unknown)
{
sal_Int32 nPos = m_xSelectionLB->get_selected_index();
if(nPos == -1)
nPos = 0;
- nTypeId = m_xSelectionLB->get_id(nPos).toUInt32();
+ nTypeId = static_cast<SwFieldTypesEnum>(m_xSelectionLB->get_id(nPos).toUInt32());
}
OUString aVal(m_xValueED->get_text());
@@ -548,37 +549,37 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
switch (nTypeId)
{
- case TYP_AUTHORFLD:
+ case SwFieldTypesEnum::Author:
nFormat = nSubType;
nSubType = 0;
[[fallthrough]];
- case TYP_EXTUSERFLD:
+ case SwFieldTypesEnum::ExtendedUser:
nFormat |= m_xFixedCB->get_active() ? AF_FIXED : 0;
break;
- case TYP_FILENAMEFLD:
+ case SwFieldTypesEnum::Filename:
nFormat |= m_xFixedCB->get_active() ? FF_FIXED : 0;
break;
- case TYP_DATEFLD:
- case TYP_TIMEFLD:
+ case SwFieldTypesEnum::Date:
+ case SwFieldTypesEnum::Time:
{
nFormat = m_xNumFormatLB->GetFormat();
long nVal = static_cast< long >(m_xDateOffsetED->get_value());
- if (nTypeId == TYP_DATEFLD)
+ if (nTypeId == SwFieldTypesEnum::Date)
aVal = OUString::number(nVal * 60 * 24);
else
aVal = OUString::number(nVal);
break;
}
- case TYP_NEXTPAGEFLD:
- case TYP_PREVPAGEFLD:
- case TYP_PAGENUMBERFLD:
- case TYP_GETREFPAGEFLD:
+ case SwFieldTypesEnum::NextPage:
+ case SwFieldTypesEnum::PreviousPage:
+ case SwFieldTypesEnum::PageNumber:
+ case SwFieldTypesEnum::GetRefPage:
{
if( SVX_NUM_CHAR_SPECIAL != nFormat &&
- (TYP_PREVPAGEFLD == nTypeId || TYP_NEXTPAGEFLD == nTypeId))
+ (SwFieldTypesEnum::PreviousPage == nTypeId || SwFieldTypesEnum::NextPage == nTypeId))
{
sal_Int32 nVal = m_xValueED->get_text().toInt32();
aVal = OUString::number(nVal);
@@ -586,7 +587,7 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
break;
}
- case TYP_CHAPTERFLD:
+ case SwFieldTypesEnum::Chapter:
aVal = m_xLevelED->get_text();
break;
diff --git a/sw/source/ui/fldui/flddok.hxx b/sw/source/ui/fldui/flddok.hxx
index 88a7b3ecbee7..4ed50de52a38 100644
--- a/sw/source/ui/fldui/flddok.hxx
+++ b/sw/source/ui/fldui/flddok.hxx
@@ -48,8 +48,8 @@ class SwFieldDokPage : public SwFieldPage
DECL_LINK(FormatHdl, weld::TreeView&, void);
DECL_LINK(SubTypeHdl, weld::TreeView&, void);
- void AddSubType(sal_uInt16 nTypeId);
- sal_Int32 FillFormatLB(sal_uInt16 nTypeId);
+ void AddSubType(SwFieldTypesEnum nTypeId);
+ sal_Int32 FillFormatLB(SwFieldTypesEnum nTypeId);
protected:
virtual sal_uInt16 GetGroup() override;
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index aaaf1e21d28f..84074dd4b45a 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -161,7 +161,7 @@ void SwFieldEditDlg::Init()
rMgr.GoNext();
m_xPrevBT->set_sensitive( bMove );
- if (pCurField->GetTypeId() == TYP_EXTUSERFLD)
+ if (pCurField->GetTypeId() == SwFieldTypesEnum::ExtendedUser)
m_xAddressBT->set_sensitive(true);
else
m_xAddressBT->set_sensitive(false);
@@ -284,7 +284,7 @@ IMPL_LINK(SwFieldEditDlg, NextPrevHdl, weld::Button&, rButton, void)
SwFieldMgr& rMgr = pTabPage->GetFieldMgr();
SwField *pCurField = rMgr.GetCurField();
- if (pCurField->GetTypeId() == TYP_DBFLD)
+ if (pCurField->GetTypeId() == SwFieldTypesEnum::Database)
pOldTyp = pCurField->GetTyp();
rMgr.GoNextPrev( bNext, pOldTyp );
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index 26b32e94c3f6..2517ba7e684a 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -108,16 +108,16 @@ void SwFieldFuncPage::Reset(const SfxItemSet* )
// fill Typ-Listbox
for(sal_uInt16 i = rRg.nStart; i < rRg.nEnd; ++i)
{
- const sal_uInt16 nTypeId = SwFieldMgr::GetTypeId(i);
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
+ const SwFieldTypesEnum nTypeId = SwFieldMgr::GetTypeId(i);
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(i));
}
}
else
{
- const sal_uInt16 nTypeId = GetCurField()->GetTypeId();
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
+ const SwFieldTypesEnum nTypeId = GetCurField()->GetTypeId();
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
- if (nTypeId == TYP_MACROFLD)
+ if (nTypeId == SwFieldTypesEnum::Macro)
{
GetFieldMgr().SetMacroPath(GetCurField()->GetPar1());
}
@@ -207,7 +207,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
if (nOld == GetTypeSel())
return;
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
// fill Selection-Listbox
UpdateSubType();
@@ -225,7 +225,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
if (nSize)
{
- if (IsFieldEdit() && nTypeId == TYP_JUMPEDITFLD)
+ if (IsFieldEdit() && nTypeId == SwFieldTypesEnum::JumpEdit)
m_xFormatLB->select_text(SwResId(FMT_MARK_ARY[GetCurField()->GetFormat()]));
if (m_xFormatLB->get_selected_index() == -1)
@@ -236,8 +236,8 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
bool bFormat = nSize != 0;
// two controls for conditional text
- bool bDropDown = TYP_DROPDOWN == nTypeId;
- bool bCondTextField = TYP_CONDTXTFLD == nTypeId;
+ bool bDropDown = SwFieldTypesEnum::Dropdown == nTypeId;
+ bool bCondTextField = SwFieldTypesEnum::ConditionalText == nTypeId;
m_xCond1FT->set_visible(!bDropDown && bCondTextField);
m_xCond1ED->set_visible(!bDropDown && bCondTextField);
@@ -287,7 +287,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
switch (nTypeId)
{
- case TYP_MACROFLD:
+ case SwFieldTypesEnum::Macro:
bMacro = true;
if (!GetFieldMgr().GetMacroPath().isEmpty())
bValue = true;
@@ -301,7 +301,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
m_xValueED->set_accessible_name(m_xValueFT->get_label());
break;
- case TYP_HIDDENPARAFLD:
+ case SwFieldTypesEnum::HiddenParagraph:
m_xNameFT->set_label(SwResId(STR_COND));
m_xNameED->SetDropEnable(true);
bName = true;
@@ -309,7 +309,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
m_xValueED->set_accessible_name(m_xValueFT->get_label());
break;
- case TYP_HIDDENTXTFLD:
+ case SwFieldTypesEnum::HiddenText:
{
m_xNameFT->set_label(SwResId(STR_COND));
m_xNameED->SetDropEnable(true);
@@ -323,7 +323,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
}
break;
- case TYP_CONDTXTFLD:
+ case SwFieldTypesEnum::ConditionalText:
m_xNameFT->set_label(SwResId(STR_COND));
m_xNameED->SetDropEnable(true);
if (IsFieldEdit())
@@ -338,7 +338,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
m_xValueED->set_accessible_name(m_xValueFT->get_label());
break;
- case TYP_JUMPEDITFLD:
+ case SwFieldTypesEnum::JumpEdit:
m_xNameFT->set_label(SwResId(STR_JUMPEDITFLD));
m_xValueFT->set_label(SwResId(STR_PROMPT));
bName = bValue = true;
@@ -346,14 +346,14 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
m_xValueED->set_accessible_name(m_xValueFT->get_label());
break;
- case TYP_INPUTFLD:
+ case SwFieldTypesEnum::Input:
m_xValueFT->set_label(SwResId(STR_PROMPT));
bValue = true;
m_xNameED->set_accessible_name(m_xNameFT->get_label());
m_xValueED->set_accessible_name(m_xValueFT->get_label());
break;
- case TYP_COMBINED_CHARS:
+ case SwFieldTypesEnum::CombinedChars:
{
m_xNameFT->set_label(SwResId(STR_COMBCHRS_FT));
m_xNameED->SetDropEnable(true);
@@ -366,7 +366,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
m_xValueED->set_accessible_name(m_xValueFT->get_label());
}
break;
- case TYP_DROPDOWN :
+ case SwFieldTypesEnum::Dropdown :
break;
default:
break;
@@ -385,9 +385,9 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, void)
IMPL_LINK_NOARG(SwFieldFuncPage, SelectHdl, weld::TreeView&, void)
{
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
- if( TYP_MACROFLD == nTypeId )
+ if( SwFieldTypesEnum::Macro == nTypeId )
m_xNameED->set_text( m_xSelectionLB->get_selected_text() );
}
@@ -472,7 +472,7 @@ IMPL_LINK_NOARG(SwFieldFuncPage, ListEnableHdl, weld::Entry&, void)
// renew types in SelectionBox
void SwFieldFuncPage::UpdateSubType()
{
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
// fill Selection-Listbox
m_xSelectionLB->freeze();
@@ -493,7 +493,7 @@ void SwFieldFuncPage::UpdateSubType()
if (bEnable)
m_xSelectionLB->select(0);
- if (nTypeId == TYP_MACROFLD)
+ if (nTypeId == SwFieldTypesEnum::Macro)
{
const bool bHasMacro = !GetFieldMgr().GetMacroPath().isEmpty();
@@ -515,7 +515,7 @@ IMPL_LINK_NOARG( SwFieldFuncPage, MacroHdl, weld::Button&, void)
bool SwFieldFuncPage::FillItemSet(SfxItemSet* )
{
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
sal_uInt16 nSubType = 0;
@@ -528,7 +528,7 @@ bool SwFieldFuncPage::FillItemSet(SfxItemSet* )
switch(nTypeId)
{
- case TYP_INPUTFLD:
+ case SwFieldTypesEnum::Input:
nSubType = INP_TXT;
// to prevent removal of CR/LF restore old content
if (!m_xNameED->get_value_changed_from_saved() && IsFieldEdit())
@@ -536,15 +536,15 @@ bool SwFieldFuncPage::FillItemSet(SfxItemSet* )
break;
- case TYP_MACROFLD:
+ case SwFieldTypesEnum::Macro:
// use the full script URL, not the name in the Edit control
aName = GetFieldMgr().GetMacroPath();
break;
- case TYP_CONDTXTFLD:
+ case SwFieldTypesEnum::ConditionalText:
aVal = m_xCond1ED->get_text() + "|" + m_xCond2ED->get_text();
break;
- case TYP_DROPDOWN :
+ case SwFieldTypesEnum::Dropdown :
{
aName = m_xListNameED->get_text();
for (sal_Int32 i = 0, nEntryCount = m_xListItemsLB->n_children(); i < nEntryCount; ++i)
@@ -601,9 +601,9 @@ IMPL_LINK_NOARG(SwFieldFuncPage, ModifyHdl, weld::Entry&, void)
const sal_Int32 nLen = m_xNameED->get_text().getLength();
bool bEnable = true;
- sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
- if( TYP_COMBINED_CHARS == nTypeId &&
+ if( SwFieldTypesEnum::CombinedChars == nTypeId &&
(!nLen || nLen > MAX_COMBINED_CHARACTERS ))
bEnable = false;
diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 705ec45fdc7c..b200528674a5 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -114,7 +114,7 @@ void SwFieldPage::EditNewField( bool bOnlyActivate )
}
// insert field
-void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUString& rPar1,
+void SwFieldPage::InsertField(SwFieldTypesEnum nTypeId, sal_uInt16 nSubType, const OUString& rPar1,
const OUString& rPar2, sal_uInt32 nFormatId,
sal_Unicode cSeparator, bool bIsAutomaticLanguage)
{
@@ -132,11 +132,11 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
pView->GetViewFrame()->GetBindings().GetRecorder();
if ( xRecorder.is() )
{
- bool bRecordDB = TYP_DBFLD == nTypeId ||
- TYP_DBSETNUMBERFLD == nTypeId ||
- TYP_DBNUMSETFLD == nTypeId ||
- TYP_DBNEXTSETFLD == nTypeId ||
- TYP_DBNAMEFLD == nTypeId ;
+ bool bRecordDB = SwFieldTypesEnum::Database == nTypeId ||
+ SwFieldTypesEnum::DatabaseSetNumber == nTypeId ||
+ SwFieldTypesEnum::DatabaseNumberSet == nTypeId ||
+ SwFieldTypesEnum::DatabaseNextSet == nTypeId ||
+ SwFieldTypesEnum::DatabaseName == nTypeId ;
SfxRequest aReq( pView->GetViewFrame(),
bRecordDB ? FN_INSERT_DBFIELD : FN_INSERT_FIELD );
@@ -159,7 +159,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
(FN_PARAM_3, OUString(cSeparator)));
aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_SUBTYPE, nSubType));
}
- aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_TYPE , nTypeId));
+ aReq.AppendItem(SfxUInt16Item(FN_PARAM_FIELD_TYPE , static_cast<sal_uInt16>(nTypeId)));
aReq.AppendItem(SfxStringItem(FN_PARAM_FIELD_CONTENT, rPar2));
aReq.AppendItem(SfxUInt32Item(FN_PARAM_FIELD_FORMAT , nFormatId));
aReq.Done();
@@ -174,16 +174,16 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
OUString sPar2(rPar2);
switch( nTypeId )
{
- case TYP_DATEFLD:
- case TYP_TIMEFLD:
- nSubType = static_cast< sal_uInt16 >(((nTypeId == TYP_DATEFLD) ? DATEFLD : TIMEFLD) |
+ case SwFieldTypesEnum::Date:
+ case SwFieldTypesEnum::Time:
+ nSubType = static_cast< sal_uInt16 >(((nTypeId == SwFieldTypesEnum::Date) ? DATEFLD : TIMEFLD) |
((nSubType == DATE_VAR) ? 0 : FIXEDFLD));
break;
- case TYP_DBNAMEFLD:
- case TYP_DBNEXTSETFLD:
- case TYP_DBNUMSETFLD:
- case TYP_DBSETNUMBERFLD:
+ case SwFieldTypesEnum::DatabaseName:
+ case SwFieldTypesEnum::DatabaseNextSet:
+ case SwFieldTypesEnum::DatabaseNumberSet:
+ case SwFieldTypesEnum::DatabaseSetNumber:
{
sal_Int32 nPos = 0;
SwDBData aData;
@@ -197,7 +197,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
}
break;
- case TYP_DBFLD:
+ case SwFieldTypesEnum::Database:
{
SwDBData aData;
sal_Int32 nIdx{ 0 };
@@ -224,7 +224,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
}
break;
- case TYP_SEQFLD:
+ case SwFieldTypesEnum::Sequence:
{
SwSetExpFieldType* pTyp = static_cast<SwSetExpFieldType*>(pTmpField->GetTyp());
pTyp->SetOutlineLvl( static_cast< sal_uInt8 >(nSubType & 0xff));
@@ -234,7 +234,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
}
break;
- case TYP_INPUTFLD:
+ case SwFieldTypesEnum::Input:
{
// User- or SetField ?
if (m_aMgr.GetFieldType(SwFieldIds::User, sPar1) == nullptr &&
@@ -246,7 +246,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
}
}
break;
- case TYP_DOCINFOFLD:
+ case SwFieldTypesEnum::DocumentInfo:
{
if( nSubType == nsSwDocInfoSubType::DI_CUSTOM )
{
@@ -255,6 +255,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
}
}
break;
+ default: break;
}
pSh->StartAllAction();
@@ -268,10 +269,11 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS
switch (nTypeId)
{
- case TYP_HIDDENTXTFLD:
- case TYP_HIDDENPARAFLD:
+ case SwFieldTypesEnum::HiddenText:
+ case SwFieldTypesEnum::HiddenParagraph:
m_aMgr.EvalExpFields(pSh);
break;
+ default: break;
}
pSh->SetUndoNoResetModified();
diff --git a/sw/source/ui/fldui/fldpage.hxx b/sw/source/ui/fldui/fldpage.hxx
index f09d368ba4f5..4cb0115f3d35 100644
--- a/sw/source/ui/fldui/fldpage.hxx
+++ b/sw/source/ui/fldui/fldpage.hxx
@@ -62,7 +62,7 @@ protected:
bool IsFieldEdit() const { return m_bFieldEdit; }
// insert field
- void InsertField(sal_uInt16 nTypeId,
+ void InsertField(SwFieldTypesEnum nTypeId,
sal_uInt16 nSubType,
const OUString& rPar1,
const OUString& rPar2,
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index d034a61337da..ca2ed6d5cb1e 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -173,11 +173,11 @@ void SwFieldRefPage::Reset(const SfxItemSet* )
for (short i = rRg.nStart; i < rRg.nEnd; ++i)
{
- const sal_uInt16 nTypeId = SwFieldMgr::GetTypeId(i);
+ const SwFieldTypesEnum nTypeId = SwFieldMgr::GetTypeId(i);
- if (!IsFieldEdit() || nTypeId != TYP_SETREFFLD)
+ if (!IsFieldEdit() || nTypeId != SwFieldTypesEnum::SetRef)
{
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(i));
}
}
@@ -372,14 +372,14 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, weld::TreeView&, void)
switch (nTypeId)
{
- case TYP_GETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef):
if (REFFLDFLAG & m_xTypeLB->get_id(nOld).toUInt32())
// the old one stays
nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
bName = true;
break;
- case TYP_SETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::SetRef):
bName = true;
break;
@@ -390,7 +390,7 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, weld::TreeView&, void)
if( REFFLDFLAG & nTypeId )
{
const sal_uInt16 nOldId = nOld != -1 ? m_xTypeLB->get_id(nOld).toUInt32() : 0;
- if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
+ if( nOldId & REFFLDFLAG || nOldId == static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef) )
// then the old one stays
nFieldDlgFormatSel = m_xFormatLB->get_selected_index();
}
@@ -426,7 +426,7 @@ void SwFieldRefPage::SubTypeHdl()
switch(nTypeId)
{
- case TYP_GETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef):
if (!IsFieldEdit() || m_xSelectionLB->get_selected_index() != -1)
{
m_xNameED->set_text(m_xSelectionLB->get_selected_text());
@@ -434,7 +434,7 @@ void SwFieldRefPage::SubTypeHdl()
}
break;
- case TYP_SETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::SetRef):
{
SwWrtShell *pSh = GetWrtShell();
if(!pSh)
@@ -655,7 +655,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString)
else
{
std::vector<OUString> aLst;
- GetFieldMgr().GetSubTypes(nTypeId, aLst);
+ GetFieldMgr().GetSubTypes(static_cast<SwFieldTypesEnum>(nTypeId), aLst);
for(const OUString & i : aLst)
{
bool isSubstring = MatchSubstring( i , filterString );
@@ -769,7 +769,7 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
bAddCrossRefFormats = true;
[[fallthrough]];
- case TYP_GETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef):
case REFFLDFLAG_BOOKMARK:
case REFFLDFLAG_FOOTNOTE:
case REFFLDFLAG_ENDNOTE:
@@ -785,18 +785,19 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
}
else
{
- nSize = GetFieldMgr().GetFormatCount( nTypeId, IsFieldDlgHtmlMode() );
+ nSize = GetFieldMgr().GetFormatCount( static_cast<SwFieldTypesEnum>(nTypeId), IsFieldDlgHtmlMode() );
}
break;
}
if (REFFLDFLAG & nTypeId)
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
+ SwFieldTypesEnum nFieldType = static_cast<SwFieldTypesEnum>(nTypeId);
for (sal_uInt16 i = 0; i < nSize; i++)
{
- OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i )));
- m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nTypeId, i));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId( nFieldType, i )));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr(nFieldType, i));
}
// #i83479#
@@ -804,14 +805,14 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
if ( bAddCrossRefFormats )
{
sal_uInt16 nFormat = FMT_REF_NUMBER_IDX;
- OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
- m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat)));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nFieldType, nFormat ));
nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX;
- sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
- m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nFieldType, nFormat ));
nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX;
- sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
- m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nTypeId, nFormat ));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat));
+ m_xFormatLB->append(sId, GetFieldMgr().GetFormatStr( nFieldType, nFormat ));
nExtraSize = 3;
}
@@ -823,42 +824,42 @@ sal_Int32 SwFieldRefPage::FillFormatLB(sal_uInt16 nTypeId)
{
for (sal_uInt16 i = 0; i < nSize; i++)
{
- OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i + SAL_N_ELEMENTS(FMT_REF_ARY))));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId( nFieldType, i + SAL_N_ELEMENTS(FMT_REF_ARY))));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, i ));
}
nExtraSize += nSize;
if ( bAddCrossRefFormats )
{
sal_uInt16 nFormat = FMT_REF_NUMBER_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
- OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat)));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
- sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX + SAL_N_ELEMENTS(FMT_REF_ARY);
- sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_LOWERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nExtraSize += 3;
}
// uppercase article
for (sal_uInt16 i = 0; i < nSize; i++)
{
- OUString sId(OUString::number(GetFieldMgr().GetFormatId( nTypeId, i + 2 * SAL_N_ELEMENTS(FMT_REF_ARY))));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, i ));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId( nFieldType, i + 2 * SAL_N_ELEMENTS(FMT_REF_ARY))));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, i ));
}
nExtraSize += nSize;
if ( bAddCrossRefFormats )
{
sal_uInt16 nFormat = FMT_REF_NUMBER_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
- OUString sId(OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat)));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
+ OUString sId(OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat)));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_NO_CONTEXT_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
- sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nFormat = FMT_REF_NUMBER_FULL_CONTEXT_IDX + 2 * SAL_N_ELEMENTS(FMT_REF_ARY);
- sId = OUString::number(GetFieldMgr().GetFormatId(nTypeId, nFormat));
- m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nTypeId, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
+ sId = OUString::number(GetFieldMgr().GetFormatId(nFieldType, nFormat));
+ m_xFormatLB->append(sId, SwResId(FMT_REF_WITH_UPPERCASE_HU_ARTICLE) + GetFieldMgr().GetFormatStr( nFieldType, nFormat % SAL_N_ELEMENTS(FMT_REF_ARY)));
nExtraSize += 3;
}
}
@@ -894,8 +895,8 @@ IMPL_LINK_NOARG(SwFieldRefPage, ModifyHdl, weld::Entry&, void)
bool bEnable = true;
sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
- if ((nTypeId == TYP_SETREFFLD && !GetFieldMgr().CanInsertRefMark(aName)) ||
- (bEmptyName && (nTypeId == TYP_GETREFFLD || nTypeId == TYP_SETREFFLD ||
+ if ((nTypeId == static_cast<sal_uInt16>(SwFieldTypesEnum::SetRef) && !GetFieldMgr().CanInsertRefMark(aName)) ||
+ (bEmptyName && (nTypeId == static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef) || nTypeId == static_cast<sal_uInt16>(SwFieldTypesEnum::SetRef) ||
nTypeId == REFFLDFLAG_BOOKMARK)))
bEnable = false;
@@ -919,11 +920,11 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
switch(nTypeId)
{
- case TYP_GETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef):
nSubType = REF_SETREFATTR;
break;
- case TYP_SETREFFLD:
+ case static_cast<sal_uInt16>(SwFieldTypesEnum::SetRef):
{
SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::SetExp, aName);
@@ -948,7 +949,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
if (nTypeId == REFFLDFLAG_BOOKMARK) // text marks!
{
aName = m_xNameED->get_text();
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_BOOKMARK;
}
else if (REFFLDFLAG_FOOTNOTE == nTypeId) // footnotes
@@ -958,7 +959,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
size_t nPos = 0;
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_FOOTNOTE;
aName.clear();
@@ -979,7 +980,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
size_t nPos = 0;
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_ENDNOTE;
aName.clear();
@@ -1009,7 +1010,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
*(maOutlineNodes[nOutlIdx]),
IDocumentMarkAccess::MarkType::CROSSREF_HEADING_BOOKMARK);
aName = pMark->GetName();
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_BOOKMARK;
}
}
@@ -1029,7 +1030,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
*(maNumItems[nNumItemIdx]->GetTextNode()),
IDocumentMarkAccess::MarkType::CROSSREF_NUMITEM_BOOKMARK);
aName = pMark->GetName();
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_BOOKMARK;
}
}
@@ -1046,7 +1047,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
size_t nPos = 0;
- nTypeId = TYP_GETREFFLD;
+ nTypeId = static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef);
nSubType = REF_SEQUENCEFLD;
aName = pType->GetName();
@@ -1064,7 +1065,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
}
}
- if (IsFieldEdit() && nTypeId == TYP_GETREFFLD)
+ if (IsFieldEdit() && nTypeId == static_cast<sal_uInt16>(SwFieldTypesEnum::GetRef))
{
aVal = OUString::number(nSubType) + "|" + aVal;
}
@@ -1076,7 +1077,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* )
m_xSelectionLB->get_value_changed_from_saved() ||
m_xFormatLB->get_value_changed_from_saved())
{
- InsertField( nTypeId, nSubType, aName, aVal, nFormat );
+ InsertField( static_cast<SwFieldTypesEnum>(nTypeId), nSubType, aName, aVal, nFormat );
}
ModifyHdl(*m_xNameED); // enable/disable insert if applicable
diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx
index b56f88bd4470..c22517e3cf4d 100644
--- a/sw/source/ui/fldui/fldvar.cxx
+++ b/sw/source/ui/fldui/fldvar.cxx
@@ -96,7 +96,7 @@ void SwFieldVarPage::Reset(const SfxItemSet* )
m_xTypeLB->freeze();
m_xTypeLB->clear();
- sal_uInt16 nTypeId;
+ SwFieldTypesEnum nTypeId;
if (!IsFieldEdit())
{
@@ -106,7 +106,7 @@ void SwFieldVarPage::Reset(const SfxItemSet* )
for (short i = rRg.nStart; i < rRg.nEnd; ++i)
{
nTypeId = SwFieldMgr::GetTypeId(i);
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(i));
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(i));
}
}
else
@@ -114,9 +114,9 @@ void SwFieldVarPage::Reset(const SfxItemSet* )
const SwField* pCurField = GetCurField();
assert(pCurField && "<SwFieldVarPage::Reset(..)> - <SwField> instance missing!");
nTypeId = pCurField->GetTypeId();
- if (nTypeId == TYP_SETINPFLD)
- nTypeId = TYP_INPUTFLD;
- m_xTypeLB->append(OUString::number(nTypeId), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
+ if (nTypeId == SwFieldTypesEnum::SetInput)
+ nTypeId = SwFieldTypesEnum::Input;
+ m_xTypeLB->append(OUString::number(static_cast<sal_uInt16>(nTypeId)), SwFieldMgr::GetTypeStr(SwFieldMgr::GetPos(nTypeId)));
m_xNumFormatLB->SetAutomaticLanguage(pCurField->IsAutomaticLanguage());
SwWrtShell *pSh = GetWrtShell();
if(!pSh)
@@ -220,7 +220,7 @@ IMPL_LINK( SwFieldVarPage, SubTypeListBoxHdl, weld::TreeView&, rBox, void )
void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
{
- sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
sal_Int32 nSelPos = m_xSelectionLB->get_selected_index();
size_t nSelData = SIZE_MAX;
@@ -229,7 +229,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
if (IsFieldEdit() && (!pBox || bInit))
{
- if (nTypeId != TYP_FORMELFLD)
+ if (nTypeId != SwFieldTypesEnum::Formel)
m_xNameED->set_text(GetFieldMgr().GetCurFieldPar1());
m_xValueED->set_text(GetFieldMgr().GetCurFieldPar2());
@@ -250,7 +250,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
switch (nTypeId)
{
- case TYP_USERFLD:
+ case SwFieldTypesEnum::User:
{
// change or create user type
SwUserFieldType* pType = static_cast<SwUserFieldType*>(
@@ -290,7 +290,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
break;
}
- case TYP_SETFLD:
+ case SwFieldTypesEnum::Set:
bValue = true;
bNumFormat = bInvisible = true;
@@ -339,7 +339,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
m_xValueED->SetDropEnable(true);
break;
- case TYP_FORMELFLD:
+ case SwFieldTypesEnum::Formel:
{
bValue = true;
bNumFormat = true;
@@ -348,7 +348,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
}
break;
- case TYP_GETFLD:
+ case SwFieldTypesEnum::Get:
{
if (!IsFieldEdit())
{
@@ -387,7 +387,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
}
break;
- case TYP_INPUTFLD:
+ case SwFieldTypesEnum::Input:
m_xValueFT->set_label(SwResId(STR_PROMPT));
if (nSelPos != -1)
@@ -398,10 +398,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
m_xNameED->set_text( sName );
// User- or SetField ?
- const sal_uInt16 nInpType = static_cast< sal_uInt16 >
- (GetFieldMgr().GetFieldType(SwFieldIds::User, sName) ? 0 : TYP_SETINPFLD);
-
- if (nInpType) // SETEXPFLD
+ if (GetFieldMgr().GetFieldType(SwFieldIds::User, sName))
{
// is there a corresponding SetField
SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>(
@@ -424,7 +421,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
}
break;
- case TYP_DDEFLD:
+ case SwFieldTypesEnum::DDE:
m_xValueFT->set_label(SwResId(STR_DDE_CMD));
if (IsFieldEdit() || pBox) // only when interacting via mouse
@@ -453,7 +450,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
bName = bValue = true;
break;
- case TYP_SEQFLD:
+ case SwFieldTypesEnum::Sequence:
{
bName = bValue = bShowChapterFrame = true;
@@ -491,7 +488,7 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
}
break;
- case TYP_SETREFPAGEFLD:
+ case SwFieldTypesEnum::SetRefPage:
{
bValue = false;
m_xValueFT->set_label( SwResId( STR_OFFSET ));
@@ -508,10 +505,12 @@ void SwFieldVarPage::SubTypeHdl(const weld::TreeView* pBox)
}
break;
- case TYP_GETREFPAGEFLD:
+ case SwFieldTypesEnum::GetRefPage:
m_xNameED->set_text(OUString());
m_xValueED->set_text(OUString());
break;
+
+ default: break;
}
m_xNumFormatLB->set_visible(bNumFormat);
@@ -537,8 +536,8 @@ IMPL_LINK(SwFieldVarPage, SubTypeInsertHdl, weld::TreeView&, rBox, void)
{
if (!bInit)
{
- sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
- if (nTypeId == TYP_FORMELFLD)
+ SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
+ if (nTypeId == SwFieldTypesEnum::Formel)
{
auto nSelPos = m_xSelectionLB->get_selected_index();
if (nSelPos != -1)
@@ -565,13 +564,13 @@ void SwFieldVarPage::UpdateSubType()
m_xSelectionLB->freeze();
m_xSelectionLB->clear();
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
std::vector<OUString> aList;
GetFieldMgr().GetSubTypes(nTypeId, aList);
const size_t nCount = aList.size();
for (size_t i = 0; i < nCount; ++i)
{
- if (nTypeId != TYP_INPUTFLD || i)
+ if (nTypeId != SwFieldTypesEnum::Input || i)
{
if (!IsFieldEdit())
{
@@ -583,22 +582,22 @@ void SwFieldVarPage::UpdateSubType()
switch (nTypeId)
{
- case TYP_INPUTFLD:
+ case SwFieldTypesEnum::Input:
if (GetCurField() && aList[i] == GetCurField()->GetPar1())
bInsert = true;
break;
- case TYP_FORMELFLD:
+ case SwFieldTypesEnum::Formel:
bInsert = true;
break;
- case TYP_GETFLD:
+ case SwFieldTypesEnum::Get:
if (GetCurField() && aList[i] == static_cast<const SwFormulaField*>(GetCurField())->GetFormula())
bInsert = true;
break;
- case TYP_SETFLD:
- case TYP_USERFLD:
+ case SwFieldTypesEnum::Set:
+ case SwFieldTypesEnum::User:
if (GetCurField() && aList[i] == GetCurField()->GetTyp()->GetName())
{
bInsert = true;
@@ -607,7 +606,7 @@ void SwFieldVarPage::UpdateSubType()
}
break;
- case TYP_SETREFPAGEFLD:
+ case SwFieldTypesEnum::SetRefPage:
{
if (GetCurField() != nullptr
&& ((static_cast<SwRefPageSetField*>(GetCurField())->IsOn()
@@ -630,7 +629,7 @@ void SwFieldVarPage::UpdateSubType()
if (bInsert)
{
m_xSelectionLB->append(OUString::number(i), aList[i]);
- if (nTypeId != TYP_FORMELFLD)
+ if (nTypeId != SwFieldTypesEnum::Formel)
break;
}
}
@@ -659,7 +658,7 @@ void SwFieldVarPage::UpdateSubType()
SubTypeHdl(pLB);
}
-void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
+void SwFieldVarPage::FillFormatLB(SwFieldTypesEnum nTypeId)
{
OUString sOldSel;
const sal_Int32 nFormatSel = m_xFormatLB->get_selected_index();
@@ -683,7 +682,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
m_xNumFormatLB->clear(); // flags list as dirty and needing refilling with stock entries
bool bSpecialFormat = false;
- if( TYP_GETREFPAGEFLD != nTypeId )
+ if( SwFieldTypesEnum::GetRefPage != nTypeId )
{
if (GetCurField() != nullptr && IsFieldEdit())
{
@@ -694,7 +693,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
m_xNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
sOldNumSel.clear();
}
- else if (nTypeId == TYP_GETFLD || nTypeId == TYP_FORMELFLD)
+ else if (nTypeId == SwFieldTypesEnum::Get || nTypeId == SwFieldTypesEnum::Formel)
{
m_xNumFormatLB->SetFormatType(SvNumFormatType::NUMBER);
}
@@ -710,7 +709,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
switch (nTypeId)
{
- case TYP_USERFLD:
+ case SwFieldTypesEnum::User:
{
if (!IsFieldEdit() || bSpecialFormat)
{
@@ -721,7 +720,7 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
}
break;
- case TYP_SETFLD:
+ case SwFieldTypesEnum::Set:
{
if (!IsFieldEdit() || bSpecialFormat)
{
@@ -731,24 +730,26 @@ void SwFieldVarPage::FillFormatLB(sal_uInt16 nTypeId)
}
break;
- case TYP_FORMELFLD:
+ case SwFieldTypesEnum::Formel:
{
OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND));
rWidget.insert(0, SwResId(FMT_GETVAR_NAME), &sId, nullptr, nullptr);
}
break;
- case TYP_GETFLD:
+ case SwFieldTypesEnum::Get:
{
OUString sId(OUString::number(NUMBERFORMAT_ENTRY_NOT_FOUND));
rWidget.insert(0, SwResId(FMT_GETVAR_NAME), &sId, nullptr, nullptr);
}
break;
+
+ default: break;
}
if (IsFieldEdit() && bSpecialFormat)
{
- if (nTypeId == TYP_USERFLD && (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_CMD))
+ if (nTypeId == SwFieldTypesEnum::User && (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_CMD))
rWidget.select(1);
else
rWidget.select(0);
@@ -796,7 +797,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
{
OUString sValue(m_xValueED->get_text());
bool bHasValue = !sValue.isEmpty();
- const sal_uInt16 nTypeId = m_xTypeLB->get_id(GetTypeSel()).toUInt32();
+ const SwFieldTypesEnum nTypeId = static_cast<SwFieldTypesEnum>(m_xTypeLB->get_id(GetTypeSel()).toUInt32());
bool bInsert = false, bApply = false, bDelete = false;
OUString sName( m_xNameED->get_text() );
@@ -804,10 +805,10 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
switch( nTypeId )
{
- case TYP_DDEFLD:
- case TYP_USERFLD:
- case TYP_SETFLD:
- case TYP_SEQFLD:
+ case SwFieldTypesEnum::DDE:
+ case SwFieldTypesEnum::User:
+ case SwFieldTypesEnum::Set:
+ case SwFieldTypesEnum::Sequence:
SwCalc::IsValidVarName( sName, &sName );
if ( sName.getLength() != nLen )
{
@@ -818,12 +819,13 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
m_xNameED->select_region(nStartPos, nEndPos); // restore Cursorpos
}
break;
+ default: break;
}
// check buttons
switch (nTypeId)
{
- case TYP_DDEFLD:
+ case SwFieldTypesEnum::DDE:
if( nLen )
{
// is there already a corresponding type
@@ -839,7 +841,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
}
break;
- case TYP_USERFLD:
+ case SwFieldTypesEnum::User:
if( nLen )
{
// is there already a corresponding type
@@ -864,7 +866,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
default:
bInsert = true;
- if (nTypeId == TYP_SETFLD || nTypeId == TYP_SEQFLD)
+ if (nTypeId == SwFieldTypesEnum::Set || nTypeId == SwFieldTypesEnum::Sequence)
{
SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(
GetFieldMgr().GetFieldType(SwFieldIds::SetExp, sName));
@@ -890,10 +892,10 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
if (i >= INIT_FLDTYPES && !pSh->IsUsed(*pFieldType))
bDelete = true;
- if (nTypeId == TYP_SEQFLD && !(pFieldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
+ if (nTypeId == SwFieldTypesEnum::Sequence && !(pFieldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
bInsert = false;
- if (nTypeId == TYP_SETFLD && (pFieldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
+ if (nTypeId == SwFieldTypesEnum::Set && (pFieldType->GetType() & nsSwGetSetExpType::GSE_SEQ))
bInsert = false;
}
}
@@ -901,11 +903,11 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, weld::Entry&, void)
bInsert = false;
}
- if (!nLen && (nTypeId == TYP_SETFLD || nTypeId == TYP_INPUTFLD ||
- (!IsFieldEdit() && nTypeId == TYP_GETFLD ) ) )
+ if (!nLen && (nTypeId == SwFieldTypesEnum::Set || nTypeId == SwFieldTypesEnum::Input ||
+ (!IsFieldEdit() && nTypeId == SwFieldTypesEnum::Get ) ) )
bInsert = false;
- if( (nTypeId == TYP_SETFLD || nTypeId == TYP_FORMELFLD) &&
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list