diff options
98 files changed, 1012 insertions, 983 deletions
diff --git a/sw/README b/sw/README index 4fe43ff8f40e..ea6c88257f55 100644 --- a/sw/README +++ b/sw/README @@ -109,7 +109,7 @@ There are several sub-categories of SwTextAttr: There are multiple model classes involved for fields: -- enum RES_FIELDS enumerates the different types of fields. +- enum SwFieldIds enumerates the different types of fields. - SwFieldType contains some shared stuff for all fields of a type. There are many subclasses of SwFieldType, one for each different type of field. @@ -117,7 +117,7 @@ There are multiple model classes involved for fields: which is created in DocumentFieldsManager::InitFieldTypes() but for some there are more than one, and they are dynamically created, see DocumentFieldsManager::InsertFieldType(). An example for the latter are - variable fields (RES_GETEXPFLD/RES_SETEXPFLD), with one SwFieldType per + variable fields (SwFieldIds::GetExp/SwFieldIds::SetExp), with one SwFieldType per variable. - SwXFieldMaster is the UNO wrapper of a field type. It is a SwClient registered at the SwFieldType. diff --git a/sw/inc/IDocumentFieldsAccess.hxx b/sw/inc/IDocumentFieldsAccess.hxx index 83d65b5ca109..c78e5a249b3b 100644 --- a/sw/inc/IDocumentFieldsAccess.hxx +++ b/sw/inc/IDocumentFieldsAccess.hxx @@ -36,6 +36,7 @@ class DateTime; class SetGetExpField; struct SwHash; class SwNode; +enum class SwFieldIds : sal_uInt16; namespace rtl { class OUString; } using rtl::OUString; @@ -50,9 +51,9 @@ namespace com { namespace sun { namespace star { namespace uno { class Any; } } virtual SwFieldType *InsertFieldType(const SwFieldType &) = 0; - virtual SwFieldType *GetSysFieldType( const sal_uInt16 eWhich ) const = 0; + virtual SwFieldType *GetSysFieldType( const SwFieldIds eWhich ) const = 0; - virtual SwFieldType* GetFieldType(sal_uInt16 nResId, const OUString& rName, bool bDbFieldMatching) const = 0; + virtual SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName, bool bDbFieldMatching) const = 0; virtual void RemoveFieldType(size_t nField) = 0; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 554a6c37c919..064990b927c0 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -685,7 +685,7 @@ public: bool MoveFieldType( const SwFieldType* pFieldType, const bool bNext, - const sal_uInt16 nResType = USHRT_MAX, + const SwFieldIds nResType = SwFieldIds::Unknown, const bool bAddSetExpressionFieldsToInputFields = true ); bool GotoFormatField( const SwFormatField& rField ); diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 4fede714eed3..cf8f91d96bc6 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -370,12 +370,12 @@ public: void UpdateFields( SwField & ); ///< One single field. - size_t GetFieldTypeCount(sal_uInt16 nResId = USHRT_MAX) const; - SwFieldType* GetFieldType(size_t nField, sal_uInt16 nResId = USHRT_MAX) const; - SwFieldType* GetFieldType(sal_uInt16 nResId, const OUString& rName) const; + size_t GetFieldTypeCount(SwFieldIds nResId = SwFieldIds::Unknown) const; + SwFieldType* GetFieldType(size_t nField, SwFieldIds nResId = SwFieldIds::Unknown) const; + SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const; void RemoveFieldType(size_t nField); - void RemoveFieldType(sal_uInt16 nResId, const OUString& rName); + void RemoveFieldType(SwFieldIds nResId, const OUString& rName); void FieldToText( SwFieldType* pType ); diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index ed520543f4a3..59bd4b00b05b 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -32,50 +32,51 @@ class SwDoc; class SvNumberFormatter; -enum RES_FIELDS { +enum class SwFieldIds : sal_uInt16 { /// For old documents the Field-Which IDs must be preserved !!! - RES_FIELDS_BEGIN, - RES_DBFLD = RES_FIELDS_BEGIN, - RES_USERFLD, - RES_FILENAMEFLD, - RES_DBNAMEFLD, - RES_DATEFLD, - RES_TIMEFLD, - RES_PAGENUMBERFLD, - RES_AUTHORFLD, - RES_CHAPTERFLD, - RES_DOCSTATFLD, - RES_GETEXPFLD, - RES_SETEXPFLD, - RES_GETREFFLD, - RES_HIDDENTXTFLD, - RES_POSTITFLD, - RES_FIXDATEFLD, - RES_FIXTIMEFLD, - RES_REGFLD, - RES_VARREGFLD, - RES_SETREFFLD, - RES_INPUTFLD, - RES_MACROFLD, - RES_DDEFLD, - RES_TABLEFLD, - RES_HIDDENPARAFLD, - RES_DOCINFOFLD, - RES_TEMPLNAMEFLD, - RES_DBNEXTSETFLD, - RES_DBNUMSETFLD, - RES_DBSETNUMBERFLD, - RES_EXTUSERFLD, - RES_REFPAGESETFLD, - RES_REFPAGEGETFLD, - RES_INTERNETFLD, - RES_JUMPEDITFLD, - RES_SCRIPTFLD, - RES_DATETIMEFLD, - RES_AUTHORITY, ///< Table of authorities - RES_COMBINED_CHARS, - RES_DROPDOWN, - RES_FIELDS_END + Database, + User, + Filename, + DatabaseName, + Date, + Time, + PageNumber, + Author, + Chapter, + DocStat, + GetExp, + SetExp, + GetRef, + HiddenText, + Postit, + FixDate, + FixTime, + Reg, + VarReg, + SetRef, + Input, + Macro, + Dde, + Table, + HiddenPara, + DocInfo, + TemplateName, + DbNextSet, + DbNumSet, + DbSetNumber, + ExtUser, + RefPageSet, + RefPageGet, + Internet, + JumpEdit, + Script, + DateTime, + TableOfAuthorities, + CombinedChars, + Dropdown, + LAST = Dropdown, + + Unknown = USHRT_MAX, // used as default value in some method calls }; /// List of FieldTypes at UI. @@ -228,7 +229,7 @@ class SW_DLLPUBLIC SwFieldType : public SwModify { css::uno::WeakReference<css::beans::XPropertySet> m_wXFieldMaster; - sal_uInt16 m_nWhich; + SwFieldIds m_nWhich; friend void FinitUI(); ///< In order to delete pointer! static std::vector<OUString>* s_pFieldNames; @@ -237,7 +238,7 @@ class SW_DLLPUBLIC SwFieldType : public SwModify protected: /// Single argument ctors shall be explicit. - explicit SwFieldType( sal_uInt16 nWhichId ); + explicit SwFieldType( SwFieldIds nWhichId ); public: @@ -256,9 +257,7 @@ public: virtual bool QueryValue( css::uno::Any& rVal, sal_uInt16 nWhich ) const; virtual bool PutValue( const css::uno::Any& rVal, sal_uInt16 nWhich ); - sal_uInt16 Which() const { - return m_nWhich; - } + SwFieldIds Which() const { return m_nWhich; } inline void UpdateFields() const; }; @@ -318,7 +317,7 @@ public: SwField * CopyField() const; /// ResId - sal_uInt16 Which() const + SwFieldIds Which() const #ifdef DBG_UTIL ; // implemented in fldbas.cxx #else @@ -390,7 +389,7 @@ private: bool m_bUseFormat; ///< Use number formatter. protected: - SwValueFieldType( SwDoc* pDocPtr, sal_uInt16 nWhichId ); + SwValueFieldType( SwDoc* pDocPtr, SwFieldIds nWhichId ); SwValueFieldType( const SwValueFieldType& rTyp ); public: diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index a32605d932d3..4dcf6e12df74 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -715,7 +715,7 @@ void SwDocTest::testSwScanner() DateTime aDate(DateTime::SYSTEM); SwPostItField aPostIt( - static_cast<SwPostItFieldType*>(m_pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_POSTITFLD)), "An Author", + static_cast<SwPostItFieldType*>(m_pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit)), "An Author", "Some Text", "Initials", "Name", aDate ); m_pDoc->getIDocumentContentOperations().InsertPoolItem(aPaM, SwFormatField(aPostIt)); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 213b51ad2811..a48caad2e67d 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -737,7 +737,7 @@ void SwUiWriterTest::testFdo74981() // create a document with an input field SwDoc* pDoc = createDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); - SwInputField aField(static_cast<SwInputFieldType*>(pWrtShell->GetFieldType(0, RES_INPUTFLD)), "foo", "bar", 0, 0); + SwInputField aField(static_cast<SwInputFieldType*>(pWrtShell->GetFieldType(0, SwFieldIds::Input)), "foo", "bar", 0, 0); pWrtShell->Insert(aField); { @@ -767,7 +767,7 @@ void SwUiWriterTest::testTdf98512() SwDoc* pDoc = createDoc(); SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwInputFieldType *const pType(static_cast<SwInputFieldType*>( - pWrtShell->GetFieldType(0, RES_INPUTFLD))); + pWrtShell->GetFieldType(0, SwFieldIds::Input))); SwInputField aField1(pType, "foo", "bar", INP_TXT, 0); pWrtShell->Insert(aField1); pWrtShell->SttEndDoc(/*bStt=*/true); @@ -2086,7 +2086,7 @@ void SwUiWriterTest::testTdf77342() SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); //inserting first footnote pWrtShell->InsertFootnote(""); - SwFieldType* pField = pWrtShell->GetFieldType(0, RES_GETREFFLD); + SwFieldType* pField = pWrtShell->GetFieldType(0, SwFieldIds::GetRef); SwGetRefFieldType* pRefType = static_cast<SwGetRefFieldType*>(pField); //moving cursor to the starting of document pWrtShell->SttDoc(); @@ -2327,10 +2327,10 @@ void SwUiWriterTest::testTdf63553() SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell(); SwPaM* pCursor = pDoc->GetEditShell()->GetCursor(); //inserting sequence field 1 - SwSetExpFieldType* pSeqType = static_cast<SwSetExpFieldType*>(pWrtShell->GetFieldType(RES_SETEXPFLD, "Illustration")); + SwSetExpFieldType* pSeqType = static_cast<SwSetExpFieldType*>(pWrtShell->GetFieldType(SwFieldIds::SetExp, "Illustration")); SwSetExpField aSetField1(pSeqType, "", SVX_NUM_ARABIC); pWrtShell->Insert(aSetField1); - SwGetRefFieldType* pRefType = static_cast<SwGetRefFieldType*>(pWrtShell->GetFieldType(0, RES_GETREFFLD)); + SwGetRefFieldType* pRefType = static_cast<SwGetRefFieldType*>(pWrtShell->GetFieldType(0, SwFieldIds::GetRef)); //moving cursor to the starting of document pWrtShell->SttDoc(); //inserting reference field 1 diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 39e197fc2789..5a974dd4d217 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1449,15 +1449,15 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) if (pField) { strTypeName = SwFieldType::GetTypeStr(pField->GetTypeId()); - const sal_uInt16 nWhich = pField->GetTyp()->Which(); + const SwFieldIds nWhich = pField->GetTyp()->Which(); OUString sEntry; sal_Int32 subType = 0; switch (nWhich) { - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: subType = static_cast<const SwDocStatField*>(pField)->GetSubType(); break; - case RES_GETREFFLD: + case SwFieldIds::GetRef: { switch( pField->GetSubType() ) { @@ -1499,10 +1499,10 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) } } break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: subType = static_cast<const SwDateTimeField*>(pField)->GetSubType(); break; - case RES_JUMPEDITFLD: + case SwFieldIds::JumpEdit: { const sal_uInt16 nFormat= pField->GetFormat(); const sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), false); @@ -1517,11 +1517,11 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) } } break; - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: subType = static_cast<const SwExtUserField*>(pField)->GetSubType(); break; - case RES_HIDDENTXTFLD: - case RES_SETEXPFLD: + case SwFieldIds::HiddenText: + case SwFieldIds::SetExp: { sEntry = pField->GetTyp()->GetName(); if (sEntry.getLength() > 0) @@ -1531,11 +1531,11 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) } } break; - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: subType = pField->GetSubType(); subType &= 0x00ff; break; - case RES_REFPAGESETFLD: + case SwFieldIds::RefPageSet: { const SwRefPageSetField* pRPld = static_cast<const SwRefPageSetField*>(pField); bool bOn = pRPld->IsOn(); @@ -1546,14 +1546,15 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) strTypeName += "off"; } break; - case RES_AUTHORFLD: + case SwFieldIds::Author: { strTypeName += "-"; strTypeName += aMgr.GetFormatStr(pField->GetTypeId(), pField->GetFormat() & 0xff); } break; + default: break; } - if (subType > 0 || (subType == 0 && (nWhich == RES_DOCINFOFLD || nWhich == RES_EXTUSERFLD || nWhich == RES_DOCSTATFLD))) + if (subType > 0 || (subType == 0 && (nWhich == SwFieldIds::DocInfo || nWhich == SwFieldIds::ExtUser || nWhich == SwFieldIds::DocStat))) { std::vector<OUString> aLst; aMgr.GetSubTypes(pField->GetTypeId(), aLst); @@ -1561,7 +1562,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) sEntry = aLst[subType]; if (sEntry.getLength() > 0) { - if (nWhich == RES_DOCINFOFLD) + if (nWhich == SwFieldIds::DocInfo) { strTypeName = sEntry; sal_uInt32 nSize = aMgr.GetFormatCount(pField->GetTypeId(), false); diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index cb731667ae97..3bad0f7382f6 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -464,7 +464,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns ) { SwCalcExp* pFndExp = static_cast<SwCalcExp*>(pFnd); - if( pFndExp->pFieldType && pFndExp->pFieldType->Which() == RES_USERFLD ) + if( pFndExp->pFieldType && pFndExp->pFieldType->Which() == SwFieldIds::User ) { SwUserFieldType* pUField = const_cast<SwUserFieldType*>(static_cast<const SwUserFieldType*>(pFndExp->pFieldType)); if( nsSwGetSetExpType::GSE_STRING & pUField->GetType() ) @@ -520,7 +520,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, bool bIns ) sDBNum = m_pCharClass->lowercase(sDBNum); // Initialize again because this doesn't happen in docfld anymore for - // elements != RES_DBFLD. E.g. if there is an expression field before + // elements != SwFieldIds::Database. E.g. if there is an expression field before // an DB_Field in a document. VarChange( sDBNum, pMgr->GetSelectedRecordId(sSourceName, sTableName)); diff --git a/sw/source/core/crsr/annotationmark.cxx b/sw/source/core/crsr/annotationmark.cxx index c2ad1f4e7f02..27e8c7973ce6 100644 --- a/sw/source/core/crsr/annotationmark.cxx +++ b/sw/source/core/crsr/annotationmark.cxx @@ -92,7 +92,7 @@ namespace sw { namespace mark SwFormatField* pAnnotationFormatField = nullptr; - SwFieldType* pType = pDoc->getIDocumentFieldsAccess().GetFieldType( RES_POSTITFLD, OUString(), false ); + SwFieldType* pType = pDoc->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::Postit, OUString(), false ); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); for( SwFormatField* pFormatField = aIter.First(); pFormatField != nullptr; pFormatField = aIter.Next() ) { diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index b0de2a06ce62..ea71014b361a 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -646,7 +646,7 @@ lcl_FindField(bool & o_rFound, SetGetExpFields const& rSrtLst, bool SwCursorShell::MoveFieldType( const SwFieldType* pFieldType, const bool bNext, - const sal_uInt16 nResType, + const SwFieldIds nResType, const bool bAddSetExpressionFieldsToInputFields ) { // sorted list of all fields @@ -654,7 +654,7 @@ bool SwCursorShell::MoveFieldType( if ( pFieldType ) { - if( RES_INPUTFLD != pFieldType->Which() && !pFieldType->HasWriterListeners() ) + if( SwFieldIds::Input != pFieldType->Which() && !pFieldType->HasWriterListeners() ) { return false; } @@ -662,7 +662,7 @@ bool SwCursorShell::MoveFieldType( // found Modify object, add all fields to array ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable() ); - if( RES_INPUTFLD == pFieldType->Which() && bAddSetExpressionFieldsToInputFields ) + if( SwFieldIds::Input == pFieldType->Which() && bAddSetExpressionFieldsToInputFields ) { // there are hidden input fields in the set exp. fields const SwFieldTypes& rFieldTypes = *mpDoc->getIDocumentFieldsAccess().GetFieldTypes(); @@ -670,7 +670,7 @@ bool SwCursorShell::MoveFieldType( for( size_t i=0; i < nSize; ++i ) { pFieldType = rFieldTypes[ i ]; - if ( RES_SETEXPFLD == pFieldType->Which() ) + if ( SwFieldIds::SetExp == pFieldType->Which() ) { ::lcl_MakeFieldLst( aSrtLst, *pFieldType, IsReadOnlyAvailable(), true ); } @@ -714,7 +714,7 @@ bool SwCursorShell::MoveFieldType( { // create dummy for the search SwFormatField* pFormatField = new SwFormatField( SwDateTimeField( - static_cast<SwDateTimeFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_DATETIMEFLD ) ) ) ); + static_cast<SwDateTimeFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DateTime ) ) ) ); pTextField = new SwTextField( *pFormatField, rPos.nContent.GetIndex(), mpDoc->IsClipBoard() ); @@ -852,7 +852,7 @@ SwField* SwCursorShell::GetCurField( const bool bIncludeInputFieldAtStart ) cons SwField* pCurField = GetFieldAtCursor( pCursor, bIncludeInputFieldAtStart ); if ( pCurField != nullptr - && RES_TABLEFLD == pCurField->GetTyp()->Which() ) + && SwFieldIds::Table == pCurField->GetTyp()->Which() ) { // TabellenFormel ? wandel internen in externen Namen um const SwTableNode* pTableNd = IsCursorInTable(); @@ -1249,13 +1249,13 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, // allow click fields in protected sections // only placeholder is not possible if( IsAttrAtPos::Field & rContentAtPos.eContentAtPos - || RES_JUMPEDITFLD == pField->Which() ) + || SwFieldIds::JumpEdit == pField->Which() ) pField = nullptr; } else UpdateCursor(); } - else if( RES_TABLEFLD == pField->Which() && + else if( SwFieldIds::Table == pField->Which() && static_cast<const SwTableField*>(pField)->IsIntrnlName() ) { // create from internal (for CORE) the external @@ -1654,7 +1654,7 @@ const SwPostItField* SwCursorShell::GetPostItFieldAtCursor() const { SwTextAttr* pTextAttr = pTextNd->GetFieldTextAttrAt( pCursorPos->nContent.GetIndex() ); const SwField* pField = pTextAttr != nullptr ? pTextAttr->GetFormatField().GetField() : nullptr; - if ( pField && pField->Which()== RES_POSTITFLD ) + if ( pField && pField->Which()== SwFieldIds::Postit ) { pPostItField = static_cast<const SwPostItField*>(pField); } diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index ef2e900de5eb..a050745d31ad 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -83,9 +83,9 @@ namespace return ; const SwField* pField = pTextField->GetFormatField().GetField(); - const sal_uInt16 nFieldWhich = pField->GetTyp()->Which(); + const SwFieldIds nFieldWhich = pField->GetTyp()->Which(); - if( RES_SETEXPFLD == nFieldWhich ) + if( SwFieldIds::SetExp == nFieldWhich ) { SwSbxValue aValue; if( nsSwGetSetExpType::GSE_EXPR & pField->GetSubType() ) @@ -104,7 +104,7 @@ namespace #else switch( nFieldWhich ) { - case RES_DBNUMSETFLD: + case SwFieldIds::DbNumSet: { SwDBNumSetField* pDBField = const_cast<SwDBNumSetField*>(static_cast<const SwDBNumSetField*>(pField)); @@ -116,7 +116,7 @@ namespace pDBField->GetFormat() ); } break; - case RES_DBNEXTSETFLD: + case SwFieldIds::DbNextSet: { SwDBNextSetField* pDBField = const_cast<SwDBNextSetField*>(static_cast<const SwDBNextSetField*>(pField)); SwDBData aDBData(pDBField->GetDBData(&rDoc)); @@ -131,6 +131,7 @@ namespace } break; + default: break; } #endif } @@ -161,13 +162,13 @@ const SwFieldTypes* DocumentFieldsManager::GetFieldTypes() const SwFieldType* DocumentFieldsManager::InsertFieldType(const SwFieldType &rFieldTyp) { const SwFieldTypes::size_type nSize = mpFieldTypes->size(); - const sal_uInt16 nFieldWhich = rFieldTyp.Which(); + const SwFieldIds nFieldWhich = rFieldTyp.Which(); SwFieldTypes::size_type i = INIT_FLDTYPES; switch( nFieldWhich ) { - case RES_SETEXPFLD: + case SwFieldIds::SetExp: //JP 29.01.96: SequenceFields start at INIT_FLDTYPES - 3!! // Or we get doubble number circles!! //MIB 14.03.95: From now on also the SW3-Reader relies on &m_rDoc, when @@ -175,9 +176,9 @@ SwFieldType* DocumentFieldsManager::InsertFieldType(const SwFieldType &rFieldTyp if( nsSwGetSetExpType::GSE_SEQ & static_cast<const SwSetExpFieldType&>(rFieldTyp).GetType() ) i -= INIT_SEQ_FLDTYPES; SAL_FALLTHROUGH; - case RES_DBFLD: - case RES_USERFLD: - case RES_DDEFLD: + case SwFieldIds::Database: + case SwFieldIds::User: + case SwFieldIds::Dde: { const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); OUString sFieldNm( rFieldTyp.GetName() ); @@ -188,7 +189,7 @@ SwFieldType* DocumentFieldsManager::InsertFieldType(const SwFieldType &rFieldTyp } break; - case RES_AUTHORITY: + case SwFieldIds::TableOfAuthorities: for( ; i < nSize; ++i ) if( nFieldWhich == (*mpFieldTypes)[i]->Which() ) return (*mpFieldTypes)[i]; @@ -203,26 +204,27 @@ SwFieldType* DocumentFieldsManager::InsertFieldType(const SwFieldType &rFieldTyp SwFieldType* pNew = rFieldTyp.Copy(); switch( nFieldWhich ) { - case RES_DDEFLD: + case SwFieldIds::Dde: static_cast<SwDDEFieldType*>(pNew)->SetDoc( &m_rDoc ); break; - case RES_DBFLD: - case RES_TABLEFLD: - case RES_DATETIMEFLD: - case RES_GETEXPFLD: + case SwFieldIds::Database: + case SwFieldIds::Table: + case SwFieldIds::DateTime: + case SwFieldIds::GetExp: static_cast<SwValueFieldType*>(pNew)->SetDoc( &m_rDoc ); break; - case RES_USERFLD: - case RES_SETEXPFLD: + case SwFieldIds::User: + case SwFieldIds::SetExp: static_cast<SwValueFieldType*>(pNew)->SetDoc( &m_rDoc ); // JP 29.07.96: Optionally prepare FieldList for Calculator: mpUpdateFields->InsertFieldType( *pNew ); break; - case RES_AUTHORITY : + case SwFieldIds::TableOfAuthorities : static_cast<SwAuthorityFieldType*>(pNew)->SetDoc( &m_rDoc ); break; + default: break; } mpFieldTypes->insert( mpFieldTypes->begin() + nSize, pNew ); @@ -232,7 +234,7 @@ SwFieldType* DocumentFieldsManager::InsertFieldType(const SwFieldType &rFieldTyp } /// @returns the field type of the Doc -SwFieldType *DocumentFieldsManager::GetSysFieldType( const sal_uInt16 eWhich ) const +SwFieldType *DocumentFieldsManager::GetSysFieldType( const SwFieldIds eWhich ) const { for( SwFieldTypes::size_type i = 0; i < INIT_FLDTYPES; ++i ) if( eWhich == (*mpFieldTypes)[i]->Which() ) @@ -242,9 +244,9 @@ SwFieldType *DocumentFieldsManager::GetSysFieldType( const sal_uInt16 eWhich ) c /// Find first type with ResId and name SwFieldType* DocumentFieldsManager::GetFieldType( - sal_uInt16 nResId, + SwFieldIds nResId, const OUString& rName, - bool bDbFieldMatching // used in some UNO calls for RES_DBFLD to use different string matching code #i51815# + bool bDbFieldMatching // used in some UNO calls for SwFieldIds::Database to use different string matching code #i51815# ) const { const SwFieldTypes::size_type nSize = mpFieldTypes->size(); @@ -253,7 +255,7 @@ SwFieldType* DocumentFieldsManager::GetFieldType( switch( nResId ) { - case RES_SETEXPFLD: + case SwFieldIds::SetExp: //JP 29.01.96: SequenceFields start at INIT_FLDTYPES - 3!! // Or we get doubble number circles!! //MIB 14.03.95: From now on also the SW3-Reader relies on &m_rDoc, when @@ -261,12 +263,13 @@ SwFieldType* DocumentFieldsManager::GetFieldType( i = INIT_FLDTYPES - INIT_SEQ_FLDTYPES; break; - case RES_DBFLD: - case RES_USERFLD: - case RES_DDEFLD: - case RES_AUTHORITY: + case SwFieldIds::Database: + case SwFieldIds::User: + case SwFieldIds::Dde: + case SwFieldIds::TableOfAuthorities: i = INIT_FLDTYPES; break; + default: break; } SwFieldType* pRet = nullptr; @@ -275,7 +278,7 @@ SwFieldType* DocumentFieldsManager::GetFieldType( SwFieldType* pFieldType = (*mpFieldTypes)[i]; OUString aFieldName( pFieldType->GetName() ); - if (bDbFieldMatching && nResId == RES_DBFLD) // #i51815# + if (bDbFieldMatching && nResId == SwFieldIds::Database) // #i51815# aFieldName = aFieldName.replace(DB_DELIM, '.'); if( nResId == pFieldType->Which() && @@ -300,28 +303,29 @@ void DocumentFieldsManager::RemoveFieldType(size_t nField) SwFieldType* pTmp = (*mpFieldTypes)[nField]; // JP 29.07.96: Optionally prepare FieldList for Calculator - sal_uInt16 nWhich = pTmp->Which(); + SwFieldIds nWhich = pTmp->Which(); switch( nWhich ) { - case RES_SETEXPFLD: - case RES_USERFLD: + case SwFieldIds::SetExp: + case SwFieldIds::User: mpUpdateFields->RemoveFieldType( *pTmp ); SAL_FALLTHROUGH; - case RES_DDEFLD: + case SwFieldIds::Dde: if( pTmp->HasWriterListeners() && !m_rDoc.IsUsed( *pTmp ) ) { - if( RES_SETEXPFLD == nWhich ) + if( SwFieldIds::SetExp == nWhich ) static_cast<SwSetExpFieldType*>(pTmp)->SetDeleted( true ); - else if( RES_USERFLD == nWhich ) + else if( SwFieldIds::User == nWhich ) static_cast<SwUserFieldType*>(pTmp)->SetDeleted( true ); else static_cast<SwDDEFieldType*>(pTmp)->SetDeleted( true ); - nWhich = 0; + nWhich = SwFieldIds::Database; } break; + default: break; } - if( nWhich ) + if( nWhich != SwFieldIds::Database ) { OSL_ENSURE( !pTmp->HasWriterListeners(), "Dependent fields present!" ); // delete field type @@ -344,23 +348,23 @@ void DocumentFieldsManager::UpdateFields( bool bCloseDB ) { // Update table fields second to last // Update references last - case RES_GETREFFLD: - case RES_TABLEFLD: - case RES_DBFLD: - case RES_JUMPEDITFLD: - case RES_REFPAGESETFLD: // are never expanded! + case SwFieldIds::GetRef: + case SwFieldIds::Table: + case SwFieldIds::Database: + case SwFieldIds::JumpEdit: + case SwFieldIds::RefPageSet: // are never expanded! break; - case RES_DDEFLD: + case SwFieldIds::Dde: { SwMsgPoolItem aUpdateDDE( RES_UPDATEDDETBL ); pFieldType->ModifyNotification( nullptr, &aUpdateDDE ); break; } - case RES_GETEXPFLD: - case RES_SETEXPFLD: - case RES_HIDDENTXTFLD: - case RES_HIDDENPARAFLD: + case SwFieldIds::GetExp: + case SwFieldIds::SetExp: + case SwFieldIds::HiddenText: + case SwFieldIds::HiddenPara: // Expression fields are treated separately break; default: @@ -394,11 +398,11 @@ void DocumentFieldsManager::InsDeletedFieldType( SwFieldType& rFieldTyp ) // - If the same type is found, the deleted one has to be renamed. const SwFieldTypes::size_type nSize = mpFieldTypes->size(); - const sal_uInt16 nFieldWhich = rFieldTyp.Which(); + const SwFieldIds nFieldWhich = rFieldTyp.Which(); - OSL_ENSURE( RES_SETEXPFLD == nFieldWhich || - RES_USERFLD == nFieldWhich || - RES_DDEFLD == nFieldWhich, "Wrong FieldType" ); + OSL_ENSURE( SwFieldIds::SetExp == nFieldWhich || + SwFieldIds::User == nFieldWhich || + SwFieldIds::Dde == nFieldWhich, "Wrong FieldType" ); const ::utl::TransliterationWrapper& rSCmp = GetAppCmpStrIgnore(); const OUString& rFieldNm = rFieldTyp.GetName(); @@ -433,15 +437,16 @@ void DocumentFieldsManager::InsDeletedFieldType( SwFieldType& rFieldTyp ) mpFieldTypes->insert( mpFieldTypes->begin() + nSize, &rFieldTyp ); switch( nFieldWhich ) { - case RES_SETEXPFLD: + case SwFieldIds::SetExp: static_cast<SwSetExpFieldType&>(rFieldTyp).SetDeleted( false ); break; - case RES_USERFLD: + case SwFieldIds::User: static_cast<SwUserFieldType&>(rFieldTyp).SetDeleted( false ); break; - case RES_DDEFLD: + case SwFieldIds::Dde: static_cast<SwDDEFieldType&>(rFieldTyp).SetDeleted( false ); break; + default: break; } } @@ -471,7 +476,7 @@ bool DocumentFieldsManager::UpdateField(SwTextField * pDstTextField, SwField & r SwFormatField * pDstFormatField = const_cast<SwFormatField*>(&pDstTextField->GetFormatField()); SwField * pDstField = pDstFormatField->GetField(); - sal_uInt16 nFieldWhich = rSrcField.GetTyp()->Which(); + SwFieldIds nFieldWhich = rSrcField.GetTyp()->Which(); SwNodeIndex aTableNdIdx(pDstTextField->GetTextNode()); if (pDstField->GetTyp()->Which() == @@ -491,14 +496,14 @@ bool DocumentFieldsManager::UpdateField(SwTextField * pDstTextField, SwField & r switch( nFieldWhich ) { - case RES_SETEXPFLD: - case RES_GETEXPFLD: - case RES_HIDDENTXTFLD: - case RES_HIDDENPARAFLD: + case SwFieldIds::SetExp: + case SwFieldIds::GetExp: + case SwFieldIds::HiddenText: + case SwFieldIds::HiddenPara: UpdateExpFields( pDstTextField, true ); break; - case RES_TABLEFLD: + case SwFieldIds::Table: { const SwTableNode* pTableNd = m_rDoc.IsIdxInTable(aTableNdIdx); @@ -517,22 +522,22 @@ bool DocumentFieldsManager::UpdateField(SwTextField * pDstTextField, SwField & r } break; - case RES_MACROFLD: + case SwFieldIds::Macro: if( bUpdateFields && pDstTextField->GetpTextNode() ) (pDstTextField->GetpTextNode())-> ModifyNotification( nullptr, pDstFormatField ); break; - case RES_DBNAMEFLD: - case RES_DBNEXTSETFLD: - case RES_DBNUMSETFLD: - case RES_DBSETNUMBERFLD: + case SwFieldIds::DatabaseName: + case SwFieldIds::DbNextSet: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbSetNumber: m_rDoc.ChgDBData(static_cast<SwDBNameInfField*>( pNewField)->GetRealDBData()); pNewField->GetTyp()->UpdateFields(); break; - case RES_DBFLD: + case SwFieldIds::Database: #if HAVE_FEATURE_DBCONNECTIVITY { // JP 10.02.96: call ChgValue, so that the style change sets the @@ -553,7 +558,7 @@ bool DocumentFieldsManager::UpdateField(SwTextField * pDstTextField, SwField & r // The fields we can calculate here are being triggered for an update // here explicitly. - if( nFieldWhich == RES_USERFLD ) + if( nFieldWhich == SwFieldIds::User ) UpdateUsrFields(); } @@ -564,7 +569,7 @@ bool DocumentFieldsManager::UpdateField(SwTextField * pDstTextField, SwField & r void DocumentFieldsManager::UpdateRefFields() { for( auto pFieldType : *mpFieldTypes ) - if( RES_GETREFFLD == pFieldType->Which() ) + if( SwFieldIds::GetRef == pFieldType->Which() ) pFieldType->ModifyNotification( nullptr, nullptr ); } @@ -577,7 +582,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt ) for (auto pFieldTypeTmp : *mpFieldTypes) { - if( RES_TABLEFLD == pFieldTypeTmp->Which() ) + if( SwFieldIds::Table == pFieldTypeTmp->Which() ) { SwTableFormulaUpdate* pUpdateField = nullptr; if( pHt && RES_TABLEFML_UPDATE == pHt->Which() ) @@ -845,7 +850,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp return ; } - sal_uInt16 nWhich; + SwFieldIds nWhich; // Hash table for all string replacements is filled on-the-fly. // Try to fabricate an uneven number. @@ -861,7 +866,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp for( auto n = mpFieldTypes->size(); n; ) switch( ( pFieldType = (*mpFieldTypes)[ --n ] )->Which() ) { - case RES_USERFLD: + case SwFieldIds::User: { // Entry present? sal_uInt16 nPos; @@ -877,9 +882,10 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp static_cast<HashStr*>(*(pHashStrTable + nPos)) ); } break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: const_cast<SwSetExpFieldType*>(static_cast<const SwSetExpFieldType*>(pFieldType))->SetOutlineChgNd( nullptr ); break; + default: break; } } @@ -955,7 +961,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp switch( nWhich = pField->GetTyp()->Which() ) { - case RES_HIDDENTXTFLD: + case SwFieldIds::HiddenText: { SwHiddenTextField* pHField = const_cast<SwHiddenTextField*>(static_cast<const SwHiddenTextField*>(pField)); SwSbxValue aValue = aCalc.Calculate( pHField->GetPar1() ); @@ -968,7 +974,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp } } break; - case RES_HIDDENPARAFLD: + case SwFieldIds::HiddenPara: { SwHiddenParaField* pHPField = const_cast<SwHiddenParaField*>(static_cast<const SwHiddenParaField*>(pField)); SwSbxValue aValue = aCalc.Calculate( pHPField->GetPar1() ); @@ -977,7 +983,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp pHPField->SetHidden( bValue ); } break; - case RES_DBSETNUMBERFLD: + case SwFieldIds::DbSetNumber: #if HAVE_FEATURE_DBCONNECTIVITY { const_cast<SwDBSetNumberField*>(static_cast<const SwDBSetNumberField*>(pField))->Evaluate(&m_rDoc); @@ -986,8 +992,8 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp } #endif break; - case RES_DBNEXTSETFLD: - case RES_DBNUMSETFLD: + case SwFieldIds::DbNextSet: + case SwFieldIds::DbNumSet: #if HAVE_FEATURE_DBCONNECTIVITY { UpdateDBNumFields( *const_cast<SwDBNameInfField*>(static_cast<const SwDBNameInfField*>(pField)), aCalc ); @@ -996,7 +1002,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp } #endif break; - case RES_DBFLD: + case SwFieldIds::Database: { #if HAVE_FEATURE_DBCONNECTIVITY // evaluate field @@ -1028,12 +1034,12 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp #endif } break; - case RES_GETEXPFLD: - case RES_SETEXPFLD: + case SwFieldIds::GetExp: + case SwFieldIds::SetExp: { if( nsSwGetSetExpType::GSE_STRING & pField->GetSubType() ) // replace String { - if( RES_GETEXPFLD == nWhich ) + if( SwFieldIds::GetExp == nWhich ) { SwGetExpField* pGField = const_cast<SwGetExpField*>(static_cast<const SwGetExpField*>(pField)); @@ -1081,7 +1087,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp } else // recalculate formula { - if( RES_GETEXPFLD == nWhich ) + if( SwFieldIds::GetExp == nWhich ) { SwGetExpField* pGField = const_cast<SwGetExpField*>(static_cast<const SwGetExpField*>(pField)); @@ -1136,15 +1142,17 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp } } } + break; + default: break; } // switch pFormatField->ModifyNotification( nullptr, nullptr ); // trigger formatting if( pUpdateField == pTextField ) // if only &m_rDoc one is updated { - if( RES_GETEXPFLD == nWhich || // only GetField or - RES_HIDDENTXTFLD == nWhich || // HiddenText? - RES_HIDDENPARAFLD == nWhich) // HiddenParaField? + if( SwFieldIds::GetExp == nWhich || // only GetField or + SwFieldIds::HiddenText == nWhich || // HiddenText? + SwFieldIds::HiddenPara == nWhich) // HiddenParaField? break; // quit pUpdateField = nullptr; // update all from here on } @@ -1171,7 +1179,7 @@ void DocumentFieldsManager::UpdateUsrFields() for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < mpFieldTypes->size(); ++i ) { const SwFieldType* pFieldType; - if( RES_USERFLD == ( pFieldType = (*mpFieldTypes)[i] )->Which() ) + if( SwFieldIds::User == ( pFieldType = (*mpFieldTypes)[i] )->Which() ) { if( !pCalc ) pCalc = new SwCalc( m_rDoc ); @@ -1206,8 +1214,8 @@ sal_Int32 DocumentFieldsManager::GetRecordsPerDocument() const switch( pField->GetTyp()->Which() ) { - case RES_DBNEXTSETFLD: - case RES_DBNUMSETFLD: + case SwFieldIds::DbNextSet: + case SwFieldIds::DbNumSet: nRecords++; break; default: @@ -1225,15 +1233,16 @@ void DocumentFieldsManager::UpdatePageFields( SfxPoolItem* pMsgHint ) SwFieldType* pFieldType = (*mpFieldTypes)[ i ]; switch( pFieldType->Which() ) { - case RES_PAGENUMBERFLD: - case RES_CHAPTERFLD: - case RES_GETEXPFLD: - case RES_REFPAGEGETFLD: + case SwFieldIds::PageNumber: + case SwFieldIds::Chapter: + case SwFieldIds::GetExp: + case SwFieldIds::RefPageGet: pFieldType->ModifyNotification( nullptr, pMsgHint ); break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: pFieldType->ModifyNotification( nullptr, nullptr ); break; + default: break; } } SetNewFieldLst(true); @@ -1324,14 +1333,14 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) nTime = tools::Time( tools::Time::SYSTEM ).GetTime(); } - sal_uInt16 aTypes[5] = { - /*0*/ RES_DOCINFOFLD, - /*1*/ RES_AUTHORFLD, - /*2*/ RES_EXTUSERFLD, - /*3*/ RES_FILENAMEFLD, - /*4*/ RES_DATETIMEFLD }; // MUST be at the end! + SwFieldIds aTypes[5] = { + /*0*/ SwFieldIds::DocInfo, + /*1*/ SwFieldIds::Author, + /*2*/ SwFieldIds::ExtUser, + /*3*/ SwFieldIds::Filename, + /*4*/ SwFieldIds::DateTime }; // MUST be at the end! - for(sal_uInt16 aType : aTypes) + for(SwFieldIds aType : aTypes) { SwFieldType* pFieldType = GetSysFieldType( aType ); SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); @@ -1342,7 +1351,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) bool bChgd = false; switch( aType ) { - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: if( static_cast<SwDocInfoField*>(pFormatField->GetField())->IsFixed() ) { bChgd = true; @@ -1356,7 +1365,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) } break; - case RES_AUTHORFLD: + case SwFieldIds::Author: if( static_cast<SwAuthorField*>(pFormatField->GetField())->IsFixed() ) { bChgd = true; @@ -1365,7 +1374,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) } break; - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: if( static_cast<SwExtUserField*>(pFormatField->GetField())->IsFixed() ) { bChgd = true; @@ -1376,7 +1385,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) } break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: if( static_cast<SwDateTimeField*>(pFormatField->GetField())->IsFixed() ) { bChgd = true; @@ -1385,7 +1394,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) } break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: if( static_cast<SwFileNameField*>(pFormatField->GetField())->IsFixed() ) { bChgd = true; @@ -1396,6 +1405,7 @@ void DocumentFieldsManager::SetFixFields( const DateTime* pNewDateTime ) pFileNameField->GetFormat() ) ); } break; + default: break; } // Trigger formatting @@ -1489,7 +1499,7 @@ void DocumentFieldsManager::FieldsToExpand( SwHash**& ppHashTable, sal_uInt16& r const SwField* pField = pTextField->GetFormatField().GetField(); switch( pField->GetTyp()->Which() ) { - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if( nsSwGetSetExpType::GSE_STRING & pField->GetSubType() ) { // set the new value in the hash table @@ -1518,7 +1528,7 @@ void DocumentFieldsManager::FieldsToExpand( SwHash**& ppHashTable, sal_uInt16& r pSField->GetExpStr(), static_cast<HashStr*>(*(ppHashTable + nPos)) ); } break; - case RES_DBFLD: + case SwFieldIds::Database: { const OUString& rName = pField->GetTyp()->GetName(); @@ -1540,6 +1550,7 @@ void DocumentFieldsManager::FieldsToExpand( SwHash**& ppHashTable, sal_uInt16& r } } break; + default: break; } } } @@ -1662,11 +1673,11 @@ void DocumentFieldsManager::UpdateDBNumFields( SwDBNameInfField& rDBField, SwCal #else SwDBManager* pMgr = m_rDoc.GetDBManager(); - sal_uInt16 nFieldType = rDBField.Which(); + SwFieldIds nFieldType = rDBField.Which(); bool bPar1 = rCalc.Calculate( rDBField.GetPar1() ).GetBool(); - if( RES_DBNEXTSETFLD == nFieldType ) + if( SwFieldIds::DbNextSet == nFieldType ) static_cast<SwDBNextSetField&>(rDBField).SetCondValid( bPar1 ); else static_cast<SwDBNumSetField&>(rDBField).SetCondValid( bPar1 ); @@ -1674,7 +1685,7 @@ void DocumentFieldsManager::UpdateDBNumFields( SwDBNameInfField& rDBField, SwCal if( !rDBField.GetRealDBData().sDataSource.isEmpty() ) { // Edit a certain database - if( RES_DBNEXTSETFLD == nFieldType ) + if( SwFieldIds::DbNextSet == nFieldType ) static_cast<SwDBNextSetField&>(rDBField).Evaluate(&m_rDoc); else static_cast<SwDBNumSetField&>(rDBField).Evaluate(&m_rDoc); diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index 77a91eb24a49..f529d5483417 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -81,8 +81,8 @@ DocumentStatisticsManager::DocumentStatisticsManager( SwDoc& i_rSwdoc ) : m_rDoc void DocumentStatisticsManager::DocInfoChgd(bool const isEnableSetModified) { - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_DOCINFOFLD )->UpdateFields(); - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_TEMPLNAMEFLD )->UpdateFields(); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )->UpdateFields(); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::TemplateName )->UpdateFields(); if (isEnableSetModified) { m_rDoc.getIDocumentState().SetModified(); @@ -164,7 +164,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF // #i93174#: notes contain paragraphs that are not nodes { - SwFieldType * const pPostits( m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_POSTITFLD) ); + SwFieldType * const pPostits( m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit) ); SwIterator<SwFormatField,SwFieldType> aIter( *pPostits ); for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) { @@ -226,7 +226,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF // optionally update stat. fields if (bFields) { - SwFieldType *pType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_DOCSTATFLD); + SwFieldType *pType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DocStat); pType->UpdateFields(); } diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index d65f623a86a1..83ce6fe2dce9 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -150,7 +150,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer*, pIdle, void ) const bool bOldLockView = pShell->IsViewLocked(); pShell->LockView( true ); - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_CHAPTERFLD )->ModifyNotification( nullptr, nullptr ); // ChapterField + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter )->ModifyNotification( nullptr, nullptr ); // ChapterField m_rDoc.getIDocumentFieldsAccess().UpdateExpFields( nullptr, false ); // Updates ExpressionFields m_rDoc.getIDocumentFieldsAccess().UpdateTableFields(nullptr); // Tables m_rDoc.getIDocumentFieldsAccess().UpdateRefFields(); // References diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index fa00bff3350f..eb51f110b016 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -488,7 +488,7 @@ void SwDoc::ChgDBData(const SwDBData& rNewData) maDBData = rNewData; getIDocumentState().SetModified(); } - getIDocumentFieldsAccess().GetSysFieldType(RES_DBNAMEFLD)->UpdateFields(); + getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DatabaseName)->UpdateFields(); } struct PostItField_ : public SetGetExpField @@ -542,7 +542,7 @@ bool sw_GetPostIts( { bool bHasPostIts = false; - SwFieldType* pFieldType = pIDFA->GetSysFieldType( RES_POSTITFLD ); + SwFieldType* pFieldType = pIDFA->GetSysFieldType( SwFieldIds::Postit ); assert(pFieldType); if( pFieldType->HasWriterListeners() ) @@ -1317,7 +1317,7 @@ bool SwDoc::RemoveInvisibleContent() { SwTextNode* pTextNd; - SwIterator<SwFormatField,SwFieldType> aIter( *getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENPARAFLD ) ); + SwIterator<SwFormatField,SwFieldType> aIter( *getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenPara ) ); for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) { if( pFormatField->GetTextField() && @@ -1480,7 +1480,7 @@ bool SwDoc::RemoveInvisibleContent() bool SwDoc::HasInvisibleContent() const { - if(SwIterator<SwFormatField,SwFieldType>(*getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENPARAFLD)).First()) + if(SwIterator<SwFormatField,SwFieldType>(*getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenPara)).First()) return true; // Search for any hidden paragraph (hidden text attribute) @@ -1533,7 +1533,7 @@ bool SwDoc::ConvertFieldsToText() { const SwFieldType *pCurType = (*pMyFieldTypes)[nType - 1]; - if ( RES_POSTITFLD == pCurType->Which() ) + if ( SwFieldIds::Postit == pCurType->Which() ) continue; SwIterator<SwFormatField,SwFieldType> aIter( *pCurType ); @@ -1559,20 +1559,20 @@ bool SwDoc::ConvertFieldsToText() const SwField* pField = rFormatField.GetField(); //#i55595# some fields have to be excluded in headers/footers - sal_uInt16 nWhich = pField->GetTyp()->Which(); + SwFieldIds nWhich = pField->GetTyp()->Which(); if(!bInHeaderFooter || - (nWhich != RES_PAGENUMBERFLD && - nWhich != RES_CHAPTERFLD && - nWhich != RES_GETEXPFLD&& - nWhich != RES_SETEXPFLD&& - nWhich != RES_INPUTFLD&& - nWhich != RES_REFPAGEGETFLD&& - nWhich != RES_REFPAGESETFLD)) + (nWhich != SwFieldIds::PageNumber && + nWhich != SwFieldIds::Chapter && + nWhich != SwFieldIds::GetExp&& + nWhich != SwFieldIds::SetExp&& + nWhich != SwFieldIds::Input&& + nWhich != SwFieldIds::RefPageGet&& + nWhich != SwFieldIds::RefPageSet)) { OUString sText = pField->ExpandField(true); // database fields should not convert their command into text - if( RES_DBFLD == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized()) + if( SwFieldIds::Database == pCurType->Which() && !static_cast<const SwDBField*>(pField)->IsInitialized()) sText.clear(); SwPaM aInsertPam(*pTextField->GetpTextNode(), pTextField->GetStart()); diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index 4c24f87000d3..583d8bb79bcc 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -410,8 +410,8 @@ void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged ) { rDesc.SetNumType( rChged.GetNumType() ); // Notify page number fields that NumFormat has changed - getIDocumentFieldsAccess().GetSysFieldType( RES_PAGENUMBERFLD )->UpdateFields(); - getIDocumentFieldsAccess().GetSysFieldType( RES_REFPAGEGETFLD )->UpdateFields(); + getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::PageNumber )->UpdateFields(); + getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::RefPageGet )->UpdateFields(); // If the numbering scheme has changed we could have QuoVadis/ErgoSum texts // that refer to a changed page, so we invalidate foot notes. diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 7dc05e7b4ca8..bfbb19a3484c 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -355,22 +355,22 @@ const SwDBData& SwDoc::GetDBDesc() for(SwFieldTypes::size_type i = 0; i < nSize && maDBData.sDataSource.isEmpty(); ++i) { SwFieldType& rFieldType = *((*getIDocumentFieldsAccess().GetFieldTypes())[i]); - sal_uInt16 nWhich = rFieldType.Which(); + SwFieldIds nWhich = rFieldType.Which(); if(IsUsed(rFieldType)) { switch(nWhich) { - case RES_DBFLD: - case RES_DBNEXTSETFLD: - case RES_DBNUMSETFLD: - case RES_DBSETNUMBERFLD: + case SwFieldIds::Database: + case SwFieldIds::DbNextSet: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbSetNumber: { SwIterator<SwFormatField,SwFieldType> aIter( rFieldType ); for( SwFormatField* pField = aIter.First(); pField; pField = aIter.Next() ) { if(pField->IsFieldInDoc()) { - if(RES_DBFLD == nWhich) + if(SwFieldIds::Database == nWhich) maDBData = (static_cast < SwDBFieldType * > (pField->GetField()->GetTyp()))->GetDBData(); else maDBData = (static_cast < SwDBNameInfField* > (pField->GetField()))->GetRealDBData(); @@ -379,6 +379,7 @@ const SwDBData& SwDoc::GetDBDesc() } } break; + default: break; } } } @@ -454,37 +455,38 @@ void SwDoc::GetAllUsedDB( std::vector<OUString>& rDBNameList, const SwField* pField = pFormatField->GetField(); switch( pField->GetTyp()->Which() ) { - case RES_DBFLD: + case SwFieldIds::Database: AddUsedDBToList( rDBNameList, lcl_DBDataToString(static_cast<const SwDBField*>(pField)->GetDBData() )); break; - case RES_DBSETNUMBERFLD: - case RES_DBNAMEFLD: + case SwFieldIds::DbSetNumber: + case SwFieldIds::DatabaseName: AddUsedDBToList( rDBNameList, lcl_DBDataToString(static_cast<const SwDBNameInfField*>(pField)->GetRealDBData() )); break; - case RES_DBNUMSETFLD: - case RES_DBNEXTSETFLD: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbNextSet: AddUsedDBToList( rDBNameList, lcl_DBDataToString(static_cast<const SwDBNameInfField*>(pField)->GetRealDBData() )); SAL_FALLTHROUGH; // JP: is that right like that? - case RES_HIDDENTXTFLD: - case RES_HIDDENPARAFLD: + case SwFieldIds::HiddenText: + case SwFieldIds::HiddenPara: AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames, pField->GetPar1(), aUsedDBNames )); aUsedDBNames.clear(); break; - case RES_SETEXPFLD: - case RES_GETEXPFLD: - case RES_TABLEFLD: + case SwFieldIds::SetExp: + case SwFieldIds::GetExp: + case SwFieldIds::Table: AddUsedDBToList(rDBNameList, FindUsedDBs( *pAllDBNames, pField->GetFormula(), aUsedDBNames )); aUsedDBNames.clear(); break; + default: break; } } #endif @@ -612,7 +614,7 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames, switch( pField->GetTyp()->Which() ) { - case RES_DBFLD: + case SwFieldIds::Database: #if HAVE_FEATURE_DBCONNECTIVITY if( IsNameInArray( rOldNames, lcl_DBDataToString(static_cast<SwDBField*>(pField)->GetDBData()))) { @@ -632,8 +634,8 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames, #endif break; - case RES_DBSETNUMBERFLD: - case RES_DBNAMEFLD: + case SwFieldIds::DbSetNumber: + case SwFieldIds::DatabaseName: if( IsNameInArray( rOldNames, lcl_DBDataToString(static_cast<SwDBNameInfField*>(pField)->GetRealDBData()))) { @@ -642,26 +644,27 @@ void SwDoc::ChangeDBFields( const std::vector<OUString>& rOldNames, } break; - case RES_DBNUMSETFLD: - case RES_DBNEXTSETFLD: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbNextSet: if( IsNameInArray( rOldNames, lcl_DBDataToString(static_cast<SwDBNameInfField*>(pField)->GetRealDBData()))) { static_cast<SwDBNameInfField*>(pField)->SetDBData(aNewDBData); } SAL_FALLTHROUGH; - case RES_HIDDENTXTFLD: - case RES_HIDDENPARAFLD: + case SwFieldIds::HiddenText: + case SwFieldIds::HiddenPara: pField->SetPar1( ReplaceUsedDBs(rOldNames, rNewName, pField->GetPar1()) ); bExpand = true; break; - case RES_SETEXPFLD: - case RES_GETEXPFLD: - case RES_TABLEFLD: + case SwFieldIds::SetExp: + case SwFieldIds::GetExp: + case SwFieldIds::Table: pField->SetPar2( ReplaceUsedDBs(rOldNames, rNewName, pField->GetFormula()) ); bExpand = true; break; + default: break; } if (bExpand) @@ -740,7 +743,7 @@ void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) for( SwFieldTypes::size_type i = INIT_FLDTYPES; i < nSize; ++i ) { SwFieldType* pFieldType = (*getIDocumentFieldsAccess().GetFieldTypes())[i]; - if( RES_AUTHORITY == pFieldType->Which() ) + if( SwFieldIds::TableOfAuthorities == pFieldType->Which() ) { SwAuthorityFieldType* pAuthType = static_cast<SwAuthorityFieldType*>(pFieldType); pAuthType->ChangeEntryContent(pNewData); @@ -752,17 +755,17 @@ void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) void SwDocUpdateField::InsDelFieldInFieldLst( bool bIns, const SwTextField& rField ) { - const sal_uInt16 nWhich = rField.GetFormatField().GetField()->GetTyp()->Which(); + const SwFieldIds nWhich = rField.GetFormatField().GetField()->GetTyp()->Which(); switch( nWhich ) { - case RES_DBFLD: - case RES_SETEXPFLD: - case RES_HIDDENPARAFLD: - case RES_HIDDENTXTFLD: - case RES_DBNUMSETFLD: - case RES_DBNEXTSETFLD: - case RES_DBSETNUMBERFLD: - case RES_GETEXPFLD: + case SwFieldIds::Database: + case SwFieldIds::SetExp: + case SwFieldIds::HiddenPara: + case SwFieldIds::HiddenText: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbNextSet: + case SwFieldIds::DbSetNumber: + case SwFieldIds::GetExp: break; // these have to be added/removed! default: @@ -887,21 +890,21 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) OUString sFormula; const SwField* pField = pFormatField->GetField(); - const sal_uInt16 nWhich = pField->GetTyp()->Which(); + const SwFieldIds nWhich = pField->GetTyp()->Which(); switch( nWhich ) { - case RES_DBSETNUMBERFLD: - case RES_GETEXPFLD: + case SwFieldIds::DbSetNumber: + case SwFieldIds::GetExp: if( GETFLD_ALL == eGetMode ) sFormula = sTrue; break; - case RES_DBFLD: + case SwFieldIds::Database: if( GETFLD_EXPAND & eGetMode ) sFormula = sTrue; break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if ( !(eGetMode == GETFLD_EXPAND) || (nsSwGetSetExpType::GSE_STRING & pField->GetSubType()) ) { @@ -909,7 +912,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) } break; - case RES_HIDDENPARAFLD: + case SwFieldIds::HiddenPara: if( GETFLD_ALL == eGetMode ) { sFormula = pField->GetPar1(); @@ -926,7 +929,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) } break; - case RES_HIDDENTXTFLD: + case SwFieldIds::HiddenText: if( GETFLD_ALL == eGetMode ) { sFormula = pField->GetPar1(); @@ -947,7 +950,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) break; #if HAVE_FEATURE_DBCONNECTIVITY - case RES_DBNUMSETFLD: + case SwFieldIds::DbNumSet: { SwDBData aDBData(const_cast<SwDBNumSetField*>(static_cast<const SwDBNumSetField*>(pField))->GetDBData(&rDoc)); @@ -960,7 +963,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) } } break; - case RES_DBNEXTSETFLD: + case SwFieldIds::DbNextSet: { SwDBData aDBData(const_cast<SwDBNextSetField*>(static_cast<const SwDBNextSetField*>(pField))->GetDBData(&rDoc)); @@ -974,6 +977,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) } break; #endif + default: break; } if (!sFormula.isEmpty()) @@ -985,7 +989,7 @@ void SwDocUpdateField::MakeFieldList_( SwDoc& rDoc, int eGetMode ) nNodes = rDoc.GetNodes().Count(); } -void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, sal_uInt16 nFieldWhich ) +void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, SwFieldIds nFieldWhich ) { const SwTextNode& rTextNd = rTField.GetTextNode(); const SwDoc& rDoc = *rTextNd.GetDoc(); @@ -1021,13 +1025,13 @@ void SwDocUpdateField::GetBodyNode( const SwTextField& rTField, sal_uInt16 nFiel } // always set the BodyTextFlag in GetExp or DB fields - if( RES_GETEXPFLD == nFieldWhich ) + if( SwFieldIds::GetExp == nFieldWhich ) { SwGetExpField* pGetField = const_cast<SwGetExpField*>(static_cast<const SwGetExpField*>(rTField.GetFormatField().GetField())); pGetField->ChgBodyTextFlag( bIsInBody ); } #if HAVE_FEATURE_DBCONNECTIVITY - else if( RES_DBFLD == nFieldWhich ) + else if( SwFieldIds::Database == nFieldWhich ) { SwDBField* pDBField = const_cast<SwDBField*>(static_cast<const SwDBField*>(rTField.GetFormatField().GetField())); pDBField->ChgBodyTextFlag( bIsInBody ); @@ -1081,10 +1085,10 @@ void SwDocUpdateField::InsertFieldType( const SwFieldType& rType ) OUString sFieldName; switch( rType.Which() ) { - case RES_USERFLD : + case SwFieldIds::User : sFieldName = static_cast<const SwUserFieldType&>(rType).GetName(); break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: sFieldName = static_cast<const SwSetExpFieldType&>(rType).GetName(); break; default: @@ -1114,12 +1118,13 @@ void SwDocUpdateField::RemoveFieldType( const SwFieldType& rType ) OUString sFieldName; switch( rType.Which() ) { - case RES_USERFLD : + case SwFieldIds::User : sFieldName = static_cast<const SwUserFieldType&>(rType).GetName(); break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: sFieldName = static_cast<const SwSetExpFieldType&>(rType).GetName(); break; + default: break; } if( !sFieldName.isEmpty() ) diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 6f70be50303d..cab0d32ace3c 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1738,7 +1738,7 @@ SwTableNumFormatMerge::SwTableNumFormatMerge( const SwDoc& rSrc, SwDoc& rDest ) ( pNFormat = rDest.GetNumberFormatter())->MergeFormatter( *pN ); if( &rSrc != &rDest ) - static_cast<SwGetRefFieldType*>(rSrc.getIDocumentFieldsAccess().GetSysFieldType( RES_GETREFFLD ))-> + static_cast<SwGetRefFieldType*>(rSrc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef ))-> MergeWithOtherDoc( rDest ); } diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 38b9f87cdd4b..260adbaf8c71 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -644,7 +644,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable, OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.getIDocumentFieldsAccess().GetFieldTypes()->size(), "FieldType index out of bounds." ); SwFieldType *pType = (nId != USHRT_MAX) ? (*rDoc.getIDocumentFieldsAccess().GetFieldTypes())[nId] : nullptr; - OSL_ENSURE(!pType || pType->Which() == RES_SETEXPFLD, "wrong Id for Label"); + OSL_ENSURE(!pType || pType->Which() == SwFieldIds::SetExp, "wrong Id for Label"); SwTextFormatColl * pColl = nullptr; if( pType ) @@ -1005,7 +1005,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable OSL_ENSURE( nId == USHRT_MAX || nId < rDoc.getIDocumentFieldsAccess().GetFieldTypes()->size(), "FieldType index out of bounds" ); SwFieldType *pType = nId != USHRT_MAX ? (*rDoc.getIDocumentFieldsAccess().GetFieldTypes())[nId] : nullptr; - OSL_ENSURE( !pType || pType->Which() == RES_SETEXPFLD, "Wrong label id" ); + OSL_ENSURE( !pType || pType->Which() == SwFieldIds::SetExp, "Wrong label id" ); SwTextFormatColl *pColl = nullptr; if( pType ) diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 7be07955410f..df5d5d051046 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1254,7 +1254,7 @@ void SwTOXBaseSection::UpdateTemplate( const SwTextNode* pOwnChapterNode ) void SwTOXBaseSection::UpdateSequence( const SwTextNode* pOwnChapterNode ) { SwDoc* pDoc = GetFormat()->GetDoc(); - SwFieldType* pSeqField = pDoc->getIDocumentFieldsAccess().GetFieldType(RES_SETEXPFLD, GetSequenceName(), false); + SwFieldType* pSeqField = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, GetSequenceName(), false); if(!pSeqField) return; @@ -1296,7 +1296,7 @@ void SwTOXBaseSection::UpdateSequence( const SwTextNode* pOwnChapterNode ) void SwTOXBaseSection::UpdateAuthorities( const SwTOXInternational& rIntl ) { SwDoc* pDoc = GetFormat()->GetDoc(); - SwFieldType* pAuthField = pDoc->getIDocumentFieldsAccess().GetFieldType(RES_AUTHORITY, OUString(), false); + SwFieldType* pAuthField = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::TableOfAuthorities, OUString(), false); if(!pAuthField) return; diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx index 78d0b98e4139..6e19eb04f6c2 100644 --- a/sw/source/core/docnode/ndnum.cxx +++ b/sw/source/core/docnode/ndnum.cxx @@ -69,7 +69,7 @@ void SwNodes::UpdateOutlineNode(SwNode & rNd) pTextNd->UpdateOutlineState(); // update the structure fields - GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_CHAPTERFLD )->UpdateFields(); + GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter )->UpdateFields(); } } diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 7c5d983532a9..1f69c67e9a81 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -273,7 +273,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, rNds.GetDoc()->getIDocumentFieldsAccess().InsDelFieldInFieldLst( !bToUndo, *pTextField ); const SwFieldType* pTyp = pTextField->GetFormatField().GetField()->GetTyp(); - if ( RES_POSTITFLD == pTyp->Which() ) + if ( SwFieldIds::Postit == pTyp->Which() ) { rNds.GetDoc()->GetDocShell()->Broadcast( SwFormatFieldHint( @@ -282,7 +282,7 @@ void SwNodes::ChgNode( SwNodeIndex& rDelPos, sal_uLong nSz, ? SwFormatFieldHintWhich::INSERTED : SwFormatFieldHintWhich::REMOVED ) ) ); } - else if( RES_DDEFLD == pTyp->Which() ) + else if( SwFieldIds::Dde == pTyp->Which() ) { if( bToUndo ) const_cast<SwDDEFieldType*>(static_cast<const SwDDEFieldType*>(pTyp))->DecRefCnt(); diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx index 273840b14e44..69b900a177ee 100644 --- a/sw/source/core/edit/edfld.cxx +++ b/sw/source/core/edit/edfld.cxx @@ -41,12 +41,12 @@ #include <DocumentSettingManager.hxx> #include <IDocumentContentOperations.hxx> -/// count field types with a ResId, if 0 count all -size_t SwEditShell::GetFieldTypeCount(sal_uInt16 nResId ) const +/// count field types with a ResId, if SwFieldIds::Unknown count all +size_t SwEditShell::GetFieldTypeCount(SwFieldIds nResId ) const { const SwFieldTypes* pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes(); - if(nResId == USHRT_MAX) + if(nResId == SwFieldIds::Unknown) { return static_cast<sal_uInt16>(pFieldTypes->size()); } @@ -63,11 +63,11 @@ size_t SwEditShell::GetFieldTypeCount(sal_uInt16 nResId ) const } /// get field types with a ResId, if 0 get all -SwFieldType* SwEditShell::GetFieldType(size_t nField, sal_uInt16 nResId ) const +SwFieldType* SwEditShell::GetFieldType(size_t nField, SwFieldIds nResId ) const { const SwFieldTypes* pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes(); - if(nResId == USHRT_MAX && nField < pFieldTypes->size()) + if(nResId == SwFieldIds::Unknown && nField < pFieldTypes->size()) { return (*pFieldTypes)[nField]; } @@ -87,7 +87,7 @@ SwFieldType* SwEditShell::GetFieldType(size_t nField, sal_uInt16 nResId ) const } /// get first type with given ResId and name -SwFieldType* SwEditShell::GetFieldType(sal_uInt16 nResId, const OUString& rName) const +SwFieldType* SwEditShell::GetFieldType(SwFieldIds nResId, const OUString& rName) const { return GetDoc()->getIDocumentFieldsAccess().GetFieldType( nResId, rName, false ); } @@ -99,7 +99,7 @@ void SwEditShell::RemoveFieldType(size_t nField) } /// delete field type based on its name -void SwEditShell::RemoveFieldType(sal_uInt16 nResId, const OUString& rStr) +void SwEditShell::RemoveFieldType(SwFieldIds nResId, const OUString& rStr) { const SwFieldTypes* pFieldTypes = GetDoc()->getIDocumentFieldsAccess().GetFieldTypes(); const SwFieldTypes::size_type nSize = pFieldTypes->size(); @@ -172,7 +172,7 @@ static SwTextField* lcl_FindInputField( SwDoc* pDoc, SwField& rField ) { // Search field via its address. For input fields this needs to be done in protected fields. SwTextField* pTField = nullptr; - if( RES_INPUTFLD == rField.Which() ) + if( SwFieldIds::Input == rField.Which() ) { const sal_uInt32 nMaxItems = pDoc->GetAttrPool().GetItemCount2( RES_TXTATR_INPUTFIELD ); @@ -187,7 +187,7 @@ static SwTextField* lcl_FindInputField( SwDoc* pDoc, SwField& rField ) } } } - else if( RES_SETEXPFLD == rField.Which() + else if( SwFieldIds::SetExp == rField.Which() && static_cast<SwSetExpField&>(rField).GetInputFlag() ) { const sal_uInt32 nMaxItems = @@ -214,8 +214,8 @@ void SwEditShell::UpdateFields( SwField &rField ) // If there are no selections so take the value of the current cursor position. SwMsgPoolItem* pMsgHint = nullptr; SwRefMarkFieldUpdate aRefMkHt( GetOut() ); - sal_uInt16 nFieldWhich = rField.GetTyp()->Which(); - if( RES_GETREFFLD == nFieldWhich ) + SwFieldIds nFieldWhich = rField.GetTyp()->Which(); + if( SwFieldIds::GetRef == nFieldWhich ) pMsgHint = &aRefMkHt; SwPaM* pCursor = GetCursor(); @@ -402,10 +402,10 @@ bool SwEditShell::IsAnyDatabaseFieldInDoc()const { switch(pFieldType->Which()) { - case RES_DBFLD: - case RES_DBNEXTSETFLD: - case RES_DBNUMSETFLD: - case RES_DBSETNUMBERFLD: + case SwFieldIds::Database: + case SwFieldIds::DbNextSet: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbSetNumber: { SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); SwFormatField* pField = aIter.First(); @@ -417,6 +417,7 @@ bool SwEditShell::IsAnyDatabaseFieldInDoc()const } } break; + default: break; } } } diff --git a/sw/source/core/edit/edfldexp.cxx b/sw/source/core/edit/edfldexp.cxx index 9a47917f101f..946be7dd3354 100644 --- a/sw/source/core/edit/edfldexp.cxx +++ b/sw/source/core/edit/edfldexp.cxx @@ -40,34 +40,27 @@ bool SwEditShell::IsFieldDataSourceAvailable(OUString& rUsedDataSource) const uno::Reference<sdb::XDatabaseContext> xDBContext = sdb::DatabaseContext::create(xContext); for(const auto pFieldType : *pFieldTypes) { - if(IsUsed(*pFieldType)) + if(IsUsed(*pFieldType) && pFieldType->Which() == SwFieldIds::Database) { - switch(pFieldType->Which()) + SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); + SwFormatField* pFormatField = aIter.First(); + while(pFormatField) { - case RES_DBFLD: + if(pFormatField->IsFieldInDoc()) { - SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); - SwFormatField* pFormatField = aIter.First(); - while(pFormatField) + const SwDBData& rData = + static_cast<SwDBFieldType*>(pFormatField->GetField()->GetTyp())->GetDBData(); + try { - if(pFormatField->IsFieldInDoc()) - { - const SwDBData& rData = - static_cast<SwDBFieldType*>(pFormatField->GetField()->GetTyp())->GetDBData(); - try - { - return xDBContext->getByName(rData.sDataSource).hasValue(); - } - catch(uno::Exception const &) - { - rUsedDataSource = rData.sDataSource; - return false; - } - } - pFormatField = aIter.Next(); + return xDBContext->getByName(rData.sDataSource).hasValue(); + } + catch(uno::Exception const &) + { + rUsedDataSource = rData.sDataSource; + return false; } } - break; + pFormatField = aIter.Next(); } } } diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index de3e7af81986..bf7cabb18d03 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -64,7 +64,7 @@ bool SwAuthEntry::operator==(const SwAuthEntry& rComp) } SwAuthorityFieldType::SwAuthorityFieldType(SwDoc* pDoc) - : SwFieldType( RES_AUTHORITY ), + : SwFieldType( SwFieldIds::TableOfAuthorities ), m_pDoc(pDoc), m_SortKeyArr(3), m_cPrefix('['), diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx index d45c070b5bea..0c0d96c9bb25 100644 --- a/sw/source/core/fields/cellfml.cxx +++ b/sw/source/core/fields/cellfml.cxx @@ -162,13 +162,13 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) const const SwField* pField = pTextField->GetFormatField().GetField(); switch ( pField->GetTyp()->Which() ) { - case RES_SETEXPFLD: + case SwFieldIds::SetExp: nRet = static_cast<const SwSetExpField*>(pField)->GetValue(); break; - case RES_USERFLD: + case SwFieldIds::User: nRet = static_cast<const SwUserField*>(pField)->GetValue(); break; - case RES_TABLEFLD: + case SwFieldIds::Table: { SwTableField* pTableField = const_cast<SwTableField*>(static_cast<const SwTableField*>(pField)); if( !pTableField->IsValid() ) @@ -183,11 +183,11 @@ double SwTableBox::GetValue( SwTableCalcPara& rCalcPara ) const } break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: nRet = static_cast<const SwDateTimeField*>( pField )->GetValue(); break; - case RES_JUMPEDITFLD: + case SwFieldIds::JumpEdit: //JP 14.09.98: Bug 56112 - placeholder never have the right content! nRet = 0; break; diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx index f7cf4ead10b0..de93b316c375 100644 --- a/sw/source/core/fields/chpfld.cxx +++ b/sw/source/core/fields/chpfld.cxx @@ -52,7 +52,7 @@ OUString removeControlChars(const OUString& sIn) } SwChapterFieldType::SwChapterFieldType() - : SwFieldType( RES_CHAPTERFLD ) + : SwFieldType( SwFieldIds::Chapter ) { } diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index beea51aca440..e6724c228c7b 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -53,7 +53,7 @@ static OUString lcl_DBTrennConv(const OUString& aContent) // database field type SwDBFieldType::SwDBFieldType(SwDoc* pDocPtr, const OUString& rNam, const SwDBData& rDBData ) : - SwValueFieldType( pDocPtr, RES_DBFLD ), + SwValueFieldType( pDocPtr, SwFieldIds::Database ), aDBData(rDBData), sName(rNam), sColumn(rNam), @@ -550,7 +550,7 @@ void SwDBNameInfField::SetSubType(sal_uInt16 nType) // next dataset SwDBNextSetFieldType::SwDBNextSetFieldType() - : SwFieldType( RES_DBNEXTSETFLD ) + : SwFieldType( SwFieldIds::DbNextSet ) { } @@ -636,7 +636,7 @@ bool SwDBNextSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) // dataset with certain ID SwDBNumSetFieldType::SwDBNumSetFieldType() : - SwFieldType( RES_DBNUMSETFLD ) + SwFieldType( SwFieldIds::DbNumSet ) { } @@ -745,7 +745,7 @@ bool SwDBNumSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwDBNameFieldType::SwDBNameFieldType(SwDoc* pDocument) - : SwFieldType( RES_DBNAMEFLD ) + : SwFieldType( SwFieldIds::DatabaseName ) { pDoc = pDocument; } @@ -795,7 +795,7 @@ bool SwDBNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwDBSetNumberFieldType::SwDBSetNumberFieldType() - : SwFieldType( RES_DBSETNUMBERFLD ) + : SwFieldType( SwFieldIds::DbSetNumber ) { } diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index e83b66c7ddec..3ff14069088a 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -232,7 +232,7 @@ bool SwIntrnlRefLink::IsInRange( sal_uLong nSttNd, sal_uLong nEndNd, SwDDEFieldType::SwDDEFieldType(const OUString& rName, const OUString& rCmd, SfxLinkUpdateMode nUpdateType ) - : SwFieldType( RES_DDEFLD ), + : SwFieldType( SwFieldIds::Dde ), aName( rName ), pDoc( nullptr ), nRefCnt( 0 ) { bCRLFFlag = bDeleted = false; diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 912a81038892..a43179f5fb5a 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -97,7 +97,7 @@ using namespace ::com::sun::star::uno; using namespace nsSwDocInfoSubType; SwPageNumberFieldType::SwPageNumberFieldType() - : SwFieldType( RES_PAGENUMBERFLD ), + : SwFieldType( SwFieldIds::PageNumber ), nNumberingType( SVX_NUM_ARABIC ), bVirtuell( false ) { @@ -309,7 +309,7 @@ bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwAuthorFieldType::SwAuthorFieldType() - : SwFieldType( RES_AUTHORFLD ) + : SwFieldType( SwFieldIds::Author ) { } @@ -398,7 +398,7 @@ bool SwAuthorField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwFileNameFieldType::SwFileNameFieldType(SwDoc *pDocument) - : SwFieldType( RES_FILENAMEFLD ) + : SwFieldType( SwFieldIds::Filename ) { pDoc = pDocument; } @@ -571,7 +571,7 @@ bool SwFileNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwTemplNameFieldType::SwTemplNameFieldType(SwDoc *pDocument) - : SwFieldType( RES_TEMPLNAMEFLD ) + : SwFieldType( SwFieldIds::TemplateName ) { pDoc = pDocument; } @@ -715,7 +715,7 @@ bool SwTemplNameField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwDocStatFieldType::SwDocStatFieldType(SwDoc* pDocument) - : SwFieldType( RES_DOCSTATFLD ), nNumberingType( SVX_NUM_ARABIC ) + : SwFieldType( SwFieldIds::DocStat ), nNumberingType( SVX_NUM_ARABIC ) { pDoc = pDocument; } @@ -836,7 +836,7 @@ bool SwDocStatField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) // Document info field type SwDocInfoFieldType::SwDocInfoFieldType(SwDoc* pDc) - : SwValueFieldType( pDc, RES_DOCINFOFLD ) + : SwValueFieldType( pDc, SwFieldIds::DocInfo ) { } @@ -1255,7 +1255,7 @@ bool SwDocInfoField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwHiddenTextFieldType::SwHiddenTextFieldType( bool bSetHidden ) - : SwFieldType( RES_HIDDENTXTFLD ), bHidden( bSetHidden ) + : SwFieldType( SwFieldIds::HiddenText ), bHidden( bSetHidden ) { } @@ -1545,7 +1545,7 @@ OUString SwHiddenTextField::GetDBName(const OUString& rName, SwDoc *pDoc) // field type for line height 0 SwHiddenParaFieldType::SwHiddenParaFieldType() - : SwFieldType( RES_HIDDENPARAFLD ) + : SwFieldType( SwFieldIds::HiddenPara ) { } @@ -1624,7 +1624,7 @@ OUString SwHiddenParaField::GetPar1() const // PostIt field type SwPostItFieldType::SwPostItFieldType(SwDoc *pDoc) - : SwFieldType( RES_POSTITFLD ) + : SwFieldType( SwFieldIds::Postit ) , mpDoc(pDoc) {} @@ -1846,7 +1846,7 @@ void SwPostItField::dumpAsXml(xmlTextWriterPtr pWriter) const // extended user information field type SwExtUserFieldType::SwExtUserFieldType() - : SwFieldType( RES_EXTUSERFLD ) + : SwFieldType( SwFieldIds::ExtUser ) { } @@ -1976,7 +1976,7 @@ bool SwExtUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) // field type for relative page numbers SwRefPageSetFieldType::SwRefPageSetFieldType() - : SwFieldType( RES_REFPAGESETFLD ) + : SwFieldType( SwFieldIds::RefPageSet ) { } @@ -2053,7 +2053,7 @@ bool SwRefPageSetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) // relative page numbers - query field SwRefPageGetFieldType::SwRefPageGetFieldType( SwDoc* pDc ) - : SwFieldType( RES_REFPAGEGETFLD ), pDoc( pDc ), nNumberingType( SVX_NUM_ARABIC ) + : SwFieldType( SwFieldIds::RefPageGet ), pDoc( pDc ), nNumberingType( SVX_NUM_ARABIC ) { } @@ -2087,7 +2087,7 @@ void SwRefPageGetFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* bool SwRefPageGetFieldType::MakeSetList( SetGetExpFields& rTmpLst ) { - SwIterator<SwFormatField,SwFieldType> aIter(*pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_REFPAGESETFLD)); + SwIterator<SwFormatField,SwFieldType> aIter(*pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::RefPageSet)); for ( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) { // update only the GetRef fields @@ -2299,7 +2299,7 @@ bool SwRefPageGetField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) // field type to jump to and edit SwJumpEditFieldType::SwJumpEditFieldType( SwDoc* pD ) - : SwFieldType( RES_JUMPEDITFLD ), pDoc( pD ), aDep( this, nullptr ) + : SwFieldType( SwFieldIds::JumpEdit ), pDoc( pD ), aDep( this, nullptr ) { } @@ -2427,7 +2427,7 @@ bool SwJumpEditField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) // combined character field type SwCombinedCharFieldType::SwCombinedCharFieldType() - : SwFieldType( RES_COMBINED_CHARS ) + : SwFieldType( SwFieldIds::CombinedChars ) { } diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 1f1e6888d758..813f8e100c10 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -261,7 +261,7 @@ const SwTextNode* GetBodyTextNode( const SwDoc& rDoc, SwPosition& rPos, } SwGetExpFieldType::SwGetExpFieldType(SwDoc* pDc) - : SwValueFieldType( pDc, RES_GETEXPFLD ) + : SwValueFieldType( pDc, SwFieldIds::GetExp ) { } @@ -342,7 +342,7 @@ void SwGetExpField::ChangeExpansion( const SwFrame& rFrame, const SwTextField& r // #i82544# if( bLateInitialization ) { - SwFieldType* pSetExpField = rDoc.getIDocumentFieldsAccess().GetFieldType(RES_SETEXPFLD, GetFormula(), false); + SwFieldType* pSetExpField = rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, GetFormula(), false); if( pSetExpField ) { bLateInitialization = false; @@ -486,7 +486,7 @@ bool SwGetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwSetExpFieldType::SwSetExpFieldType( SwDoc* pDc, const OUString& rName, sal_uInt16 nTyp ) - : SwValueFieldType( pDc, RES_SETEXPFLD ), + : SwValueFieldType( pDc, SwFieldIds::SetExp ), sName( rName ), pOutlChgNd( nullptr ), sDelim( "." ), @@ -1110,7 +1110,7 @@ bool SwSetExpField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const } SwInputFieldType::SwInputFieldType( SwDoc* pD ) - : SwFieldType( RES_INPUTFLD ) + : SwFieldType( SwFieldIds::Input ) , pDoc( pD ) { } @@ -1155,7 +1155,7 @@ void SwInputField::applyFieldContent( const OUString& rNewFieldContent ) else if( (nSubType & 0x00ff) == INP_USR ) { SwUserFieldType* pUserTyp = static_cast<SwUserFieldType*>( - static_cast<SwInputFieldType*>(GetTyp())->GetDoc()->getIDocumentFieldsAccess().GetFieldType( RES_USERFLD, getContent(), false ) ); + static_cast<SwInputFieldType*>(GetTyp())->GetDoc()->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::User, getContent(), false ) ); if( pUserTyp ) { pUserTyp->SetContent( rNewFieldContent ); @@ -1220,7 +1220,7 @@ OUString SwInputField::Expand() const if( (nSubType & 0x00ff) == INP_USR ) { SwUserFieldType* pUserTyp = static_cast<SwUserFieldType*>( - static_cast<SwInputFieldType*>(GetTyp())->GetDoc()->getIDocumentFieldsAccess().GetFieldType( RES_USERFLD, getContent(), false ) ); + static_cast<SwInputFieldType*>(GetTyp())->GetDoc()->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::User, getContent(), false ) ); if( pUserTyp ) return pUserTyp->GetContent(); } diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index 69233a93cb80..b24f6c1057de 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -28,6 +28,7 @@ #include <svl/zforlist.hxx> #include <svl/zformat.hxx> #include <editeng/unolingu.hxx> +#include <o3tl/enumarray.hxx> #include <unofldmid.h> #include <doc.hxx> #include <editsh.hxx> @@ -78,47 +79,47 @@ std::vector<OUString>* SwFieldType::s_pFieldNames = nullptr; namespace { - const sal_uInt16 aTypeTab[] = { - /* RES_DBFLD */ TYP_DBFLD, - /* RES_USERFLD */ TYP_USERFLD, - /* RES_FILENAMEFLD */ TYP_FILENAMEFLD, - /* RES_DBNAMEFLD */ TYP_DBNAMEFLD, - /* RES_DATEFLD */ TYP_DATEFLD, - /* RES_TIMEFLD */ TYP_TIMEFLD, - /* RES_PAGENUMBERFLD */ TYP_PAGENUMBERFLD, // dynamic - /* RES_AUTHORFLD */ TYP_AUTHORFLD, - /* RES_CHAPTERFLD */ TYP_CHAPTERFLD, - /* RES_DOCSTATFLD */ TYP_DOCSTATFLD, - /* RES_GETEXPFLD */ TYP_GETFLD, // dynamic - /* RES_SETEXPFLD */ TYP_SETFLD, // dynamic - /* RES_GETREFFLD */ TYP_GETREFFLD, - /* RES_HIDDENTXTFLD */ TYP_HIDDENTXTFLD, - /* RES_POSTITFLD */ TYP_POSTITFLD, - /* RES_FIXDATEFLD */ TYP_FIXDATEFLD, - /* RES_FIXTIMEFLD */ TYP_FIXTIMEFLD, - /* RES_REGFLD */ 0, // old (no change since 2000) - /* RES_VARREGFLD */ 0, // old (no change since 2000) - /* RES_SETREFFLD */ TYP_SETREFFLD, - /* RES_INPUTFLD */ TYP_INPUTFLD, - /* RES_MACROFLD */ TYP_MACROFLD, - /* RES_DDEFLD */ TYP_DDEFLD, - /* RES_TABLEFLD */ TYP_FORMELFLD, - /* RES_HIDDENPARAFLD */ TYP_HIDDENPARAFLD, - /* RES_DOCINFOFLD */ TYP_DOCINFOFLD, - /* RES_TEMPLNAMEFLD */ TYP_TEMPLNAMEFLD, - /* RES_DBNEXTSETFLD */ TYP_DBNEXTSETFLD, - /* RES_DBNUMSETFLD */ TYP_DBNUMSETFLD, - /* RES_DBSETNUMBERFLD */ TYP_DBSETNUMBERFLD, - /* RES_EXTUSERFLD */ TYP_EXTUSERFLD, - /* RES_REFPAGESETFLD */ TYP_SETREFPAGEFLD, - /* RES_REFPAGEGETFLD */ TYP_GETREFPAGEFLD, - /* RES_INTERNETFLD */ TYP_INTERNETFLD, - /* RES_JUMPEDITFLD */ TYP_JUMPEDITFLD, - /* RES_SCRIPTFLD */ TYP_SCRIPTFLD, - /* RES_DATETIMEFLD */ 0, // dynamic - /* RES_AUTHORITY */ TYP_AUTHORITY, - /* RES_COMBINED_CHARS */ TYP_COMBINED_CHARS, - /* RES_DROPDOWN */ TYP_DROPDOWN + 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 }; } @@ -134,7 +135,7 @@ OUString SwFieldType::GetTypeStr(sal_uInt16 nTypeId) } // each field refences a field type that is unique for each document -SwFieldType::SwFieldType( sal_uInt16 nWhichId ) +SwFieldType::SwFieldType( SwFieldIds nWhichId ) : SwModify(nullptr) , m_nWhich(nWhichId) { @@ -192,7 +193,7 @@ SwField::~SwField() // instead of indirectly via the type #ifdef DBG_UTIL -sal_uInt16 SwField::Which() const +SwFieldIds SwField::Which() const { assert(m_pType); return m_pType->Which(); @@ -205,21 +206,21 @@ sal_uInt16 SwField::GetTypeId() const sal_uInt16 nRet; switch (m_pType->Which()) { - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: if (GetSubType() & FIXEDFLD) nRet = static_cast<sal_uInt16>(GetSubType() & DATEFLD ? TYP_FIXDATEFLD : TYP_FIXTIMEFLD); else nRet = static_cast<sal_uInt16>(GetSubType() & DATEFLD ? TYP_DATEFLD : TYP_TIMEFLD); break; - case RES_GETEXPFLD: + case SwFieldIds::GetExp: nRet = static_cast<sal_uInt16>(nsSwGetSetExpType::GSE_FORMULA & GetSubType() ? TYP_FORMELFLD : TYP_GETFLD); break; - case RES_HIDDENTXTFLD: + case SwFieldIds::HiddenText: nRet = GetSubType(); break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if( nsSwGetSetExpType::GSE_SEQ & GetSubType() ) nRet = TYP_SEQFLD; else if( static_cast<const SwSetExpField*>(this)->GetInputFlag() ) @@ -228,7 +229,7 @@ sal_uInt16 SwField::GetTypeId() const nRet = TYP_SETFLD; break; - case RES_PAGENUMBERFLD: + case SwFieldIds::PageNumber: nRet = GetSubType(); if( PG_NEXT == nRet ) nRet = TYP_NEXTPAGEFLD; @@ -248,7 +249,7 @@ sal_uInt16 SwField::GetTypeId() const OUString SwField::GetFieldName() const { sal_uInt16 nTypeId = GetTypeId(); - if (RES_DATETIMEFLD == GetTyp()->Which()) + if (SwFieldIds::DateTime == GetTyp()->Which()) { nTypeId = static_cast<sal_uInt16>( ((GetSubType() & DATEFLD) != 0) ? TYP_DATEFLD : TYP_TIMEFLD); @@ -343,18 +344,19 @@ bool SwField::HasClickHdl() const bool bRet = false; switch (m_pType->Which()) { - case RES_INTERNETFLD: - case RES_JUMPEDITFLD: - case RES_GETREFFLD: - case RES_MACROFLD: - case RES_INPUTFLD: - case RES_DROPDOWN : + case SwFieldIds::Internet: + case SwFieldIds::JumpEdit: + case SwFieldIds::GetRef: + case SwFieldIds::Macro: + case SwFieldIds::Input: + case SwFieldIds::Dropdown : bRet = true; break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: bRet = static_cast<const SwSetExpField*>(this)->GetInputFlag(); break; + default: break; } return bRet; } @@ -374,27 +376,28 @@ bool SwField::IsFixed() const bool bRet = false; switch (m_pType->Which()) { - case RES_FIXDATEFLD: - case RES_FIXTIMEFLD: + case SwFieldIds::FixDate: + case SwFieldIds::FixTime: bRet = true; break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: bRet = 0 != (GetSubType() & FIXEDFLD); break; - case RES_EXTUSERFLD: - case RES_AUTHORFLD: + case SwFieldIds::ExtUser: + case SwFieldIds::Author: bRet = 0 != (GetFormat() & AF_FIXED); break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: bRet = 0 != (GetFormat() & FF_FIXED); break; - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: bRet = 0 != (GetSubType() & DI_SUB_FIXED); break; + default: break; } return bRet; } @@ -443,7 +446,7 @@ OUString FormatNumber(sal_uInt32 nNum, SvxNumType nFormat) return aNumber.GetNumStr(nNum); } -SwValueFieldType::SwValueFieldType(SwDoc *const pDoc, sal_uInt16 const nWhichId) +SwValueFieldType::SwValueFieldType(SwDoc *const pDoc, SwFieldIds const nWhichId) : SwFieldType(nWhichId) , m_pDoc(pDoc) , m_bUseFormat(true) @@ -621,7 +624,7 @@ void SwValueField::SetLanguage( sal_uInt16 nLng ) if( (GetFormat() >= SV_COUNTRY_LANGUAGE_OFFSET || LANGUAGE_SYSTEM != nFormatLng ) && - !(Which() == RES_USERFLD && (GetSubType()&nsSwExtendedSubType::SUB_CMD) ) ) + !(Which() == SwFieldIds::User && (GetSubType()&nsSwExtendedSubType::SUB_CMD) ) ) { const SvNumberformat* pEntry = pFormatter->GetEntry(GetFormat()); @@ -747,13 +750,14 @@ bool SwField::IsClickable() const { switch (Which()) { - case RES_JUMPEDITFLD: - case RES_MACROFLD: - case RES_GETREFFLD: - case RES_INPUTFLD: - case RES_SETEXPFLD: - case RES_DROPDOWN: + case SwFieldIds::JumpEdit: + case SwFieldIds::Macro: + case SwFieldIds::GetRef: + case SwFieldIds::Input: + case SwFieldIds::SetExp: + case SwFieldIds::Dropdown: return true; + default: break; } return false; } diff --git a/sw/source/core/fields/flddat.cxx b/sw/source/core/fields/flddat.cxx index 1bd3b6313c38..549c9771ba3c 100644 --- a/sw/source/core/fields/flddat.cxx +++ b/sw/source/core/fields/flddat.cxx @@ -31,7 +31,7 @@ using namespace ::com::sun::star; SwDateTimeFieldType::SwDateTimeFieldType(SwDoc* pInitDoc) - : SwValueFieldType( pInitDoc, RES_DATETIMEFLD ) + : SwValueFieldType( pInitDoc, SwFieldIds::DateTime ) {} SwFieldType* SwDateTimeFieldType::Copy() const diff --git a/sw/source/core/fields/flddropdown.cxx b/sw/source/core/fields/flddropdown.cxx index e2b1fb7ee27b..f0b4c07bece1 100644 --- a/sw/source/core/fields/flddropdown.cxx +++ b/sw/source/core/fields/flddropdown.cxx @@ -33,7 +33,7 @@ using namespace com::sun::star; using std::vector; SwDropDownFieldType::SwDropDownFieldType() - : SwFieldType(RES_DROPDOWN) + : SwFieldType(SwFieldIds::Dropdown) { } diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx index 04e0f601d2a2..216473997382 100644 --- a/sw/source/core/fields/fldlst.cxx +++ b/sw/source/core/fields/fldlst.cxx @@ -45,9 +45,9 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst ) for(size_t i=0; i < nSize; ++i) { SwFieldType* pFieldType = rFieldTypes[ i ]; - const sal_uInt16 nType = pFieldType->Which(); + const SwFieldIds nType = pFieldType->Which(); - if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType || RES_DROPDOWN == nType ) + if( SwFieldIds::SetExp == nType || SwFieldIds::Input == nType || SwFieldIds::Dropdown == nType ) { SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) @@ -55,7 +55,7 @@ SwInputFieldList::SwInputFieldList( SwEditShell* pShell, bool bBuildTmpLst ) const SwTextField* pTextField = pFormatField->GetTextField(); // only process InputFields, interactive SetExpFields and DropDown fields - if( !pTextField || ( RES_SETEXPFLD == nType && + if( !pTextField || ( SwFieldIds::SetExp == nType && !static_cast<SwSetExpField*>(pFormatField->GetField())->GetInputFlag())) continue; @@ -132,9 +132,9 @@ bool SwInputFieldList::BuildSortLst() for( size_t i = 0; i < nSize; ++i ) { SwFieldType* pFieldType = rFieldTypes[ i ]; - const sal_uInt16 nType = pFieldType->Which(); + const SwFieldIds nType = pFieldType->Which(); - if( RES_SETEXPFLD == nType || RES_INPUTFLD == nType ) + if( SwFieldIds::SetExp == nType || SwFieldIds::Input == nType ) { SwIterator<SwFormatField,SwFieldType> aIter( *pFieldType ); for( SwFormatField* pFormatField = aIter.First(); pFormatField; pFormatField = aIter.Next() ) @@ -142,7 +142,7 @@ bool SwInputFieldList::BuildSortLst() const SwTextField* pTextField = pFormatField->GetTextField(); // process only InputFields and interactive SetExpFields - if( !pTextField || ( RES_SETEXPFLD == nType && + if( !pTextField || ( SwFieldIds::SetExp == nType && !static_cast<SwSetExpField*>(pFormatField->GetField())->GetInputFlag())) continue; diff --git a/sw/source/core/fields/macrofld.cxx b/sw/source/core/fields/macrofld.cxx index 8a22b69de5dd..1ace82b854ae 100644 --- a/sw/source/core/fields/macrofld.cxx +++ b/sw/source/core/fields/macrofld.cxx @@ -28,7 +28,7 @@ using namespace ::com::sun::star; SwMacroFieldType::SwMacroFieldType(SwDoc* pDocument) - : SwFieldType( RES_MACROFLD ), + : SwFieldType( SwFieldIds::Macro ), pDoc(pDocument) { } diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 7fcde5e71b35..9bee3fa6a4c5 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -753,7 +753,7 @@ void SwGetRefField::ConvertProgrammaticToUIName() SwDoc* pDoc = static_cast<SwGetRefFieldType*>(GetTyp())->GetDoc(); const OUString rPar1 = GetPar1(); // don't convert when the name points to an existing field type - if(!pDoc->getIDocumentFieldsAccess().GetFieldType(RES_SETEXPFLD, rPar1, false)) + if(!pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, rPar1, false)) { sal_uInt16 nPoolId = SwStyleNameMapper::GetPoolIdFromProgName( rPar1, SwGetPoolIdFromName::TxtColl ); sal_uInt16 nResId = USHRT_MAX; @@ -779,7 +779,7 @@ void SwGetRefField::ConvertProgrammaticToUIName() } SwGetRefFieldType::SwGetRefFieldType( SwDoc* pDc ) - : SwFieldType( RES_GETREFFLD ), pDoc( pDc ) + : SwFieldType( SwFieldIds::GetRef ), pDoc( pDc ) {} SwFieldType* SwGetRefFieldType::Copy() const @@ -839,7 +839,7 @@ SwTextNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark case REF_SEQUENCEFLD: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetFieldType( RES_SETEXPFLD, rRefMark, false ); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetFieldType( SwFieldIds::SetExp, rRefMark, false ); if( pFieldType && pFieldType->HasWriterListeners() && nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(pFieldType)->GetType() ) { @@ -949,7 +949,7 @@ public: /// @param[in,out] rIds The list of IDs found in the document. void RefIdsMap::GetFieldIdsFromDoc( SwDoc& rDoc, std::set<sal_uInt16> &rIds) { - SwFieldType *const pType = rDoc.getIDocumentFieldsAccess().GetFieldType(RES_SETEXPFLD, aName, false); + SwFieldType *const pType = rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, aName, false); if (!pType) return; @@ -997,7 +997,7 @@ void RefIdsMap::Init( SwDoc& rDoc, SwDoc& rDestDoc, bool bField ) AddId( GetFirstUnusedId(aIds), *pIt ); // Change the Sequence number of all SetExp fields in the source document - SwFieldType* pType = rDoc.getIDocumentFieldsAccess().GetFieldType( RES_SETEXPFLD, aName, false ); + SwFieldType* pType = rDoc.getIDocumentFieldsAccess().GetFieldType( SwFieldIds::SetExp, aName, false ); if( pType ) { SwIterator<SwFormatField,SwFieldType> aIter( *pType ); @@ -1090,7 +1090,7 @@ void SwGetRefFieldType::MergeWithOtherDoc( SwDoc& rDestDoc ) { // when copying _to_ clipboard, expectation is that no fields exist // so no re-mapping is required to avoid collisions - assert(!rDestDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_GETREFFLD)->HasWriterListeners()); + assert(!rDestDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetRef)->HasWriterListeners()); return; // don't modify the fields in the source doc } diff --git a/sw/source/core/fields/scrptfld.cxx b/sw/source/core/fields/scrptfld.cxx index f2d9a50b1c3a..8585d8b2bdc2 100644 --- a/sw/source/core/fields/scrptfld.cxx +++ b/sw/source/core/fields/scrptfld.cxx @@ -26,7 +26,7 @@ using namespace ::com::sun::star; SwScriptFieldType::SwScriptFieldType( SwDoc* pD ) - : SwFieldType( RES_SCRIPTFLD ), pDoc( pD ) + : SwFieldType( SwFieldIds::Script ), pDoc( pD ) {} SwFieldType* SwScriptFieldType::Copy() const diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx index 1f5c7df71cbd..3668aa5055e1 100644 --- a/sw/source/core/fields/tblcalc.cxx +++ b/sw/source/core/fields/tblcalc.cxx @@ -35,7 +35,7 @@ using namespace ::com::sun::star; SwTableFieldType::SwTableFieldType(SwDoc* pDocPtr) - : SwValueFieldType( pDocPtr, RES_TABLEFLD ) + : SwValueFieldType( pDocPtr, SwFieldIds::Table ) {} SwFieldType* SwTableFieldType::Copy() const diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index ec7aee3fa392..245ef8f35afc 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -156,7 +156,7 @@ bool SwUserField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) } SwUserFieldType::SwUserFieldType( SwDoc* pDocPtr, const OUString& aNam ) - : SwValueFieldType( pDocPtr, RES_USERFLD ), + : SwValueFieldType( pDocPtr, SwFieldIds::User ), nValue( 0 ), nType(nsSwGetSetExpType::GSE_STRING) { @@ -207,7 +207,7 @@ void SwUserFieldType::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) if ( !IsModifyLocked() ) { LockModify(); - GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_INPUTFLD )->UpdateFields(); + GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )->UpdateFields(); UnlockModify(); } } diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx index 18678ce7a2ce..b6d2d04a51be 100644 --- a/sw/source/core/frmedt/fecopy.cxx +++ b/sw/source/core/frmedt/fecopy.cxx @@ -472,7 +472,7 @@ bool SwFEShell::Copy( SwFEShell* pDestShell, const Point& rSttPt, // If there are table formulas in the area, then display the table first // so that the table formula can calculate a new value first // (individual boxes in the area are retrieved via the layout) - SwFieldType* pTableFieldTyp = pDestShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_TABLEFLD ); + SwFieldType* pTableFieldTyp = pDestShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Table ); if( IsFrameSelected() ) { @@ -694,7 +694,7 @@ bool SwFEShell::Paste( SwDoc* pClpDoc ) // If there are table formulas in the area, then display the table first // so that the table formula can calculate a new value first // (individual boxes in the area are retrieved via the layout) - SwFieldType* pTableFieldTyp = GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_TABLEFLD ); + SwFieldType* pTableFieldTyp = GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Table ); SwTableNode *const pSrcNd = aCpyPam.GetNode().GetTableNode(); if( !pSrcNd ) // TabellenNode ? diff --git a/sw/source/core/inc/DocumentFieldsManager.hxx b/sw/source/core/inc/DocumentFieldsManager.hxx index fb1ad7c8af8c..cda9b99421b4 100644 --- a/sw/source/core/inc/DocumentFieldsManager.hxx +++ b/sw/source/core/inc/DocumentFieldsManager.hxx @@ -36,8 +36,8 @@ public: virtual const SwFieldTypes *GetFieldTypes() const override; virtual SwFieldType *InsertFieldType(const SwFieldType &) override; - virtual SwFieldType *GetSysFieldType( const sal_uInt16 eWhich ) const override; - virtual SwFieldType* GetFieldType(sal_uInt16 nResId, const OUString& rName, bool bDbFieldMatching) const override; + virtual SwFieldType *GetSysFieldType( const SwFieldIds eWhich ) const override; + virtual SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName, bool bDbFieldMatching) const override; virtual void RemoveFieldType(size_t nField) override; virtual void UpdateFields(bool bCloseDB) override; virtual void InsDeletedFieldType(SwFieldType &) override; diff --git a/sw/source/core/inc/docfld.hxx b/sw/source/core/inc/docfld.hxx index 6cf9ba575fd5..5410ed76f52a 100644 --- a/sw/source/core/inc/docfld.hxx +++ b/sw/source/core/inc/docfld.hxx @@ -142,7 +142,7 @@ class SwDocUpdateField bool bFieldsDirty : 1; // some fields are invalid void MakeFieldList_( SwDoc& pDoc, int eGetMode ); - void GetBodyNode( const SwTextField& , sal_uInt16 nFieldWhich ); + void GetBodyNode( const SwTextField& , SwFieldIds nFieldWhich ); void GetBodyNode( const SwSectionNode&); public: diff --git a/sw/source/core/inc/rolbck.hxx b/sw/source/core/inc/rolbck.hxx index 53c7deb17b56..391e1251aa36 100644 --- a/sw/source/core/inc/rolbck.hxx +++ b/sw/source/core/inc/rolbck.hxx @@ -53,7 +53,7 @@ class SwpHints; class SwFormatChain; class SwNode; class SwCharFormat; - +enum class SwFieldIds : sal_uInt16; enum HISTORY_HINT { HSTRY_SETFMTHNT, @@ -134,7 +134,7 @@ class SwHistorySetTextField : public SwHistoryHint sal_uLong m_nNodeIndex; sal_Int32 m_nPos; - sal_uInt16 m_nFieldWhich; + SwFieldIds m_nFieldWhich; public: SwHistorySetTextField( SwTextField* pTextField, sal_uLong nNode ); diff --git a/sw/source/core/inc/unofield.hxx b/sw/source/core/inc/unofield.hxx index e864587bdfa4..b54480c97c3b 100644 --- a/sw/source/core/inc/unofield.hxx +++ b/sw/source/core/inc/unofield.hxx @@ -30,6 +30,7 @@ #include <unobaseclass.hxx> #include <unocoll.hxx> +#include <fldbas.hxx> class SwFieldType; class SwDoc; @@ -56,13 +57,13 @@ private: SwXFieldMaster(SwFieldType& rType, SwDoc * pDoc); /// descriptor - SwXFieldMaster(SwDoc* pDoc, sal_uInt16 nResId); + SwXFieldMaster(SwDoc* pDoc, SwFieldIds nResId); public: static css::uno::Reference<css::beans::XPropertySet> CreateXFieldMaster(SwDoc * pDoc, SwFieldType * pType, - sal_uInt16 nResId = 0xFFFF); + SwFieldIds nResId = SwFieldIds::Unknown); static OUString GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc); static OUString LocalizeFormula(const SwSetExpField& rField, const OUString& rFormula, bool bQuery); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index dde3c458e79f..6b2b5d7528cf 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -1413,12 +1413,12 @@ void SwTaggedPDFHelper::BeginInlineStructureElements() if ( pHint && RES_TXTATR_FIELD == pHint->Which() ) { const SwField* pField = pHint->GetFormatField().GetField(); - if ( RES_GETREFFLD == pField->Which() ) + if ( SwFieldIds::GetRef == pField->Which() ) { nPDFType = vcl::PDFWriter::Link; aPDFType = aLinkString; } - else if ( RES_AUTHORITY == pField->Which() ) + else if ( SwFieldIds::TableOfAuthorities == pField->Which() ) { nPDFType = vcl::PDFWriter::BibEntry; aPDFType = aBibEntryString; @@ -1564,7 +1564,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() if ( pPDFExtOutDevData->GetIsExportNotes() ) { - SwFieldType* pType = mrSh.GetFieldType( RES_POSTITFLD, OUString() ); + SwFieldType* pType = mrSh.GetFieldType( SwFieldIds::Postit, OUString() ); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); for( SwFormatField* pFirst = aIter.First(); pFirst; ) { @@ -1852,7 +1852,7 @@ void SwEnhancedPDFExportHelper::EnhancedPDFExport() // REFERENCES - SwFieldType* pType = mrSh.GetFieldType( RES_GETREFFLD, OUString() ); + SwFieldType* pType = mrSh.GetFieldType( SwFieldIds::GetRef, OUString() ); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); for( SwFormatField* pFirst = aIter.First(); pFirst; ) { diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index 1d5ecd28aaab..028eb23b7c2f 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -86,7 +86,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, { pField->SetLanguage( GetFnt()->GetLanguage() ); // let the visual note know about its new language - if (pField->GetTyp()->Which()==RES_POSTITFLD) + if (pField->GetTyp()->Which()==SwFieldIds::Postit) const_cast<SwFormatField*> (&pHint->GetFormatField())->Broadcast( SwFormatFieldHint( &pHint->GetFormatField(), SwFormatFieldHintWhich::LANGUAGE ) ); } @@ -97,12 +97,12 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, switch( pField->GetTyp()->Which() ) { - case RES_SCRIPTFLD: - case RES_POSTITFLD: - pRet = new SwPostItsPortion( RES_SCRIPTFLD == pField->GetTyp()->Which() ); + case SwFieldIds::Script: + case SwFieldIds::Postit: + pRet = new SwPostItsPortion( SwFieldIds::Script == pField->GetTyp()->Which() ); break; - case RES_COMBINED_CHARS: + case SwFieldIds::CombinedChars: { if( bName ) pRet = new SwFieldPortion( pField->GetFieldName() ); @@ -111,7 +111,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } break; - case RES_HIDDENTXTFLD: + case SwFieldIds::HiddenText: { OUString const aStr( (bName) ? pField->GetFieldName() @@ -120,7 +120,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } break; - case RES_CHAPTERFLD: + case SwFieldIds::Chapter: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFields() ) { static_cast<SwChapterField*>(pField)->ChangeExpansion( pFrame, @@ -134,7 +134,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFields() ) { static_cast<SwDocStatField*>(pField)->ChangeExpansion( pFrame ); @@ -148,7 +148,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, static_cast<SwFieldPortion*>(pRet)->m_nAttrFieldType= ATTR_PAGECOOUNTFLD; break; - case RES_PAGENUMBERFLD: + case SwFieldIds::PageNumber: { if( !bName && pSh && pSh->GetLayout() && !pSh->Imp()->IsUpdateExpFields() ) { @@ -176,7 +176,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, static_cast<SwFieldPortion*>(pRet)->m_nAttrFieldType= ATTR_PAGENUMBERFLD; break; } - case RES_GETEXPFLD: + case SwFieldIds::GetExp: { if( !bName && pSh && !pSh->Imp()->IsUpdateExpFields() ) { @@ -203,7 +203,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } break; } - case RES_DBFLD: + case SwFieldIds::Database: { if( !bName ) { @@ -218,7 +218,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } break; } - case RES_REFPAGEGETFLD: + case SwFieldIds::RefPageGet: if( !bName && pSh && !pSh->Imp()->IsUpdateExpFields() ) { static_cast<SwRefPageGetField*>(pField)->ChangeExpansion(pFrame, @@ -232,13 +232,13 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, } break; - case RES_JUMPEDITFLD: + case SwFieldIds::JumpEdit: if( !bName ) pChFormat = static_cast<SwJumpEditField*>(pField)->GetCharFormat(); bNewFlyPor = true; bPlaceHolder = true; break; - case RES_GETREFFLD: + case SwFieldIds::GetRef: subType = static_cast<SwGetRefField*>(pField)->GetSubType(); { OUString const str( (bName) @@ -251,7 +251,7 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, else if( subType == REF_SETREFATTR ) static_cast<SwFieldPortion*>(pRet)->m_nAttrFieldType = ATTR_SETREFATTRFLD; break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: subType = static_cast<SwDateTimeField*>(pField)->GetSubType(); { OUString const str( (bName) diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index 70a2008c29d6..1183dd5bedfb 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -58,18 +58,18 @@ SwFormatField::SwFormatField( const SwField &rField ) , mpField( rField.CopyField() ) , mpTextField( nullptr ) { - if ( GetField()->GetTyp()->Which() == RES_INPUTFLD ) + if ( GetField()->GetTyp()->Which() == SwFieldIds::Input ) { // input field in-place editing SetWhich( RES_TXTATR_INPUTFIELD ); static_cast<SwInputField*>(GetField())->SetFormatField( *this ); } - else if (GetField()->GetTyp()->Which() == RES_SETEXPFLD) + else if (GetField()->GetTyp()->Which() == SwFieldIds::SetExp) { // see SwWrtShell::StartInputFieldDlg static_cast<SwSetExpField *>(GetField())->SetFormatField(*this); } - else if ( GetField()->GetTyp()->Which() == RES_POSTITFLD ) + else if ( GetField()->GetTyp()->Which() == SwFieldIds::Postit ) { // text annotation field SetWhich( RES_TXTATR_ANNOTATION ); @@ -91,7 +91,7 @@ SwFormatField::SwFormatField( const SwFormatField& rAttr ) { rAttr.GetField()->GetTyp()->Add(this); mpField = rAttr.GetField()->CopyField(); - if ( GetField()->GetTyp()->Which() == RES_INPUTFLD ) + if ( GetField()->GetTyp()->Which() == SwFieldIds::Input ) { // input field in-place editing SetWhich( RES_TXTATR_INPUTFIELD ); @@ -100,12 +100,12 @@ SwFormatField::SwFormatField( const SwFormatField& rAttr ) if (pField) pField->SetFormatField( *this ); } - else if (GetField()->GetTyp()->Which() == RES_SETEXPFLD) + else if (GetField()->GetTyp()->Which() == SwFieldIds::SetExp) { // see SwWrtShell::StartInputFieldDlg static_cast<SwSetExpField *>(GetField())->SetFormatField(*this); } - else if ( GetField()->GetTyp()->Which() == RES_POSTITFLD ) + else if ( GetField()->GetTyp()->Which() == SwFieldIds::Postit ) { // text annotation field SetWhich( RES_TXTATR_ANNOTATION ); @@ -117,7 +117,7 @@ SwFormatField::~SwFormatField() { SwFieldType* pType = mpField ? mpField->GetTyp() : nullptr; - if (pType && pType->Which() == RES_DBFLD) + if (pType && pType->Which() == SwFieldIds::Database) pType = nullptr; // DB field types destroy themselves Broadcast( SwFormatFieldHint( this, SwFormatFieldHintWhich::REMOVED ) ); @@ -129,17 +129,18 @@ SwFormatField::~SwFormatField() bool bDel = false; switch( pType->Which() ) { - case RES_USERFLD: + case SwFieldIds::User: bDel = static_cast<SwUserFieldType*>(pType)->IsDeleted(); break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: bDel = static_cast<SwSetExpFieldType*>(pType)->IsDeleted(); break; - case RES_DDEFLD: + case SwFieldIds::Dde: bDel = static_cast<SwDDEFieldType*>(pType)->IsDeleted(); break; + default: break; } if( bDel ) @@ -161,11 +162,11 @@ void SwFormatField::SetField(SwField * _pField) delete mpField; mpField = _pField; - if ( GetField()->GetTyp()->Which() == RES_INPUTFLD ) + if ( GetField()->GetTyp()->Which() == SwFieldIds::Input ) { static_cast<SwInputField* >(GetField())->SetFormatField( *this ); } - else if (GetField()->GetTyp()->Which() == RES_SETEXPFLD) + else if (GetField()->GetTyp()->Which() == SwFieldIds::SetExp) { // see SwWrtShell::StartInputFieldDlg static_cast<SwSetExpField *>(GetField())->SetFormatField(*this); @@ -253,7 +254,7 @@ void SwFormatField::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { case RES_REFMARKFLD_UPDATE: // update GetRef fields - if( RES_GETREFFLD == GetField()->GetTyp()->Which() ) + if( SwFieldIds::GetRef == GetField()->GetTyp()->Which() ) { // #i81002# static_cast<SwGetRefField*>(GetField())->UpdateField( mpTextField ); @@ -275,19 +276,20 @@ void SwFormatField::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) switch (GetField()->GetTyp()->Which()) { - case RES_HIDDENPARAFLD: + case SwFieldIds::HiddenPara: if( !pOld || RES_HIDDENPARA_PRINT != pOld->Which() ) break; SAL_FALLTHROUGH; - case RES_DBSETNUMBERFLD: - case RES_DBNUMSETFLD: - case RES_DBNEXTSETFLD: - case RES_DBNAMEFLD: + case SwFieldIds::DbSetNumber: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbNextSet: + case SwFieldIds::DatabaseName: pTextNd->ModifyNotification( nullptr, pNew); return; + default: break; } - if( RES_USERFLD == GetField()->GetTyp()->Which() ) + if( SwFieldIds::User == GetField()->GetTyp()->Which() ) { SwUserFieldType* pType = static_cast<SwUserFieldType*>(GetField()->GetTyp()); if(!pType->IsValid()) @@ -378,14 +380,14 @@ void SwTextField::ExpandTextField(const bool bForceNotify) const if (aNewExpand == m_aExpand) { - const sal_uInt16 nWhich = pField->GetTyp()->Which(); - if ( RES_CHAPTERFLD != nWhich - && RES_PAGENUMBERFLD != nWhich - && RES_REFPAGEGETFLD != nWhich + const SwFieldIds nWhich = pField->GetTyp()->Which(); + if ( SwFieldIds::Chapter != nWhich + && SwFieldIds::PageNumber != nWhich + && SwFieldIds::RefPageGet != nWhich // Page count fields to not use aExpand during formatting, // therefore an invalidation of the text frame has to be triggered even if aNewExpand == aExpand: - && ( RES_DOCSTATFLD != nWhich || DS_PAGE != static_cast<const SwDocStatField*>(pField)->GetSubType() ) - && ( RES_GETEXPFLD != nWhich || static_cast<const SwGetExpField*>(pField)->IsInBodyText() ) ) + && ( SwFieldIds::DocStat != nWhich || DS_PAGE != static_cast<const SwDocStatField*>(pField)->GetSubType() ) + && ( SwFieldIds::GetExp != nWhich || static_cast<const SwGetExpField*>(pField)->IsInBodyText() ) ) { if( m_pTextNode->CalcHiddenParaField() ) { @@ -413,18 +415,18 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const IDocumentFieldsAccess* pDestIDFA = &pDest->m_pTextNode->getIDocumentFieldsAccess(); SwFormatField& rDestFormatField = (SwFormatField&)pDest->GetFormatField(); - const sal_uInt16 nFieldWhich = rDestFormatField.GetField()->GetTyp()->Which(); + const SwFieldIds nFieldWhich = rDestFormatField.GetField()->GetTyp()->Which(); if( pIDFA != pDestIDFA ) { // different documents, e.g. clipboard: // register field type in target document SwFieldType* pFieldType; - if( nFieldWhich != RES_DBFLD - && nFieldWhich != RES_USERFLD - && nFieldWhich != RES_SETEXPFLD - && nFieldWhich != RES_DDEFLD - && RES_AUTHORITY != nFieldWhich ) + if( nFieldWhich != SwFieldIds::Database + && nFieldWhich != SwFieldIds::User + && nFieldWhich != SwFieldIds::SetExp + && nFieldWhich != SwFieldIds::Dde + && SwFieldIds::TableOfAuthorities != nFieldWhich ) { pFieldType = pDestIDFA->GetSysFieldType( nFieldWhich ); } @@ -434,7 +436,7 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const } // DDE fields need special treatment - if( RES_DDEFLD == nFieldWhich ) + if( SwFieldIds::Dde == nFieldWhich ) { if( rDestFormatField.GetTextField() ) { @@ -449,15 +451,15 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const } // update expression fields - if( nFieldWhich == RES_SETEXPFLD - || nFieldWhich == RES_GETEXPFLD - || nFieldWhich == RES_HIDDENTXTFLD ) + if( nFieldWhich == SwFieldIds::SetExp + || nFieldWhich == SwFieldIds::GetExp + || nFieldWhich == SwFieldIds::HiddenText ) { SwTextField* pField = const_cast<SwTextField*>(this); pDestIDFA->UpdateExpFields( pField, true ); } // table fields: external display - else if( RES_TABLEFLD == nFieldWhich + else if( SwFieldIds::Table == nFieldWhich && static_cast<SwTableField*>(rDestFormatField.GetField())->IsIntrnlName() ) { // convert internal (core) to external (UI) formula diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index dbca147c552b..40969ca7308f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1483,7 +1483,7 @@ void lcl_CopyHint( // Table Formula must be copied relative. const SwFormatField& rField = pHt->GetFormatField(); - if( RES_TABLEFLD == rField.GetField()->GetTyp()->Which() + if( SwFieldIds::Table == rField.GetField()->GetTyp()->Which() && static_cast<const SwTableField*>(rField.GetField())->IsIntrnlName()) { // convert internal formula to external diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 2a31d34da89f..e38856540c09 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -1145,36 +1145,37 @@ void SwTextNode::DestroyAttr( SwTextAttr* pAttr ) const SwField* pField = pAttr->GetFormatField().GetField(); //JP 06-08-95: DDE-fields are an exception - assert(RES_DDEFLD == pField->GetTyp()->Which() || + assert(SwFieldIds::Dde == pField->GetTyp()->Which() || this == pTextField->GetpTextNode()); // certain fields must update the SwDoc's calculation flags switch( pField->GetTyp()->Which() ) { - case RES_HIDDENPARAFLD: + case SwFieldIds::HiddenPara: // HiddenParaField must trigger recalculation of visible flag SetCalcHiddenParaField(); SAL_FALLTHROUGH; - case RES_DBSETNUMBERFLD: - case RES_GETEXPFLD: - case RES_DBFLD: - case RES_SETEXPFLD: - case RES_HIDDENTXTFLD: - case RES_DBNUMSETFLD: - case RES_DBNEXTSETFLD: + case SwFieldIds::DbSetNumber: + case SwFieldIds::GetExp: + case SwFieldIds::Database: + case SwFieldIds::SetExp: + case SwFieldIds::HiddenText: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbNextSet: if( !pDoc->getIDocumentFieldsAccess().IsNewFieldLst() && GetNodes().IsDocNodes() ) pDoc->getIDocumentFieldsAccess().InsDelFieldInFieldLst(false, *pTextField); break; - case RES_DDEFLD: + case SwFieldIds::Dde: if (GetNodes().IsDocNodes() && pTextField->GetpTextNode()) static_cast<SwDDEFieldType*>(pField->GetTyp())->DecRefCnt(); break; - case RES_POSTITFLD: + case SwFieldIds::Postit: { const_cast<SwFormatField&>(pAttr->GetFormatField()).Broadcast( SwFormatFieldHint(&pTextField->GetFormatField(), SwFormatFieldHintWhich::REMOVED)); break; } + default: break; } } static_cast<SwFormatField&>(pAttr->GetAttr()).InvalidateField(); @@ -1438,7 +1439,7 @@ bool SwTextNode::InsertHint( SwTextAttr * const pAttr, const SetAttrMode nMode ) case RES_TXTATR_FIELD: { // trigger notification for HiddenParaFields - if( RES_HIDDENPARAFLD == pAttr->GetFormatField().GetField()->GetTyp()->Which() ) + if( SwFieldIds::HiddenPara == pAttr->GetFormatField().GetField()->GetTyp()->Which() ) { bHiddenPara = true; } @@ -2559,7 +2560,7 @@ void SwpHints::CalcFlags() case RES_TXTATR_FIELD: { const SwField* pField = pAttr->GetFormatField().GetField(); - if( RES_DDEFLD == pField->GetTyp()->Which() ) + if( SwFieldIds::Dde == pField->GetTyp()->Which() ) { m_bDDEFields = true; if ( m_bFootnote ) @@ -2587,7 +2588,7 @@ bool SwpHints::CalcHiddenParaField() if( RES_TXTATR_FIELD == nWhich ) { const SwFormatField& rField = pTextHt->GetFormatField(); - if( RES_HIDDENPARAFLD == rField.GetField()->GetTyp()->Which() ) + if( SwFieldIds::HiddenPara == rField.GetField()->GetTyp()->Which() ) { if( !static_cast<const SwHiddenParaField*>(rField.GetField())->IsHidden() ) { @@ -2997,12 +2998,12 @@ bool SwpHints::TryInsertHint( // certain fields must update the SwDoc's calculation flags switch( pField->GetTyp()->Which() ) { - case RES_DBFLD: - case RES_SETEXPFLD: - case RES_HIDDENPARAFLD: - case RES_HIDDENTXTFLD: - case RES_DBNUMSETFLD: - case RES_DBNEXTSETFLD: + case SwFieldIds::Database: + case SwFieldIds::SetExp: + case SwFieldIds::HiddenPara: + case SwFieldIds::HiddenText: + case SwFieldIds::DbNumSet: + case SwFieldIds::DbNextSet: { if( bDelFirst ) pDoc->getIDocumentFieldsAccess().InsDelFieldInFieldLst(false, *pTextField); @@ -3010,10 +3011,11 @@ bool SwpHints::TryInsertHint( pDoc->getIDocumentFieldsAccess().InsDelFieldInFieldLst(true, *pTextField); } break; - case RES_DDEFLD: + case SwFieldIds::Dde: if( rNode.GetNodes().IsDocNodes() ) static_cast<SwDDEFieldType*>(pField->GetTyp())->IncRefCnt(); break; + default: break; } } @@ -3023,7 +3025,7 @@ bool SwpHints::TryInsertHint( bool bInsFieldType = false; switch( pField->GetTyp()->Which() ) { - case RES_SETEXPFLD: + case SwFieldIds::SetExp: bInsFieldType = static_cast<SwSetExpFieldType*>(pField->GetTyp())->IsDeleted(); if( nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(pField->GetTyp())->GetType() ) { @@ -3040,23 +3042,24 @@ bool SwpHints::TryInsertHint( pFieldType->SetSeqRefNo( *const_cast<SwSetExpField*>(static_cast<const SwSetExpField*>(pField)) ); } break; - case RES_USERFLD: + case SwFieldIds::User: bInsFieldType = static_cast<SwUserFieldType*>(pField->GetTyp())->IsDeleted(); break; - case RES_DDEFLD: + case SwFieldIds::Dde: if( pDoc->getIDocumentFieldsAccess().IsNewFieldLst() ) static_cast<SwDDEFieldType*>(pField->GetTyp())->IncRefCnt(); bInsFieldType = static_cast<SwDDEFieldType*>(pField->GetTyp())->IsDeleted(); break; - case RES_POSTITFLD: + case SwFieldIds::Postit: if ( pDoc->GetDocShell() ) { pDoc->GetDocShell()->Broadcast( SwFormatFieldHint( &pTextField->GetFormatField(), SwFormatFieldHintWhich::INSERTED)); } break; + default: break; } if( bInsFieldType ) pDoc->getIDocumentFieldsAccess().InsDeletedFieldType( *pField->GetTyp() ); @@ -3270,7 +3273,7 @@ void SwpHints::DeleteAtPos( const size_t nPos ) { SwTextField *const pTextField(static_txtattr_cast<SwTextField*>(pHint)); const SwFieldType* pFieldTyp = pTextField->GetFormatField().GetField()->GetTyp(); - if( RES_DDEFLD == pFieldTyp->Which() ) + if( SwFieldIds::Dde == pFieldTyp->Which() ) { const SwTextNode* pNd = pTextField->GetpTextNode(); if( pNd && pNd->GetNodes().IsDocNodes() ) @@ -3278,7 +3281,7 @@ void SwpHints::DeleteAtPos( const size_t nPos ) pTextField->ChgTextNode(nullptr); } else if ( m_bHasHiddenParaField && - RES_HIDDENPARAFLD == pFieldTyp->Which() ) + SwFieldIds::HiddenPara == pFieldTyp->Which() ) { m_bCalcHiddenParaField = true; } diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx index 88ae5ac0d7da..2b075c0842d0 100644 --- a/sw/source/core/undo/SwUndoField.cxx +++ b/sw/source/core/undo/SwUndoField.cxx @@ -96,7 +96,7 @@ void SwUndoFieldFromDoc::DoImpl() pDoc->getIDocumentFieldsAccess().UpdateField(pTextField, *pNewField, pHint, bUpdate); SwFormatField* pDstFormatField = const_cast<SwFormatField*>(&pTextField->GetFormatField()); - if ( pDoc->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, aEmptyOUStr, false) == pDstFormatField->GetField()->GetTyp() ) + if ( pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, aEmptyOUStr, false) == pDstFormatField->GetField()->GetTyp() ) pDoc->GetDocShell()->Broadcast( SwFormatFieldHint( pDstFormatField, SwFormatFieldHintWhich::INSERTED ) ); } } diff --git a/sw/source/core/undo/rolbck.cxx b/sw/source/core/undo/rolbck.cxx index c6fdd3c52d4f..2e9ac3d3b6e3 100644 --- a/sw/source/core/undo/rolbck.cxx +++ b/sw/source/core/undo/rolbck.cxx @@ -261,10 +261,10 @@ SwHistorySetTextField::SwHistorySetTextField( SwTextField* pTextField, sal_uLong SwDoc* pDoc = pTextField->GetTextNode().GetDoc(); m_nFieldWhich = m_pField->GetField()->GetTyp()->Which(); - if (m_nFieldWhich == RES_DBFLD || - m_nFieldWhich == RES_USERFLD || - m_nFieldWhich == RES_SETEXPFLD || - m_nFieldWhich == RES_DDEFLD || + if (m_nFieldWhich == SwFieldIds::Database || + m_nFieldWhich == SwFieldIds::User || + m_nFieldWhich == SwFieldIds::SetExp || + m_nFieldWhich == SwFieldIds::Dde || !pDoc->getIDocumentFieldsAccess().GetSysFieldType( m_nFieldWhich )) { m_pFieldType.reset( m_pField->GetField()->GetTyp()->Copy() ); diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 15eb57a2ca1d..674c86ab04c8 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -768,13 +768,13 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc) case SwServiceType::FieldMasterSetExp : case SwServiceType::FieldMasterDatabase: { - sal_uInt16 nResId = USHRT_MAX; + SwFieldIds nResId = SwFieldIds::Unknown; switch(nObjectType) { - case SwServiceType::FieldMasterUser: nResId = RES_USERFLD; break; - case SwServiceType::FieldMasterDDE: nResId = RES_DDEFLD; break; - case SwServiceType::FieldMasterSetExp : nResId = RES_SETEXPFLD; break; - case SwServiceType::FieldMasterDatabase: nResId = RES_DBFLD; break; + case SwServiceType::FieldMasterUser: nResId = SwFieldIds::User; break; + case SwServiceType::FieldMasterDDE: nResId = SwFieldIds::Dde; break; + case SwServiceType::FieldMasterSetExp : nResId = SwFieldIds::SetExp; break; + case SwServiceType::FieldMasterDatabase: nResId = SwFieldIds::Database; break; default: break; } xRet = SwXFieldMaster::CreateXFieldMaster(&rDoc, nullptr, nResId); @@ -782,7 +782,7 @@ SwXServiceProvider::MakeInstance(SwServiceType nObjectType, SwDoc & rDoc) break; case SwServiceType::FieldMasterBibliography: { - SwFieldType* pType = rDoc.getIDocumentFieldsAccess().GetFieldType(RES_AUTHORITY, aEmptyOUStr, true); + SwFieldType* pType = rDoc.getIDocumentFieldsAccess().GetFieldType(SwFieldIds::TableOfAuthorities, aEmptyOUStr, true); if(!pType) { SwAuthorityFieldType aType(&rDoc); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index d7df39bf4884..89e296e159d8 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -129,67 +129,67 @@ static const sal_uInt16 aDocInfoSubTypeFromService[] = struct ServiceIdResId { - sal_uInt16 nResId; + SwFieldIds nResId; SwServiceType nServiceId; }; static const ServiceIdResId aServiceToRes[] = { - {RES_DATETIMEFLD, SwServiceType::FieldTypeDateTime }, - {RES_USERFLD, SwServiceType::FieldTypeUser }, - {RES_SETEXPFLD, SwServiceType::FieldTypeSetExp } , - {RES_GETEXPFLD, SwServiceType::FieldTypeGetExp } , - {RES_FILENAMEFLD, SwServiceType::FieldTypeFileName }, - {RES_PAGENUMBERFLD, SwServiceType::FieldTypePageNum } , - {RES_AUTHORFLD, SwServiceType::FieldTypeAuthor } , - {RES_CHAPTERFLD, SwServiceType::FieldTypeChapter }, - {RES_GETREFFLD, SwServiceType::FieldTypeGetReference } , - {RES_HIDDENTXTFLD, SwServiceType::FieldTypeConditionedText }, - {RES_POSTITFLD, SwServiceType::FieldTypeAnnotation } , - {RES_INPUTFLD, SwServiceType::FieldTypeInput }, - {RES_MACROFLD, SwServiceType::FieldTypeMacro }, - {RES_DDEFLD, SwServiceType::FieldTypeDDE }, - {RES_HIDDENPARAFLD, SwServiceType::FieldTypeHiddenPara } , - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfo }, - {RES_TEMPLNAMEFLD, SwServiceType::FieldTypeTemplateName }, - {RES_EXTUSERFLD, SwServiceType::FieldTypeUserExt }, - {RES_REFPAGESETFLD, SwServiceType::FieldTypeRefPageSet } , - {RES_REFPAGEGETFLD, SwServiceType::FieldTypeRefPageGet } , - {RES_JUMPEDITFLD, SwServiceType::FieldTypeJumpEdit }, - {RES_SCRIPTFLD, SwServiceType::FieldTypeScript } , - {RES_DBNEXTSETFLD, SwServiceType::FieldTypeDatabaseNextSet }, - {RES_DBNUMSETFLD, SwServiceType::FieldTypeDatabaseNumSet }, - {RES_DBSETNUMBERFLD, SwServiceType::FieldTypeDatabaseSetNum } , - {RES_DBFLD, SwServiceType::FieldTypeDatabase } , - {RES_DBNAMEFLD, SwServiceType::FieldTypeDatabaseName }, - {RES_DOCSTATFLD, SwServiceType::FieldTypePageCount }, - {RES_DOCSTATFLD, SwServiceType::FieldTypeParagraphCount }, - {RES_DOCSTATFLD, SwServiceType::FieldTypeWordCount }, - {RES_DOCSTATFLD, SwServiceType::FieldTypeCharacterCount }, - {RES_DOCSTATFLD, SwServiceType::FieldTypeTableCount }, - {RES_DOCSTATFLD, SwServiceType::FieldTypeGraphicObjectCount }, - {RES_DOCSTATFLD, SwServiceType::FieldTypeEmbeddedObjectCount }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoChangeAuthor }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoChangeDateTime}, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoEditTime }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoDescription }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoCreateAuthor }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoCreateDateTime}, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoCustom }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoPrintAuthor }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoPrintDateTime }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoKeywords }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoSubject }, - {RES_DOCINFOFLD, SwServiceType::FieldTypeDocInfoTitle }, - {RES_INPUTFLD, SwServiceType::FieldTypeInputUser }, - {RES_HIDDENTXTFLD, SwServiceType::FieldTypeHiddenText }, - {RES_AUTHORITY, SwServiceType::FieldTypeBibliography }, - {RES_COMBINED_CHARS, SwServiceType::FieldTypeCombinedCharacters }, - {RES_DROPDOWN, SwServiceType::FieldTypeDropdown }, - {RES_TABLEFLD, SwServiceType::FieldTypeTableFormula } + {SwFieldIds::DateTime, SwServiceType::FieldTypeDateTime }, + {SwFieldIds::User, SwServiceType::FieldTypeUser }, + {SwFieldIds::SetExp, SwServiceType::FieldTypeSetExp }, + {SwFieldIds::GetExp, SwServiceType::FieldTypeGetExp }, + {SwFieldIds::Filename, SwServiceType::FieldTypeFileName }, + {SwFieldIds::PageNumber, SwServiceType::FieldTypePageNum }, + {SwFieldIds::Author, SwServiceType::FieldTypeAuthor }, + {SwFieldIds::Chapter, SwServiceType::FieldTypeChapter }, + {SwFieldIds::GetRef, SwServiceType::FieldTypeGetReference }, + {SwFieldIds::HiddenText, SwServiceType::FieldTypeConditionedText }, + {SwFieldIds::Postit, SwServiceType::FieldTypeAnnotation }, + {SwFieldIds::Input, SwServiceType::FieldTypeInput }, + {SwFieldIds::Macro, SwServiceType::FieldTypeMacro }, + {SwFieldIds::Dde, SwServiceType::FieldTypeDDE }, + {SwFieldIds::HiddenPara, SwServiceType::FieldTypeHiddenPara }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfo }, + {SwFieldIds::TemplateName, SwServiceType::FieldTypeTemplateName }, + {SwFieldIds::ExtUser, SwServiceType::FieldTypeUserExt }, + {SwFieldIds::RefPageSet, SwServiceType::FieldTypeRefPageSet }, + {SwFieldIds::RefPageGet, SwServiceType::FieldTypeRefPageGet }, + {SwFieldIds::JumpEdit, SwServiceType::FieldTypeJumpEdit }, + {SwFieldIds::Script, SwServiceType::FieldTypeScript }, + {SwFieldIds::DbNextSet, SwServiceType::FieldTypeDatabaseNextSet }, + {SwFieldIds::DbNumSet, SwServiceType::FieldTypeDatabaseNumSet }, + {SwFieldIds::DbSetNumber, SwServiceType::FieldTypeDatabaseSetNum }, + {SwFieldIds::Database, SwServiceType::FieldTypeDatabase }, + {SwFieldIds::DatabaseName, SwServiceType::FieldTypeDatabaseName }, + {SwFieldIds::DocStat, SwServiceType::FieldTypePageCount }, + {SwFieldIds::DocStat, SwServiceType::FieldTypeParagraphCount }, + {SwFieldIds::DocStat, SwServiceType::FieldTypeWordCount }, + {SwFieldIds::DocStat, SwServiceType::FieldTypeCharacterCount }, + {SwFieldIds::DocStat, SwServiceType::FieldTypeTableCount }, + {SwFieldIds::DocStat, SwServiceType::FieldTypeGraphicObjectCount }, + {SwFieldIds::DocStat, SwServiceType::FieldTypeEmbeddedObjectCount }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoChangeAuthor }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoChangeDateTime }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoEditTime }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoDescription }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoCreateAuthor }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoCreateDateTime }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoCustom }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoPrintAuthor }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoPrintDateTime }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoKeywords }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoSubject }, + {SwFieldIds::DocInfo, SwServiceType::FieldTypeDocInfoTitle }, + {SwFieldIds::Input, SwServiceType::FieldTypeInputUser }, + {SwFieldIds::HiddenText, SwServiceType::FieldTypeHiddenText }, + {SwFieldIds::TableOfAuthorities, SwServiceType::FieldTypeBibliography }, + {SwFieldIds::CombinedChars, SwServiceType::FieldTypeCombinedCharacters }, + {SwFieldIds::Dropdown, SwServiceType::FieldTypeDropdown }, + {SwFieldIds::Table, SwServiceType::FieldTypeTableFormula } }; -static sal_uInt16 lcl_ServiceIdToResId(SwServiceType nServiceId) +static SwFieldIds lcl_ServiceIdToResId(SwServiceType nServiceId) { for (unsigned i=0; i<SAL_N_ELEMENTS(aServiceToRes); ++i) if (aServiceToRes[i].nServiceId == nServiceId) @@ -197,22 +197,22 @@ static sal_uInt16 lcl_ServiceIdToResId(SwServiceType nServiceId) #if OSL_DEBUG_LEVEL > 0 OSL_FAIL("service id not found"); #endif - return USHRT_MAX; + return SwFieldIds::Unknown; } static SwServiceType lcl_GetServiceForField( const SwField& rField ) { - const sal_uInt16 nWhich = rField.Which(); + const SwFieldIds nWhich = rField.Which(); SwServiceType nSrvId = SwServiceType::Invalid; //special handling for some fields switch( nWhich ) { - case RES_INPUTFLD: + case SwFieldIds::Input: if( INP_USR == (rField.GetSubType() & 0x00ff) ) nSrvId = SwServiceType::FieldTypeInputUser; break; - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: { const sal_uInt16 nSubType = rField.GetSubType(); switch( (nSubType & 0xff)) @@ -243,13 +243,13 @@ static SwServiceType lcl_GetServiceForField( const SwField& rField ) } break; - case RES_HIDDENTXTFLD: + case SwFieldIds::HiddenText: nSrvId = TYP_CONDTXTFLD == rField.GetSubType() ? SwServiceType::FieldTypeConditionedText : SwServiceType::FieldTypeHiddenText; break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: { switch( rField.GetSubType() ) { @@ -263,11 +263,12 @@ static SwServiceType lcl_GetServiceForField( const SwField& rField ) } } break; + default: break; } if( SwServiceType::Invalid == nSrvId ) { for( const ServiceIdResId* pMap = aServiceToRes; - USHRT_MAX != pMap->nResId; ++pMap ) + SwFieldIds::Unknown != pMap->nResId; ++pMap ) if( nWhich == pMap->nResId ) { nSrvId = pMap->nServiceId; @@ -281,17 +282,18 @@ static SwServiceType lcl_GetServiceForField( const SwField& rField ) return nSrvId; } -static sal_uInt16 lcl_GetPropMapIdForFieldType( sal_uInt16 nWhich ) +static sal_uInt16 lcl_GetPropMapIdForFieldType( SwFieldIds nWhich ) { sal_uInt16 nId; switch( nWhich ) { - case RES_USERFLD: nId = PROPERTY_MAP_FLDMSTR_USER; break; - case RES_DBFLD: nId = PROPERTY_MAP_FLDMSTR_DATABASE; break; - case RES_SETEXPFLD: nId = PROPERTY_MAP_FLDMSTR_SET_EXP; break; - case RES_DDEFLD: nId = PROPERTY_MAP_FLDMSTR_DDE; break; - case RES_AUTHORITY: nId = PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; break; - default: nId = PROPERTY_MAP_FLDMSTR_DUMMY0; + case SwFieldIds::User: nId = PROPERTY_MAP_FLDMSTR_USER; break; + case SwFieldIds::Database: nId = PROPERTY_MAP_FLDMSTR_DATABASE; break; + case SwFieldIds::SetExp: nId = PROPERTY_MAP_FLDMSTR_SET_EXP; break; + case SwFieldIds::Dde: nId = PROPERTY_MAP_FLDMSTR_DDE; break; + case SwFieldIds::TableOfAuthorities: + nId = PROPERTY_MAP_FLDMSTR_BIBLIOGRAPHY; break; + default: nId = PROPERTY_MAP_FLDMSTR_DUMMY0; } return nId; } @@ -421,7 +423,7 @@ public: bool m_bIsDescriptor; - sal_uInt16 m_nResTypeId; + SwFieldIds m_nResTypeId; OUString m_sParam1; // Content / Database / NumberingSeparator OUString m_sParam2; // - /DataTablename @@ -433,7 +435,7 @@ public: sal_Int32 m_nParam2; Impl(SwModify *const pModify, - SwDoc * pDoc, sal_uInt16 const nResId, bool const bIsDescriptor) + SwDoc * pDoc, SwFieldIds nResId, bool bIsDescriptor) : SwClient(pModify) , m_EventListeners(m_Mutex) , m_pDoc(pDoc) @@ -475,24 +477,24 @@ SwXFieldMaster::getImplementationName() namespace { -OUString getServiceName(const sal_uInt16 aId) +OUString getServiceName(const SwFieldIds aId) { const sal_Char* pEntry; switch (aId) { - case RES_USERFLD: + case SwFieldIds::User: pEntry = "User"; break; - case RES_DBFLD: + case SwFieldIds::Database: pEntry = "Database"; break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: pEntry = "SetExpression"; break; - case RES_DDEFLD: + case SwFieldIds::Dde: pEntry = "DDE"; break; - case RES_AUTHORITY: + case SwFieldIds::TableOfAuthorities: pEntry = "Bibliography"; break; default: @@ -519,7 +521,7 @@ SwXFieldMaster::getSupportedServiceNames() return aRet; } -SwXFieldMaster::SwXFieldMaster(SwDoc *const pDoc, sal_uInt16 const nResId) +SwXFieldMaster::SwXFieldMaster(SwDoc *const pDoc, SwFieldIds const nResId) : m_pImpl(new Impl(pDoc->getIDocumentStylePoolAccess().GetPageDescFromPool(RES_POOLPAGE_STANDARD), pDoc, nResId, true)) { @@ -536,7 +538,7 @@ SwXFieldMaster::~SwXFieldMaster() uno::Reference<beans::XPropertySet> SwXFieldMaster::CreateXFieldMaster(SwDoc * pDoc, SwFieldType *const pType, - sal_uInt16 nResId) + SwFieldIds nResId) { // re-use existing SwXFieldMaster uno::Reference<beans::XPropertySet> xFM; @@ -611,7 +613,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( if ( USHRT_MAX != nMemberValueId ) { pType->PutValue( rValue, nMemberValueId ); - if ( pType->Which() == RES_USERFLD ) + if ( pType->Which() == SwFieldIds::User ) { // trigger update of User field in order to get depending Input Fields updated. pType->UpdateFields(); @@ -633,7 +635,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( m_pImpl->m_nResTypeId, sTypeName, false); if(pType2 || - (RES_SETEXPFLD == m_pImpl->m_nResTypeId && + (SwFieldIds::SetExp == m_pImpl->m_nResTypeId && ( sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_TABLE) || sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_DRAWING) || sTypeName == SW_RESSTR(STR_POOLCOLL_LABEL_FRAME) || @@ -644,7 +646,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( switch (m_pImpl->m_nResTypeId) { - case RES_USERFLD : + case SwFieldIds::User : { SwUserFieldType aType(m_pImpl->m_pDoc, sTypeName); pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType); @@ -654,14 +656,14 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( ? nsSwGetSetExpType::GSE_EXPR : nsSwGetSetExpType::GSE_STRING); } break; - case RES_DDEFLD : + case SwFieldIds::Dde : { SwDDEFieldType aType(sTypeName, m_pImpl->m_sParam1, m_pImpl->m_bParam1 ? SfxLinkUpdateMode::ALWAYS : SfxLinkUpdateMode::ONCALL); pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType); } break; - case RES_SETEXPFLD : + case SwFieldIds::SetExp : { SwSetExpFieldType aType(m_pImpl->m_pDoc, sTypeName); if (!m_pImpl->m_sParam1.isEmpty()) @@ -671,12 +673,13 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( pType2 = m_pImpl->m_pDoc->getIDocumentFieldsAccess().InsertFieldType(aType); } break; - case RES_DBFLD : + case SwFieldIds::Database : { rValue >>= m_pImpl->m_sParam3; pType2 = GetFieldType(); } break; + default: break; } if (!pType2) { @@ -689,7 +692,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( { switch (m_pImpl->m_nResTypeId) { - case RES_USERFLD: + case SwFieldIds::User: if(rPropertyName == UNO_NAME_CONTENT) rValue >>= m_pImpl->m_sParam1; else if(rPropertyName == UNO_NAME_VALUE) @@ -706,7 +709,7 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( } break; - case RES_DBFLD: + case SwFieldIds::Database: if(rPropertyName == UNO_NAME_DATA_BASE_NAME) rValue >>= m_pImpl->m_sParam1; else if(rPropertyName == UNO_NAME_DATA_TABLE_NAME) @@ -726,13 +729,13 @@ void SAL_CALL SwXFieldMaster::setPropertyValue( GetFieldType(); } break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if(rPropertyName == UNO_NAME_NUMBERING_SEPARATOR) rValue >>= m_pImpl->m_sParam1; else if(rPropertyName == UNO_NAME_CHAPTER_NUMBERING_LEVEL) rValue >>= m_pImpl->m_nParam1; break; - case RES_DDEFLD: + case SwFieldIds::Dde: { sal_Int32 nPart = lcl_PropName2TokenPos(rPropertyName); if(nPart < 3 ) @@ -779,7 +782,7 @@ SwFieldType* SwXFieldMaster::GetFieldType(bool const bDontCreate) const #if !HAVE_FEATURE_DBCONNECTIVITY (void) bDontCreate; #else - if (!bDontCreate && RES_DBFLD == m_pImpl->m_nResTypeId + if (!bDontCreate && SwFieldIds::Database == m_pImpl->m_nResTypeId && m_pImpl->m_bIsDescriptor && m_pImpl->m_pDoc) { SwDBData aData; @@ -897,7 +900,7 @@ SwXFieldMaster::getPropertyValue(const OUString& rPropertyName) { switch (m_pImpl->m_nResTypeId) { - case RES_USERFLD: + case SwFieldIds::User: if( rPropertyName == UNO_NAME_CONTENT ) aRet <<= m_pImpl->m_sParam1; else if(rPropertyName == UNO_NAME_VALUE) @@ -905,7 +908,7 @@ SwXFieldMaster::getPropertyValue(const OUString& rPropertyName) else if(rPropertyName == UNO_NAME_IS_EXPRESSION) aRet <<= m_pImpl->m_bParam1; break; - case RES_DBFLD: + case SwFieldIds::Database: if(rPropertyName == UNO_NAME_DATA_BASE_NAME || rPropertyName == UNO_NAME_DATA_BASE_URL) { @@ -923,13 +926,13 @@ SwXFieldMaster::getPropertyValue(const OUString& rPropertyName) else if(rPropertyName == UNO_NAME_DATA_COLUMN_NAME) aRet <<= m_pImpl->m_sParam3; break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if(rPropertyName == UNO_NAME_NUMBERING_SEPARATOR) aRet <<= m_pImpl->m_sParam1; else if(rPropertyName == UNO_NAME_CHAPTER_NUMBERING_LEVEL) aRet <<= m_pImpl->m_nParam1; break; - case RES_DDEFLD: + case SwFieldIds::Dde: { const sal_Int32 nPart = lcl_PropName2TokenPos(rPropertyName); if(nPart < 3 ) @@ -1032,7 +1035,7 @@ void SwXFieldMaster::Impl::Modify( OUString SwXFieldMaster::GetProgrammaticName(const SwFieldType& rType, SwDoc& rDoc) { const OUString sName(rType.GetName()); - if(RES_SETEXPFLD == rType.Which()) + if(SwFieldIds::SetExp == rType.Which()) { const SwFieldTypes* pTypes = rDoc.getIDocumentFieldsAccess().GetFieldTypes(); for( size_t i = 0; i <= size_t(INIT_FLDTYPES); i++ ) @@ -1330,7 +1333,7 @@ void SAL_CALL SwXTextField::attach( { case SwServiceType::FieldTypeAnnotation: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_POSTITFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit); DateTime aDateTime( DateTime::EMPTY ); if (m_pImpl->m_pProps->pDateTime) @@ -1354,7 +1357,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeScript: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_SCRIPTFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Script); pField = new SwScriptField(static_cast<SwScriptFieldType*>(pFieldType), m_pImpl->m_pProps->sPar1, m_pImpl->m_pProps->sPar2, m_pImpl->m_pProps->bBool1); @@ -1369,7 +1372,7 @@ void SAL_CALL SwXTextField::attach( nSub |= DATEFLD; else nSub |= TIMEFLD; - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DATETIMEFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime); SwDateTimeField *const pDTField = new SwDateTimeField( static_cast<SwDateTimeFieldType*>(pFieldType), nSub, m_pImpl->m_pProps->nFormat); @@ -1388,7 +1391,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeFileName: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_FILENAMEFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Filename); sal_Int32 nFormat = m_pImpl->m_pProps->nFormat; if (m_pImpl->m_pProps->bBool2) nFormat |= FF_FIXED; @@ -1404,7 +1407,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeTemplateName: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_TEMPLNAMEFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::TemplateName); pField = new SwTemplNameField(static_cast<SwTemplNameFieldType*>(pFieldType), m_pImpl->m_pProps->nFormat); uno::Any aFormat; @@ -1414,7 +1417,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeChapter: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_CHAPTERFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Chapter); SwChapterField *const pChapterField = new SwChapterField( static_cast<SwChapterFieldType*>(pFieldType), m_pImpl->m_pProps->nUSHORT1); @@ -1431,7 +1434,7 @@ void SAL_CALL SwXTextField::attach( if (m_pImpl->m_pProps->bBool2) nFormat |= AF_FIXED; - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_AUTHORFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Author); SwAuthorField *const pAuthorField = new SwAuthorField( static_cast<SwAuthorFieldType*>(pFieldType), nFormat); pField = pAuthorField; @@ -1441,7 +1444,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeConditionedText: case SwServiceType::FieldTypeHiddenText: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_HIDDENTXTFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenText); SwHiddenTextField *const pHTField = new SwHiddenTextField( static_cast<SwHiddenTextFieldType*>(pFieldType), m_pImpl->m_pProps->sPar1, @@ -1457,7 +1460,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeHiddenPara: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_HIDDENPARAFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenPara); SwHiddenParaField *const pHPField = new SwHiddenParaField( static_cast<SwHiddenParaFieldType*>(pFieldType), m_pImpl->m_pProps->sPar1); @@ -1467,7 +1470,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeGetReference: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_GETREFFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetRef); pField = new SwGetRefField(static_cast<SwGetRefFieldType*>(pFieldType), m_pImpl->m_pProps->sPar1, 0, @@ -1486,7 +1489,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeJumpEdit: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_JUMPEDITFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::JumpEdit); pField = new SwJumpEditField(static_cast<SwJumpEditFieldType*>(pFieldType), m_pImpl->m_pProps->nUSHORT1, m_pImpl->m_pProps->sPar2, m_pImpl->m_pProps->sPar1); @@ -1507,7 +1510,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeDocInfoRevision : case SwServiceType::FieldTypeDocInfo: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DOCINFOFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DocInfo); sal_uInt16 nSubType = aDocInfoSubTypeFromService[ (sal_uInt16)m_pImpl->m_nServiceId - (sal_uInt16)SwServiceType::FieldTypeDocInfoChangeAuthor]; if (SwServiceType::FieldTypeDocInfoChangeDateTime == m_pImpl->m_nServiceId || @@ -1541,7 +1544,7 @@ void SAL_CALL SwXTextField::attach( if (m_pImpl->m_pProps->bBool1) nFormat = AF_FIXED; - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_EXTUSERFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::ExtUser); SwExtUserField *const pEUField = new SwExtUserField( static_cast<SwExtUserFieldType*>(pFieldType), m_pImpl->m_pProps->nUSHORT1, nFormat); @@ -1552,7 +1555,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeUser: { SwFieldType* pFieldType = - pDoc->getIDocumentFieldsAccess().GetFieldType(RES_USERFLD, m_pImpl->m_sTypeName, true); + pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::User, m_pImpl->m_sTypeName, true); if (!pFieldType) throw uno::RuntimeException(); sal_uInt16 nUserSubType = (m_pImpl->m_pProps->bBool1) @@ -1571,7 +1574,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeRefPageSet: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_REFPAGESETFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageSet); pField = new SwRefPageSetField( static_cast<SwRefPageSetFieldType*>(pFieldType), m_pImpl->m_pProps->nUSHORT1, m_pImpl->m_pProps->bBool1 ); @@ -1579,7 +1582,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeRefPageGet: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_REFPAGEGETFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::RefPageGet); SwRefPageGetField *const pRGField = new SwRefPageGetField( static_cast<SwRefPageGetFieldType*>(pFieldType), m_pImpl->m_pProps->nUSHORT1 ); @@ -1589,7 +1592,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypePageNum: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_PAGENUMBERFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::PageNumber); SwPageNumberField *const pPNField = new SwPageNumberField( static_cast<SwPageNumberFieldType*>(pFieldType), PG_RANDOM, m_pImpl->m_pProps->nFormat, @@ -1604,7 +1607,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeDDE: { SwFieldType* pFieldType = - pDoc->getIDocumentFieldsAccess().GetFieldType(RES_DDEFLD, m_pImpl->m_sTypeName, true); + pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, m_pImpl->m_sTypeName, true); if (!pFieldType) throw uno::RuntimeException(); pField = new SwDDEField( static_cast<SwDDEFieldType*>(pFieldType) ); @@ -1613,7 +1616,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeDatabaseName: #if HAVE_FEATURE_DBCONNECTIVITY { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DBNAMEFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DatabaseName); SwDBData aData; aData.sDataSource = m_pImpl->m_pProps->sPar1; aData.sCommand = m_pImpl->m_pProps->sPar2; @@ -1635,7 +1638,7 @@ void SAL_CALL SwXTextField::attach( aData.sDataSource = m_pImpl->m_pProps->sPar1; aData.sCommand = m_pImpl->m_pProps->sPar2; aData.nCommandType = m_pImpl->m_pProps->nSHORT1; - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DBNEXTSETFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DbNextSet); pField = new SwDBNextSetField(static_cast<SwDBNextSetFieldType*>(pFieldType), m_pImpl->m_pProps->sPar3, OUString(), aData); } @@ -1649,7 +1652,7 @@ void SAL_CALL SwXTextField::attach( aData.sCommand = m_pImpl->m_pProps->sPar2; aData.nCommandType = m_pImpl->m_pProps->nSHORT1; pField = new SwDBNumSetField( static_cast<SwDBNumSetFieldType*>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DBNUMSETFLD)), + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DbNumSet)), m_pImpl->m_pProps->sPar3, OUString::number(m_pImpl->m_pProps->nFormat), aData ); @@ -1665,7 +1668,7 @@ void SAL_CALL SwXTextField::attach( aData.nCommandType = m_pImpl->m_pProps->nSHORT1; SwDBSetNumberField *const pDBSNField = new SwDBSetNumberField(static_cast<SwDBSetNumberFieldType*>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DBSETNUMBERFLD)), aData, + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DbSetNumber)), aData, m_pImpl->m_pProps->nUSHORT1); pField = pDBSNField; pDBSNField->SetSetNumber(m_pImpl->m_pProps->nFormat); @@ -1682,7 +1685,7 @@ void SAL_CALL SwXTextField::attach( #if HAVE_FEATURE_DBCONNECTIVITY { SwFieldType* pFieldType = - pDoc->getIDocumentFieldsAccess().GetFieldType(RES_DBFLD, m_pImpl->m_sTypeName, false); + pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Database, m_pImpl->m_sTypeName, false); if (!pFieldType) throw uno::RuntimeException(); pField = new SwDBField(static_cast<SwDBFieldType*>(pFieldType), @@ -1700,7 +1703,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeSetExp: { SwFieldType* pFieldType = - pDoc->getIDocumentFieldsAccess().GetFieldType(RES_SETEXPFLD, m_pImpl->m_sTypeName, true); + pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, m_pImpl->m_sTypeName, true); if (!pFieldType) throw uno::RuntimeException(); // detect the field type's sub type and set an appropriate number format @@ -1749,7 +1752,7 @@ void SAL_CALL SwXTextField::attach( } //make sure the SubType matches the field type SwFieldType* pSetExpField = pDoc->getIDocumentFieldsAccess().GetFieldType( - RES_SETEXPFLD, m_pImpl->m_pProps->sPar1, false); + SwFieldIds::SetExp, m_pImpl->m_pProps->sPar1, false); bool bSetGetExpFieldUninitialized = false; if (pSetExpField) { @@ -1766,7 +1769,7 @@ void SAL_CALL SwXTextField::attach( nSubType &= ~nsSwExtendedSubType::SUB_CMD; SwGetExpField *const pGEField = new SwGetExpField( static_cast<SwGetExpFieldType*>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_GETEXPFLD)), + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetExp)), m_pImpl->m_pProps->sPar1, nSubType, m_pImpl->m_pProps->nFormat); pField = pGEField; @@ -1782,7 +1785,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeInput: { SwFieldType* pFieldType = - pDoc->getIDocumentFieldsAccess().GetFieldType(RES_INPUTFLD, m_pImpl->m_sTypeName, true); + pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Input, m_pImpl->m_sTypeName, true); if (!pFieldType) throw uno::RuntimeException(); sal_uInt16 nInpSubType = @@ -1802,7 +1805,7 @@ void SAL_CALL SwXTextField::attach( break; case SwServiceType::FieldTypeMacro: { - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_MACROFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Macro); OUString aName; // support for Scripting Framework macros @@ -1838,7 +1841,7 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeEmbeddedObjectCount : nSubType = DS_OLE; break; default: break; } - SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DOCSTATFLD); + SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DocStat); pField = new SwDocStatField( static_cast<SwDocStatFieldType*>(pFieldType), nSubType, m_pImpl->m_pProps->nUSHORT2); @@ -1861,14 +1864,14 @@ void SAL_CALL SwXTextField::attach( case SwServiceType::FieldTypeCombinedCharacters: // create field pField = new SwCombinedCharField( static_cast<SwCombinedCharFieldType*>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_COMBINED_CHARS)), + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::CombinedChars)), m_pImpl->m_pProps->sPar1); break; case SwServiceType::FieldTypeDropdown: { SwDropDownField *const pDDField = new SwDropDownField( static_cast<SwDropDownFieldType *>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_DROPDOWN))); + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Dropdown))); pField = pDDField; pDDField->SetItems(m_pImpl->m_pProps->aStrings); @@ -1890,7 +1893,7 @@ void SAL_CALL SwXTextField::attach( m_pImpl->m_pProps->nFormat = -1; } pField = new SwTableField( static_cast<SwTableFieldType*>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_TABLEFLD)), + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Table)), m_pImpl->m_pProps->sPar2, nType, m_pImpl->m_pProps->nFormat); @@ -2046,7 +2049,7 @@ SwXTextField::getAnchor() return nullptr; // If this is a postit field, then return the range of its annotation mark if it has one. - if (pField->Which() == RES_POSTITFLD) + if (pField->Which() == SwFieldIds::Postit) { const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField); IDocumentMarkAccess* pMarkAccess = m_pImpl->m_pDoc->getIDocumentMarkAccess(); @@ -2137,8 +2140,8 @@ SwXTextField::setPropertyValue( if(pField) { // special treatment for mail merge fields - const sal_uInt16 nWhich = pField->Which(); - if( RES_DBFLD == nWhich && + const SwFieldIds nWhich = pField->Which(); + if( SwFieldIds::Database == nWhich && (rPropertyName == UNO_NAME_DATA_BASE_NAME || rPropertyName == UNO_NAME_DATA_BASE_URL|| rPropertyName == UNO_NAME_DATA_TABLE_NAME|| @@ -2161,7 +2164,7 @@ SwXTextField::setPropertyValue( } //#i100374# notify SwPostIt about new field content - if (RES_POSTITFLD == nWhich && m_pImpl->m_pFormatField) + if (SwFieldIds::Postit == nWhich && m_pImpl->m_pFormatField) { const_cast<SwFormatField*>(m_pImpl->m_pFormatField)->Broadcast( SwFormatFieldHint( nullptr, SwFormatFieldHintWhich::CHANGED )); @@ -2488,11 +2491,11 @@ void SAL_CALL SwXTextField::update() { switch(pField->Which()) { - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: static_cast<SwDateTimeField*>(pField)->SetDateTime( ::DateTime( ::DateTime::SYSTEM ) ); break; - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: { SwExtUserField* pExtUserField = static_cast<SwExtUserField*>(pField); pExtUserField->SetExpansion( SwExtUserFieldType::Expand( @@ -2501,7 +2504,7 @@ void SAL_CALL SwXTextField::update() } break; - case RES_AUTHORFLD: + case SwFieldIds::Author: { SwAuthorField* pAuthorField = static_cast<SwAuthorField*>(pField); pAuthorField->SetExpansion( SwAuthorFieldType::Expand( @@ -2509,7 +2512,7 @@ void SAL_CALL SwXTextField::update() } break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: { SwFileNameField* pFileNameField = static_cast<SwFileNameField*>(pField); pFileNameField->SetExpansion( static_cast<SwFileNameFieldType*>(pField->GetTyp())->Expand( @@ -2517,7 +2520,7 @@ void SAL_CALL SwXTextField::update() } break; - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: { SwDocInfoField* pDocInfField = static_cast<SwDocInfoField*>(pField); pDocInfField->SetExpansion( static_cast<SwDocInfoFieldType*>(pField->GetTyp())->Expand( @@ -2527,6 +2530,7 @@ void SAL_CALL SwXTextField::update() pDocInfField->GetName() ) ); } break; + default: break; } // Text formatting has to be triggered. const_cast<SwFormatField*>(m_pImpl->m_pFormatField)->ModifyNotification(nullptr, nullptr); @@ -2661,21 +2665,21 @@ SwXTextFieldMasters::~SwXTextFieldMasters() If too much, maybe one could leave out the "com.sun.star.text". */ -static sal_uInt16 lcl_GetIdByName( OUString& rName, OUString& rTypeName ) +static SwFieldIds lcl_GetIdByName( OUString& rName, OUString& rTypeName ) { if (rName.startsWithIgnoreAsciiCase(COM_TEXT_FLDMASTER_CC)) rName = rName.copy(30); - sal_uInt16 nResId = USHRT_MAX; + SwFieldIds nResId = SwFieldIds::Unknown; sal_Int32 nFound = 0; rTypeName = rName.getToken( 0, '.', nFound ); if (rTypeName == "User") - nResId = RES_USERFLD; + nResId = SwFieldIds::User; else if (rTypeName == "DDE") - nResId = RES_DDEFLD; + nResId = SwFieldIds::Dde; else if (rTypeName == "SetExpression") { - nResId = RES_SETEXPFLD; + nResId = SwFieldIds::SetExp; const OUString sFieldTypName( rName.getToken( 1, '.' )); const OUString sUIName( SwStyleNameMapper::GetSpecialExtraUIName( sFieldTypName ) ); @@ -2691,11 +2695,11 @@ static sal_uInt16 lcl_GetIdByName( OUString& rName, OUString& rTypeName ) { // #i51815# rName = "DataBase." + rName; - nResId = RES_DBFLD; + nResId = SwFieldIds::Database; } } else if (rTypeName == "Bibliography") - nResId = RES_AUTHORITY; + nResId = SwFieldIds::TableOfAuthorities; return nResId; } @@ -2706,8 +2710,8 @@ uno::Any SwXTextFieldMasters::getByName(const OUString& rName) throw uno::RuntimeException(); OUString sName(rName), sTypeName; - const sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName ); - if( USHRT_MAX == nResId ) + const SwFieldIds nResId = lcl_GetIdByName( sName, sTypeName ); + if( SwFieldIds::Unknown == nResId ) throw container::NoSuchElementException( "SwXTextFieldMasters::getByName(" + rName + ")", css::uno::Reference<css::uno::XInterface>()); @@ -2731,22 +2735,22 @@ bool SwXTextFieldMasters::getInstanceName( switch( rFieldType.Which() ) { - case RES_USERFLD: + case SwFieldIds::User: sField = "User." + rFieldType.GetName(); break; - case RES_DDEFLD: + case SwFieldIds::Dde: sField = "DDE." + rFieldType.GetName(); break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: sField = "SetExpression." + SwStyleNameMapper::GetSpecialExtraProgName( rFieldType.GetName() ); break; - case RES_DBFLD: + case SwFieldIds::Database: sField = "DataBase." + rFieldType.GetName().replaceAll(OUStringLiteral1(DB_DELIM), "."); break; - case RES_AUTHORITY: + case SwFieldIds::TableOfAuthorities: sField = "Bibliography"; break; @@ -2789,12 +2793,12 @@ sal_Bool SwXTextFieldMasters::hasByName(const OUString& rName) throw uno::RuntimeException(); OUString sName(rName), sTypeName; - const sal_uInt16 nResId = lcl_GetIdByName( sName, sTypeName ); + const SwFieldIds nResId = lcl_GetIdByName( sName, sTypeName ); bool bRet = false; - if( USHRT_MAX != nResId ) + if( SwFieldIds::Unknown != nResId ) { sName = sName.copy(std::min(sTypeName.getLength()+1, sName.getLength())); - bRet = USHRT_MAX != nResId && nullptr != GetDoc()->getIDocumentFieldsAccess().GetFieldType(nResId, sName, true); + bRet = SwFieldIds::Unknown != nResId && nullptr != GetDoc()->getIDocumentFieldsAccess().GetFieldType(nResId, sName, true); } return bRet; } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 1762c097201f..fa61ea70eff5 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -2098,14 +2098,14 @@ void SwViewShell::ImplApplyViewOptions( const SwViewOption &rOpt ) if( mpOpt->IsShowHiddenField() != rOpt.IsShowHiddenField() ) { - static_cast<SwHiddenTextFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENTXTFLD ))-> + static_cast<SwHiddenTextFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenText ))-> SetHiddenFlag( !rOpt.IsShowHiddenField() ); bReformat = true; } if ( mpOpt->IsShowHiddenPara() != rOpt.IsShowHiddenPara() ) { SwHiddenParaFieldType* pFieldType = static_cast<SwHiddenParaFieldType*>(GetDoc()-> - getIDocumentFieldsAccess().GetSysFieldType(RES_HIDDENPARAFLD)); + getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::HiddenPara)); if( pFieldType && pFieldType->HasWriterListeners() ) { SwMsgPoolItem aHint( RES_HIDDENPARA_PRINT ); diff --git a/sw/source/core/view/vnew.cxx b/sw/source/core/view/vnew.cxx index dd4fc972072d..ba003b21b2a8 100644 --- a/sw/source/core/view/vnew.cxx +++ b/sw/source/core/view/vnew.cxx @@ -195,7 +195,7 @@ SwViewShell::SwViewShell( SwDoc& rDocument, vcl::Window *pWindow, SET_CURR_SHELL( this ); - static_cast<SwHiddenTextFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENTXTFLD ))-> + static_cast<SwHiddenTextFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenText ))-> SetHiddenFlag( !mpOpt->IsShowHiddenField() ); // In Init a standard FrameFormat is created. @@ -268,7 +268,7 @@ SwViewShell::SwViewShell( SwViewShell& rShell, vcl::Window *pWindow, if ( mbPreview ) mpImp->InitPagePreviewLayout(); - static_cast<SwHiddenTextFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENTXTFLD ))-> + static_cast<SwHiddenTextFieldType*>(mpDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenText ))-> SetHiddenFlag( !mpOpt->IsShowHiddenField() ); // In Init a standard FrameFormat is created. diff --git a/sw/source/filter/basflt/fltshell.cxx b/sw/source/filter/basflt/fltshell.cxx index 1257e8711133..e195c4a1a149 100644 --- a/sw/source/filter/basflt/fltshell.cxx +++ b/sw/source/filter/basflt/fltshell.cxx @@ -599,7 +599,7 @@ void SwFltControlStack::SetAttrInDoc(const SwPosition& rTmpPos, if (IsFlagSet(BOOK_TO_VAR_REF)) { - SwFieldType* pFT = pDoc->getIDocumentFieldsAccess().GetFieldType(RES_SETEXPFLD, rName, false); + SwFieldType* pFT = pDoc->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::SetExp, rName, false); if (!pFT) { SwSetExpFieldType aS(pDoc, rName, nsSwGetSetExpType::GSE_STRING); diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index bb9c33e0b99d..6d9830e5c3cd 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -2381,10 +2381,10 @@ Writer& OutHTML_SwTextNode( Writer& rWrt, const SwContentNode& rNode ) else { pTextHt = pHt; - sal_uInt16 nFieldWhich; + SwFieldIds nFieldWhich; if( RES_TXTATR_FIELD != pHt->Which() - || ( RES_POSTITFLD != (nFieldWhich = static_cast<const SwFormatField&>(pHt->GetAttr()).GetField()->Which()) - && RES_SCRIPTFLD != nFieldWhich ) ) + || ( SwFieldIds::Postit != (nFieldWhich = static_cast<const SwFormatField&>(pHt->GetAttr()).GetField()->Which()) + && SwFieldIds::Script != nFieldWhich ) ) { bWriteBreak = false; } diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index f2b0e98e8a8d..b776fcf6eece 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -92,7 +92,7 @@ void SwHTMLParser::EndScript() if( bInsSrcIntoField && !m_bIgnoreHTMLComments ) { SwScriptFieldType *pType = - static_cast<SwScriptFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_SCRIPTFLD )); + static_cast<SwScriptFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Script )); SwScriptField aField( pType, m_aScriptType, !m_aScriptURL.isEmpty() ? m_aScriptURL : m_aScriptSource, diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 2dfdb21e7c89..5901069b8791 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -43,18 +43,18 @@ struct HTMLNumFormatTableEntry NfIndexTableOffset eFormat; }; -static HTMLOptionEnum<RES_FIELDS> aHTMLFieldTypeTable[] = +static HTMLOptionEnum<SwFieldIds> aHTMLFieldTypeTable[] = { - { OOO_STRING_SW_HTML_FT_author, RES_AUTHORFLD }, - { OOO_STRING_SW_HTML_FT_sender, RES_EXTUSERFLD }, - { "DATE", RES_DATEFLD }, - { "TIME", RES_TIMEFLD }, - { OOO_STRING_SW_HTML_FT_datetime,RES_DATETIMEFLD }, - { OOO_STRING_SW_HTML_FT_page, RES_PAGENUMBERFLD }, - { OOO_STRING_SW_HTML_FT_docinfo, RES_DOCINFOFLD }, - { OOO_STRING_SW_HTML_FT_docstat, RES_DOCSTATFLD }, - { OOO_STRING_SW_HTML_FT_filename,RES_FILENAMEFLD }, - { nullptr, (RES_FIELDS)0 } + { OOO_STRING_SW_HTML_FT_author, SwFieldIds::Author }, + { OOO_STRING_SW_HTML_FT_sender, SwFieldIds::ExtUser }, + { "DATE", SwFieldIds::Date }, + { "TIME", SwFieldIds::Time }, + { OOO_STRING_SW_HTML_FT_datetime, SwFieldIds::DateTime }, + { OOO_STRING_SW_HTML_FT_page, SwFieldIds::PageNumber }, + { OOO_STRING_SW_HTML_FT_docinfo, SwFieldIds::DocInfo }, + { OOO_STRING_SW_HTML_FT_docstat, SwFieldIds::DocStat }, + { OOO_STRING_SW_HTML_FT_filename, SwFieldIds::Filename }, + { nullptr, (SwFieldIds)0 } }; static HTMLNumFormatTableEntry aHTMLDateFieldFormatTable[] = @@ -206,7 +206,7 @@ void SwHTMLParser::NewField() { bool bKnownType = false, bFixed = false, bHasNumFormat = false, bHasNumValue = false; - RES_FIELDS nType = RES_DBFLD; + SwFieldIds nType = SwFieldIds::Database; OUString aValue, aNumFormat, aNumValue, aName; const HTMLOption *pSubOption=nullptr, *pFormatOption=nullptr; @@ -255,8 +255,8 @@ void SwHTMLParser::NewField() // niemend geandert hat und man das Dok erstellt hat. Sonst // wird ein Fixed-Feld daraus gemacht. if( !bFixed && - (RES_EXTUSERFLD == nType || - RES_AUTHORFLD == nType) ) + (SwFieldIds::ExtUser == nType || + SwFieldIds::Author == nType) ) { SvtUserOptions aOpt; const OUString& rUser = aOpt.GetFullName(); @@ -276,9 +276,9 @@ void SwHTMLParser::NewField() } } - sal_uInt16 nWhich = nType; - if( RES_DATEFLD==nType || RES_TIMEFLD==nType ) - nWhich = RES_DATETIMEFLD; + SwFieldIds nWhich = nType; + if( SwFieldIds::Date==nType || SwFieldIds::Time==nType ) + nWhich = SwFieldIds::DateTime; SwFieldType* pType = m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( nWhich ); SwField *pNewField = nullptr; @@ -286,7 +286,7 @@ void SwHTMLParser::NewField() switch( nType ) { - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: if( pSubOption ) { SwExtUserSubType nSub; @@ -301,7 +301,7 @@ void SwHTMLParser::NewField() } break; - case RES_AUTHORFLD: + case SwFieldIds::Author: { SwAuthorFormat nFormat = AF_NAME; if( pFormatOption ) @@ -316,8 +316,8 @@ void SwHTMLParser::NewField() } break; - case RES_DATEFLD: - case RES_TIMEFLD: + case SwFieldIds::Date: + case SwFieldIds::Time: { sal_uInt32 nNumFormat = 0; sal_Int64 nTime = tools::Time( tools::Time::SYSTEM ).GetTime(); @@ -326,7 +326,7 @@ void SwHTMLParser::NewField() bool bValidFormat = false; HTMLNumFormatTableEntry * pFormatTable; - if( RES_DATEFLD==nType ) + if( SwFieldIds::Date==nType ) { nSub = DATEFLD; pFormatTable = aHTMLDateFieldFormatTable; @@ -369,7 +369,7 @@ void SwHTMLParser::NewField() } break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: if( bHasNumFormat ) { sal_uInt16 nSub = 0; @@ -399,7 +399,7 @@ void SwHTMLParser::NewField() } break; - case RES_PAGENUMBERFLD: + case SwFieldIds::PageNumber: if( pSubOption ) { SwPageNumSubType nSub; @@ -429,7 +429,7 @@ void SwHTMLParser::NewField() } break; - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: if( pSubOption ) { sal_uInt16 nSub; @@ -479,7 +479,7 @@ void SwHTMLParser::NewField() } break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: if( pSubOption ) { SwDocStatSubType nSub; @@ -494,7 +494,7 @@ void SwHTMLParser::NewField() } break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: { SwFileNameFormat nFormat = FF_NAME; if( pFormatOption ) @@ -533,29 +533,30 @@ void SwHTMLParser::EndField() { switch( m_pField->Which() ) { - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: OSL_ENSURE( static_cast<SwDocInfoField*>(m_pField)->IsFixed(), "DokInfo-Feld haette nicht gemerkt werden muessen" ); static_cast<SwDocInfoField*>(m_pField)->SetExpansion( m_aContents ); break; - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: OSL_ENSURE( static_cast<SwExtUserField*>(m_pField)->IsFixed(), "ExtUser-Feld haette nicht gemerkt werden muessen" ); static_cast<SwExtUserField*>(m_pField)->SetExpansion( m_aContents ); break; - case RES_AUTHORFLD: + case SwFieldIds::Author: OSL_ENSURE( static_cast<SwAuthorField*>(m_pField)->IsFixed(), "Author-Feld haette nicht gemerkt werden muessen" ); static_cast<SwAuthorField*>(m_pField)->SetExpansion( m_aContents ); break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: OSL_ENSURE( static_cast<SwFileNameField*>(m_pField)->IsFixed(), "FileName-Feld haette nicht gemerkt werden muessen" ); static_cast<SwFileNameField*>(m_pField)->SetExpansion( m_aContents ); break; + default: break; } m_xDoc->getIDocumentContentOperations().InsertPoolItem( *m_pPam, SwFormatField(*m_pField) ); @@ -620,7 +621,7 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const sal_Char *pTag break; if( RES_TXTATR_FIELD == pAttr->pItem->Which() && - RES_SCRIPTFLD == static_cast<const SwFormatField *>(pAttr->pItem.get())->GetField()->GetTyp()->Which() ) + SwFieldIds::Script == static_cast<const SwFormatField *>(pAttr->pItem.get())->GetField()->GetTyp()->Which() ) { bMoveFwd = false; break; @@ -632,7 +633,7 @@ void SwHTMLParser::InsertComment( const OUString& rComment, const sal_Char *pTag } SwPostItField aPostItField( - static_cast<SwPostItFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_POSTITFLD )), + static_cast<SwPostItFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Postit )), aEmptyOUStr, aComment, aEmptyOUStr, aEmptyOUStr, DateTime( DateTime::SYSTEM ) ); InsertAttr( SwFormatField( aPostItField ), false ); diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 0ee31b9ef8ba..39a173bd6c43 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -66,7 +66,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, SwHTMLWriter & rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); const SwFieldType* pFieldTyp = pField->GetTyp(); - sal_uInt16 nField = pFieldTyp->Which(); + SwFieldIds nField = pFieldTyp->Which(); sal_uLong nFormat = pField->GetFormat(); const sal_Char *pTypeStr=nullptr, // TYPE @@ -81,7 +81,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, switch( nField ) { - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: pTypeStr = OOO_STRING_SW_HTML_FT_sender; switch( (SwExtUserSubType)pField->GetSubType() ) { @@ -107,7 +107,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, bFixed = static_cast<const SwExtUserField*>(pField)->IsFixed(); break; - case RES_AUTHORFLD: + case SwFieldIds::Author: pTypeStr = OOO_STRING_SW_HTML_FT_author; switch( (SwAuthorFormat)nFormat & 0xff) { @@ -118,7 +118,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, bFixed = static_cast<const SwAuthorField*>(pField)->IsFixed(); break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: pTypeStr = OOO_STRING_SW_HTML_FT_datetime; bNumFormat = true; if( static_cast<const SwDateTimeField*>(pField)->IsFixed() ) @@ -128,7 +128,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, } break; - case RES_PAGENUMBERFLD: + case SwFieldIds::PageNumber: { pTypeStr = OOO_STRING_SW_HTML_FT_page; SwPageNumSubType eSubType = (SwPageNumSubType)pField->GetSubType(); @@ -158,7 +158,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, } } break; - case RES_DOCINFOFLD: + case SwFieldIds::DocInfo: { sal_uInt16 nSubType = pField->GetSubType(); pTypeStr = OOO_STRING_SW_HTML_FT_docinfo; @@ -219,7 +219,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, } break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: { pTypeStr = OOO_STRING_SW_HTML_FT_docstat; sal_uInt16 nSubType = pField->GetSubType(); @@ -238,7 +238,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, } break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: pTypeStr = OOO_STRING_SW_HTML_FT_filename; switch( (SwFileNameFormat)(nFormat & ~FF_FIXED) ) { @@ -252,6 +252,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, bFixed = static_cast<const SwFileNameField*>(pField)->IsFixed(); OSL_ENSURE( pFormatStr, "unbekanntes Format fuer SwFileNameField" ); break; + default: break; } // <SDFIELD>-Tag ausgeben @@ -437,7 +438,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) const SwField* pField = rField.GetField(); const SwFieldType* pFieldTyp = pField->GetTyp(); - if( RES_SETEXPFLD == pFieldTyp->Which() && + if( SwFieldIds::SetExp == pFieldTyp->Which() && (nsSwGetSetExpType::GSE_STRING & pField->GetSubType()) ) { const bool bOn = pFieldTyp->GetName() == "HTML_ON"; @@ -454,7 +455,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)); rWrt.Strm().WriteCharPtr( sTmp.getStr() ).WriteChar( '>' ); } - else if( RES_POSTITFLD == pFieldTyp->Which() ) + else if( SwFieldIds::Postit == pFieldTyp->Which() ) { // Kommentare werden im ANSI-Zeichensetz, aber mit System-Zeilen- // Umbruechen gesschrieben. @@ -506,7 +507,7 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) rWrt.Strm().WriteCharPtr( sOut.getStr() ); } } - else if( RES_SCRIPTFLD == pFieldTyp->Which() ) + else if( SwFieldIds::Script == pFieldTyp->Which() ) { SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt); if( rHTMLWrt.m_bLFPossible ) diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index e835bc70d568..d8d3620e14b5 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -634,7 +634,7 @@ void SwHTMLParser::Continue( int nToken ) if( !m_aScriptSource.isEmpty() ) { SwScriptFieldType *pType = - static_cast<SwScriptFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_SCRIPTFLD )); + static_cast<SwScriptFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Script )); SwScriptField aField( pType, m_aScriptType, m_aScriptSource, false ); @@ -2827,12 +2827,12 @@ void SwHTMLParser::SetAttr_( bool bChkEnd, bool bBeforeTable, case RES_TXTATR_ANNOTATION: case RES_TXTATR_INPUTFIELD: { - sal_uInt16 nFieldWhich = + SwFieldIds nFieldWhich = pPostIts ? static_cast<const SwFormatField *>(pAttr->pItem.get())->GetField()->GetTyp()->Which() - : 0; - if( pPostIts && (RES_POSTITFLD == nFieldWhich || - RES_SCRIPTFLD == nFieldWhich) ) + : SwFieldIds::Database; + if( pPostIts && (SwFieldIds::Postit == nFieldWhich || + SwFieldIds::Script == nFieldWhich) ) { pPostIts->push_front( pAttr ); } @@ -5404,7 +5404,7 @@ void SwHTMLParser::ParseMoreMetaOptions() sText.append("\">"); SwPostItField aPostItField( - static_cast<SwPostItFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_POSTITFLD )), + static_cast<SwPostItFieldType*>(m_xDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Postit )), aEmptyOUStr, sText.makeStringAndClear(), aEmptyOUStr, aEmptyOUStr, DateTime( DateTime::SYSTEM ) ); SwFormatField aFormatField( aPostItField ); InsertAttr( aFormatField, false ); diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index bfa402a7d3e8..979481f8440f 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -915,10 +915,10 @@ sal_uInt16 SwHTMLWriter::OutHeaderAttrs() && pHt->Which() != RES_TXTATR_ANNOTATION ) ) break; - const sal_uInt16 nFieldWhich = + const SwFieldIds nFieldWhich = static_cast<const SwFormatField&>(pHt->GetAttr()).GetField()->GetTyp()->Which(); - if( RES_POSTITFLD!=nFieldWhich && - RES_SCRIPTFLD!=nFieldWhich ) + if( SwFieldIds::Postit!=nFieldWhich && + SwFieldIds::Script!=nFieldWhich ) break; OutNewLine(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 7b9da4c41b0e..875caf9d1a4e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1699,7 +1699,7 @@ void DocxAttributeOutput::EndField_Impl( FieldInfos& rInfos ) if ( rInfos.pField ) { sal_uInt16 nSubType = rInfos.pField->GetSubType( ); - bool bIsSetField = rInfos.pField->GetTyp( )->Which( ) == RES_SETEXPFLD; + bool bIsSetField = rInfos.pField->GetTyp( )->Which( ) == SwFieldIds::SetExp; bool bShowRef = bIsSetField && ( nSubType & nsSwExtendedSubType::SUB_INVISIBLE ) == 0; if ( ( !m_sFieldBkm.isEmpty() ) && bShowRef ) @@ -6653,8 +6653,8 @@ void DocxAttributeOutput::TextCharFormat( const SwFormatCharFormat& rCharFormat void DocxAttributeOutput::RefField( const SwField& rField, const OUString& rRef ) { - sal_uInt16 nType = rField.GetTyp( )->Which( ); - if ( nType == RES_GETEXPFLD ) + SwFieldIds nType = rField.GetTyp( )->Which( ); + if ( nType == SwFieldIds::GetExp ) { OUString sCmd = FieldString( ww::eREF ); sCmd += "\"" + rRef + "\" "; @@ -6788,16 +6788,16 @@ void DocxAttributeOutput::WriteField_Impl( const SwField* pField, ww::eField eTy if ( pField ) { - sal_uInt16 nType = pField->GetTyp( )->Which( ); + SwFieldIds nType = pField->GetTyp( )->Which( ); sal_uInt16 nSubType = pField->GetSubType(); // TODO Any other field types here ? - if ( ( nType == RES_SETEXPFLD ) && ( nSubType & nsSwGetSetExpType::GSE_STRING ) ) + if ( ( nType == SwFieldIds::SetExp ) && ( nSubType & nsSwGetSetExpType::GSE_STRING ) ) { const SwSetExpField *pSet = static_cast<const SwSetExpField*>( pField ); m_sFieldBkm = pSet->GetPar1( ); } - else if ( nType == RES_DROPDOWN ) + else if ( nType == SwFieldIds::Dropdown ) { const SwDropDownField* pDropDown = static_cast<const SwDropDownField*>( pField ); m_sFieldBkm = pDropDown->GetName( ); diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 5cb920df4e77..5bb6d50e6110 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -3402,10 +3402,10 @@ void RtfAttributeOutput::WriteExpand(const SwField* pField) switch (pField->GetTyp()->Which()) { //#i119803# Export user field and DB field for RTF filter - case RES_DBFLD: + case SwFieldIds::Database: sCmd = FieldString(ww::eMERGEFIELD); SAL_FALLTHROUGH; - case RES_USERFLD: + case SwFieldIds::User: sCmd += pField->GetTyp()->GetName(); m_rExport.OutputField(pField, ww::eNONE, sCmd); break; diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d0fad8f5eb5d..d3941a2ef10e 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -299,7 +299,7 @@ void MSWordExportBase::OutputItemSet( const SfxItemSet& rSet, bool bPapFormat, b void MSWordExportBase::GatherChapterFields() { //If the header/footer contains a chapter field - SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_CHAPTERFLD ); + SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Chapter ); SwIterator<SwFormatField,SwFieldType> aFormatFields( *pType ); for ( SwFormatField* pField = aFormatFields.First(); pField; pField = aFormatFields.Next() ) { @@ -847,7 +847,7 @@ void MSWordExportBase::OutputFormat( const SwFormat& rFormat, bool bPapFormat, b bool MSWordExportBase::HasRefToObject( sal_uInt16 nTyp, const OUString* pName, sal_uInt16 nSeqNo ) { - SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_GETREFFLD ); + SwFieldType* pType = m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef ); SwIterator<SwFormatField, SwFieldType> aFormatFields( *pType ); for ( SwFormatField* pFormatField = aFormatFields.First(); pFormatField; pFormatField = aFormatFields.Next() ) { @@ -1711,7 +1711,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType, if (pField) { - if (pField->GetTyp()->Which() == RES_GETREFFLD && + if (pField->GetTyp()->Which() == SwFieldIds::GetRef && ( eFieldType == ww::ePAGEREF || eFieldType == ww::eREF || eFieldType == ww::eNOTEREF || eFieldType == ww::eFOOTREF )) bHandleBookmark = true; @@ -1762,7 +1762,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType, if (pField) { - if (pField->GetTyp()->Which() == RES_INPUTFLD && + if (pField->GetTyp()->Which() == SwFieldIds::Input && eFieldType == ww::eFORMTEXT) { sal_uInt8 aArr[12]; @@ -1788,7 +1788,7 @@ void WW8Export::OutputField( const SwField* pField, ww::eField eFieldType, if (pField) { - if (pField->GetTyp()->Which() == RES_INPUTFLD && + if (pField->GetTyp()->Which() == SwFieldIds::Input && eFieldType == ww::eFORMTEXT) { sal_uInt16 nSubType = pField->GetSubType(); @@ -2464,7 +2464,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) switch (pField->GetTyp()->Which()) { - case RES_GETEXPFLD: + case SwFieldIds::GetExp: if (nSubType == nsSwGetSetExpType::GSE_STRING) { const SwGetExpField *pGet = static_cast<const SwGetExpField*>(pField); @@ -2473,7 +2473,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) else bWriteExpand = true; break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if (nsSwGetSetExpType::GSE_SEQ == nSubType) { OUString sStr; @@ -2516,14 +2516,14 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) else bWriteExpand = true; break; - case RES_PAGENUMBERFLD: + case SwFieldIds::PageNumber: { OUString sStr = FieldString(ww::ePAGE); GetNumberPara(sStr, *pField); GetExport().OutputField(pField, ww::ePAGE, sStr); } break; - case RES_FILENAMEFLD: + case SwFieldIds::Filename: { OUString sStr = FieldString(ww::eFILENAME); if (pField->GetFormat() == FF_PATHNAME) @@ -2531,7 +2531,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) GetExport().OutputField(pField, ww::eFILENAME, sStr); } break; - case RES_DBNAMEFLD: + case SwFieldIds::DatabaseName: { SwDBData aData = GetExport().m_pDoc->GetDBData(); const OUString sStr = FieldString(ww::eDATABASE) @@ -2541,17 +2541,17 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) GetExport().OutputField(pField, ww::eDATABASE, sStr); } break; - case RES_AUTHORFLD: + case SwFieldIds::Author: { ww::eField eField = ((AF_SHORTCUT & pField->GetFormat()) ? ww::eUSERINITIALS : ww::eUSERNAME); GetExport().OutputField(pField, eField, FieldString(eField)); } break; - case RES_TEMPLNAMEFLD: + case SwFieldIds::TemplateName: GetExport().OutputField(pField, ww::eTEMPLATE, FieldString(ww::eTEMPLATE)); break; - case RES_DOCINFOFLD: // Last printed, last edited,... + case SwFieldIds::DocInfo: // Last printed, last edited,... if( DI_SUB_FIXED & nSubType ) bWriteExpand = true; else @@ -2632,7 +2632,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) bWriteExpand = true; } break; - case RES_DATETIMEFLD: + case SwFieldIds::DateTime: { OUString sStr; if (!GetExport().GetNumberFormat(*pField, sStr)) @@ -2644,7 +2644,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) } } break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: { ww::eField eField = ww::eNONE; @@ -2671,7 +2671,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) bWriteExpand = true; } break; - case RES_EXTUSERFLD: + case SwFieldIds::ExtUser: { ww::eField eField = ww::eNONE; switch (0xFF & nSubType) @@ -2699,7 +2699,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) bWriteExpand = true; } break; - case RES_AUTHORITY: + case SwFieldIds::TableOfAuthorities: { OUString sRet(static_cast<SwAuthorityField const*>(pField) ->ExpandCitation(AUTH_FIELD_IDENTIFIER)); @@ -2713,14 +2713,14 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) GetExport().OutputField( pField, ww::eCITATION, sRet ); } break; - case RES_POSTITFLD: + case SwFieldIds::Postit: //Sadly only possible for word in main document text if (GetExport().m_nTextTyp == TXT_MAINTEXT) { PostitField( pField ); } break; - case RES_INPUTFLD: + case SwFieldIds::Input: { const SwInputField * pInputField = dynamic_cast<const SwInputField *>(pField); @@ -2735,7 +2735,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) } } break; - case RES_GETREFFLD: + case SwFieldIds::GetRef: { ww::eField eField = ww::eNONE; OUString sStr; @@ -2813,7 +2813,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) bWriteExpand = true; } break; - case RES_COMBINED_CHARS: + case SwFieldIds::CombinedChars: { /* We need a font size to fill in the defaults, if these are overridden @@ -2858,10 +2858,10 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) GetExport().OutputField(pField, ww::eEQ, sStr); } break; - case RES_DROPDOWN: + case SwFieldIds::Dropdown: bWriteExpand = DropdownField( pField ); break; - case RES_CHAPTERFLD: + case SwFieldIds::Chapter: bWriteExpand = true; if (GetExport().m_bOutKF && rField.GetTextField()) { @@ -2884,7 +2884,7 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) } } break; - case RES_HIDDENTXTFLD: + case SwFieldIds::HiddenText: { OUString sExpand(pField->GetPar2()); if (!sExpand.isEmpty()) @@ -2893,10 +2893,10 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) } } break; - case RES_JUMPEDITFLD: + case SwFieldIds::JumpEdit: bWriteExpand = PlaceholderField( pField ); break; - case RES_MACROFLD: + case SwFieldIds::Macro: { const OUString sStr = " MACROBUTTON" + pField->GetPar1().replaceFirst("StarOffice.Standard.Modul1.", " ") diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 8b9e4e25aad2..55379a6afae6 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1601,7 +1601,7 @@ bool SwWW8FltRefStack::IsFootnoteEdnBkmField( { const SwField* pField = rFormatField.GetField(); sal_uInt16 nSubType; - if(pField && (RES_GETREFFLD == pField->Which()) + if(pField && (SwFieldIds::GetRef == pField->Which()) && ((REF_FOOTNOTE == (nSubType = pField->GetSubType())) || (REF_ENDNOTE == nSubType)) && !static_cast<const SwGetRefField*>(pField)->GetSetRefName().isEmpty()) { @@ -2214,7 +2214,7 @@ long SwWW8ImplReader::Read_And(WW8PLCFManResult* pRes) m_pFormatOfJustInsertedApo = nullptr; SwPostItField aPostIt( - static_cast<SwPostItFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_POSTITFLD)), sAuthor, + static_cast<SwPostItFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Postit)), sAuthor, sText, sInitials, OUString(), aDate ); aPostIt.SetTextObject(pOutliner); @@ -3516,7 +3516,7 @@ bool SwWW8ImplReader::ReadChar(long nPosCp, long nCpOfs) // Page number SwPageNumberField aField( static_cast<SwPageNumberFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( - RES_PAGENUMBERFLD )), PG_RANDOM, SVX_NUM_ARABIC); + SwFieldIds::PageNumber )), PG_RANDOM, SVX_NUM_ARABIC); m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField)); } break; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 9cd338780d1c..dbe6c0c35d8b 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -111,7 +111,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormTextBox( WW8FieldDesc* pF, OUString& rStr ) aFormula.msDefault = GetFieldResult(pF); SwInputField aField( - static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_INPUTFLD )), + static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )), aFormula.msDefault, aFormula.msTitle, INP_TXT, @@ -228,7 +228,7 @@ eF_ResT SwWW8ImplReader::Read_F_FormListBox( WW8FieldDesc* pF, OUString& rStr) if (!bUseEnhFields) { - SwDropDownField aField(static_cast<SwDropDownFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_DROPDOWN))); + SwDropDownField aField(static_cast<SwDropDownFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Dropdown))); aField.SetName(aFormula.msTitle); aField.SetHelp(aFormula.msHelp); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 4e0dfc628290..e384a834e463 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1163,7 +1163,7 @@ eF_ResT SwWW8ImplReader::Read_F_Input( WW8FieldDesc* pF, OUString& rStr ) if ( pF->nId != 0x01 ) // 0x01 fields have no result { - SwInputField aField( static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_INPUTFLD )), + SwInputField aField( static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )), aDef, aQ, INP_TXT, 0, false ); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); } @@ -1278,7 +1278,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField, SwFltStackEntry &rEntry) { SwFltStackEntry *pRet=nullptr; - if (pField && RES_GETREFFLD == pField->Which()) + if (pField && SwFieldIds::GetRef == pField->Which()) { //Get the name of the ref field, and see if actually a variable const OUString sName = pField->GetPar1(); @@ -1288,7 +1288,7 @@ SwFltStackEntry *SwWW8FltRefStack::RefToVar(const SwField* pField, if (aResult != aFieldVarNames.end()) { SwGetExpField aField( static_cast<SwGetExpFieldType*>( - pDoc->getIDocumentFieldsAccess().GetSysFieldType(RES_GETEXPFLD)), sName, nsSwGetSetExpType::GSE_STRING, 0); + pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::GetExp)), sName, nsSwGetSetExpType::GSE_STRING, 0); SwFormatField aTmp(aField); rEntry.pAttr.reset( aTmp.Clone() ); pRet = &rEntry; @@ -1472,7 +1472,7 @@ eF_ResT SwWW8ImplReader::Read_F_Styleref(WW8FieldDesc*, OUString& rString) if (nResult < 1) return eF_ResT::TAGIGN; - SwFieldType* pFieldType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_CHAPTERFLD); + SwFieldType* pFieldType = m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Chapter); SwChapterField aField(static_cast<SwChapterFieldType*>(pFieldType), CF_TITLE); aField.SetLevel(nResult - 1); m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField)); @@ -1596,7 +1596,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) if( !bFieldFound ) { SwDocInfoField aField( static_cast<SwDocInfoFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_DOCINFOFLD )), DI_CUSTOM|nReg, aDocProperty, GetFieldResult( pF ) ); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )), DI_CUSTOM|nReg, aDocProperty, GetFieldResult( pF ) ); m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField)); return eF_ResT::OK; @@ -1703,7 +1703,7 @@ eF_ResT SwWW8ImplReader::Read_F_DocInfo( WW8FieldDesc* pF, OUString& rStr ) } SwDocInfoField aField( static_cast<SwDocInfoFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_DOCINFOFLD )), nSub|nReg, aData, nFormat ); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )), nSub|nReg, aData, nFormat ); if (bDateTime) ForceFieldLanguage(aField, nLang); m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField)); @@ -1716,7 +1716,7 @@ eF_ResT SwWW8ImplReader::Read_F_Author( WW8FieldDesc*, OUString& ) // SH: Das SwAuthorField bezeichnet nicht den urspruenglichen // Autor, sondern den aktuellen Benutzer, also besser ueber DocInfo SwDocInfoField aField( static_cast<SwDocInfoFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_DOCINFOFLD )), + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocInfo )), DI_CREATE|DI_SUB_AUTHOR, OUString() ); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); return eF_ResT::OK; @@ -1725,7 +1725,7 @@ eF_ResT SwWW8ImplReader::Read_F_Author( WW8FieldDesc*, OUString& ) eF_ResT SwWW8ImplReader::Read_F_TemplName( WW8FieldDesc*, OUString& ) { SwTemplNameField aField( static_cast<SwTemplNameFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_TEMPLNAMEFLD )), FF_NAME ); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::TemplateName )), FF_NAME ); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); return eF_ResT::OK; } @@ -1780,14 +1780,14 @@ eF_ResT SwWW8ImplReader::Read_F_DateTime( WW8FieldDesc*pF, OUString& rStr ) if (nDT & css::util::NumberFormat::DATE) { SwDateTimeField aField(static_cast<SwDateTimeFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_DATETIMEFLD )), DATEFLD, nFormat); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime )), DATEFLD, nFormat); ForceFieldLanguage(aField, nLang); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); } else if (nDT == css::util::NumberFormat::TIME) { SwDateTimeField aField(static_cast<SwDateTimeFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_DATETIMEFLD)), TIMEFLD, nFormat); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DateTime)), TIMEFLD, nFormat); ForceFieldLanguage(aField, nLang); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); } @@ -1820,7 +1820,7 @@ eF_ResT SwWW8ImplReader::Read_F_FileName(WW8FieldDesc*, OUString &rStr) } SwFileNameField aField( - static_cast<SwFileNameFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_FILENAMEFLD)), eType); + static_cast<SwFileNameFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Filename)), eType); m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField)); return eF_ResT::OK; } @@ -1833,7 +1833,7 @@ eF_ResT SwWW8ImplReader::Read_F_Num( WW8FieldDesc* pF, OUString& rStr ) case 28: nSub = DS_CHAR; break; // number of characters } SwDocStatField aField( static_cast<SwDocStatFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_DOCSTATFLD )), nSub, + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::DocStat )), nSub, GetNumberPara( rStr ) ); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); return eF_ResT::OK; @@ -1843,7 +1843,7 @@ eF_ResT SwWW8ImplReader::Read_F_CurPage( WW8FieldDesc*, OUString& rStr ) { // page number SwPageNumberField aField( static_cast<SwPageNumberFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_PAGENUMBERFLD )), PG_RANDOM, + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::PageNumber )), PG_RANDOM, GetNumberPara(rStr, true)); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); @@ -2044,7 +2044,7 @@ eF_ResT SwWW8ImplReader::Read_F_Ref( WW8FieldDesc*, OUString& rStr ) } SwGetRefField aField( - static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_GETREFFLD )), + static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), sBkmName,REF_BOOKMARK,0,eFormat); if (eFormat == REF_CONTENT) @@ -2100,14 +2100,14 @@ eF_ResT SwWW8ImplReader::Read_F_NoteReference( WW8FieldDesc*, OUString& rStr ) // set Sequence No of corresponding Foot-/Endnote to Zero // (will be corrected in SwGetRefField aField( static_cast<SwGetRefFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_GETREFFLD )), aBkmName, REF_FOOTNOTE, 0, + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), aBkmName, REF_FOOTNOTE, 0, REF_ONLYNUMBER ); m_pReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField)); m_pReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD); if (bAboveBelow) { SwGetRefField aField2( static_cast<SwGetRefFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_GETREFFLD )),aBkmName, REF_FOOTNOTE, 0, + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )),aBkmName, REF_FOOTNOTE, 0, REF_UPDOWN ); m_pReffingStck->NewAttr(*m_pPaM->GetPoint(), SwFormatField(aField2)); m_pReffingStck->SetAttr(*m_pPaM->GetPoint(), RES_TXTATR_FIELD); @@ -2180,7 +2180,7 @@ eF_ResT SwWW8ImplReader::Read_F_PgRef( WW8FieldDesc*, OUString& rStr ) { sPageRefBookmarkName = sName; } - SwGetRefField aField( static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_GETREFFLD )), + SwGetRefField aField( static_cast<SwGetRefFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::GetRef )), sPageRefBookmarkName, REF_BOOKMARK, 0, REF_PAGE ); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); @@ -2260,7 +2260,7 @@ eF_ResT SwWW8ImplReader::Read_F_Macro( WW8FieldDesc*, OUString& rStr) aName = "StarOffice.Standard.Modul1." + aName; SwMacroField aField( static_cast<SwMacroFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_MACROFLD )), aName, aVText ); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Macro )), aName, aVText ); if( !bApplyWingdings ) { @@ -2578,14 +2578,14 @@ eF_ResT SwWW8ImplReader::Read_F_Equation( WW8FieldDesc*, OUString& rStr ) if (aResult.sType == "Input") { - SwInputField aField( static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( RES_INPUTFLD )), + SwInputField aField( static_cast<SwInputFieldType*>(m_rDoc.getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Input )), aResult.sResult, aResult.sResult, INP_TXT, 0 ); m_rDoc.getIDocumentContentOperations().InsertPoolItem( *m_pPaM, SwFormatField( aField ) ); // insert input field } else if (aResult.sType == "CombinedCharacters") { SwCombinedCharField aField(static_cast<SwCombinedCharFieldType*>( - m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(RES_COMBINED_CHARS)), aResult.sType); + m_rDoc.getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::CombinedChars)), aResult.sType); m_rDoc.getIDocumentContentOperations().InsertPoolItem(*m_pPaM, SwFormatField(aField)); } } diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 624ebfe560b7..5225122370cb 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -1116,7 +1116,7 @@ static OUString lcl_GenerateFieldTypeName(const OUString& sPrefix, SwTableNode* ++nCount; sName = sPrefixStr + OUString::number(nCount); } - while (nullptr != pTableNode->GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_DDEFLD, sName, false)); + while (nullptr != pTableNode->GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, sName, false)); return sName; } @@ -1150,7 +1150,7 @@ static SwDDEFieldType* lcl_GetDDEFieldType(SwXMLDDETableContext_Impl* pContext, else { // check for existing DDE field type with the same name - SwDDEFieldType* pOldType = static_cast<SwDDEFieldType*>(pTableNode->GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_DDEFLD, sName, false)); + SwDDEFieldType* pOldType = static_cast<SwDDEFieldType*>(pTableNode->GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Dde, sName, false)); if (nullptr != pOldType) { // same values -> return old type diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 49537401187f..25431a1111cc 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -477,7 +477,7 @@ SwCaptionOptPage::SwCaptionOptPage(vcl::Window* pParent, const SfxItemSet& rSet) { for ( auto i = pMgr->GetFieldTypeCount(); i; ) { - SwFieldType* pFieldType = pMgr->GetFieldType(USHRT_MAX, --i); + SwFieldType* pFieldType = pMgr->GetFieldType(SwFieldIds::Unknown, --i); if (!pFieldType->GetName().isEmpty() && pFieldType->GetName().equals(m_pCategoryBox->GetText())) { @@ -508,7 +508,7 @@ SwCaptionOptPage::SwCaptionOptPage(vcl::Window* pParent, const SfxItemSet& rSet) if (pSh) { SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(pMgr->GetFieldType( - RES_SETEXPFLD, m_pCategoryBox->GetText() )); + SwFieldIds::SetExp, m_pCategoryBox->GetText() )); if( pFieldType ) { sDelim = pFieldType->GetDelimiter(); @@ -699,8 +699,8 @@ IMPL_LINK_NOARG(SwCaptionOptPage, ShowEntryHdl, SvTreeListBox*, void) for (size_t i = 0; i < nCount; ++i) { - SwFieldType *pType = pMgr->GetFieldType( USHRT_MAX, i ); - if( pType->Which() == RES_SETEXPFLD && + SwFieldType *pType = pMgr->GetFieldType( SwFieldIds::Unknown, i ); + if( pType->Which() == SwFieldIds::SetExp && static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) m_pCategoryBox->InsertSwEntry(pType->GetName()); } @@ -881,7 +881,7 @@ void SwCaptionOptPage::InvalidatePreview() if (pSh) { SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(pMgr->GetFieldType( - RES_SETEXPFLD, m_pCategoryBox->GetText() )); + SwFieldIds::SetExp, m_pCategoryBox->GetText() )); if( pFieldType && pFieldType->GetOutlineLvl() < MAXLEVEL ) { sal_uInt8 nLvl = pFieldType->GetOutlineLvl(); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 8a0a68a6674a..91d0ba84fb7a 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -1265,7 +1265,7 @@ void SwInsertDBColAutoPilot::DataToDoc( const Sequence<Any>& rSelection, } aDBFormatData.aLocale = LanguageTag( rSh.GetCurLang() ).getLocale(); SwDBNextSetField aNxtDBField( static_cast<SwDBNextSetFieldType*>(rSh. - GetFieldType( 0, RES_DBNEXTSETFLD )), + GetFieldType( 0, SwFieldIds::DbNextSet )), "1", "", aDBData ); bool bSetCursor = true; diff --git a/sw/source/ui/fldui/DropDownFieldDialog.cxx b/sw/source/ui/fldui/DropDownFieldDialog.cxx index c1d4855f4d02..91b522028082 100644 --- a/sw/source/ui/fldui/DropDownFieldDialog.cxx +++ b/sw/source/ui/fldui/DropDownFieldDialog.cxx @@ -53,7 +53,7 @@ sw::DropDownFieldDialog::DropDownFieldDialog(vcl::Window *pParent, SwWrtShell &r m_pNextPB->Show(); m_pNextPB->SetClickHdl(aButtonLk); } - if( RES_DROPDOWN == pField->GetTyp()->Which() ) + if( SwFieldIds::Dropdown == pField->GetTyp()->Which() ) { pDropField = static_cast<SwDropDownField*>(pField); diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx index 9b0d039ee667..a0dedb4dca83 100644 --- a/sw/source/ui/fldui/fldpage.cxx +++ b/sw/source/ui/fldui/fldpage.cxx @@ -237,7 +237,7 @@ void SwFieldPage::InsertField(sal_uInt16 nTypeId, sal_uInt16 nSubType, const OUS case TYP_INPUTFLD: { // User- or SetField ? - if (m_aMgr.GetFieldType(RES_USERFLD, sPar1) == nullptr && + if (m_aMgr.GetFieldType(SwFieldIds::User, sPar1) == nullptr && !(pTmpField->GetSubType() & INP_TXT)) // SETEXPFLD { SwSetExpField* pField = static_cast<SwSetExpField*>(pTmpField); diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx index 83356a0e9e7a..91c71bc888ad 100644 --- a/sw/source/ui/fldui/fldref.cxx +++ b/sw/source/ui/fldui/fldref.cxx @@ -215,13 +215,13 @@ void SwFieldRefPage::Reset(const SfxItemSet* ) if (!pSh) return; - const size_t nFieldTypeCnt = pSh->GetFieldTypeCount(RES_SETEXPFLD); + const size_t nFieldTypeCnt = pSh->GetFieldTypeCount(SwFieldIds::SetExp); OSL_ENSURE( nFieldTypeCnt < static_cast<size_t>(REFFLDFLAG), "<SwFieldRefPage::Reset> - Item index will overlap flags!" ); for (size_t n = 0; n < nFieldTypeCnt; ++n) { - SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType(n, RES_SETEXPFLD)); + SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType(n, SwFieldIds::SetExp)); if ((nsSwGetSetExpType::GSE_SEQ & pType->GetType()) && pType->HasWriterListeners() && pSh->IsUsed(*pType)) { @@ -647,7 +647,7 @@ void SwFieldRefPage::UpdateSubType(const OUString& filterString) // get the fields to Seq-FieldType: SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType( - nTypeId & ~REFFLDFLAG, RES_SETEXPFLD )); + nTypeId & ~REFFLDFLAG, SwFieldIds::SetExp )); if( pType ) { SwSeqFieldList aArr; @@ -866,7 +866,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* ) case TYP_SETREFFLD: { - SwFieldType* pType = GetFieldMgr().GetFieldType(RES_SETEXPFLD, aName); + SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::SetExp, aName); if(!pType) // Only insert when the name doesn't exist yet { @@ -981,7 +981,7 @@ bool SwFieldRefPage::FillItemSet(SfxItemSet* ) { // get fields for Seq-FieldType: SwSetExpFieldType* pType = static_cast<SwSetExpFieldType*>(pSh->GetFieldType( - nTypeId & ~REFFLDFLAG, RES_SETEXPFLD )); + nTypeId & ~REFFLDFLAG, SwFieldIds::SetExp )); if( pType ) { SwSeqFieldList aArr; diff --git a/sw/source/ui/fldui/fldvar.cxx b/sw/source/ui/fldui/fldvar.cxx index 3c3cbac9839a..ada5795548c3 100644 --- a/sw/source/ui/fldui/fldvar.cxx +++ b/sw/source/ui/fldui/fldvar.cxx @@ -280,7 +280,7 @@ void SwFieldVarPage::SubTypeHdl(ListBox* pBox) { // change or create user type SwUserFieldType* pType = static_cast<SwUserFieldType*>( - GetFieldMgr().GetFieldType(RES_USERFLD, nSelData)); + GetFieldMgr().GetFieldType(SwFieldIds::User, nSelData)); if (pType) { @@ -346,7 +346,7 @@ void SwFieldVarPage::SubTypeHdl(ListBox* pBox) if(pSh) { SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>( - pSh->GetFieldType(RES_SETEXPFLD, sName)); + pSh->GetFieldType(SwFieldIds::SetExp, sName)); if (pSetTyp && pSetTyp->GetType() == nsSwGetSetExpType::GSE_STRING) m_pNumFormatLB->SelectEntryPos(0); // textual @@ -396,7 +396,7 @@ void SwFieldVarPage::SubTypeHdl(ListBox* pBox) if(pSh) { SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>( - pSh->GetFieldType(RES_SETEXPFLD, sName)); + pSh->GetFieldType(SwFieldIds::SetExp, sName)); if(pSetTyp) { @@ -428,13 +428,13 @@ void SwFieldVarPage::SubTypeHdl(ListBox* pBox) // User- or SetField ? const sal_uInt16 nInpType = static_cast< sal_uInt16 > - (GetFieldMgr().GetFieldType(RES_USERFLD, sName) ? 0 : TYP_SETINPFLD); + (GetFieldMgr().GetFieldType(SwFieldIds::User, sName) ? 0 : TYP_SETINPFLD); if (nInpType) // SETEXPFLD { // is there a corresponding SetField SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>( - GetFieldMgr().GetFieldType(RES_SETEXPFLD, sName)); + GetFieldMgr().GetFieldType(SwFieldIds::SetExp, sName)); if(pSetTyp) { @@ -463,7 +463,7 @@ void SwFieldVarPage::SubTypeHdl(ListBox* pBox) if (nSelPos != LISTBOX_ENTRY_NOTFOUND) { SwDDEFieldType* pType = - static_cast<SwDDEFieldType*>( GetFieldMgr().GetFieldType(RES_DDEFLD, nSelData) ); + static_cast<SwDDEFieldType*>( GetFieldMgr().GetFieldType(SwFieldIds::Dde, nSelData) ); if(pType) { @@ -495,7 +495,7 @@ void SwFieldVarPage::SubTypeHdl(ListBox* pBox) { OUString sFieldTypeName( m_pSelectionLB->GetEntry( nSelPos )); if( !sFieldTypeName.isEmpty() ) - pFieldTyp = GetFieldMgr().GetFieldType( RES_SETEXPFLD, + pFieldTyp = GetFieldMgr().GetFieldType( SwFieldIds::SetExp, sFieldTypeName ); else pFieldTyp = nullptr; @@ -865,7 +865,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, Edit&, void) // is there already a corresponding type bInsert = bApply = true; - SwFieldType* pType = GetFieldMgr().GetFieldType(RES_DDEFLD, sName); + SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::Dde, sName); SwWrtShell *pSh = GetWrtShell(); if(!pSh) @@ -879,7 +879,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, Edit&, void) if( nLen ) { // is there already a corresponding type - SwFieldType* pType = GetFieldMgr().GetFieldType(RES_USERFLD, sName); + SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::User, sName); SwWrtShell *pSh = GetWrtShell(); if(!pSh) @@ -887,7 +887,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, Edit&, void) if(pSh && pType) bDelete = !pSh->IsUsed( *pType ); - pType = GetFieldMgr().GetFieldType(RES_SETEXPFLD, sName); + pType = GetFieldMgr().GetFieldType(SwFieldIds::SetExp, sName); if (!pType) // no name conflict with variables { // user fields can also be inserted without content! @@ -903,7 +903,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, Edit&, void) if (nTypeId == TYP_SETFLD || nTypeId == TYP_SEQFLD) { SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>( - GetFieldMgr().GetFieldType(RES_SETEXPFLD, sName)); + GetFieldMgr().GetFieldType(SwFieldIds::SetExp, sName)); if (pFieldType) { @@ -933,7 +933,7 @@ IMPL_LINK_NOARG(SwFieldVarPage, ModifyHdl, Edit&, void) bInsert = false; } } - if (GetFieldMgr().GetFieldType(RES_USERFLD, sName)) + if (GetFieldMgr().GetFieldType(SwFieldIds::User, sName)) bInsert = false; } @@ -961,19 +961,19 @@ IMPL_LINK( SwFieldVarPage, TBClickHdl, ToolBox *, pBox, void ) if (nCurId == m_nDeleteId) { if( nTypeId == TYP_USERFLD ) - GetFieldMgr().RemoveFieldType(RES_USERFLD, m_pSelectionLB->GetSelectEntry()); + GetFieldMgr().RemoveFieldType(SwFieldIds::User, m_pSelectionLB->GetSelectEntry()); else { - sal_uInt16 nWhich; + SwFieldIds nWhich; switch(nTypeId) { case TYP_SETFLD: case TYP_SEQFLD: - nWhich = RES_SETEXPFLD; + nWhich = SwFieldIds::SetExp; break; default: - nWhich = RES_DDEFLD; + nWhich = SwFieldIds::Dde; break; } @@ -993,14 +993,14 @@ IMPL_LINK( SwFieldVarPage, TBClickHdl, ToolBox *, pBox, void ) { OUString sName(m_pNameED->GetText()), sValue(m_pValueED->GetText()); SwFieldType* pType = nullptr; - sal_uInt16 nId = 0; + SwFieldIds nId = SwFieldIds::Database; sal_Int32 nNumFormatPos = m_pNumFormatLB->GetSelectEntryPos(); switch (nTypeId) { - case TYP_USERFLD: nId = RES_USERFLD; break; - case TYP_DDEFLD: nId = RES_DDEFLD; break; - case TYP_SETFLD: nId = RES_SETEXPFLD;break; + case TYP_USERFLD: nId = SwFieldIds::User; break; + case TYP_DDEFLD: nId = SwFieldIds::Dde; break; + case TYP_SETFLD: nId = SwFieldIds::SetExp;break; } pType = GetFieldMgr().GetFieldType(nId, sName); @@ -1182,7 +1182,7 @@ bool SwFieldVarPage::FillItemSet(SfxItemSet* ) } case TYP_INPUTFLD: { - SwFieldType* pType = GetFieldMgr().GetFieldType(RES_USERFLD, aName); + SwFieldType* pType = GetFieldMgr().GetFieldType(SwFieldIds::User, aName); nSubType = static_cast< sal_uInt16 >((nSubType & 0xff00) | ((pType) ? INP_USR : INP_VAR)); break; } diff --git a/sw/source/ui/fldui/inpdlg.cxx b/sw/source/ui/fldui/inpdlg.cxx index 553e472ea344..6c7a02f58f66 100644 --- a/sw/source/ui/fldui/inpdlg.cxx +++ b/sw/source/ui/fldui/inpdlg.cxx @@ -58,7 +58,7 @@ SwFieldInputDlg::SwFieldInputDlg( vcl::Window *pParent, SwWrtShell &rS, // evaluation here OUString aStr; - if( RES_INPUTFLD == pField->GetTyp()->Which() ) + if( SwFieldIds::Input == pField->GetTyp()->Which() ) { // it is an input field pInpField = static_cast<SwInputField*>(pField); @@ -74,7 +74,7 @@ SwFieldInputDlg::SwFieldInputDlg( vcl::Window *pParent, SwWrtShell &rS, case INP_USR: // user field if( nullptr != ( pUsrType = static_cast<SwUserFieldType*>(rSh.GetFieldType( - RES_USERFLD, pInpField->GetPar1() ) ) ) ) + SwFieldIds::User, pInpField->GetPar1() ) ) ) ) aStr = pUsrType->GetContent(); break; } diff --git a/sw/source/ui/fldui/javaedit.cxx b/sw/source/ui/fldui/javaedit.cxx index 4cd62dbe2b7c..f409f253da17 100644 --- a/sw/source/ui/fldui/javaedit.cxx +++ b/sw/source/ui/fldui/javaedit.cxx @@ -75,7 +75,7 @@ SwJavaEditDialog::SwJavaEditDialog(vcl::Window* pParent, SwWrtShell* pWrtSh) : pMgr = new SwFieldMgr(pSh); pField = static_cast<SwScriptField*>(pMgr->GetCurField()); - bNew = !(pField && pField->GetTyp()->Which() == RES_SCRIPTFLD); + bNew = !(pField && pField->GetTyp()->Which() == SwFieldIds::Script); CheckTravel(); diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index ae9cf890278e..5fe1cd7b8c85 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -145,8 +145,8 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) : size_t nCount = pMgr->GetFieldTypeCount(); for (size_t i = 0; i < nCount; ++i) { - SwFieldType *pType = pMgr->GetFieldType( USHRT_MAX, i ); - if( pType->Which() == RES_SETEXPFLD && + SwFieldType *pType = pMgr->GetFieldType( SwFieldIds::Unknown, i ); + if( pType->Which() == SwFieldIds::SetExp && static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) m_pCategoryBox->InsertEntry(pType->GetName()); } @@ -207,7 +207,7 @@ SwCaptionDialog::SwCaptionDialog( vcl::Window *pParent, SwView &rV ) : nCount = pMgr->GetFieldTypeCount(); for ( size_t i = nCount; i; ) { - SwFieldType* pFieldType = pMgr->GetFieldType(USHRT_MAX, --i); + SwFieldType* pFieldType = pMgr->GetFieldType(SwFieldIds::Unknown, --i); if( pFieldType->GetName().equals(m_pCategoryBox->GetText()) ) { nSelFormat = (sal_uInt16)static_cast<SwSetExpFieldType*>(pFieldType)->GetSeqFormat(); @@ -317,7 +317,7 @@ IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl, Edit&, void) bool bCorrectFieldName = !sFieldTypeName.isEmpty(); bool bNone = sFieldTypeName == m_sNone; SwFieldType* pType = (bCorrectFieldName && !bNone) - ? rSh.GetFieldType( RES_SETEXPFLD, sFieldTypeName ) + ? rSh.GetFieldType( SwFieldIds::SetExp, sFieldTypeName ) : nullptr; m_pOKButton->Enable( bCorrectFieldName && (!pType || @@ -363,7 +363,7 @@ void SwCaptionDialog::DrawSample() SwWrtShell &rSh = rView.GetWrtShell(); SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(rSh.GetFieldType( - RES_SETEXPFLD, sFieldTypeName )); + SwFieldIds::SetExp, sFieldTypeName )); if( pFieldType && pFieldType->GetOutlineLvl() < MAXLEVEL ) { SwNumberTree::tNumberVector aNumVector; @@ -448,7 +448,7 @@ SwSequenceOptionDialog::SwSequenceOptionDialog( vcl::Window *pParent, SwView &rV m_pLbLevel->InsertEntry( OUString::number(n+1) ); SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(rSh.GetFieldType( - RES_SETEXPFLD, aFieldTypeName )); + SwFieldIds::SetExp, aFieldTypeName )); sal_Unicode nLvl = MAXLEVEL; OUString sDelim(": "); @@ -486,7 +486,7 @@ void SwSequenceOptionDialog::Apply() { SwWrtShell &rSh = rView.GetWrtShell(); SwSetExpFieldType* pFieldType = static_cast<SwSetExpFieldType*>(rSh.GetFieldType( - RES_SETEXPFLD, aFieldTypeName )); + SwFieldIds::SetExp, aFieldTypeName )); sal_Int8 nLvl = (sal_Int8)( m_pLbLevel->GetSelectEntryPos() - 1); sal_Unicode cDelim = m_pEdDelim->GetText()[0]; diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 66a8e0129fca..100e75914084 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -280,7 +280,7 @@ SwMultiTOXTabDialog::SwMultiTOXTabDialog(vcl::Window* pParent, const SfxItemSet& if(TOX_AUTHORITIES == eCurrentTOXType.eType) { const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - rSh.GetFieldType(RES_AUTHORITY, aEmptyOUStr)); + rSh.GetFieldType(SwFieldIds::TableOfAuthorities, aEmptyOUStr)); if(pFType) { OUString sBrackets; @@ -428,7 +428,7 @@ SwTOXDescription& SwMultiTOXTabDialog::GetTOXDescription(CurTOXType eType) if(TOX_AUTHORITIES == eType.eType) { const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - rSh.GetFieldType(RES_AUTHORITY, aEmptyOUStr)); + rSh.GetFieldType(SwFieldIds::TableOfAuthorities, aEmptyOUStr)); if(pFType) { pDescArr[nIndex]->SetAuthBrackets(OUStringLiteral1(pFType->GetPrefix()) + @@ -1268,11 +1268,11 @@ void SwTOXSelectTabPage::Reset( const SfxItemSet* ) m_pFromFileCB->Check( !sAutoMarkURL.isEmpty() ); m_pCaptionSequenceLB->Clear(); - const size_t nCount = rSh.GetFieldTypeCount(RES_SETEXPFLD); + const size_t nCount = rSh.GetFieldTypeCount(SwFieldIds::SetExp); for (size_t i = 0; i < nCount; ++i) { - SwFieldType *pType = rSh.GetFieldType( i, RES_SETEXPFLD ); - if( pType->Which() == RES_SETEXPFLD && + SwFieldType *pType = rSh.GetFieldType( i, SwFieldIds::SetExp ); + if( pType->Which() == SwFieldIds::SetExp && static_cast<SwSetExpFieldType *>( pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) m_pCaptionSequenceLB->InsertEntry(pType->GetName()); } @@ -2095,7 +2095,7 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) { SwWrtShell& rSh = pTOXDlg->GetWrtShell(); const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - rSh.GetFieldType(RES_AUTHORITY, aEmptyOUStr)); + rSh.GetFieldType(SwFieldIds::TableOfAuthorities, aEmptyOUStr)); if(pFType) { if(pFType->IsSortByDocument()) diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index fd79226e02ab..666e6450d459 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -1188,7 +1188,7 @@ IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, ListBox&, rBox, void) if(!sEntry.isEmpty()) { const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - pSh->GetFieldType(RES_AUTHORITY, OUString())); + pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString())); const SwAuthEntry* pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : nullptr; for(int i = 0; i < AUTH_FIELD_END; i++) m_sFields[i] = pEntry ? @@ -1214,7 +1214,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void) OSL_ENSURE(!m_sFields[AUTH_FIELD_AUTHORITY_TYPE].isEmpty() , "No authority type is set!"); //check if the entry already exists with different content const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - pSh->GetFieldType(RES_AUTHORITY, OUString())); + pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString())); const SwAuthEntry* pEntry = pFType ? pFType->GetEntryByIdentifier( m_sFields[AUTH_FIELD_IDENTIFIER]) : nullptr; @@ -1347,7 +1347,7 @@ IMPL_LINK(SwAuthorMarkPane, ChangeSourceHdl, Button*, pButton, void) else { const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - pSh->GetFieldType(RES_AUTHORITY, OUString())); + pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString())); if(pFType) { std::vector<OUString> aIds; @@ -1386,7 +1386,7 @@ IMPL_LINK(SwAuthorMarkPane, IsEntryAllowedHdl, Edit*, pEdit, bool) else if(bIsFromComponent) { const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - pSh->GetFieldType(RES_AUTHORITY, OUString())); + pSh->GetFieldType(SwFieldIds::TableOfAuthorities, OUString())); bAllowed = !pFType || !pFType->GetEntryByIdentifier(sEntry); } else @@ -1410,7 +1410,7 @@ void SwAuthorMarkPane::InitControls() for(int i = 0; i < AUTH_FIELD_END; i++) m_sFields[i] = m_sCreatedEntry[i]; } - if(bNewEntry || !pField || pField->GetTyp()->Which() != RES_AUTHORITY) + if(bNewEntry || !pField || pField->GetTyp()->Which() != SwFieldIds::TableOfAuthorities) return; const SwAuthEntry* pEntry = static_cast<SwAuthorityFieldType*>(pField->GetTyp())-> @@ -1490,7 +1490,7 @@ SwCreateAuthEntryDlg_Impl::SwCreateAuthEntryDlg_Impl(vcl::Window* pParent, SwCreateAuthEntryDlg_Impl, IdentifierHdl)); const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - rSh.GetFieldType(RES_AUTHORITY, OUString())); + rSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString())); if(pFType) { std::vector<OUString> aIds; @@ -1584,7 +1584,7 @@ OUString SwCreateAuthEntryDlg_Impl::GetEntryText(ToxAuthorityField eField) cons IMPL_LINK(SwCreateAuthEntryDlg_Impl, IdentifierHdl, ComboBox&, rBox, void) { const SwAuthorityFieldType* pFType = static_cast<const SwAuthorityFieldType*>( - rWrtSh.GetFieldType(RES_AUTHORITY, OUString())); + rWrtSh.GetFieldType(SwFieldIds::TableOfAuthorities, OUString())); if(pFType) { const SwAuthEntry* pEntry = pFType->GetEntryByIdentifier( diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 2a94aa9ee4e0..eb1af4860268 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -923,7 +923,7 @@ HiddenInformation SwDocShell::GetHiddenInformationState( HiddenInformation nStat OSL_ENSURE( GetWrtShell(), "No SwWrtShell, no information" ); if ( GetWrtShell() ) { - SwFieldType* pType = GetWrtShell()->GetFieldType( RES_POSTITFLD, aEmptyOUStr ); + SwFieldType* pType = GetWrtShell()->GetFieldType( SwFieldIds::Postit, aEmptyOUStr ); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); SwFormatField* pFirst = aIter.First(); while( pFirst ) diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 83c2001e4057..cb60351eb8ee 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -275,7 +275,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint ) switch( nAction ) { case 2: - m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( RES_FILENAMEFLD )->UpdateFields(); + m_pDoc->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::Filename )->UpdateFields(); break; // #i38126# - own action for event LOADFINISHED // in order to avoid a modified document. diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 938c47c63610..3a3063bda6ef 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -2112,7 +2112,7 @@ bool SwTransferable::PasteDDE( TransferableDataHelper& rData, for( j = INIT_FLDTYPES; j < nSize; j++ ) { pTyp = rWrtShell.GetFieldType( j ); - if( RES_DDEFLD == pTyp->Which() ) + if( SwFieldIds::Dde == pTyp->Which() ) { OUString sTmp( static_cast<SwDDEFieldType*>(pTyp)->GetCmd() ); if( rColl.isEqual( sTmp, aCmd ) && diff --git a/sw/source/uibase/docvw/AnnotationWin.cxx b/sw/source/uibase/docvw/AnnotationWin.cxx index b606cee379cf..eae69733f332 100644 --- a/sw/source/uibase/docvw/AnnotationWin.cxx +++ b/sw/source/uibase/docvw/AnnotationWin.cxx @@ -190,7 +190,7 @@ sal_uInt32 SwAnnotationWin::CalcParent() RES_TXTATR_ANNOTATION ); const SwField* pField = pTextAttr ? pTextAttr->GetFormatField().GetField() : nullptr; sal_uInt32 nParentId = 0; - if (pField && pField->Which() == RES_POSTITFLD) + if (pField && pField->Which() == SwFieldIds::Postit) { const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField); nParentId = pPostItField->GetPostItId(); @@ -212,7 +212,7 @@ sal_uInt32 SwAnnotationWin::CountFollowing() SwField* pField = pTextAttr ? const_cast<SwField*>(pTextAttr->GetFormatField().GetField()) : nullptr; - while ( pField && ( pField->Which()== RES_POSTITFLD ) ) + while ( pField && ( pField->Which()== SwFieldIds::Postit ) ) { aCount++; pTextAttr = pTextField->GetTextNode().GetTextAttrForCharAt( diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index eb838a1d1774..ff282b3692f2 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1300,7 +1300,7 @@ bool SwPostItMgr::LayoutByPage(std::list<SwSidebarWin*> &aVisiblePostItList, con void SwPostItMgr::AddPostIts(bool bCheckExistance, bool bFocus) { bool bEmpty = mvPostItFields.empty(); - SwFieldType* pType = mpView->GetDocShell()->GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(),false); + SwFieldType* pType = mpView->GetDocShell()->GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(),false); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); SwFormatField* pSwFormatField = aIter.First(); while(pSwFormatField) @@ -1347,7 +1347,7 @@ class IsPostitField : public FilterFunctor public: bool operator()(const SwFormatField* pField) const override { - return pField->GetField()->GetTyp()->Which() == RES_POSTITFLD; + return pField->GetField()->GetTyp()->Which() == SwFieldIds::Postit; } }; @@ -1361,7 +1361,7 @@ public: } bool operator()(const SwFormatField* pField) const override { - if (pField->GetField()->GetTyp()->Which() != RES_POSTITFLD) + if (pField->GetField()->GetTyp()->Which() != SwFieldIds::Postit) return false; return static_cast<const SwPostItField*>(pField->GetField())->GetPar1() == m_sAuthor; } @@ -1377,7 +1377,7 @@ public: bool operator()(const SwFormatField* pField) const override { - if (pField->GetField()->GetTyp()->Which() != RES_POSTITFLD) + if (pField->GetField()->GetTyp()->Which() != SwFieldIds::Postit) return false; return static_cast<const SwPostItField*>(pField->GetField())->GetPostItId() == m_nPostItId; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 1ac0c293d2ac..3532441517a8 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1487,7 +1487,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) if ((rKeyCode.IsMod1() && rKeyCode.IsMod2()) && ((rKeyCode.GetCode() == KEY_PAGEUP) || (rKeyCode.GetCode() == KEY_PAGEDOWN))) { const bool bNext = rKeyCode.GetCode()==KEY_PAGEDOWN; - const SwFieldType* pFieldType = rSh.GetFieldType( 0, RES_POSTITFLD ); + const SwFieldType* pFieldType = rSh.GetFieldType( 0, SwFieldIds::Postit ); rSh.MoveFieldType( pFieldType, bNext ); return; } @@ -4169,7 +4169,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) if( rSh.GetContentAtPos( aDocPt, aContentAtPos, false, &aFieldRect ) ) { const SwField* pField = aContentAtPos.aFnd.pField; - if (pField->Which()== RES_POSTITFLD) + if (pField->Which()== SwFieldIds::Postit) { m_rView.GetPostItMgr()->SetShadowState(reinterpret_cast<const SwPostItField*>(pField),false); } diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 5d173185bc04..598bf0d8ba66 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -289,9 +289,9 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) const SwField* pField = aContentAtPos.aFnd.pField; switch( pField->Which() ) { - case RES_SETEXPFLD: - case RES_TABLEFLD: - case RES_GETEXPFLD: + case SwFieldIds::SetExp: + case SwFieldIds::Table: + case SwFieldIds::GetExp: { sal_uInt16 nOldSubType = pField->GetSubType(); const_cast<SwField*>(pField)->SetSubType(nsSwExtendedSubType::SUB_CMD); @@ -300,34 +300,34 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } break; - case RES_POSTITFLD: + case SwFieldIds::Postit: { break; } - case RES_INPUTFLD: // BubbleHelp, because the suggestion could be quite long + case SwFieldIds::Input: // BubbleHelp, because the suggestion could be quite long bBalloon = true; SAL_FALLTHROUGH; - case RES_JUMPEDITFLD: + case SwFieldIds::JumpEdit: sText = pField->GetPar2(); break; - case RES_DBFLD: + case SwFieldIds::Database: sText = pField->GetFieldName(); break; - case RES_USERFLD: - case RES_HIDDENTXTFLD: + case SwFieldIds::User: + case SwFieldIds::HiddenText: sText = pField->GetPar1(); break; - case RES_DOCSTATFLD: + case SwFieldIds::DocStat: break; - case RES_MACROFLD: + case SwFieldIds::Macro: sText = static_cast<const SwMacroField*>(pField)->GetMacro(); break; - case RES_GETREFFLD: + case SwFieldIds::GetRef: { // #i85090# const SwGetRefField* pRefField( dynamic_cast<const SwGetRefField*>(pField) ); @@ -351,6 +351,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } } break; + default: break; } } diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index f8b17daac75b..68a70d0fcf75 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -248,7 +248,7 @@ bool SwFieldMgr::CanInsertRefMark( const OUString& rStr ) } // access over ResIds -void SwFieldMgr::RemoveFieldType(sal_uInt16 nResId, const OUString& rName ) +void SwFieldMgr::RemoveFieldType(SwFieldIds nResId, const OUString& rName ) { SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell(); OSL_ENSURE(pSh, "no SwWrtShell found"); @@ -263,14 +263,14 @@ size_t SwFieldMgr::GetFieldTypeCount() const return pSh ? pSh->GetFieldTypeCount() : 0; } -SwFieldType* SwFieldMgr::GetFieldType(sal_uInt16 nResId, size_t nField) const +SwFieldType* SwFieldMgr::GetFieldType(SwFieldIds nResId, size_t nField) const { SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell(); OSL_ENSURE(pSh, "no SwWrtShell found"); return pSh ? pSh->GetFieldType(nField, nResId) : nullptr; } -SwFieldType* SwFieldMgr::GetFieldType(sal_uInt16 nResId, const OUString& rName) const +SwFieldType* SwFieldMgr::GetFieldType(SwFieldIds nResId, const OUString& rName) const { SwWrtShell * pSh = pWrtShell ? pWrtShell : lcl_GetShell(); OSL_ENSURE(pSh, "no SwWrtShell found"); @@ -457,24 +457,24 @@ void SwFieldMgr::GetSubTypes(sal_uInt16 nTypeId, std::vector<OUString>& rToFill) for(size_t i = 0; i < nCount; ++i) { SwFieldType* pFieldType = pSh->GetFieldType( i ); - const sal_uInt16 nWhich = pFieldType->Which(); + const SwFieldIds nWhich = pFieldType->Which(); - if((nTypeId == TYP_DDEFLD && pFieldType->Which() == RES_DDEFLD) || + if((nTypeId == TYP_DDEFLD && pFieldType->Which() == SwFieldIds::Dde) || - (nTypeId == TYP_USERFLD && nWhich == RES_USERFLD) || + (nTypeId == TYP_USERFLD && nWhich == SwFieldIds::User) || - (nTypeId == TYP_GETFLD && nWhich == RES_SETEXPFLD && + (nTypeId == TYP_GETFLD && nWhich == SwFieldIds::SetExp && !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || - (nTypeId == TYP_SETFLD && nWhich == RES_SETEXPFLD && + (nTypeId == TYP_SETFLD && nWhich == SwFieldIds::SetExp && !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || - (nTypeId == TYP_SEQFLD && nWhich == RES_SETEXPFLD && + (nTypeId == TYP_SEQFLD && nWhich == SwFieldIds::SetExp && (static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) || ((nTypeId == TYP_INPUTFLD || nTypeId == TYP_FORMELFLD) && - (nWhich == RES_USERFLD || - (nWhich == RES_SETEXPFLD && + (nWhich == SwFieldIds::User || + (nWhich == SwFieldIds::SetExp && !(static_cast<SwSetExpFieldType*>(pFieldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) ) { rToFill.push_back(pFieldType->GetName()); @@ -715,15 +715,15 @@ bool SwFieldMgr::GoNextPrev( bool bNext, SwFieldType* pTyp ) { const sal_uInt16 nTypeId = pCurField->GetTypeId(); if( TYP_SETINPFLD == nTypeId || TYP_USRINPFLD == nTypeId ) - pTyp = pSh->GetFieldType( 0, RES_INPUTFLD ); + pTyp = pSh->GetFieldType( 0, SwFieldIds::Input ); else pTyp = pCurField->GetTyp(); } - if (pTyp && pTyp->Which() == RES_DBFLD) + if (pTyp && pTyp->Which() == SwFieldIds::Database) { // for fieldcommand-edit (hop to all DB fields) - return pSh->MoveFieldType( nullptr, bNext, RES_DBFLD ); + return pSh->MoveFieldType( nullptr, bNext, SwFieldIds::Database ); } return pTyp && pSh && pSh->MoveFieldType( pTyp, bNext ); @@ -767,7 +767,7 @@ bool SwFieldMgr::InsertField( case TYP_POSTITFLD: { SvtUserOptions aUserOpt; - SwPostItFieldType* pType = static_cast<SwPostItFieldType*>(pCurShell->GetFieldType(0, RES_POSTITFLD)); + SwPostItFieldType* pType = static_cast<SwPostItFieldType*>(pCurShell->GetFieldType(0, SwFieldIds::Postit)); SwPostItField* pPostItField = new SwPostItField( pType, @@ -782,7 +782,7 @@ bool SwFieldMgr::InsertField( case TYP_SCRIPTFLD: { SwScriptFieldType* pType = - static_cast<SwScriptFieldType*>(pCurShell->GetFieldType(0, RES_SCRIPTFLD)); + static_cast<SwScriptFieldType*>(pCurShell->GetFieldType(0, SwFieldIds::Script)); pField = new SwScriptField(pType, rData.m_sPar1, rData.m_sPar2, (bool)nFormatId); break; } @@ -790,7 +790,7 @@ bool SwFieldMgr::InsertField( case TYP_COMBINED_CHARS: { SwCombinedCharFieldType* pType = static_cast<SwCombinedCharFieldType*>( - pCurShell->GetFieldType( 0, RES_COMBINED_CHARS )); + pCurShell->GetFieldType( 0, SwFieldIds::CombinedChars )); pField = new SwCombinedCharField( pType, rData.m_sPar1 ); } break; @@ -798,7 +798,7 @@ bool SwFieldMgr::InsertField( case TYP_AUTHORITY: { SwAuthorityFieldType* pType = - static_cast<SwAuthorityFieldType*>(pCurShell->GetFieldType(0, RES_AUTHORITY)); + static_cast<SwAuthorityFieldType*>(pCurShell->GetFieldType(0, SwFieldIds::TableOfAuthorities)); if (!pType) { SwAuthorityFieldType const type(pCurShell->GetDoc()); @@ -816,7 +816,7 @@ bool SwFieldMgr::InsertField( nSub |= nSubType == DATE_VAR ? 0 : FIXEDFLD; SwDateTimeFieldType* pTyp = - static_cast<SwDateTimeFieldType*>( pCurShell->GetFieldType(0, RES_DATETIMEFLD) ); + static_cast<SwDateTimeFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::DateTime) ); pField = new SwDateTimeField(pTyp, nSub, nFormatId); pField->SetPar2(rData.m_sPar2); break; @@ -825,7 +825,7 @@ bool SwFieldMgr::InsertField( case TYP_FILENAMEFLD: { SwFileNameFieldType* pTyp = - static_cast<SwFileNameFieldType*>( pCurShell->GetFieldType(0, RES_FILENAMEFLD) ); + static_cast<SwFileNameFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::Filename) ); pField = new SwFileNameField(pTyp, nFormatId); break; } @@ -833,7 +833,7 @@ bool SwFieldMgr::InsertField( case TYP_TEMPLNAMEFLD: { SwTemplNameFieldType* pTyp = - static_cast<SwTemplNameFieldType*>( pCurShell->GetFieldType(0, RES_TEMPLNAMEFLD) ); + static_cast<SwTemplNameFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::TemplateName) ); pField = new SwTemplNameField(pTyp, nFormatId); break; } @@ -842,7 +842,7 @@ bool SwFieldMgr::InsertField( { sal_uInt16 nByte = (sal_uInt16)rData.m_sPar2.toInt32(); SwChapterFieldType* pTyp = - static_cast<SwChapterFieldType*>( pCurShell->GetFieldType(0, RES_CHAPTERFLD) ); + static_cast<SwChapterFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::Chapter) ); pField = new SwChapterField(pTyp, nFormatId); nByte = std::max(sal_uInt16(1), nByte); nByte = std::min(nByte, sal_uInt16(MAXLEVEL)); @@ -877,7 +877,7 @@ bool SwFieldMgr::InsertField( nSubType = PG_RANDOM; SwPageNumberFieldType* pTyp = - static_cast<SwPageNumberFieldType*>( pCurShell->GetFieldType(0, RES_PAGENUMBERFLD) ); + static_cast<SwPageNumberFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::PageNumber) ); pField = new SwPageNumberField(pTyp, nSubType, nFormatId, nOff); if( SVX_NUM_CHAR_SPECIAL == nFormatId && @@ -889,7 +889,7 @@ bool SwFieldMgr::InsertField( case TYP_DOCSTATFLD: { SwDocStatFieldType* pTyp = - static_cast<SwDocStatFieldType*>( pCurShell->GetFieldType(0, RES_DOCSTATFLD) ); + static_cast<SwDocStatFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::DocStat) ); pField = new SwDocStatField(pTyp, nSubType, nFormatId); break; } @@ -897,7 +897,7 @@ bool SwFieldMgr::InsertField( case TYP_AUTHORFLD: { SwAuthorFieldType* pTyp = - static_cast<SwAuthorFieldType*>( pCurShell->GetFieldType(0, RES_AUTHORFLD) ); + static_cast<SwAuthorFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::Author) ); pField = new SwAuthorField(pTyp, nFormatId); break; } @@ -906,7 +906,7 @@ bool SwFieldMgr::InsertField( case TYP_HIDDENTXTFLD: { SwHiddenTextFieldType* pTyp = - static_cast<SwHiddenTextFieldType*>( pCurShell->GetFieldType(0, RES_HIDDENTXTFLD) ); + static_cast<SwHiddenTextFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::HiddenText) ); pField = new SwHiddenTextField(pTyp, true, rData.m_sPar1, rData.m_sPar2, false, rData.m_nTypeId); bExp = true; break; @@ -915,7 +915,7 @@ bool SwFieldMgr::InsertField( case TYP_HIDDENPARAFLD: { SwHiddenParaFieldType* pTyp = - static_cast<SwHiddenParaFieldType*>( pCurShell->GetFieldType(0, RES_HIDDENPARAFLD) ); + static_cast<SwHiddenParaFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::HiddenPara) ); pField = new SwHiddenParaField(pTyp, rData.m_sPar1); bExp = true; break; @@ -934,7 +934,7 @@ bool SwFieldMgr::InsertField( case TYP_GETREFFLD: { SwGetRefFieldType* pTyp = - static_cast<SwGetRefFieldType*>( pCurShell->GetFieldType(0, RES_GETREFFLD) ); + static_cast<SwGetRefFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::GetRef) ); sal_uInt16 nSeqNo = (sal_uInt16)rData.m_sPar2.toInt32(); pField = new SwGetRefField(pTyp, rData.m_sPar1, nSubType, nSeqNo, nFormatId); bExp = true; @@ -961,7 +961,7 @@ bool SwFieldMgr::InsertField( case TYP_MACROFLD: { SwMacroFieldType* pTyp = - static_cast<SwMacroFieldType*>(pCurShell->GetFieldType(0, RES_MACROFLD)); + static_cast<SwMacroFieldType*>(pCurShell->GetFieldType(0, SwFieldIds::Macro)); pField = new SwMacroField(pTyp, rData.m_sPar1, rData.m_sPar2); @@ -979,7 +979,7 @@ bool SwFieldMgr::InsertField( case TYP_JUMPEDITFLD: { SwJumpEditFieldType* pTyp = - static_cast<SwJumpEditFieldType*>(pCurShell->GetFieldType(0, RES_JUMPEDITFLD)); + static_cast<SwJumpEditFieldType*>(pCurShell->GetFieldType(0, SwFieldIds::JumpEdit)); pField = new SwJumpEditField(pTyp, nFormatId, rData.m_sPar1, rData.m_sPar2); break; @@ -988,7 +988,7 @@ bool SwFieldMgr::InsertField( case TYP_DOCINFOFLD: { SwDocInfoFieldType* pTyp = static_cast<SwDocInfoFieldType*>( pCurShell->GetFieldType( - 0, RES_DOCINFOFLD ) ); + 0, SwFieldIds::DocInfo ) ); pField = new SwDocInfoField(pTyp, nSubType, rData.m_sPar1, nFormatId); break; } @@ -996,7 +996,7 @@ bool SwFieldMgr::InsertField( case TYP_EXTUSERFLD: { SwExtUserFieldType* pTyp = static_cast<SwExtUserFieldType*>( pCurShell->GetFieldType( - 0, RES_EXTUSERFLD) ); + 0, SwFieldIds::ExtUser) ); pField = new SwExtUserField(pTyp, nSubType, nFormatId); break; } @@ -1097,7 +1097,7 @@ bool SwFieldMgr::InsertField( case TYP_DBNAMEFLD: { SwDBNameFieldType* pTyp = - static_cast<SwDBNameFieldType*>(pCurShell->GetFieldType(0, RES_DBNAMEFLD)); + static_cast<SwDBNameFieldType*>(pCurShell->GetFieldType(0, SwFieldIds::DatabaseName)); pField = new SwDBNameField(pTyp, aDBData); break; @@ -1105,7 +1105,7 @@ bool SwFieldMgr::InsertField( case TYP_DBNEXTSETFLD: { SwDBNextSetFieldType* pTyp = static_cast<SwDBNextSetFieldType*>(pCurShell->GetFieldType( - 0, RES_DBNEXTSETFLD) ); + 0, SwFieldIds::DbNextSet) ); pField = new SwDBNextSetField(pTyp, sPar1, rData.m_sPar2, aDBData); bExp = true; break; @@ -1113,7 +1113,7 @@ bool SwFieldMgr::InsertField( case TYP_DBNUMSETFLD: { SwDBNumSetFieldType* pTyp = static_cast<SwDBNumSetFieldType*>( pCurShell->GetFieldType( - 0, RES_DBNUMSETFLD) ); + 0, SwFieldIds::DbNumSet) ); pField = new SwDBNumSetField( pTyp, sPar1, rData.m_sPar2, aDBData); bExp = true; break; @@ -1121,7 +1121,7 @@ bool SwFieldMgr::InsertField( case TYP_DBSETNUMBERFLD: { SwDBSetNumberFieldType* pTyp = static_cast<SwDBSetNumberFieldType*>( - pCurShell->GetFieldType(0, RES_DBSETNUMBERFLD) ); + pCurShell->GetFieldType(0, SwFieldIds::DbSetNumber) ); pField = new SwDBSetNumberField( pTyp, aDBData, nFormatId); bExp = true; break; @@ -1134,7 +1134,7 @@ bool SwFieldMgr::InsertField( case TYP_USERFLD: { SwUserFieldType* pTyp = - static_cast<SwUserFieldType*>( pCurShell->GetFieldType(RES_USERFLD, rData.m_sPar1) ); + static_cast<SwUserFieldType*>( pCurShell->GetFieldType(SwFieldIds::User, rData.m_sPar1) ); // only if existing if(!pTyp) @@ -1156,7 +1156,7 @@ bool SwFieldMgr::InsertField( if ((nSubType & 0x00ff) == INP_VAR) { SwSetExpFieldType* pTyp = static_cast<SwSetExpFieldType*>( - pCurShell->GetFieldType(RES_SETEXPFLD, rData.m_sPar1) ); + pCurShell->GetFieldType(SwFieldIds::SetExp, rData.m_sPar1) ); // no Expression Type with this name existing -> create if(pTyp) @@ -1179,7 +1179,7 @@ bool SwFieldMgr::InsertField( else { SwInputFieldType* pTyp = - static_cast<SwInputFieldType*>( pCurShell->GetFieldType(0, RES_INPUTFLD) ); + static_cast<SwInputFieldType*>( pCurShell->GetFieldType(0, SwFieldIds::Input) ); SwInputField* pInpField = new SwInputField( pTyp, rData.m_sPar1, rData.m_sPar2, nSubType|nsSwExtendedSubType::SUB_INVISIBLE, nFormatId); @@ -1226,12 +1226,12 @@ bool SwFieldMgr::InsertField( { // is there a corresponding SetField SwSetExpFieldType* pSetTyp = static_cast<SwSetExpFieldType*>( - pCurShell->GetFieldType(RES_SETEXPFLD, rData.m_sPar1)); + pCurShell->GetFieldType(SwFieldIds::SetExp, rData.m_sPar1)); if(pSetTyp) { SwGetExpFieldType* pTyp = static_cast<SwGetExpFieldType*>( pCurShell->GetFieldType( - 0, RES_GETEXPFLD) ); + 0, SwFieldIds::GetExp) ); pField = new SwGetExpField(pTyp, rData.m_sPar1, pSetTyp->GetType(), nFormatId); pField->SetSubType(nSubType | pSetTyp->GetType()); bExp = true; @@ -1278,7 +1278,7 @@ bool SwFieldMgr::InsertField( else { SwGetExpFieldType* pTyp = static_cast<SwGetExpFieldType*>( - pCurShell->GetFieldType(0, RES_GETEXPFLD) ); + pCurShell->GetFieldType(0, SwFieldIds::GetExp) ); pField = new SwGetExpField(pTyp, rData.m_sPar2, nsSwGetSetExpType::GSE_FORMULA, nFormatId); pField->SetSubType(nSubType); bExp = true; @@ -1287,19 +1287,19 @@ bool SwFieldMgr::InsertField( } case TYP_SETREFPAGEFLD: pField = new SwRefPageSetField( static_cast<SwRefPageSetFieldType*>( - pCurShell->GetFieldType( 0, RES_REFPAGESETFLD ) ), + pCurShell->GetFieldType( 0, SwFieldIds::RefPageSet ) ), (short)rData.m_sPar2.toInt32(), 0 != nSubType ); bPageVar = true; break; case TYP_GETREFPAGEFLD: pField = new SwRefPageGetField( static_cast<SwRefPageGetFieldType*>( - pCurShell->GetFieldType( 0, RES_REFPAGEGETFLD ) ), nFormatId ); + pCurShell->GetFieldType( 0, SwFieldIds::RefPageGet ) ), nFormatId ); bPageVar = true; break; case TYP_DROPDOWN : { - pField = new SwDropDownField(pCurShell->GetFieldType( 0, RES_DROPDOWN )); + pField = new SwDropDownField(pCurShell->GetFieldType( 0, SwFieldIds::Dropdown )); const sal_Int32 nTokenCount = comphelper::string::getTokenCount(rData.m_sPar2, DB_DELIM); Sequence<OUString> aEntries(nTokenCount); OUString* pArray = aEntries.getArray(); @@ -1344,7 +1344,7 @@ bool SwFieldMgr::InsertField( pCurShell->Right(CRSR_SKIP_CHARS, false, 1, false ); } else if( bPageVar ) - static_cast<SwRefPageGetFieldType*>(pCurShell->GetFieldType( 0, RES_REFPAGEGETFLD ))->UpdateFields(); + static_cast<SwRefPageGetFieldType*>(pCurShell->GetFieldType( 0, SwFieldIds::RefPageGet ))->UpdateFields(); else if( TYP_GETREFFLD == rData.m_nTypeId ) pField->GetTyp()->ModifyNotification( nullptr, nullptr ); diff --git a/sw/source/uibase/inc/fldmgr.hxx b/sw/source/uibase/inc/fldmgr.hxx index f8ca5c3d3eb3..25193aafa835 100644 --- a/sw/source/uibase/inc/fldmgr.hxx +++ b/sw/source/uibase/inc/fldmgr.hxx @@ -43,6 +43,7 @@ class SbModule; class SvxMacroItem; class SvNumberFormatter; namespace vcl { class Window; } +enum class SwFieldIds : sal_uInt16; // the groups of fields enum SwFieldGroups @@ -154,10 +155,10 @@ public: // access to field types via ResId size_t GetFieldTypeCount() const; - SwFieldType* GetFieldType(sal_uInt16 nResId, size_t nField = 0) const; - SwFieldType* GetFieldType(sal_uInt16 nResId, const OUString& rName) const; + SwFieldType* GetFieldType(SwFieldIds nResId, size_t nField = 0) const; + SwFieldType* GetFieldType(SwFieldIds nResId, const OUString& rName) const; - void RemoveFieldType(sal_uInt16 nResId, const OUString& rName); + void RemoveFieldType(SwFieldIds nResId, const OUString& rName); // access via TypeId from the dialog // Ids for a range of fields diff --git a/sw/source/uibase/index/toxmgr.cxx b/sw/source/uibase/index/toxmgr.cxx index 067c0690af18..ca81f0c73dc3 100644 --- a/sw/source/uibase/index/toxmgr.cxx +++ b/sw/source/uibase/index/toxmgr.cxx @@ -348,7 +348,7 @@ bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc, if(TOX_AUTHORITIES == eCurTOXType) { SwAuthorityFieldType* pFType = static_cast<SwAuthorityFieldType*>( - pSh->GetFieldType(RES_AUTHORITY, aEmptyOUStr)); + pSh->GetFieldType(SwFieldIds::TableOfAuthorities, aEmptyOUStr)); if (!pFType) { SwAuthorityFieldType const type(pSh->GetDoc()); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 0728ccad4624..b62d8e58db68 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -699,7 +699,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) case FN_GOTO_PREV_MARK: { SwFieldMgr aFieldMgr; - SwFieldType* pFieldType = aFieldMgr.GetFieldType(RES_JUMPEDITFLD); + SwFieldType* pFieldType = aFieldMgr.GetFieldType(SwFieldIds::JumpEdit); if (pFieldType) { diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index bf94094dce97..6cee27968e31 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -163,7 +163,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) case FN_EXECUTE_MACROFIELD: { SwField* pField = rSh.GetCurField(); - if(pField && pField->GetTyp()->Which() == RES_MACROFLD) + if(pField && pField->GetTyp()->Which() == SwFieldIds::Macro) { const OUString& rMacro = static_cast<SwMacroField*>(pField)->GetMacro(); @@ -181,13 +181,13 @@ void SwTextShell::ExecField(SfxRequest &rReq) case FN_GOTO_PREV_INPUTFLD: { bool bRet = false; - SwFieldType* pField = rSh.GetFieldType( 0, RES_INPUTFLD ); + SwFieldType* pField = rSh.GetFieldType( 0, SwFieldIds::Input ); const bool bAddSetExpressionFields = !( rSh.GetViewOptions()->IsReadonly() ); if ( pField != nullptr && rSh.MoveFieldType( pField, FN_GOTO_NEXT_INPUTFLD == nSlot, - USHRT_MAX, + SwFieldIds::Unknown, bAddSetExpressionFields ) ) { rSh.ClearMark(); @@ -382,7 +382,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) const SvxPostItIdItem* pIdItem = rReq.GetArg<SvxPostItIdItem>(SID_ATTR_POSTIT_ID); if (pIdItem && !pIdItem->GetValue().isEmpty()) { - SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(), false); + SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(), false); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); SwFormatField* pSwFormatField = aIter.First(); while( pSwFormatField ) @@ -411,7 +411,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) case FN_POSTIT: { SwPostItField* pPostIt = dynamic_cast<SwPostItField*>(aFieldMgr.GetCurField()); - bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == RES_POSTITFLD); + bool bNew = !(pPostIt && pPostIt->GetTyp()->Which() == SwFieldIds::Postit); if (bNew || GetView().GetPostItMgr()->IsAnswer()) { const SvxPostItAuthorItem* pAuthorItem = rReq.GetArg<SvxPostItAuthorItem>(SID_ATTR_POSTIT_AUTHOR); @@ -461,7 +461,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) if (pPostIt) { - SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(RES_POSTITFLD, OUString(), false); + SwFieldType* pType = rSh.GetDoc()->getIDocumentFieldsAccess().GetFieldType(SwFieldIds::Postit, OUString(), false); SwIterator<SwFormatField,SwFieldType> aIter( *pType ); SwFormatField* pSwFormatField = aIter.First(); while( pSwFormatField ) @@ -615,7 +615,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) bIsUrl = pIsUrl->GetValue(); SwScriptField* pField = static_cast<SwScriptField*>(aMgr.GetCurField()); - bNew = !pField || !(pField->GetTyp()->Which() == RES_SCRIPTFLD); + bNew = !pField || !(pField->GetTyp()->Which() == SwFieldIds::Script); bUpdate = pField && ( bIsUrl != (bool)pField->GetFormat() || pField->GetPar2() != aType || pField->GetPar1() != aText ); } else @@ -742,13 +742,13 @@ void SwTextShell::StateField( SfxItemSet &rSet ) bGetField = true; } - sal_uInt16 nTempWhich = pField ? pField->GetTyp()->Which() : USHRT_MAX; - if( USHRT_MAX == nTempWhich || - RES_POSTITFLD == nTempWhich || - RES_SCRIPTFLD == nTempWhich || - RES_AUTHORITY == nTempWhich ) + SwFieldIds nTempWhich = pField ? pField->GetTyp()->Which() : SwFieldIds::Unknown; + if( SwFieldIds::Unknown == nTempWhich || + SwFieldIds::Postit == nTempWhich || + SwFieldIds::Script == nTempWhich || + SwFieldIds::TableOfAuthorities == nTempWhich ) rSet.DisableItem( nWhich ); - else if( RES_DDEFLD == nTempWhich && + else if( SwFieldIds::Dde == nTempWhich && !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible()) { // nested links cannot be edited @@ -764,7 +764,7 @@ void SwTextShell::StateField( SfxItemSet &rSet ) pField = rSh.GetCurField(); bGetField = true; } - if(!pField || pField->GetTyp()->Which() != RES_MACROFLD) + if(!pField || pField->GetTyp()->Which() != SwFieldIds::Macro) rSet.DisableItem(nWhich); } break; @@ -822,9 +822,9 @@ void SwTextShell::StateField( SfxItemSet &rSet ) bool bCurField = false; pField = rSh.GetCurField(); if(nWhich == FN_POSTIT || nWhich == FN_REPLY) - bCurField = pField && pField->GetTyp()->Which() == RES_POSTITFLD; + bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Postit; else - bCurField = pField && pField->GetTyp()->Which() == RES_SCRIPTFLD; + bCurField = pField && pField->GetTyp()->Which() == SwFieldIds::Script; if( !bCurField && rSh.IsReadOnlyAvailable() && rSh.HasReadonlySel() ) { diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx index 7f88652d229d..5d8c2880ddca 100644 --- a/sw/source/uibase/shells/textidx.cxx +++ b/sw/source/uibase/shells/textidx.cxx @@ -239,7 +239,7 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet) rSet.Put(SfxBoolItem(FN_INSERT_AUTH_ENTRY_DLG, nullptr != pAuthMark)); if( bInReadonly || !pField || - pField->GetTyp()->Which() != RES_AUTHORITY) + pField->GetTyp()->Which() != SwFieldIds::TableOfAuthorities) rSet.DisableItem(FN_EDIT_AUTH_ENTRY_DLG); rSet.DisableItem(FN_REMOVE_CUR_TOX); } diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index ae34348f35bf..203a0666a4f9 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -126,13 +126,13 @@ void SwView::InsertCaption(const InsCaptionOpt *pOpt) SwFieldMgr aMgr(&rSh); SwSetExpFieldType* pFieldType = - static_cast<SwSetExpFieldType*>(aMgr.GetFieldType(RES_SETEXPFLD, rName)); + static_cast<SwSetExpFieldType*>(aMgr.GetFieldType(SwFieldIds::SetExp, rName)); if (!pFieldType && !rName.isEmpty() ) { // Create new field types SwSetExpFieldType aSwSetExpFieldType(rSh.GetDoc(), rName, nsSwGetSetExpType::GSE_SEQ); aMgr.InsertFieldType(aSwSetExpFieldType); - pFieldType = static_cast<SwSetExpFieldType*>(aMgr.GetFieldType(RES_SETEXPFLD, rName)); + pFieldType = static_cast<SwSetExpFieldType*>(aMgr.GetFieldType(SwFieldIds::SetExp, rName)); } if (!pOpt->IgnoreSeqOpts()) @@ -151,9 +151,9 @@ void SwView::InsertCaption(const InsCaptionOpt *pOpt) { for (size_t i = 0; i < nCount; ++i) { - pType = aMgr.GetFieldType(USHRT_MAX, i); + pType = aMgr.GetFieldType(SwFieldIds::Unknown, i); OUString aTmpName( pType->GetName() ); - if (aTmpName == rName && pType->Which() == RES_SETEXPFLD) + if (aTmpName == rName && pType->Which() == SwFieldIds::SetExp) { nID = i; OSL_ENSURE(nID==i, "Downcasting to sal_uInt16 lost information!"); diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 059683e331de..d2fe2fdc0f29 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -420,7 +420,7 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void ) sw::sidebarwindows::SwSidebarWin* pPostIt = GetPostItMgr()->GetActiveSidebarWin(); if (pPostIt) GetPostItMgr()->SetActiveSidebarWin(nullptr); - SwFieldType* pFieldType = rSh.GetFieldType(0, RES_POSTITFLD); + SwFieldType* pFieldType = rSh.GetFieldType(0, SwFieldIds::Postit); if ( rSh.MoveFieldType( pFieldType, bNext ) ) GetViewFrame()->GetDispatcher()->Execute(FN_POSTIT); else diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index d95b363c9902..6c7647464d55 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -4283,11 +4283,11 @@ SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions, // to avoid unnecessary reformatting the view options related to the content // below should only change if necessary, that is if respective content is present const bool bContainsHiddenChars = m_pShell->GetDoc()->ContainsHiddenChars(); - const SwFieldType* pFieldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENTXTFLD ); + const SwFieldType* pFieldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenText ); const bool bContainsHiddenFields = pFieldType && pFieldType->HasWriterListeners(); - pFieldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_HIDDENPARAFLD ); + pFieldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::HiddenPara ); const bool bContainsHiddenParagraphs = pFieldType && pFieldType->HasWriterListeners(); - pFieldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( RES_JUMPEDITFLD ); + pFieldType = m_pShell->GetDoc()->getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::JumpEdit ); const bool bContainsPlaceHolders = pFieldType && pFieldType->HasWriterListeners(); const bool bContainsFields = m_pShell->IsAnyFieldInDoc(); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index a8c22d3a1981..1486b83a22c7 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -83,7 +83,7 @@ void SwWrtShell::Insert(SwField &rField) std::unique_ptr<SwPaM> pAnnotationTextRange; if ( HasSelection() ) { - if ( rField.GetTyp()->Which() == RES_POSTITFLD ) + if ( rField.GetTyp()->Which() == SwFieldIds::Postit ) { // for annotation fields: // - keep the current selection in order to create a corresponding annotation mark @@ -150,7 +150,7 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst ) { pTmp->GotoFieldPos( i ); SwField* pField = pTmp->GetField( i ); - if(pField->GetTyp()->Which() == RES_DROPDOWN) + if(pField->GetTyp()->Which() == SwFieldIds::Dropdown) bCancel = StartDropDownFieldDlg( pField, true, &aDlgPos ); else bCancel = StartInputFieldDlg( pField, true, nullptr, &aDlgPos); @@ -317,7 +317,7 @@ bool SwWrtShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) void SwWrtShell::ClickToField( const SwField& rField ) { // cross reference field must not be selected because it moves the cursor - if (RES_GETREFFLD != rField.GetTyp()->Which()) + if (SwFieldIds::GetRef != rField.GetTyp()->Which()) { StartAllAction(); Right( CRSR_SKIP_CHARS, true, 1, false ); // Select the field. @@ -328,7 +328,7 @@ void SwWrtShell::ClickToField( const SwField& rField ) m_bIsInClickToEdit = true; switch( rField.GetTyp()->Which() ) { - case RES_JUMPEDITFLD: + case SwFieldIds::JumpEdit: { sal_uInt16 nSlotId = 0; switch( rField.GetFormat() ) @@ -358,7 +358,7 @@ void SwWrtShell::ClickToField( const SwField& rField ) } break; - case RES_MACROFLD: + case SwFieldIds::Macro: { const SwMacroField *pField = static_cast<const SwMacroField*>(&rField); const OUString sText( rField.GetPar2() ); @@ -376,7 +376,7 @@ void SwWrtShell::ClickToField( const SwField& rField ) } break; - case RES_GETREFFLD: + case SwFieldIds::GetRef: StartAllAction(); SwCursorShell::GotoRefMark( static_cast<const SwGetRefField&>(rField).GetSetRefName(), static_cast<const SwGetRefField&>(rField).GetSubType(), @@ -384,7 +384,7 @@ void SwWrtShell::ClickToField( const SwField& rField ) EndAllAction(); break; - case RES_INPUTFLD: + case SwFieldIds::Input: { const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rField); if ( pInputField == nullptr ) @@ -394,11 +394,11 @@ void SwWrtShell::ClickToField( const SwField& rField ) } break; - case RES_SETEXPFLD: + case SwFieldIds::SetExp: if( static_cast<const SwSetExpField&>(rField).GetInputFlag() ) StartInputFieldDlg( const_cast<SwField*>(&rField), false ); break; - case RES_DROPDOWN : + case SwFieldIds::Dropdown : StartDropDownFieldDlg( const_cast<SwField*>(&rField), false ); break; default: |