sw/inc/docufld.hxx                  |   51 +++++++++++++++++++-----------------
 sw/source/core/access/accpara.cxx   |    9 +++---
 sw/source/core/fields/docufld.cxx   |   40 ++++++++++++++--------------
 sw/source/core/fields/fldbas.cxx    |   16 +++++------
 sw/source/core/text/porfld.cxx      |    2 -
 sw/source/core/text/porfld.hxx      |    5 ++-
 sw/source/core/unocore/unofield.cxx |   10 +++----
 sw/source/filter/html/htmlfld.cxx   |   12 ++++----
 sw/source/filter/html/htmlfldw.cxx  |    7 ++--
 sw/source/filter/ww8/ww8atr.cxx     |    2 -
 sw/source/ui/fldui/flddok.cxx       |   24 ++++++++++++++--
 sw/source/ui/fldui/fldfunc.cxx      |    5 ++-
 sw/source/uibase/fldui/fldmgr.cxx   |    6 ++--
 sw/source/uibase/wrtsh/wrtsh2.cxx   |   16 ++++++-----
 14 files changed, 117 insertions(+), 88 deletions(-)

New commits:
commit 17142f87425c5cfd955088288fb9ad23e6553b5d
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Jul 5 12:05:39 2025 +0200
Commit:     Noel Grandin <noelgran...@gmail.com>
CommitDate: Mon Jul 7 18:51:18 2025 +0200

    Convert SwJumpEditFormat to scoped enum
    
    Change-Id: I49a4a6805d34f446b4357c99e9a1857d2a6d44e2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187489
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Jenkins

diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index fb157775b693..417ad4adcad1 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -125,13 +125,13 @@ enum SwExtUserSubType
     EU_APARTMENT
 };
 
-enum SwJumpEditFormat
+enum class SwJumpEditFormat
 {
-    JE_FMT_TEXT,
-    JE_FMT_TABLE,
-    JE_FMT_FRAME,
-    JE_FMT_GRAPHIC,
-    JE_FMT_OLE
+    Text,
+    Table,
+    Frame,
+    Graphic,
+    OLE
 };
 
 class SAL_DLLPUBLIC_RTTI SwPageNumberFieldType final : public SwFieldType
@@ -723,13 +723,13 @@ class SwJumpEditField final : public SwField
 {
     OUString m_sText;
     OUString m_sHelp;
-    sal_uInt32 m_nFormat;
+    SwJumpEditFormat m_nFormat;
 public:
-    SwJumpEditField( SwJumpEditFieldType*, sal_uInt32 nFormat,
+    SwJumpEditField( SwJumpEditFieldType*, SwJumpEditFormat nFormat,
                      OUString sText, OUString sHelp );
 
-    sal_uInt32 GetFormat() const { return m_nFormat; }
-    void SetFormat(sal_uInt32 n) { m_nFormat = n; }
+    SwJumpEditFormat GetFormat() const { return m_nFormat; }
+    void SetFormat(SwJumpEditFormat n) { m_nFormat = n; }
 
     virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 4bc56dd598c5..c507fc2d4a0e 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1074,11 +1074,11 @@ OUString 
SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
         break;
     case SwFieldIds::JumpEdit:
         {
-            const sal_uInt32 nFormat = static_cast<const 
SwJumpEditField*>(pField)->GetFormat();
+            const SwJumpEditFormat nFormat = static_cast<const 
SwJumpEditField*>(pField)->GetFormat();
             const sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), 
false);
-            if (nFormat < nSize)
+            if (static_cast<sal_uInt32>(nFormat) < nSize)
             {
-                sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nFormat);
+                sEntry = aMgr.GetFormatStr(pField->GetTypeId(), 
static_cast<sal_uInt32>(nFormat));
                 if (sEntry.getLength() > 0)
                 {
                     strTypeName += "-" + sEntry;
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index ec267c45d0fa..8714545e8419 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2628,7 +2628,7 @@ SwCharFormat* SwJumpEditFieldType::GetCharFormat()
     return pFormat;
 }
 
-SwJumpEditField::SwJumpEditField( SwJumpEditFieldType* pTyp, sal_uInt32 
nFormat,
+SwJumpEditField::SwJumpEditField( SwJumpEditFieldType* pTyp, SwJumpEditFormat 
nFormat,
                                 OUString aText, OUString aHelp )
     : SwField( pTyp), m_sText( std::move(aText) ), m_sHelp( std::move(aHelp) 
), m_nFormat(nFormat)
 {
@@ -2678,10 +2678,10 @@ bool SwJumpEditField::QueryValue( uno::Any& rAny, 
sal_uInt16 nWhichId ) const
             sal_Int16 nRet;
             switch( GetFormat() )
             {
-            case JE_FMT_TABLE:  nRet = text::PlaceholderType::TABLE; break;
-            case JE_FMT_FRAME:  nRet = text::PlaceholderType::TEXTFRAME; break;
-            case JE_FMT_GRAPHIC:nRet = text::PlaceholderType::GRAPHIC; break;
-            case JE_FMT_OLE:    nRet = text::PlaceholderType::OBJECT; break;
+            case SwJumpEditFormat::Table:  nRet = 
text::PlaceholderType::TABLE; break;
+            case SwJumpEditFormat::Frame:  nRet = 
text::PlaceholderType::TEXTFRAME; break;
+            case SwJumpEditFormat::Graphic:nRet = 
text::PlaceholderType::GRAPHIC; break;
+            case SwJumpEditFormat::OLE:    nRet = 
text::PlaceholderType::OBJECT; break;
             default:
                 nRet = text::PlaceholderType::TEXT; break;
             }
@@ -2713,11 +2713,11 @@ bool SwJumpEditField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
             rAny >>= nSet;
             switch( nSet )
             {
-                case text::PlaceholderType::TEXT     : m_nFormat = 
JE_FMT_TEXT; break;
-                case text::PlaceholderType::TABLE    : m_nFormat = 
JE_FMT_TABLE; break;
-                case text::PlaceholderType::TEXTFRAME: m_nFormat = 
JE_FMT_FRAME; break;
-                case text::PlaceholderType::GRAPHIC  : m_nFormat = 
JE_FMT_GRAPHIC; break;
-                case text::PlaceholderType::OBJECT   : m_nFormat = JE_FMT_OLE; 
break;
+                case text::PlaceholderType::TEXT     : m_nFormat = 
SwJumpEditFormat::Text; break;
+                case text::PlaceholderType::TABLE    : m_nFormat = 
SwJumpEditFormat::Table; break;
+                case text::PlaceholderType::TEXTFRAME: m_nFormat = 
SwJumpEditFormat::Frame; break;
+                case text::PlaceholderType::GRAPHIC  : m_nFormat = 
SwJumpEditFormat::Graphic; break;
+                case text::PlaceholderType::OBJECT   : m_nFormat = 
SwJumpEditFormat::OLE; break;
             }
         }
         break;
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index f6c9036f5b43..adc7328e9c64 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -331,7 +331,7 @@ sal_uInt32 SwField::GetUntypedFormat() const
     case SwFieldIds::PageNumber:
         return static_cast<const SwPageNumberField*>(this)->GetFormat();
     case SwFieldIds::JumpEdit:
-        return static_cast<const SwJumpEditField*>(this)->GetFormat();
+        return static_cast<sal_uInt32>(static_cast<const 
SwJumpEditField*>(this)->GetFormat());
     case SwFieldIds::DocStat:
         return static_cast<const SwDocStatField*>(this)->GetFormat();
     case SwFieldIds::TemplateName:
@@ -369,7 +369,7 @@ void SwField::SetUntypedFormat(sal_uInt32 n)
         
static_cast<SwPageNumberField*>(this)->SetFormat(static_cast<SvxNumType>(n));
         return;
     case SwFieldIds::JumpEdit:
-        static_cast<SwJumpEditField*>(this)->SetFormat(n);
+        
static_cast<SwJumpEditField*>(this)->SetFormat(static_cast<SwJumpEditFormat>(n));
         return;
     case SwFieldIds::DocStat:
         
static_cast<SwDocStatField*>(this)->SetFormat(static_cast<SvxNumType>(n));
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index b3355286c205..ad4fa9290310 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -1430,7 +1430,7 @@ bool SwJumpFieldPortion::DescribePDFControl(const 
SwTextPaintInfo& rInf) const
     if (!pPDFExtOutDevData->GetIsExportFormFields())
         return false;
 
-    if (m_nFormat != SwJumpEditFormat::JE_FMT_TEXT)
+    if (m_nFormat != SwJumpEditFormat::Text)
         return false;
 
     vcl::PDFWriter::EditWidget aDescriptor;
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 1c4198cf2b3a..da9624ffd854 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -30,6 +30,7 @@
 
 class SvxBrushItem;
 class SwFormatVertOrient;
+enum class SwJumpEditFormat;
 
 class SwFieldPortion : public SwExpandPortion
 {
@@ -267,7 +268,7 @@ class SwJumpFieldPortion final : public SwFieldPortion
 {
 public:
     explicit SwJumpFieldPortion(OUString aExpand, OUString aHelp, 
std::unique_ptr<SwFont> pFont,
-                                sal_uInt32 nFormat)
+                                SwJumpEditFormat nFormat)
         : SwFieldPortion(std::move(aExpand), std::move(pFont))
         , m_nFormat(nFormat)
         , m_sHelp(std::move(aHelp))
@@ -278,7 +279,7 @@ public:
     virtual void Paint(const SwTextPaintInfo& rInf) const override;
 
 private:
-    sal_uInt32 m_nFormat; // SwJumpEditFormat from SwField::GetFormat()
+    SwJumpEditFormat m_nFormat; // SwJumpEditFormat from SwField::GetFormat()
     OUString m_sHelp;
 
     bool DescribePDFControl(const SwTextPaintInfo& rInf) const;
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index fa3acac8afe7..8a26bf66db48 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1543,7 +1543,7 @@ void SAL_CALL SwXTextField::attach(
             {
                 SwFieldType* pFieldType = 
pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::JumpEdit);
                 xField.reset(new 
SwJumpEditField(static_cast<SwJumpEditFieldType*>(pFieldType),
-                        m_pImpl->m_pProps->nUSHORT1, m_pImpl->m_pProps->sPar2,
+                        
static_cast<SwJumpEditFormat>(m_pImpl->m_pProps->nUSHORT1), 
m_pImpl->m_pProps->sPar2,
                         m_pImpl->m_pProps->sPar1));
             }
             break;
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index 163d29f81470..3258f86bdbce 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -223,7 +223,10 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, weld::TreeView&, 
void)
     if (nSize)
     {
         if (IsFieldEdit() && nTypeId == SwFieldTypesEnum::JumpEdit)
-            m_xFormatLB->select_text(SwResId(FMT_MARK_ARY[static_cast<const 
SwJumpEditField*>(GetCurField())->GetFormat()]));
+        {
+            auto pJumpField = static_cast<const 
SwJumpEditField*>(GetCurField());
+            
m_xFormatLB->select_text(SwResId(FMT_MARK_ARY[static_cast<sal_uInt32>(pJumpField->GetFormat())]));
+        }
 
         if (m_xFormatLB->get_selected_index() == -1)
             m_xFormatLB->select(0);
diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index 2addc7ec85ea..13872c00907f 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1198,7 +1198,7 @@ bool SwFieldMgr::InsertField(
             SwJumpEditFieldType* pTyp =
                 static_cast<SwJumpEditFieldType*>(pCurShell->GetFieldType(0, 
SwFieldIds::JumpEdit));
 
-            pField.reset(new SwJumpEditField(pTyp, nFormatId, rData.m_sPar1, 
rData.m_sPar2));
+            pField.reset(new SwJumpEditField(pTyp, 
static_cast<SwJumpEditFormat>(nFormatId), rData.m_sPar1, rData.m_sPar2));
             break;
         }
 
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx 
b/sw/source/uibase/wrtsh/wrtsh2.cxx
index a2fbfe154d52..f3f897b45fec 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -379,17 +379,19 @@ void SwWrtShell::ClickToField(const SwField& rField, bool 
bExecHyperlinks)
             sal_uInt16 nSlotId = 0;
             switch( static_cast<const SwJumpEditField&>(rField).GetFormat() )
             {
-            case JE_FMT_TABLE:
+            case SwJumpEditFormat::Table:
                 nSlotId = FN_INSERT_TABLE;
                 break;
-
-            case JE_FMT_FRAME:
+            case SwJumpEditFormat::Frame:
                 nSlotId = FN_INSERT_FRAME;
                 break;
-
-            case JE_FMT_GRAPHIC:    nSlotId = SID_INSERT_GRAPHIC;       break;
-            case JE_FMT_OLE:        nSlotId = SID_INSERT_OBJECT;        break;
-
+            case SwJumpEditFormat::Graphic:
+                nSlotId = SID_INSERT_GRAPHIC;
+                break;
+            case SwJumpEditFormat::OLE:
+                nSlotId = SID_INSERT_OBJECT;
+                break;
+            default: break;
             }
 
             if( nSlotId )
commit 9b74fb16415c4deb5b1829798aa073474f428948
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat Jul 5 11:52:59 2025 +0200
Commit:     Noel Grandin <noelgran...@gmail.com>
CommitDate: Mon Jul 7 18:51:09 2025 +0200

    Convert SwAuthorFormat to scoped enum
    
    Change-Id: I9b96186f0eb215ec85d65baa4c0f1f89129fb02b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187488
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx
index 98e373d83f2f..fb157775b693 100644
--- a/sw/inc/docufld.hxx
+++ b/sw/inc/docufld.hxx
@@ -40,13 +40,16 @@ class SwFrame;
 class SwTextAPIObject;
 class SwCharFormat;
 
-enum SwAuthorFormat
+enum class SwAuthorFormat : sal_uInt32
 {
-    AF_BEGIN,
-    AF_NAME = AF_BEGIN,
-    AF_SHORTCUT,
-    AF_FIXED = 0x8000
+    // most of the constants are a regular enum
+    Name,
+    Shortcut,
+    Mask = Name | Shortcut, // mask off the enum part
+    // except for this, which is a flag
+    Fixed = 0x8000
 };
+namespace o3tl { template<> struct typed_flags<SwAuthorFormat> : 
is_typed_flags<SwAuthorFormat, 0x8003> {}; }
 
 // Subtype of document statistics.
 enum SwDocStatSubType
@@ -188,20 +191,20 @@ class SwAuthorFieldType final : public SwFieldType
 public:
     SwAuthorFieldType();
 
-    static OUString         Expand(sal_uLong);
+    static OUString         Expand(SwAuthorFormat);
     virtual std::unique_ptr<SwFieldType> Copy() const override;
 };
 
 class SwAuthorField final : public SwField
 {
     OUString m_aContent;
-    sal_uInt32 m_nFormat;
+    SwAuthorFormat m_nFormat;
 
 public:
-    SwAuthorField(SwAuthorFieldType*, sal_uInt32 nFormat);
+    SwAuthorField(SwAuthorFieldType*, SwAuthorFormat nFormat);
 
-    sal_uInt32 GetFormat() const { return m_nFormat; }
-    void SetFormat(sal_uInt32 n) { m_nFormat = n; }
+    SwAuthorFormat GetFormat() const { return m_nFormat; }
+    void SetFormat(SwAuthorFormat n) { m_nFormat = n; }
 
     virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
@@ -604,13 +607,13 @@ class SwExtUserField final : public SwField
 {
     OUString m_aContent;
     sal_uInt16  m_nType;
-    sal_uInt32 m_nFormat;
+    SwAuthorFormat m_nFormat;
 
 public:
-    SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, sal_uInt32 nFormat);
+    SwExtUserField(SwExtUserFieldType*, sal_uInt16 nSub, SwAuthorFormat 
nFormat);
 
-    sal_uInt32 GetFormat() const { return m_nFormat; }
-    void SetFormat(sal_uInt32 n) { m_nFormat = n; }
+    SwAuthorFormat GetFormat() const { return m_nFormat; }
+    void SetFormat(SwAuthorFormat n) { m_nFormat = n; }
 
     virtual OUString    ExpandImpl(SwRootFrame const* pLayout) const override;
     virtual std::unique_ptr<SwField> Copy() const override;
diff --git a/sw/source/core/access/accpara.cxx 
b/sw/source/core/access/accpara.cxx
index 5a2378110b64..4bc56dd598c5 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -1116,7 +1116,8 @@ OUString 
SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
         break;
     case SwFieldIds::Author:
         {
-            strTypeName += "-" + aMgr.GetFormatStr(pField->GetTypeId(), 
static_cast<const SwAuthorField*>(pField)->GetFormat() & 0xff);
+            const SwAuthorField* pAuthorField = static_cast<const 
SwAuthorField*>(pField);
+            strTypeName += "-" + aMgr.GetFormatStr(pField->GetTypeId(), 
static_cast<sal_uInt32>(pAuthorField->GetFormat() & SwAuthorFormat::Mask));
         }
         break;
     default: break;
diff --git a/sw/source/core/fields/docufld.cxx 
b/sw/source/core/fields/docufld.cxx
index fa273b4b1784..ec267c45d0fa 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -323,11 +323,11 @@ SwAuthorFieldType::SwAuthorFieldType()
 {
 }
 
-OUString SwAuthorFieldType::Expand(sal_uLong nFormat)
+OUString SwAuthorFieldType::Expand(SwAuthorFormat nFormat)
 {
     SwModule* mod = SwModule::get();
     SvtUserOptions&  rOpt = mod->GetUserOptions();
-    if((nFormat & 0xff) == AF_NAME)
+    if((nFormat & SwAuthorFormat::Mask) == SwAuthorFormat::Name)
     {
         // Prefer the view's redline author name.
         // (set in SwXTextDocument::initializeForTiledRendering)
@@ -347,7 +347,7 @@ std::unique_ptr<SwFieldType> SwAuthorFieldType::Copy() const
     return std::make_unique<SwAuthorFieldType>();
 }
 
-SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, sal_uInt32 nFormat)
+SwAuthorField::SwAuthorField(SwAuthorFieldType* pTyp, SwAuthorFormat nFormat)
     : SwField(pTyp),
       m_nFormat(nFormat)
 {
@@ -376,7 +376,7 @@ bool SwAuthorField::QueryValue( uno::Any& rAny, sal_uInt16 
nWhichId ) const
     switch( nWhichId )
     {
     case FIELD_PROP_BOOL1:
-        rAny <<= (GetFormat() & 0xff) == AF_NAME;
+        rAny <<= (GetFormat() & SwAuthorFormat::Mask) == SwAuthorFormat::Name;
         break;
 
     case FIELD_PROP_BOOL2:
@@ -401,14 +401,14 @@ bool SwAuthorField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
     switch( nWhichId )
     {
     case FIELD_PROP_BOOL1:
-        m_nFormat = *o3tl::doAccess<bool>(rAny) ? AF_NAME : AF_SHORTCUT;
+        m_nFormat = *o3tl::doAccess<bool>(rAny) ? SwAuthorFormat::Name : 
SwAuthorFormat::Shortcut;
         break;
 
     case FIELD_PROP_BOOL2:
         if( *o3tl::doAccess<bool>(rAny) )
-            m_nFormat |= AF_FIXED;
+            m_nFormat |= SwAuthorFormat::Fixed;
         else
-            m_nFormat &= ~AF_FIXED;
+            m_nFormat &= ~SwAuthorFormat::Fixed;
         break;
 
     case FIELD_PROP_PAR1:
@@ -2144,7 +2144,7 @@ OUString SwExtUserFieldType::Expand(sal_uInt16 nSub )
 
 // extended user information field
 
-SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, 
sal_uInt32 nFormat) :
+SwExtUserField::SwExtUserField(SwExtUserFieldType* pTyp, sal_uInt16 nSubTyp, 
SwAuthorFormat nFormat) :
     SwField(pTyp), m_nType(nSubTyp), m_nFormat(nFormat)
 {
     m_aContent = SwExtUserFieldType::Expand(m_nType);
@@ -2216,9 +2216,9 @@ bool SwExtUserField::PutValue( const uno::Any& rAny, 
sal_uInt16 nWhichId )
         break;
     case FIELD_PROP_BOOL1:
         if( *o3tl::doAccess<bool>(rAny) )
-            m_nFormat |= AF_FIXED;
+            m_nFormat |= SwAuthorFormat::Fixed;
         else
-            m_nFormat &= ~AF_FIXED;
+            m_nFormat &= ~SwAuthorFormat::Fixed;
         break;
     default:
         assert(false);
diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx
index 173b8a2e8c30..f6c9036f5b43 100644
--- a/sw/source/core/fields/fldbas.cxx
+++ b/sw/source/core/fields/fldbas.cxx
@@ -341,9 +341,9 @@ sal_uInt32 SwField::GetUntypedFormat() const
     case SwFieldIds::Filename:
         return static_cast<sal_uInt32>(static_cast<const 
SwFileNameField*>(this)->GetFormat());
     case SwFieldIds::Author:
-        return static_cast<const SwAuthorField*>(this)->GetFormat();
+        return static_cast<sal_uInt32>(static_cast<const 
SwAuthorField*>(this)->GetFormat());
     case SwFieldIds::ExtUser:
-        return static_cast<const SwExtUserField*>(this)->GetFormat();
+        return static_cast<sal_uInt32>(static_cast<const 
SwExtUserField*>(this)->GetFormat());
     case SwFieldIds::DbNextSet:
     case SwFieldIds::DbNumSet:
     case SwFieldIds::DatabaseName:
@@ -384,10 +384,10 @@ void SwField::SetUntypedFormat(sal_uInt32 n)
         
static_cast<SwFileNameField*>(this)->SetFormat(static_cast<SwFileNameFormat>(n));
         return;
     case SwFieldIds::Author:
-        static_cast<SwAuthorField*>(this)->SetFormat(n);
+        
static_cast<SwAuthorField*>(this)->SetFormat(static_cast<SwAuthorFormat>(n));
         return;
     case SwFieldIds::ExtUser:
-        static_cast<SwExtUserField*>(this)->SetFormat(n);
+        
static_cast<SwExtUserField*>(this)->SetFormat(static_cast<SwAuthorFormat>(n));
         return;
     case SwFieldIds::DbNextSet:
     case SwFieldIds::DbNumSet:
@@ -543,10 +543,10 @@ bool SwField::IsFixed() const
         break;
 
     case SwFieldIds::ExtUser:
-        bRet = 0 != (static_cast<const SwExtUserField*>(this)->GetFormat() & 
AF_FIXED);
+        bRet = bool(static_cast<const SwExtUserField*>(this)->GetFormat() & 
SwAuthorFormat::Fixed);
         break;
     case SwFieldIds::Author:
-        bRet = 0 != (static_cast<const SwAuthorField*>(this)->GetFormat() & 
AF_FIXED);
+        bRet = bool(static_cast<const SwAuthorField*>(this)->GetFormat() & 
SwAuthorFormat::Fixed);
         break;
 
     case SwFieldIds::Filename:
diff --git a/sw/source/core/unocore/unofield.cxx 
b/sw/source/core/unocore/unofield.cxx
index 17cad02d9cc8..fa3acac8afe7 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -1475,9 +1475,9 @@ void SAL_CALL SwXTextField::attach(
             break;
             case SwServiceType::FieldTypeAuthor:
             {
-                tools::Long nFormat = m_pImpl->m_pProps->bBool1 ? AF_NAME : 
AF_SHORTCUT;
+                SwAuthorFormat nFormat = m_pImpl->m_pProps->bBool1 ? 
SwAuthorFormat::Name : SwAuthorFormat::Shortcut;
                 if (m_pImpl->m_pProps->bBool2)
-                    nFormat |= AF_FIXED;
+                    nFormat |= SwAuthorFormat::Fixed;
 
                 SwFieldType* pFieldType = 
pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Author);
                 SwAuthorField *const pAuthorField = new SwAuthorField(
@@ -1592,9 +1592,9 @@ void SAL_CALL SwXTextField::attach(
             break;
             case SwServiceType::FieldTypeUserExt:
             {
-                sal_Int32 nFormat = 0;
+                SwAuthorFormat nFormat = SwAuthorFormat::Name;
                 if (m_pImpl->m_pProps->bBool1)
-                    nFormat = AF_FIXED;
+                    nFormat = SwAuthorFormat::Fixed;
 
                 SwFieldType* pFieldType = 
pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::ExtUser);
                 SwExtUserField *const pEUField = new SwExtUserField(
diff --git a/sw/source/filter/html/htmlfld.cxx 
b/sw/source/filter/html/htmlfld.cxx
index e4a556b9eed9..343b9694dfc5 100644
--- a/sw/source/filter/html/htmlfld.cxx
+++ b/sw/source/filter/html/htmlfld.cxx
@@ -131,8 +131,8 @@ HTMLOptionEnum<SwExtUserSubType> const 
aHTMLExtUsrFieldSubTable[] =
 
 HTMLOptionEnum<SwAuthorFormat> const aHTMLAuthorFieldFormatTable[] =
 {
-    { OOO_STRING_SW_HTML_FF_name,        AF_NAME },
-    { OOO_STRING_SW_HTML_FF_shortcut,    AF_SHORTCUT },
+    { OOO_STRING_SW_HTML_FF_name,        SwAuthorFormat::Name },
+    { OOO_STRING_SW_HTML_FF_shortcut,    SwAuthorFormat::Shortcut },
     { nullptr,                           SwAuthorFormat(0) }
 };
 
@@ -297,10 +297,10 @@ void SwHTMLParser::NewField()
         if( pSubOption )
         {
             SwExtUserSubType nSub;
-            sal_uLong nFormat = 0;
+            SwAuthorFormat nFormat = SwAuthorFormat::Name;
             if( bFixed )
             {
-                nFormat |= AF_FIXED;
+                nFormat |= SwAuthorFormat::Fixed;
                 bInsOnEndTag = true;
             }
             if( pSubOption->GetEnum( nSub, aHTMLExtUsrFieldSubTable ) )
@@ -310,12 +310,12 @@ void SwHTMLParser::NewField()
 
     case SwFieldIds::Author:
         {
-            SwAuthorFormat nFormat = AF_NAME;
+            SwAuthorFormat nFormat = SwAuthorFormat::Name;
             if( pFormatOption )
                 pFormatOption->GetEnum( nFormat, aHTMLAuthorFieldFormatTable );
             if( bFixed )
             {
-                nFormat = 
static_cast<SwAuthorFormat>(static_cast<int>(nFormat) | AF_FIXED);
+                nFormat |= SwAuthorFormat::Fixed;
                 bInsOnEndTag = true;
             }
 
diff --git a/sw/source/filter/html/htmlfldw.cxx 
b/sw/source/filter/html/htmlfldw.cxx
index 9e443f22f086..048d9383acea 100644
--- a/sw/source/filter/html/htmlfldw.cxx
+++ b/sw/source/filter/html/htmlfldw.cxx
@@ -114,10 +114,11 @@ static SwHTMLWriter& OutHTML_SwField( SwHTMLWriter& rWrt, 
const SwField* pField,
 
         case SwFieldIds::Author:
             pTypeStr = OOO_STRING_SW_HTML_FT_author;
-            switch( static_cast<SwAuthorFormat>(static_cast<const 
SwAuthorField*>(pField)->GetFormat()) & 0xff)
+            switch( static_cast<const SwAuthorField*>(pField)->GetFormat() & 
SwAuthorFormat::Mask )
             {
-                case AF_NAME:     pFormatStr = OOO_STRING_SW_HTML_FF_name;     
break;
-                case AF_SHORTCUT:  pFormatStr = 
OOO_STRING_SW_HTML_FF_shortcut;    break;
+                case SwAuthorFormat::Name:     pFormatStr = 
OOO_STRING_SW_HTML_FF_name;     break;
+                case SwAuthorFormat::Shortcut:  pFormatStr = 
OOO_STRING_SW_HTML_FF_shortcut;    break;
+                default: break;
             }
             OSL_ENSURE( pFormatStr, "unknown format for SwAuthorField" );
             bFixed = static_cast<const SwAuthorField*>(pField)->IsFixed();
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index ab64c12c73f7..35dc8f614bf3 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3043,7 +3043,7 @@ void AttributeOutputBase::TextField( const SwFormatField& 
rField )
     case SwFieldIds::Author:
         {
             ww::eField eField =
-                ((AF_SHORTCUT & static_cast<const 
SwAuthorField*>(pField)->GetFormat()) ? ww::eUSERINITIALS : ww::eUSERNAME);
+                ((SwAuthorFormat::Shortcut & static_cast<const 
SwAuthorField*>(pField)->GetFormat()) ? ww::eUSERINITIALS : ww::eUSERNAME);
             GetExport().OutputField(pField, eField, FieldString(eField));
         }
         break;
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 1393fc8e3241..029e7db209ea 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -416,7 +416,14 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, weld::TreeView&, 
void)
     m_xFixedCB->set_sensitive(bFixed);
 
     if (IsFieldEdit())
-        m_xFixedCB->set_active((GetCurField()->GetUntypedFormat() & AF_FIXED) 
!= 0 && bFixed);
+    {
+        if (nTypeId == SwFieldTypesEnum::Author)
+            m_xFixedCB->set_active((static_cast<const 
SwAuthorField*>(GetCurField())->GetFormat() & SwAuthorFormat::Fixed) && bFixed);
+        else if (nTypeId == SwFieldTypesEnum::ExtendedUser)
+            m_xFixedCB->set_active((static_cast<const 
SwExtUserField*>(GetCurField())->GetFormat() & SwAuthorFormat::Fixed) && 
bFixed);
+        else
+            m_xFixedCB->set_active(false);
+    }
 
     if (m_xNumFormatLB->get_selected_index() == -1)
         m_xNumFormatLB->select(0);
@@ -480,7 +487,18 @@ sal_Int32 SwFieldDokPage::FillFormatLB(SwFieldTypesEnum 
nTypeId)
 
     if (IsFieldEdit())
     {
-        
m_xFormatLB->select_id(OUString::number(GetCurField()->GetUntypedFormat() & 
~AF_FIXED));
+        if (nTypeId == SwFieldTypesEnum::Author)
+        {
+            SwAuthorFormat nFormat = static_cast<const 
SwAuthorField*>(GetCurField())->GetFormat() & ~SwAuthorFormat::Fixed;
+            
m_xFormatLB->select_id(OUString::number(static_cast<sal_uInt32>(nFormat)));
+        }
+        else if (nTypeId == SwFieldTypesEnum::ExtendedUser)
+        {
+            SwAuthorFormat nFormat = static_cast<const 
SwExtUserField*>(GetCurField())->GetFormat() & ~SwAuthorFormat::Fixed;
+            
m_xFormatLB->select_id(OUString::number(static_cast<sal_uInt32>(nFormat)));
+        }
+        else
+            
m_xFormatLB->select_id(OUString::number(GetCurField()->GetUntypedFormat()));
     }
     else
     {
@@ -567,7 +585,7 @@ bool SwFieldDokPage::FillItemSet(SfxItemSet* )
             nSubType = 0;
             [[fallthrough]];
         case SwFieldTypesEnum::ExtendedUser:
-            nFormat |= m_xFixedCB->get_active() ? AF_FIXED : 0;
+            nFormat |= m_xFixedCB->get_active() ? 
static_cast<sal_uInt32>(SwAuthorFormat::Fixed) : 0;
             break;
 
         case SwFieldTypesEnum::Filename:
diff --git a/sw/source/uibase/fldui/fldmgr.cxx 
b/sw/source/uibase/fldui/fldmgr.cxx
index 4ceac9f9061f..2addc7ec85ea 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -1052,7 +1052,7 @@ bool SwFieldMgr::InsertField(
         {
             SwAuthorFieldType* pTyp =
                 static_cast<SwAuthorFieldType*>( pCurShell->GetFieldType(0, 
SwFieldIds::Author) );
-            pField.reset(new SwAuthorField(pTyp, nFormatId));
+            pField.reset(new SwAuthorField(pTyp, 
static_cast<SwAuthorFormat>(nFormatId)));
             break;
         }
 
@@ -1214,7 +1214,7 @@ bool SwFieldMgr::InsertField(
         {
             SwExtUserFieldType* pTyp = static_cast<SwExtUserFieldType*>( 
pCurShell->GetFieldType(
                 0, SwFieldIds::ExtUser) );
-            pField.reset(new SwExtUserField(pTyp, nSubType, nFormatId));
+            pField.reset(new SwExtUserField(pTyp, nSubType, 
static_cast<SwAuthorFormat>(nFormatId)));
             break;
         }
 

Reply via email to