[Libreoffice-commits] core.git: cui/source editeng/source include/editeng include/svl include/svx reportdesign/source sc/inc sc/qa sc/source sd/inc svl/source svx/inc svx/source sw/inc sw/qa sw/source

Noel Grandin noel.grandin at collabora.co.uk
Fri Mar 3 06:45:21 UTC 2017


 cui/source/tabpages/align.cxx                      |   14 ++--
 editeng/source/items/frmitems.cxx                  |    4 -
 editeng/source/items/justifyitem.cxx               |   24 +++----
 editeng/source/items/textitem.cxx                  |   39 ++++++------
 include/editeng/charreliefitem.hxx                 |    4 -
 include/editeng/cmapitem.hxx                       |    9 --
 include/editeng/crossedoutitem.hxx                 |    4 -
 include/editeng/formatbreakitem.hxx                |   10 +--
 include/editeng/justifyitem.hxx                    |    6 -
 include/editeng/langitem.hxx                       |    7 --
 include/editeng/postitem.hxx                       |    4 -
 include/editeng/udlnitem.hxx                       |    6 -
 include/editeng/wghtitem.hxx                       |    5 -
 include/svl/aeitem.hxx                             |    2 
 include/svl/eitem.hxx                              |   64 +++++++++++++++------
 include/svx/algitem.hxx                            |    2 
 include/svx/chrtitem.hxx                           |   28 +--------
 include/svx/rotmodit.hxx                           |    2 
 include/svx/sdgmoitm.hxx                           |   11 +--
 include/svx/sdtaditm.hxx                           |    7 --
 include/svx/sdtaitm.hxx                            |   16 ++---
 include/svx/sdtakitm.hxx                           |    9 +-
 include/svx/sdtfsitm.hxx                           |    9 --
 include/svx/sxcecitm.hxx                           |    7 --
 include/svx/sxctitm.hxx                            |    9 +-
 include/svx/sxekitm.hxx                            |   13 +---
 include/svx/sxmtpitm.hxx                           |   14 +---
 include/svx/sxmuitm.hxx                            |   11 +--
 include/svx/xfillit0.hxx                           |    3 
 include/svx/xflbmpit.hxx                           |    5 -
 include/svx/xftadit.hxx                            |    5 -
 include/svx/xftshit.hxx                            |    5 -
 include/svx/xlineit0.hxx                           |    3 
 include/svx/xlinjoit.hxx                           |    7 --
 include/svx/xlncapit.hxx                           |    6 -
 include/svx/xtextit0.hxx                           |    5 -
 reportdesign/source/ui/misc/UITools.cxx            |    2 
 sc/inc/attrib.hxx                                  |    2 
 sc/qa/unit/subsequent_filters-test.cxx             |    4 -
 sc/source/core/data/attrib.cxx                     |    2 
 sc/source/filter/excel/xestyle.cxx                 |    8 +-
 sc/source/ui/drawfunc/drawsh5.cxx                  |    2 
 sd/inc/sdattr.hxx                                  |   12 +--
 svl/source/items/aeitem.cxx                        |    2 
 svl/source/items/cenumitm.cxx                      |   32 ----------
 svx/inc/sxcikitm.hxx                               |    7 --
 svx/inc/sxmkitm.hxx                                |    7 --
 svx/source/items/algitem.cxx                       |    6 -
 svx/source/items/chrtitem.cxx                      |   27 +-------
 svx/source/items/rotmodit.cxx                      |    4 -
 svx/source/sdr/primitive2d/sdrattributecreator.cxx |   10 +--
 svx/source/svdraw/svdattr.cxx                      |   24 +++----
 svx/source/xoutdev/xattr.cxx                       |   21 +++---
 svx/source/xoutdev/xattr2.cxx                      |   10 +--
 sw/inc/fmtfordr.hxx                                |    4 -
 sw/inc/fmtftntx.hxx                                |    6 -
 sw/inc/fmtsrnd.hxx                                 |    8 +-
 sw/inc/grfatr.hxx                                  |   10 +--
 sw/qa/extras/ww8export/ww8export.cxx               |    2 
 sw/source/core/graphic/grfatr.cxx                  |    4 -
 sw/source/core/graphic/ndgrf.cxx                   |    1 
 sw/source/core/layout/atrfrm.cxx                   |    6 -
 sw/source/filter/html/htmlflywriter.cxx            |    1 
 sw/source/filter/ww8/docxattributeoutput.cxx       |    2 
 sw/source/filter/ww8/wrtw8esh.cxx                  |    2 
 sw/source/filter/ww8/ww8atr.cxx                    |    2 
 sw/source/ui/dialog/uiregionsw.cxx                 |    6 +
 sw/source/uibase/shells/drwbassh.cxx               |    4 -
 sw/source/uibase/shells/grfsh.cxx                  |    2 
 69 files changed, 278 insertions(+), 343 deletions(-)

New commits:
commit f091259ad2ec1590714645839668580cd7b8c7c4
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Wed Mar 1 14:17:08 2017 +0200

    convert SfxEnumItem to type-safe template class
    
    and drop the SvxChartTextOrientItem class, unused.
    
    Change-Id: I99100837d1beb953450f57b2cda47d165df1620c
    Reviewed-on: https://gerrit.libreoffice.org/34747
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/cui/source/tabpages/align.cxx b/cui/source/tabpages/align.cxx
index b657329..4a46c38 100644
--- a/cui/source/tabpages/align.cxx
+++ b/cui/source/tabpages/align.cxx
@@ -49,7 +49,7 @@ namespace svx {
 
 // horizontal alignment -------------------------------------------------------
 
-typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify, sal_uInt16 > HorJustItemWrapper;
+typedef sfx::ValueItemWrapper< SvxHorJustifyItem, SvxCellHorJustify > HorJustItemWrapper;
 typedef sfx::ListBoxConnection< HorJustItemWrapper > HorJustConnection;
 
 static const HorJustConnection::MapEntryType s_pHorJustMap[] =
@@ -66,7 +66,7 @@ static const HorJustConnection::MapEntryType s_pHorJustMap[] =
 
 // vertical alignment ---------------------------------------------------------
 
-typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify, sal_uInt16 > VerJustItemWrapper;
+typedef sfx::ValueItemWrapper< SvxVerJustifyItem, SvxCellVerJustify > VerJustItemWrapper;
 typedef sfx::ListBoxConnection< VerJustItemWrapper > VerJustConnection;
 
 static const VerJustConnection::MapEntryType s_pVerJustMap[] =
@@ -82,7 +82,7 @@ static const VerJustConnection::MapEntryType s_pVerJustMap[] =
 
 // cell rotate mode -----------------------------------------------------------
 
-typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode, sal_uInt16 > RotateModeItemWrapper;
+typedef sfx::ValueItemWrapper< SvxRotateModeItem, SvxRotateMode > RotateModeItemWrapper;
 typedef sfx::ValueSetConnection< RotateModeItemWrapper > RotateModeConnection;
 
 static const RotateModeConnection::MapEntryType s_pRotateModeMap[] =
@@ -120,7 +120,7 @@ void lcl_MaybeResetAlignToDistro(
         // alignment not set.
         return;
 
-    const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
+    const SfxEnumItemInterface* p = static_cast<const SfxEnumItemInterface*>(pItem);
     JustContainerType eVal = static_cast<JustContainerType>(p->GetEnumValue());
     if (eVal != eBlock)
         // alignment is not 'justify'.  No need to go further.
@@ -130,7 +130,7 @@ void lcl_MaybeResetAlignToDistro(
         // justification method is not set.
         return;
 
-    p = static_cast<const SfxEnumItem*>(pItem);
+    p = static_cast<const SfxEnumItemInterface*>(pItem);
     SvxCellJustifyMethod eMethod = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     if (eMethod == SvxCellJustifyMethod::Distribute)
         // Select the 'distribute' entry in the specified list box.
@@ -404,13 +404,13 @@ bool AlignmentTabPage::HasAlignmentChanged( const SfxItemSet& rNew, sal_uInt16 n
     SvxCellJustifyMethod eMethodNew = SvxCellJustifyMethod::Auto;
     if (rOld.GetItemState(nWhich, true, &pItem) == SfxItemState::SET)
     {
-        const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
+        const SfxEnumItemInterface* p = static_cast<const SfxEnumItemInterface*>(pItem);
         eMethodOld = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     }
 
     if (rNew.GetItemState(nWhich, true, &pItem) == SfxItemState::SET)
     {
-        const SfxEnumItem* p = static_cast<const SfxEnumItem*>(pItem);
+        const SfxEnumItemInterface* p = static_cast<const SfxEnumItemInterface*>(pItem);
         eMethodNew = static_cast<SvxCellJustifyMethod>(p->GetEnumValue());
     }
 
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index 3fd113b..2c45bbd 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -2933,7 +2933,7 @@ bool SvxFormatBreakItem::GetPresentation
     OUString&           rText, const IntlWrapper *
 )   const
 {
-    rText = GetValueTextByPos( GetValue() );
+    rText = GetValueTextByPos( GetEnumValue() );
     return true;
 }
 
@@ -3000,7 +3000,7 @@ SfxPoolItem* SvxFormatBreakItem::Clone( SfxItemPool* ) const
 
 SvStream& SvxFormatBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
 {
-    rStrm.WriteSChar( GetValue() );
+    rStrm.WriteSChar( GetEnumValue() );
     if( FMTBREAK_NOAUTO > nItemVersion )
         rStrm.WriteSChar( 0x01 );
     return rStrm;
diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx
index 7979a7b..5d63a37 100644
--- a/editeng/source/items/justifyitem.cxx
+++ b/editeng/source/items/justifyitem.cxx
@@ -38,13 +38,13 @@ using namespace ::com::sun::star;
 
 
 SvxHorJustifyItem::SvxHorJustifyItem( const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)SVX_HOR_JUSTIFY_STANDARD )
+    SfxEnumItem( nId, SVX_HOR_JUSTIFY_STANDARD )
 {
 }
 
 SvxHorJustifyItem::SvxHorJustifyItem( const SvxCellHorJustify eJustify,
                                       const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)eJustify )
+    SfxEnumItem( nId, eJustify )
 {
 }
 
@@ -130,7 +130,7 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     case table::CellHoriJustify_REPEAT:   eSvx = SVX_HOR_JUSTIFY_REPEAT;   break;
                     default: ; //prevent warning
                 }
-                SetValue( (sal_uInt16)eSvx );
+                SetValue( eSvx );
             }
             break;
         case MID_HORJUST_ADJUST:
@@ -150,7 +150,7 @@ bool SvxHorJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     case style::ParagraphAdjust_BLOCK:   eSvx = SVX_HOR_JUSTIFY_BLOCK;  break;
                     case style::ParagraphAdjust_CENTER:  eSvx = SVX_HOR_JUSTIFY_CENTER; break;
                 }
-                SetValue( (sal_uInt16)eSvx );
+                SetValue( eSvx );
             }
     }
     return true;
@@ -185,13 +185,13 @@ sal_uInt16 SvxHorJustifyItem::GetValueCount() const
 
 
 SvxVerJustifyItem::SvxVerJustifyItem( const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)SVX_VER_JUSTIFY_STANDARD )
+    SfxEnumItem( nId, SVX_VER_JUSTIFY_STANDARD )
 {
 }
 
 SvxVerJustifyItem::SvxVerJustifyItem( const SvxCellVerJustify eJustify,
                                       const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)eJustify )
+    SfxEnumItem( nId, eJustify )
 {
 }
 
@@ -266,7 +266,7 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     case style::VerticalAlignment_BOTTOM:   eSvx = SVX_VER_JUSTIFY_BOTTOM;  break;
                     default:;
                 }
-                SetValue( (sal_uInt16)eSvx );
+                SetValue( eSvx );
                 break;
             }
         default:
@@ -284,7 +284,7 @@ bool SvxVerJustifyItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     case table::CellVertJustify2::BLOCK:    eSvx = SVX_VER_JUSTIFY_BLOCK;     break;
                     default: ; //prevent warning
                 }
-                SetValue( (sal_uInt16)eSvx );
+                SetValue( eSvx );
                 break;
             }
     }
@@ -322,7 +322,7 @@ sal_uInt16 SvxVerJustifyItem::GetValueCount() const
 
 SvxJustifyMethodItem::SvxJustifyMethodItem( const SvxCellJustifyMethod eJustify,
                                       const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)eJustify )
+    SfxEnumItem( nId, eJustify )
 {
 }
 
@@ -335,7 +335,7 @@ bool SvxJustifyMethodItem::GetPresentation
     OUString&           rText,
     const IntlWrapper * )    const
 {
-    rText = GetValueText( GetValue() );
+    rText = GetValueText( GetEnumValue() );
     return true;
 }
 
@@ -343,7 +343,7 @@ bool SvxJustifyMethodItem::GetPresentation
 bool SvxJustifyMethodItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
 {
     sal_Int32 nUno = table::CellJustifyMethod::AUTO;
-    switch (static_cast<SvxCellJustifyMethod>(GetValue()))
+    switch (GetValue())
     {
         case SvxCellJustifyMethod::Auto:       nUno = table::CellJustifyMethod::AUTO;       break;
         case SvxCellJustifyMethod::Distribute: nUno = table::CellJustifyMethod::DISTRIBUTE; break;
@@ -370,7 +370,7 @@ bool SvxJustifyMethodItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId
         break;
         default:;
     }
-    SetValue(static_cast<sal_uInt16>(eSvx));
+    SetValue(eSvx);
     return true;
 }
 
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index c7c875e..4b4b621 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -452,7 +452,7 @@ void SvxFontItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 // class SvxPostureItem --------------------------------------------------
 
 SvxPostureItem::SvxPostureItem( const FontItalic ePosture, const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)ePosture )
+    SfxEnumItem( nId, ePosture )
 {
 }
 
@@ -549,7 +549,7 @@ bool SvxPostureItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 
                 eSlant = (awt::FontSlant)nValue;
             }
-            SetValue((sal_uInt16)eSlant);
+            SetValue((FontItalic)eSlant);
         }
     }
     return true;
@@ -564,13 +564,13 @@ bool SvxPostureItem::HasBoolValue() const
 
 bool SvxPostureItem::GetBoolValue() const
 {
-    return ( (FontItalic)GetValue() >= ITALIC_OBLIQUE );
+    return ( GetValue() >= ITALIC_OBLIQUE );
 }
 
 
 void SvxPostureItem::SetBoolValue( bool bVal )
 {
-    SetValue( (sal_uInt16)(bVal ? ITALIC_NORMAL : ITALIC_NONE) );
+    SetValue( bVal ? ITALIC_NORMAL : ITALIC_NONE );
 }
 
 void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const
@@ -585,7 +585,7 @@ void SvxPostureItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 // class SvxWeightItem ---------------------------------------------------
 
 SvxWeightItem::SvxWeightItem( const FontWeight eWght, const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)eWght )
+    SfxEnumItem( nId, eWght )
 {
 }
 
@@ -598,13 +598,13 @@ bool SvxWeightItem::HasBoolValue() const
 
 bool SvxWeightItem::GetBoolValue() const
 {
-    return  (FontWeight)GetValue() >= WEIGHT_BOLD;
+    return GetValue() >= WEIGHT_BOLD;
 }
 
 
 void SvxWeightItem::SetBoolValue( bool bVal )
 {
-    SetValue( (sal_uInt16)(bVal ? WEIGHT_BOLD : WEIGHT_NORMAL) );
+    SetValue( bVal ? WEIGHT_BOLD : WEIGHT_NORMAL );
 }
 
 
@@ -689,7 +689,7 @@ bool SvxWeightItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     return false;
                 fValue = (float)nValue;
             }
-            SetValue( (sal_uInt16)VCLUnoHelper::ConvertFontWeight((float)fValue) );
+            SetValue( VCLUnoHelper::ConvertFontWeight((float)fValue) );
         }
         break;
     }
@@ -1210,7 +1210,7 @@ bool SvxFontWidthItem::GetPresentation
 // class SvxTextLineItem ------------------------------------------------
 
 SvxTextLineItem::SvxTextLineItem( const FontLineStyle eSt, const sal_uInt16 nId )
-    : SfxEnumItem( nId, (sal_uInt16)eSt ), mColor( COL_TRANSPARENT )
+    : SfxEnumItem( nId, eSt ), mColor( COL_TRANSPARENT )
 {
 }
 
@@ -1229,7 +1229,7 @@ bool SvxTextLineItem::GetBoolValue() const
 
 void SvxTextLineItem::SetBoolValue( bool bVal )
 {
-    SetValue( (sal_uInt16)(bVal ? LINESTYLE_SINGLE : LINESTYLE_NONE) );
+    SetValue( bVal ? LINESTYLE_SINGLE : LINESTYLE_NONE );
 }
 
 
@@ -1320,7 +1320,7 @@ bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
         if(!(rVal >>= nValue))
             bRet = false;
         else
-            SetValue((sal_Int16)nValue);
+            SetValue((FontLineStyle)nValue);
     }
     break;
     case MID_TL_COLOR:
@@ -1348,7 +1348,7 @@ bool SvxTextLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
 bool SvxTextLineItem::operator==( const SfxPoolItem& rItem ) const
 {
     assert(SfxPoolItem::operator==(rItem));
-    return SfxEnumItem::operator==( rItem ) &&
+    return SfxEnumItem::operator==( static_cast<const SfxEnumItem<FontLineStyle>&>(rItem) ) &&
            GetColor() == static_cast<const SvxTextLineItem&>(rItem).GetColor();
 }
 
@@ -1415,7 +1415,7 @@ OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
 // class SvxCrossedOutItem -----------------------------------------------
 
 SvxCrossedOutItem::SvxCrossedOutItem( const FontStrikeout eSt, const sal_uInt16 nId )
-    : SfxEnumItem( nId, (sal_uInt16)eSt )
+    : SfxEnumItem( nId, eSt )
 {
 }
 
@@ -1428,13 +1428,13 @@ bool SvxCrossedOutItem::HasBoolValue() const
 
 bool SvxCrossedOutItem::GetBoolValue() const
 {
-    return (FontStrikeout)GetValue() != STRIKEOUT_NONE;
+    return GetValue() != STRIKEOUT_NONE;
 }
 
 
 void SvxCrossedOutItem::SetBoolValue( bool bVal )
 {
-    SetValue( (sal_uInt16)(bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE) );
+    SetValue( bVal ? STRIKEOUT_SINGLE : STRIKEOUT_NONE );
 }
 
 
@@ -1512,7 +1512,7 @@ bool SvxCrossedOutItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
             sal_Int32 nValue = 0;
             if(!(rVal >>= nValue))
                 return false;
-            SetValue((sal_Int16)nValue);
+            SetValue((FontStrikeout)nValue);
         }
         break;
     }
@@ -2086,7 +2086,7 @@ bool SvxKerningItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId)
 // class SvxCaseMapItem --------------------------------------------------
 
 SvxCaseMapItem::SvxCaseMapItem( const SvxCaseMap eMap, const sal_uInt16 nId ) :
-    SfxEnumItem( nId, (sal_uInt16)eMap )
+    SfxEnumItem( nId, eMap )
 {
 }
 
@@ -2146,6 +2146,7 @@ bool SvxCaseMapItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
         case SVX_CASEMAP_GEMEINE     :      nRet = style::CaseMap::LOWERCASE; break;
         case SVX_CASEMAP_TITEL       :      nRet = style::CaseMap::TITLE    ; break;
         case SVX_CASEMAP_KAPITAELCHEN:      nRet = style::CaseMap::SMALLCAPS; break;
+        default: break;
     }
     rVal <<= (sal_Int16)(nRet);
     return true;
@@ -2165,7 +2166,7 @@ bool SvxCaseMapItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
     case style::CaseMap::TITLE    :  nVal = SVX_CASEMAP_TITEL       ; break;
     case style::CaseMap::SMALLCAPS:  nVal = SVX_CASEMAP_KAPITAELCHEN; break;
     }
-    SetValue(nVal);
+    SetValue((SvxCaseMap)nVal);
     return true;
 }
 
@@ -3097,7 +3098,7 @@ bool SvxCharScaleWidthItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/
 
 SvxCharReliefItem::SvxCharReliefItem( FontRelief eValue,
                                          const sal_uInt16 nId )
-    : SfxEnumItem( nId, (sal_uInt16)eValue )
+    : SfxEnumItem( nId, eValue )
 {
 }
 
diff --git a/include/editeng/charreliefitem.hxx b/include/editeng/charreliefitem.hxx
index b644d31..c87aa57 100644
--- a/include/editeng/charreliefitem.hxx
+++ b/include/editeng/charreliefitem.hxx
@@ -31,7 +31,7 @@
     emboss, relief.
 */
 
-class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxCharReliefItem : public SfxEnumItem<FontRelief>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -46,8 +46,6 @@ public:
 
     virtual OUString        GetValueTextByPos( sal_uInt16 nPos ) const override;
     virtual sal_uInt16      GetValueCount() const override;
-    FontRelief              GetValue() const { return (FontRelief)SfxEnumItem::GetValue(); }
-    void                    SetValue(FontRelief f) { SfxEnumItem::SetValue((sal_uInt16)f); }
 
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                   MapUnit eCoreMetric,
diff --git a/include/editeng/cmapitem.hxx b/include/editeng/cmapitem.hxx
index f140a88..d1a38a0 100644
--- a/include/editeng/cmapitem.hxx
+++ b/include/editeng/cmapitem.hxx
@@ -32,7 +32,7 @@ class SvXMLUnitConverter;
     This item describe the font type (uppercase, small caps ,...).
 */
 
-class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxCaseMapItem : public SfxEnumItem<SvxCaseMap>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -49,11 +49,9 @@ public:
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create(SvStream &, sal_uInt16) const override;
     virtual SvStream&       Store(SvStream &, sal_uInt16 nItemVersion) const override;
-    virtual OUString   GetValueTextByPos( sal_uInt16 nPos ) const override;
+    virtual OUString        GetValueTextByPos( sal_uInt16 nPos ) const override;
     virtual sal_uInt16      GetValueCount() const override;
 
-    using SfxEnumItem::SetValue;
-
     inline SvxCaseMapItem& operator=(const SvxCaseMapItem& rMap)
         {
             SetValue( rMap.GetValue() );
@@ -61,8 +59,7 @@ public:
         }
 
     // enum cast
-    SvxCaseMap              GetCaseMap() const
-                                { return (SvxCaseMap)GetValue(); }
+    SvxCaseMap              GetCaseMap() const { return GetValue(); }
     virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
 };
diff --git a/include/editeng/crossedoutitem.hxx b/include/editeng/crossedoutitem.hxx
index e91d9af..6bf4d42 100644
--- a/include/editeng/crossedoutitem.hxx
+++ b/include/editeng/crossedoutitem.hxx
@@ -31,7 +31,7 @@ class SvXMLUnitConverter;
     This item describes, whether and how it is striked out.
 */
 
-class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxCrossedOutItem : public SfxEnumItem<FontStrikeout>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -67,7 +67,7 @@ public:
 
     // enum cast
     FontStrikeout           GetStrikeout() const
-                                { return (FontStrikeout)GetValue(); }
+                                { return GetValue(); }
 };
 
 #endif // INCLUDED_EDITENG_CROSSEDOUTITEM_HXX
diff --git a/include/editeng/formatbreakitem.hxx b/include/editeng/formatbreakitem.hxx
index 38894da..e0fd881 100644
--- a/include/editeng/formatbreakitem.hxx
+++ b/include/editeng/formatbreakitem.hxx
@@ -33,7 +33,7 @@
 */
 #define FMTBREAK_NOAUTO ((sal_uInt16)0x0001)
 
-class EDITENG_DLLPUBLIC SvxFormatBreakItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxFormatBreakItem : public SfxEnumItem<SvxBreak>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -52,7 +52,7 @@ public:
                                   MapUnit eCoreMetric,
                                   MapUnit ePresMetric,
                                   OUString &rText, const IntlWrapper * = nullptr ) const override;
-    virtual OUString    GetValueTextByPos( sal_uInt16 nPos ) const override;
+    virtual OUString         GetValueTextByPos( sal_uInt16 nPos ) const override;
 
     virtual SfxPoolItem*     Clone( SfxItemPool *pPool = nullptr ) const override;
     virtual SvStream&        Store( SvStream& , sal_uInt16 nItemVersion ) const override;
@@ -60,15 +60,13 @@ public:
     virtual SfxPoolItem*     Create( SvStream&, sal_uInt16 ) const override;
     virtual sal_uInt16       GetValueCount() const override;
 
-    void                     SetValue( SvxBreak nNewVal )
-                                {SfxEnumItem::SetValue((sal_uInt16) nNewVal); }
-    SvxBreak                 GetBreak() const { return (SvxBreak) GetValue(); }
+    SvxBreak                 GetBreak() const { return GetValue(); }
 };
 
 
 inline SvxFormatBreakItem::SvxFormatBreakItem( const SvxBreak eBreak,
                                          const sal_uInt16 _nWhich ) :
-    SfxEnumItem( _nWhich, (sal_uInt16)eBreak )
+    SfxEnumItem( _nWhich, eBreak )
 {}
 
 inline SvxFormatBreakItem::SvxFormatBreakItem( const SvxFormatBreakItem& rBreak ) :
diff --git a/include/editeng/justifyitem.hxx b/include/editeng/justifyitem.hxx
index 9ffaf6f..e246bb5 100644
--- a/include/editeng/justifyitem.hxx
+++ b/include/editeng/justifyitem.hxx
@@ -25,7 +25,7 @@
 #include <svl/eitem.hxx>
 #include <sal/types.h>
 
-class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxHorJustifyItem: public SfxEnumItem<SvxCellHorJustify>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -57,7 +57,7 @@ public:
 };
 
 
-class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxVerJustifyItem: public SfxEnumItem<SvxCellVerJustify>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -89,7 +89,7 @@ public:
 };
 
 
-class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxJustifyMethodItem: public SfxEnumItem<SvxCellJustifyMethod>
 {
 public:
     SvxJustifyMethodItem(
diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx
index 6b611b1..a3a1823 100644
--- a/include/editeng/langitem.hxx
+++ b/include/editeng/langitem.hxx
@@ -32,7 +32,7 @@ class SvXMLUnitConverter;
     This item describes a Language.
 */
 
-class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem<LanguageType>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -49,7 +49,7 @@ public:
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create(SvStream &, sal_uInt16) const override;
     virtual SvStream&       Store(SvStream &, sal_uInt16 nItemVersion) const override;
-    virtual sal_uInt16          GetValueCount() const override;
+    virtual sal_uInt16      GetValueCount() const override;
 
     inline SvxLanguageItem& operator=(const SvxLanguageItem& rLang)
         {
@@ -57,9 +57,8 @@ public:
             return *this;
         }
 
-    // enum cast
     LanguageType            GetLanguage() const
-                                { return (LanguageType)GetValue(); }
+                                { return GetValue(); }
     virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
 };
diff --git a/include/editeng/postitem.hxx b/include/editeng/postitem.hxx
index 8a6a0c5..674f5ba 100644
--- a/include/editeng/postitem.hxx
+++ b/include/editeng/postitem.hxx
@@ -32,7 +32,7 @@ class SvXMLUnitConverter;
     This item describes the font setting (Italic)
 */
 
-class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxPostureItem : public SfxEnumItem<FontItalic>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -66,7 +66,7 @@ public:
 
     // enum cast
     FontItalic              GetPosture() const
-                                { return (FontItalic)GetValue(); }
+                                { return GetValue(); }
 
     void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
diff --git a/include/editeng/udlnitem.hxx b/include/editeng/udlnitem.hxx
index 900c212..6b7bb0f 100644
--- a/include/editeng/udlnitem.hxx
+++ b/include/editeng/udlnitem.hxx
@@ -30,7 +30,7 @@ class SvXMLUnitConverter;
 
 /* Value container for underline and overline font effects */
 
-class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxTextLineItem : public SfxEnumItem<FontLineStyle>
 {
     Color mColor;
 public:
@@ -70,9 +70,9 @@ public:
 
     // enum cast
     FontLineStyle           GetLineStyle() const
-                                { return (FontLineStyle)GetValue(); }
+                                { return GetValue(); }
     void                    SetLineStyle( FontLineStyle eNew )
-                                { SetValue((sal_uInt16) eNew); }
+                                { SetValue(eNew); }
 
     const Color&            GetColor() const                { return mColor; }
     void                    SetColor( const Color& rCol )   { mColor = rCol; }
diff --git a/include/editeng/wghtitem.hxx b/include/editeng/wghtitem.hxx
index 4ced552..eaa1169 100644
--- a/include/editeng/wghtitem.hxx
+++ b/include/editeng/wghtitem.hxx
@@ -32,7 +32,7 @@ class SvXMLUnitConverter;
     This item describes the font weight.
 */
 
-class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem
+class EDITENG_DLLPUBLIC SvxWeightItem : public SfxEnumItem<FontWeight>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -65,8 +65,7 @@ public:
         }
 
     // enum cast
-    FontWeight              GetWeight() const
-                                { return (FontWeight)GetValue(); }
+    FontWeight              GetWeight() const { return GetValue(); }
 
     void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx
index fb9125e..ee38084 100644
--- a/include/svl/aeitem.hxx
+++ b/include/svl/aeitem.hxx
@@ -26,7 +26,7 @@
 
 class SfxAllEnumValueArr;
 
-class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem
+class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem<sal_uInt16>
 {
     SfxAllEnumValueArr*      pValues;
     std::vector<sal_uInt16>* pDisabledValues;
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
index 16518a7..93c122b 100644
--- a/include/svl/eitem.hxx
+++ b/include/svl/eitem.hxx
@@ -22,15 +22,16 @@
 
 #include <svl/svldllapi.h>
 #include <svl/cenumitm.hxx>
+#include <tools/stream.hxx>
 
 
-class SVL_DLLPUBLIC SfxEnumItem
-    : public SfxEnumItemInterface
+template<typename EnumT>
+class SfxEnumItem : public SfxEnumItemInterface
 {
-    sal_uInt16 m_nValue;
+    EnumT m_nValue;
 
 protected:
-    explicit SfxEnumItem(sal_uInt16 const nWhich =0, sal_uInt16 const nValue =0)
+    explicit SfxEnumItem(sal_uInt16 const nWhich, EnumT const nValue)
         : SfxEnumItemInterface(nWhich)
         , m_nValue(nValue)
     { }
@@ -40,23 +41,54 @@ protected:
         , m_nValue(rItem.m_nValue)
     { }
 
-    SfxEnumItem(sal_uInt16 const nWhich, SvStream & rStream);
+    SfxEnumItem(sal_uInt16 const nWhich, SvStream & rStream)
+        : SfxEnumItemInterface(nWhich)
+    {
+        sal_uInt16 nTmp = 0;
+        rStream.ReadUInt16( nTmp );
+        m_nValue = static_cast<EnumT>(nTmp);
+    }
 
 public:
 
-    sal_uInt16 GetValue() const { return m_nValue; }
-
-    void SetValue(sal_uInt16 nTheValue);
-
-    // SfxPoolItem
-    virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override;
-
-    virtual sal_uInt16 GetEnumValue() const override;
-
-    virtual void SetEnumValue(sal_uInt16 nTheValue) override;
-
+    EnumT GetValue() const { return m_nValue; }
+
+    void SetValue(EnumT nTheValue)
+    {
+        assert(GetRefCount() == 0 && "SfxEnumItem::SetValue(): Pooled item");
+        m_nValue = nTheValue;
+    }
+
+    virtual SvStream & Store(SvStream & rStream, sal_uInt16) const override
+    {
+        rStream.WriteUInt16( static_cast<sal_uInt16>(m_nValue) );
+        return rStream;
+    }
+
+    virtual sal_uInt16 GetEnumValue() const override
+    {
+        return static_cast<sal_uInt16>(GetValue());
+    }
+
+    virtual void SetEnumValue(sal_uInt16 nTheValue) override
+    {
+        SetValue(static_cast<EnumT>(nTheValue));
+    }
+
+    virtual bool operator==(SfxPoolItem const & other) const override
+    {
+        return SfxEnumItemInterface::operator==(other) &&
+               m_nValue == static_cast<const SfxEnumItem<EnumT> &>(other).m_nValue;
+    }
 };
 
+// We need to have this one instantiated only once to prevent LNK2005 "already defined" on 32-bit MSVC.
+// But then we run into the problem that "extern" and SVL_DLLPUBLIC are mutually exclusive on templates for MSVC.
+#ifdef _WIN32
+extern template class SfxEnumItem<sal_uInt16>;
+#else
+extern template class SVL_DLLPUBLIC SfxEnumItem<sal_uInt16>;
+#endif
 
 class SVL_DLLPUBLIC SfxBoolItem
     : public SfxPoolItem
diff --git a/include/svx/algitem.hxx b/include/svx/algitem.hxx
index 4fc8229..98dc301 100644
--- a/include/svx/algitem.hxx
+++ b/include/svx/algitem.hxx
@@ -27,7 +27,7 @@
 
 class SvStream;
 
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxOrientationItem: public SfxEnumItem
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxOrientationItem: public SfxEnumItem<SvxCellOrientation>
 {
 public:
     static SfxPoolItem* CreateDefault();
diff --git a/include/svx/chrtitem.hxx b/include/svx/chrtitem.hxx
index 31c669a..a285fd6 100644
--- a/include/svx/chrtitem.hxx
+++ b/include/svx/chrtitem.hxx
@@ -71,7 +71,7 @@ enum class SvxChartRegress
 
 #define CHREGRESS_COUNT ((sal_uInt16)SvxChartRegress::Unknown + 1)
 
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartRegressItem : public SfxEnumItem
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartRegressItem : public SfxEnumItem<SvxChartRegress>
 {
 public:
     SvxChartRegressItem(SvxChartRegress eRegress /*= SvxChartRegress::Linear*/,
@@ -82,12 +82,10 @@ public:
     virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
 
     sal_uInt16 GetValueCount() const override { return CHREGRESS_COUNT; }
-    SvxChartRegress GetValue() const
-        { return (SvxChartRegress)SfxEnumItem::GetValue(); }
     sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override;
 };
 
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartTextOrderItem : public SfxEnumItem
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartTextOrderItem : public SfxEnumItem<SvxChartTextOrder>
 {
 public:
     SvxChartTextOrderItem(SvxChartTextOrder eOrder /*= SvxChartTextOrder::SideBySide*/,
@@ -102,23 +100,9 @@ public:
     virtual bool         PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
 
     sal_uInt16 GetValueCount() const override { return CHTXTORDER_COUNT; }
-    SvxChartTextOrder GetValue() const
-        { return (SvxChartTextOrder)SfxEnumItem::GetValue(); }
 };
 
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartTextOrientItem : public SfxEnumItem
-{
-public:
-    SvxChartTextOrientItem(SvStream& rIn,
-                           sal_uInt16 nId );
-
-    virtual SfxPoolItem* Clone(SfxItemPool* pPool = nullptr) const override;
-    virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
-
-    sal_uInt16 GetValueCount() const override { return CHTXTORDER_COUNT; }
-};
-
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartKindErrorItem : public SfxEnumItem
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartKindErrorItem : public SfxEnumItem<SvxChartKindError>
 {
 public:
     SvxChartKindErrorItem(SvxChartKindError /*eOrient = SvxChartKindError::NONE*/,
@@ -130,13 +114,11 @@ public:
     virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
 
     sal_uInt16 GetValueCount() const override { return CHERROR_COUNT; }
-    SvxChartKindError GetValue() const
-        { return (SvxChartKindError)SfxEnumItem::GetValue(); }
 
     sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override;
 };
 
-class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartIndicateItem : public SfxEnumItem
+class SAL_WARN_UNUSED SVX_DLLPUBLIC SvxChartIndicateItem : public SfxEnumItem<SvxChartIndicate>
 {
 public:
     SvxChartIndicateItem(SvxChartIndicate eOrient /*= SvxChartIndicate::NONE*/,
@@ -148,8 +130,6 @@ public:
     virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
 
     sal_uInt16 GetValueCount() const override { return CHINDICATE_COUNT; }
-    SvxChartIndicate GetValue() const
-        { return (SvxChartIndicate)SfxEnumItem::GetValue(); }
 
     sal_uInt16 GetVersion (sal_uInt16 nFileFormatVersion) const override;
 };
diff --git a/include/svx/rotmodit.hxx b/include/svx/rotmodit.hxx
index f044200..fa2b04a 100644
--- a/include/svx/rotmodit.hxx
+++ b/include/svx/rotmodit.hxx
@@ -34,7 +34,7 @@ enum SvxRotateMode
     SVX_ROTATE_MODE_BOTTOM
 };
 
-class SVX_DLLPUBLIC SvxRotateModeItem: public SfxEnumItem
+class SVX_DLLPUBLIC SvxRotateModeItem: public SfxEnumItem<SvxRotateMode>
 {
 public:
                 static SfxPoolItem* CreateDefault();
diff --git a/include/svx/sdgmoitm.hxx b/include/svx/sdgmoitm.hxx
index 411266a..3d38fb1 100644
--- a/include/svx/sdgmoitm.hxx
+++ b/include/svx/sdgmoitm.hxx
@@ -29,20 +29,17 @@
 // SdrGrafModeItem -
 
 
-class SVX_DLLPUBLIC SdrGrafModeItem : public SfxEnumItem
+class SVX_DLLPUBLIC SdrGrafModeItem : public SfxEnumItem<GraphicDrawMode>
 {
 public:
-
-
-                            SdrGrafModeItem( GraphicDrawMode eMode = GRAPHICDRAWMODE_STANDARD ) : SfxEnumItem( SDRATTR_GRAFMODE, (sal_uInt16)eMode ) {}
+                            SdrGrafModeItem( GraphicDrawMode eMode = GRAPHICDRAWMODE_STANDARD ) : SfxEnumItem( SDRATTR_GRAFMODE, eMode ) {}
                             SdrGrafModeItem( SvStream& rIn ) : SfxEnumItem( SDRATTR_GRAFMODE, rIn ) {}
 
     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create( SvStream& rIn, sal_uInt16 nVer ) const override;
-    virtual sal_uInt16          GetValueCount() const override;
-    GraphicDrawMode         GetValue() const { return (GraphicDrawMode) SfxEnumItem::GetValue(); }
+    virtual sal_uInt16      GetValueCount() const override;
 
-    virtual OUString   GetValueTextByPos( sal_uInt16 nPos ) const override;
+    virtual OUString        GetValueTextByPos( sal_uInt16 nPos ) const override;
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                   MapUnit eCoreMetric,
                                   MapUnit ePresMetric,
diff --git a/include/svx/sdtaditm.hxx b/include/svx/sdtaditm.hxx
index 2481aa7..84d0736 100644
--- a/include/svx/sdtaditm.hxx
+++ b/include/svx/sdtaditm.hxx
@@ -32,14 +32,13 @@ enum class SdrTextAniDirection
     Left, Right, Up, Down
 };
 
-class SVX_DLLPUBLIC SdrTextAniDirectionItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrTextAniDirectionItem: public SfxEnumItem<SdrTextAniDirection> {
 public:
-    SdrTextAniDirectionItem(SdrTextAniDirection eDir=SdrTextAniDirection::Left): SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,(sal_uInt16)eDir) {}
+    SdrTextAniDirectionItem(SdrTextAniDirection eDir=SdrTextAniDirection::Left): SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION, eDir) {}
     SdrTextAniDirectionItem(SvStream& rIn)                           : SfxEnumItem(SDRATTR_TEXT_ANIDIRECTION,rIn)  {}
     virtual SfxPoolItem*   Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*   Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16         GetValueCount() const override;
-    SdrTextAniDirection GetValue() const      { return (SdrTextAniDirection)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16     GetValueCount() const override;
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/sdtaitm.hxx b/include/svx/sdtaitm.hxx
index 9c59352..7cc9fb8 100644
--- a/include/svx/sdtaitm.hxx
+++ b/include/svx/sdtaitm.hxx
@@ -33,15 +33,14 @@ enum SdrTextVertAdjust {SDRTEXTVERTADJUST_TOP,      // aligned to top (normally
                         SDRTEXTVERTADJUST_BLOCK    // support vertical full with supported now
                         /*,SDRTEXTVERTADJUST_STRETCH*/}; // also stretch letters in their height (ni)
 
-class SVX_DLLPUBLIC SdrTextVertAdjustItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrTextVertAdjustItem: public SfxEnumItem<SdrTextVertAdjust> {
 public:
-    SdrTextVertAdjustItem(SdrTextVertAdjust eAdj=SDRTEXTVERTADJUST_TOP): SfxEnumItem(SDRATTR_TEXT_VERTADJUST,(sal_uInt16)eAdj) {}
-    SdrTextVertAdjustItem(SdrTextVertAdjust eAdj, sal_uInt16 nWhich): SfxEnumItem(nWhich,(sal_uInt16)eAdj) {}
+    SdrTextVertAdjustItem(SdrTextVertAdjust eAdj=SDRTEXTVERTADJUST_TOP): SfxEnumItem(SDRATTR_TEXT_VERTADJUST, eAdj) {}
+    SdrTextVertAdjustItem(SdrTextVertAdjust eAdj, sal_uInt16 nWhich): SfxEnumItem(nWhich, eAdj) {}
     SdrTextVertAdjustItem(SvStream& rIn)                               : SfxEnumItem(SDRATTR_TEXT_VERTADJUST,rIn)  {}
     virtual SfxPoolItem*      Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*      Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16            GetValueCount() const override; // { return 5; }
-            SdrTextVertAdjust GetValue() const      { return (SdrTextVertAdjust)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16        GetValueCount() const override; // { return 5; }
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
@@ -61,14 +60,13 @@ enum SdrTextHorzAdjust {SDRTEXTHORZADJUST_LEFT,     // left adjusted
                         SDRTEXTHORZADJUST_BLOCK    // use the whole text frame width
                         /*,SDRTEXTHORZADJUST_STRETCH*/}; // FitToSize in X direction (ni).
 
-class SVX_DLLPUBLIC SdrTextHorzAdjustItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrTextHorzAdjustItem: public SfxEnumItem<SdrTextHorzAdjust> {
 public:
-    SdrTextHorzAdjustItem(SdrTextHorzAdjust eAdj=SDRTEXTHORZADJUST_BLOCK): SfxEnumItem(SDRATTR_TEXT_HORZADJUST,(sal_uInt16)eAdj) {}
-    SdrTextHorzAdjustItem(SvStream& rIn)                                 : SfxEnumItem(SDRATTR_TEXT_HORZADJUST,rIn)  {}
+    SdrTextHorzAdjustItem(SdrTextHorzAdjust eAdj=SDRTEXTHORZADJUST_BLOCK): SfxEnumItem(SDRATTR_TEXT_HORZADJUST, eAdj) {}
+    SdrTextHorzAdjustItem(SvStream& rIn)                                 : SfxEnumItem(SDRATTR_TEXT_HORZADJUST, rIn)  {}
     virtual SfxPoolItem*      Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*      Create(SvStream& rIn, sal_uInt16 nVer) const override;
     virtual sal_uInt16        GetValueCount() const override;
-            SdrTextHorzAdjust GetValue() const      { return (SdrTextHorzAdjust)SfxEnumItem::GetValue(); }
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/sdtakitm.hxx b/include/svx/sdtakitm.hxx
index 2960559..9cac471 100644
--- a/include/svx/sdtakitm.hxx
+++ b/include/svx/sdtakitm.hxx
@@ -76,14 +76,13 @@ enum SdrTextAniKind {
 //   of the text depends on the anchor of the drawing object.  This
 //   corresponds to the position of the text in normal Paint (without scrolling).
 
-class SVX_DLLPUBLIC SdrTextAniKindItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrTextAniKindItem: public SfxEnumItem<SdrTextAniKind> {
 public:
-    SdrTextAniKindItem(SdrTextAniKind eKind=SDRTEXTANI_NONE): SfxEnumItem(SDRATTR_TEXT_ANIKIND,(sal_uInt16)eKind) {}
-    SdrTextAniKindItem(SvStream& rIn)                       : SfxEnumItem(SDRATTR_TEXT_ANIKIND,rIn)  {}
+    SdrTextAniKindItem(SdrTextAniKind eKind=SDRTEXTANI_NONE): SfxEnumItem(SDRATTR_TEXT_ANIKIND, eKind) {}
+    SdrTextAniKindItem(SvStream& rIn)                       : SfxEnumItem(SDRATTR_TEXT_ANIKIND, rIn)  {}
     virtual SfxPoolItem*      Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*      Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16            GetValueCount() const override; // { return 5; }
-            SdrTextAniKind GetValue() const      { return (SdrTextAniKind)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16        GetValueCount() const override; // { return 5; }
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/sdtfsitm.hxx b/include/svx/sdtfsitm.hxx
index 406bd2b..ed024c8 100644
--- a/include/svx/sdtfsitm.hxx
+++ b/include/svx/sdtfsitm.hxx
@@ -42,17 +42,14 @@ enum class SdrFitToSizeType
 // TextMaxFrameWidth is reached).
 
 
-// class SdrTextFitToSizeTypeItem
-
-class SVX_DLLPUBLIC SdrTextFitToSizeTypeItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrTextFitToSizeTypeItem: public SfxEnumItem<SdrFitToSizeType> {
 public:
     static SfxPoolItem* CreateDefault();
-    SdrTextFitToSizeTypeItem(SdrFitToSizeType eFit=SdrFitToSizeType::NONE): SfxEnumItem(SDRATTR_TEXT_FITTOSIZE,(sal_uInt16)eFit) {}
-    SdrTextFitToSizeTypeItem(SvStream& rIn)                        : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE,rIn)  {}
+    SdrTextFitToSizeTypeItem(SdrFitToSizeType eFit=SdrFitToSizeType::NONE): SfxEnumItem(SDRATTR_TEXT_FITTOSIZE, eFit) {}
+    SdrTextFitToSizeTypeItem(SvStream& rIn)                        : SfxEnumItem(SDRATTR_TEXT_FITTOSIZE, rIn)  {}
     virtual SfxPoolItem*     Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*     Create(SvStream& rIn, sal_uInt16 nVer) const override;
     virtual sal_uInt16       GetValueCount() const override;
-            SdrFitToSizeType GetValue() const      { return (SdrFitToSizeType)SfxEnumItem::GetValue(); }
 
     virtual bool             QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool             PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/sxcecitm.hxx b/include/svx/sxcecitm.hxx
index 4d8acea..eb4f4a8 100644
--- a/include/svx/sxcecitm.hxx
+++ b/include/svx/sxcecitm.hxx
@@ -30,14 +30,13 @@ enum class SdrCaptionEscDir { Horizontal, Vertical, BestFit };
 
 // class SdrCaptionEscDirItem
 
-class SVX_DLLPUBLIC SdrCaptionEscDirItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrCaptionEscDirItem: public SfxEnumItem<SdrCaptionEscDir> {
 public:
-    SdrCaptionEscDirItem(SdrCaptionEscDir eDir=SdrCaptionEscDir::Horizontal): SfxEnumItem(SDRATTR_CAPTIONESCDIR,sal::static_int_cast< sal_uInt16 >(eDir)) {}
+    SdrCaptionEscDirItem(SdrCaptionEscDir eDir=SdrCaptionEscDir::Horizontal): SfxEnumItem(SDRATTR_CAPTIONESCDIR, eDir) {}
     SdrCaptionEscDirItem(SvStream& rIn)                              : SfxEnumItem(SDRATTR_CAPTIONESCDIR,rIn)  {}
     virtual SfxPoolItem*     Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*     Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16           GetValueCount() const override; // { return 3; }
-    SdrCaptionEscDir GetValue() const      { return (SdrCaptionEscDir)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16       GetValueCount() const override; // { return 3; }
 
     virtual OUString GetValueTextByPos(sal_uInt16 nPos) const override;
 
diff --git a/include/svx/sxctitm.hxx b/include/svx/sxctitm.hxx
index b255b95..d75e80b 100644
--- a/include/svx/sxctitm.hxx
+++ b/include/svx/sxctitm.hxx
@@ -28,15 +28,14 @@ enum class SdrCaptionType { Type1, Type2, Type3, Type4 };
 
 // class SdrCaptionTypeItem
 
-class SVX_DLLPUBLIC SdrCaptionTypeItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrCaptionTypeItem: public SfxEnumItem<SdrCaptionType> {
 public:
-    SdrCaptionTypeItem(SdrCaptionType eStyle=SdrCaptionType::Type3): SfxEnumItem(SDRATTR_CAPTIONTYPE,sal::static_int_cast< sal_uInt16 >(eStyle)) {}
+    SdrCaptionTypeItem(SdrCaptionType eStyle=SdrCaptionType::Type3): SfxEnumItem(SDRATTR_CAPTIONTYPE, eStyle) {}
     SdrCaptionTypeItem(SvStream& rIn)                      : SfxEnumItem(SDRATTR_CAPTIONTYPE,rIn)    {}
     virtual SfxPoolItem*    Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*    Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16          GetValueCount() const override; // { return 4; }
-            SdrCaptionType  GetValue() const      { return (SdrCaptionType)SfxEnumItem::GetValue(); }
-    virtual OUString GetValueTextByPos(sal_uInt16 nPos) const override;
+    virtual sal_uInt16      GetValueCount() const override; // { return 4; }
+    virtual OUString        GetValueTextByPos(sal_uInt16 nPos) const override;
     virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper * = nullptr) const override;
 };
 
diff --git a/include/svx/sxekitm.hxx b/include/svx/sxekitm.hxx
index 1fce19d..67a11d3 100644
--- a/include/svx/sxekitm.hxx
+++ b/include/svx/sxekitm.hxx
@@ -31,17 +31,16 @@ enum class SdrEdgeKind
 
 // class SdrEdgeKindItem
 
-class SVX_DLLPUBLIC SdrEdgeKindItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrEdgeKindItem: public SfxEnumItem<SdrEdgeKind> {
 public:
-    SdrEdgeKindItem(SdrEdgeKind eStyle=SdrEdgeKind::OrthoLines): SfxEnumItem(SDRATTR_EDGEKIND,sal::static_int_cast< sal_uInt16 >(eStyle)) {}
+    SdrEdgeKindItem(SdrEdgeKind eStyle=SdrEdgeKind::OrthoLines): SfxEnumItem(SDRATTR_EDGEKIND, eStyle) {}
     SdrEdgeKindItem(SvStream& rIn)                        : SfxEnumItem(SDRATTR_EDGEKIND,rIn)    {}
     virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16       GetValueCount() const override; // { return 5; }
-            SdrEdgeKind  GetValue() const      { return (SdrEdgeKind)SfxEnumItem::GetValue(); }
-    virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
-    virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
-    virtual OUString GetValueTextByPos(sal_uInt16 nPos) const override;
+    virtual sal_uInt16   GetValueCount() const override; // { return 5; }
+    virtual bool         QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+    virtual bool         PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+    virtual OUString     GetValueTextByPos(sal_uInt16 nPos) const override;
     virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper * = nullptr) const override;
 };
 
diff --git a/include/svx/sxmtpitm.hxx b/include/svx/sxmtpitm.hxx
index fc9abf8..a3692fb 100644
--- a/include/svx/sxmtpitm.hxx
+++ b/include/svx/sxmtpitm.hxx
@@ -26,10 +26,10 @@
 #include <com/sun/star/drawing/MeasureTextVertPos.hpp>
 
 // class SdrMeasureTextHPosItem
-class SVX_DLLPUBLIC SdrMeasureTextHPosItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrMeasureTextHPosItem: public SfxEnumItem<css::drawing::MeasureTextHorzPos> {
 public:
     SdrMeasureTextHPosItem(css::drawing::MeasureTextHorzPos ePos = css::drawing::MeasureTextHorzPos::MeasureTextHorzPos_AUTO)
-        : SfxEnumItem(SDRATTR_MEASURETEXTHPOS, sal::static_int_cast<sal_uInt16>(ePos))
+        : SfxEnumItem(SDRATTR_MEASURETEXTHPOS, ePos)
     {
     }
     SdrMeasureTextHPosItem(SvStream& rIn)
@@ -38,8 +38,7 @@ public:
     }
     virtual SfxPoolItem*   Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*   Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16         GetValueCount() const override; // { return 4; }
-    css::drawing::MeasureTextHorzPos GetValue() const { return (css::drawing::MeasureTextHorzPos)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16     GetValueCount() const override; // { return 4; }
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
@@ -49,10 +48,10 @@ public:
 };
 
 // class SdrMeasureTextVPosItem
-class SVX_DLLPUBLIC SdrMeasureTextVPosItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrMeasureTextVPosItem: public SfxEnumItem<css::drawing::MeasureTextVertPos> {
 public:
     SdrMeasureTextVPosItem(css::drawing::MeasureTextVertPos ePos = css::drawing::MeasureTextVertPos_AUTO)
-        : SfxEnumItem(SDRATTR_MEASURETEXTVPOS, sal::static_int_cast<sal_uInt16>(ePos))
+        : SfxEnumItem(SDRATTR_MEASURETEXTVPOS, ePos)
     {
     }
     SdrMeasureTextVPosItem(SvStream& rIn)
@@ -61,8 +60,7 @@ public:
     }
     virtual SfxPoolItem*   Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*   Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16         GetValueCount() const override; // { return 5; }
-    css::drawing::MeasureTextVertPos GetValue() const { return (css::drawing::MeasureTextVertPos)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16     GetValueCount() const override; // { return 5; }
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/sxmuitm.hxx b/include/svx/sxmuitm.hxx
index 47102dc..46052c3 100644
--- a/include/svx/sxmuitm.hxx
+++ b/include/svx/sxmuitm.hxx
@@ -26,17 +26,16 @@
 
 // specification of the unit if measurement. The numerical quantity value is converted in this unity.
 // (based on the facts of the MapUnit of the model). This unity is displayed if necessary.
-class SVX_DLLPUBLIC SdrMeasureUnitItem: public SfxEnumItem {
+class SVX_DLLPUBLIC SdrMeasureUnitItem: public SfxEnumItem<FieldUnit> {
 public:
-    SdrMeasureUnitItem(FieldUnit eUnit=FUNIT_NONE): SfxEnumItem(SDRATTR_MEASUREUNIT,sal::static_int_cast< sal_uInt16 >(eUnit)) {}
+    SdrMeasureUnitItem(FieldUnit eUnit=FUNIT_NONE): SfxEnumItem(SDRATTR_MEASUREUNIT, eUnit) {}
     SdrMeasureUnitItem(SvStream& rIn)             : SfxEnumItem(SDRATTR_MEASUREUNIT,rIn)   {}
     virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16       GetValueCount() const override; // { return 14; }
-            FieldUnit    GetValue() const { return (FieldUnit)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16   GetValueCount() const override; // { return 14; }
 
-    virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
-    virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
+    virtual bool         QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
+    virtual bool         PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
 
     virtual OUString GetValueTextByPos(sal_uInt16 nPos) const override;
     virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper * = nullptr) const override;
diff --git a/include/svx/xfillit0.hxx b/include/svx/xfillit0.hxx
index 54495aa..53c946a 100644
--- a/include/svx/xfillit0.hxx
+++ b/include/svx/xfillit0.hxx
@@ -31,7 +31,7 @@
 // class XFillStyleItem
 
 
-class SVX_DLLPUBLIC XFillStyleItem : public SfxEnumItem
+class SVX_DLLPUBLIC XFillStyleItem : public SfxEnumItem<css::drawing::FillStyle>
 {
 public:
                             static SfxPoolItem* CreateDefault();
@@ -50,7 +50,6 @@ public:
                                   MapUnit ePresMetric,
                                   OUString &rText, const IntlWrapper * = nullptr ) const override;
     virtual sal_uInt16          GetValueCount() const override;
-    css::drawing::FillStyle GetValue() const { return (css::drawing::FillStyle) SfxEnumItem::GetValue(); }
 
     void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
diff --git a/include/svx/xflbmpit.hxx b/include/svx/xflbmpit.hxx
index df73cb4..7be034b7 100644
--- a/include/svx/xflbmpit.hxx
+++ b/include/svx/xflbmpit.hxx
@@ -24,7 +24,7 @@
 #include <svx/rectenum.hxx>
 #include <svx/svxdllapi.h>
 
-class SVX_DLLPUBLIC XFillBmpPosItem : public SfxEnumItem
+class SVX_DLLPUBLIC XFillBmpPosItem : public SfxEnumItem<RectPoint>
 {
 public:
                             static SfxPoolItem* CreateDefault();
@@ -39,8 +39,7 @@ public:
                                                  MapUnit ePresMetric,
                                                  OUString &rText, const IntlWrapper * = nullptr ) const override;
 
-    SVX_DLLPRIVATE virtual sal_uInt16           GetValueCount() const override;
-    SVX_DLLPRIVATE RectPoint               GetValue() const { return (RectPoint) SfxEnumItem::GetValue(); }
+    SVX_DLLPRIVATE virtual sal_uInt16      GetValueCount() const override;
     void dumpAsXml(struct _xmlTextWriter* pWriter) const override;
 };
 
diff --git a/include/svx/xftadit.hxx b/include/svx/xftadit.hxx
index 4346eb6..c7a418e 100644
--- a/include/svx/xftadit.hxx
+++ b/include/svx/xftadit.hxx
@@ -29,7 +29,7 @@
 |*
 \************************************************************************/
 
-class SVX_DLLPUBLIC XFormTextAdjustItem : public SfxEnumItem
+class SVX_DLLPUBLIC XFormTextAdjustItem : public SfxEnumItem<XFormTextAdjust>
 {
 public:
                             static SfxPoolItem* CreateDefault();
@@ -38,8 +38,7 @@ public:
                             XFormTextAdjustItem(SvStream& rIn);
     virtual SfxPoolItem*    Clone(SfxItemPool* pPool = nullptr) const override;
     virtual SfxPoolItem*    Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16          GetValueCount() const override;
-    XFormTextAdjust         GetValue() const { return (XFormTextAdjust) SfxEnumItem::GetValue(); }
+    virtual sal_uInt16      GetValueCount() const override;
     // #FontWork#
     virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/xftshit.hxx b/include/svx/xftshit.hxx
index 384bc30..7f85186 100644
--- a/include/svx/xftshit.hxx
+++ b/include/svx/xftshit.hxx
@@ -30,7 +30,7 @@
 |*
 \************************************************************************/
 
-class SVX_DLLPUBLIC XFormTextShadowItem : public SfxEnumItem
+class SVX_DLLPUBLIC XFormTextShadowItem : public SfxEnumItem<XFormTextShadow>
 {
 public:
                             static SfxPoolItem* CreateDefault();
@@ -39,8 +39,7 @@ public:
                             XFormTextShadowItem(SvStream& rIn);
     virtual SfxPoolItem*    Clone(SfxItemPool* pPool = nullptr) const override;
     virtual SfxPoolItem*    Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16          GetValueCount() const override;
-    XFormTextShadow         GetValue() const { return (XFormTextShadow) SfxEnumItem::GetValue(); }
+    virtual sal_uInt16      GetValueCount() const override;
     // #FontWork#
     virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/include/svx/xlineit0.hxx b/include/svx/xlineit0.hxx
index ca0148a..6f6e2044 100644
--- a/include/svx/xlineit0.hxx
+++ b/include/svx/xlineit0.hxx
@@ -28,7 +28,7 @@
 #include <svx/svxdllapi.h>
 #include <com/sun/star/drawing/LineStyle.hpp>
 
-class SVX_DLLPUBLIC XLineStyleItem : public SfxEnumItem
+class SVX_DLLPUBLIC XLineStyleItem : public SfxEnumItem<css::drawing::LineStyle>
 {
 public:
                             static SfxPoolItem* CreateDefault();
@@ -45,7 +45,6 @@ public:
                                   MapUnit ePresMetric,
                                   OUString &rText, const IntlWrapper * = nullptr ) const override;
     virtual sal_uInt16          GetValueCount() const override;
-    css::drawing::LineStyle     GetValue() const { return (css::drawing::LineStyle) SfxEnumItem::GetValue(); }
 };
 
 #endif
diff --git a/include/svx/xlinjoit.hxx b/include/svx/xlinjoit.hxx
index 131c977..b9ac6f7 100644
--- a/include/svx/xlinjoit.hxx
+++ b/include/svx/xlinjoit.hxx
@@ -29,14 +29,14 @@
 // class XLineJointItem
 
 
-class SVX_DLLPUBLIC XLineJointItem : public SfxEnumItem
+class SVX_DLLPUBLIC XLineJointItem : public SfxEnumItem<css::drawing::LineJoint>
 {
 public:
                             static SfxPoolItem* CreateDefault();
                             XLineJointItem( css::drawing::LineJoint eLineJoint = css::drawing::LineJoint_ROUND );
                             XLineJointItem( SvStream& rIn );
 
-    virtual sal_uInt16           GetVersion( sal_uInt16 nFileFormatVersion ) const override;
+    virtual sal_uInt16      GetVersion( sal_uInt16 nFileFormatVersion ) const override;
     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create( SvStream& rIn, sal_uInt16 nVer ) const override;
 
@@ -46,8 +46,7 @@ public:
                                   MapUnit eCoreMetric, MapUnit ePresMetric,
                                   OUString &rText, const IntlWrapper * = nullptr ) const override;
 
-    virtual sal_uInt16                 GetValueCount() const override;
-    css::drawing::LineJoint GetValue() const { return (css::drawing::LineJoint) SfxEnumItem::GetValue(); }
+    virtual sal_uInt16       GetValueCount() const override;
 };
 
 #endif // INCLUDED_SVX_XLINJOIT_HXX
diff --git a/include/svx/xlncapit.hxx b/include/svx/xlncapit.hxx
index 80bf211..d42224c 100644
--- a/include/svx/xlncapit.hxx
+++ b/include/svx/xlncapit.hxx
@@ -29,7 +29,7 @@
 // class XLineCapItem
 
 
-class SVX_DLLPUBLIC XLineCapItem : public SfxEnumItem
+class SVX_DLLPUBLIC XLineCapItem : public SfxEnumItem<css::drawing::LineCap>
 {
 public:
     static SfxPoolItem* CreateDefault();
@@ -46,8 +46,8 @@ public:
                                   MapUnit eCoreMetric, MapUnit ePresMetric,
                                   OUString &rText, const IntlWrapper * = nullptr ) const override;
 
-    virtual sal_uInt16          GetValueCount() const override;
-    css::drawing::LineCap GetValue() const;
+    css::drawing::LineCap   GetValue() const;
+    virtual sal_uInt16      GetValueCount() const override;
 };
 
 #endif // INCLUDED_SVX_XLNCAPIT_HXX
diff --git a/include/svx/xtextit0.hxx b/include/svx/xtextit0.hxx
index 5cdc377..8e4f570 100644
--- a/include/svx/xtextit0.hxx
+++ b/include/svx/xtextit0.hxx
@@ -30,7 +30,7 @@
 |*
 \************************************************************************/
 
-class SVX_DLLPUBLIC XFormTextStyleItem : public SfxEnumItem
+class SVX_DLLPUBLIC XFormTextStyleItem : public SfxEnumItem<XFormTextStyle>
 {
 public:
                             static SfxPoolItem* CreateDefault();
@@ -38,8 +38,7 @@ public:
                             XFormTextStyleItem(SvStream& rIn);
     virtual SfxPoolItem*    Clone(SfxItemPool* pPool = nullptr) const override;
     virtual SfxPoolItem*    Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16          GetValueCount() const override;
-    XFormTextStyle          GetValue() const { return (XFormTextStyle) SfxEnumItem::GetValue(); }
+    virtual sal_uInt16      GetValueCount() const override;
     // #FontWork#
     virtual bool            QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool            PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx
index 475f7e6..f01a962 100644
--- a/reportdesign/source/ui/misc/UITools.cxx
+++ b/reportdesign/source/ui/misc/UITools.cxx
@@ -531,7 +531,7 @@ namespace
         if ( SfxItemState::SET == _rItemSet.GetItemState( ITEMID_CASEMAP,true,&pItem) && dynamic_cast< const SvxCaseMapItem *>( pItem ) !=  nullptr)
         {
             const SvxCaseMapItem* pFontItem = static_cast<const SvxCaseMapItem*>(pItem);
-            lcl_pushBack( _out_rProperties, PROPERTY_CHARCASEMAP, uno::makeAny( pFontItem->GetValue() ) );
+            lcl_pushBack( _out_rProperties, PROPERTY_CHARCASEMAP, uno::makeAny( pFontItem->GetEnumValue() ) );
         }
         struct Items {
                 sal_uInt16 nWhich;
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index 83235ac..5897942 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -260,7 +260,7 @@ public:
 
 // page format item: contents of header and footer
 
-class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem
+class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem<ScVObjMode>
 {
 public:
                 static SfxPoolItem* CreateDefault();
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index ff9717d..a7ce8ee 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -3029,14 +3029,14 @@ void ScFiltersTest::testOrcusODSStyleInterface()
         pStyleSheet->GetItemSet().HasItem(ATTR_HOR_JUSTIFY, &pItem));
 
     const SvxHorJustifyItem* pHorJustify = static_cast<const SvxHorJustifyItem*>(pItem);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Style Name10 :Error with hor justify", static_cast<sal_uInt16>(SVX_HOR_JUSTIFY_RIGHT), pHorJustify->GetValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Style Name10 :Error with hor justify", SVX_HOR_JUSTIFY_RIGHT, pHorJustify->GetValue());
 
     pStyleSheet = pStyleSheetPool->FindCaseIns("Name10", SfxStyleFamily::Para);
     CPPUNIT_ASSERT_MESSAGE("Style Name10 : Doesn't have Attribute ver justify, but it should have.",
         pStyleSheet->GetItemSet().HasItem(ATTR_VER_JUSTIFY, &pItem));
 
     const SvxVerJustifyItem* pVerJustify = static_cast<const SvxVerJustifyItem*>(pItem);
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Style Name10 :Error with ver justify", static_cast<sal_uInt16>(SVX_VER_JUSTIFY_CENTER), pVerJustify->GetValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Style Name10 :Error with ver justify", SVX_VER_JUSTIFY_CENTER, pVerJustify->GetValue());
 
 }
 
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index 3c74048..daa114d 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -818,7 +818,7 @@ ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP )
 }
 
 ScViewObjectModeItem::ScViewObjectModeItem( sal_uInt16 nWhichP, ScVObjMode eMode )
-    : SfxEnumItem( nWhichP, sal::static_int_cast<sal_uInt16>(eMode) )
+    : SfxEnumItem( nWhichP, eMode )
 {
 }
 
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index 1bb6619..ab7dd9d 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -1543,16 +1543,16 @@ bool XclExpCellAlign::FillFromItemSet(
         // Adjust for distributed alignments.
         if (eHorAlign == SVX_HOR_JUSTIFY_BLOCK)
         {
-            SvxCellJustifyMethod eHorJustMethod = GETITEMVALUE(
-                rItemSet, SvxJustifyMethodItem, ATTR_HOR_JUSTIFY_METHOD, SvxCellJustifyMethod);
+            SvxCellJustifyMethod eHorJustMethod =
+                rItemSet.GetItem<SvxJustifyMethodItem>(ATTR_HOR_JUSTIFY_METHOD)->GetValue();
             if (eHorJustMethod == SvxCellJustifyMethod::Distribute)
                 mnHorAlign = EXC_XF_HOR_DISTRIB;
         }
 
         if (eVerAlign == SVX_VER_JUSTIFY_BLOCK)
         {
-            SvxCellJustifyMethod eVerJustMethod = GETITEMVALUE(
-                rItemSet, SvxJustifyMethodItem, ATTR_VER_JUSTIFY_METHOD, SvxCellJustifyMethod);
+            SvxCellJustifyMethod eVerJustMethod =
+                rItemSet.GetItem<SvxJustifyMethodItem>(ATTR_VER_JUSTIFY_METHOD)->GetValue();
             if (eVerJustMethod == SvxCellJustifyMethod::Distribute)
                 mnVerAlign = EXC_XF_VER_DISTRIB;
         }
diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx
index 9851f08..062a58a 100644
--- a/sc/source/ui/drawfunc/drawsh5.cxx
+++ b/sc/source/ui/drawfunc/drawsh5.cxx
@@ -248,7 +248,7 @@ void ScDrawShell::ExecDrawFunc( SfxRequest& rReq )
     // wer weiss, wie lange das funktioniert? (->vom Abreisscontrol funktioniert es)
 
     if (nSlotId == SID_OBJECT_ALIGN && pArgs)
-        nSlotId = SID_OBJECT_ALIGN + static_cast<const SfxEnumItem&>(pArgs->Get(SID_OBJECT_ALIGN)).GetValue() + 1;
+        nSlotId = SID_OBJECT_ALIGN + static_cast<const SfxEnumItemInterface&>(pArgs->Get(SID_OBJECT_ALIGN)).GetEnumValue() + 1;
 
     switch (nSlotId)
     {
diff --git a/sd/inc/sdattr.hxx b/sd/inc/sdattr.hxx
index b91d857..da66190 100644
--- a/sd/inc/sdattr.hxx
+++ b/sd/inc/sdattr.hxx
@@ -67,34 +67,34 @@ inline SfxBoolItem makeSdAttrLayerThisPage()
     return SfxBoolItem( ATTR_LAYER_THISPAGE, false );
 }
 
-class DiaEffectItem : public SfxEnumItem
+class DiaEffectItem : public SfxEnumItem<sal_uInt16>
 {
 public:
             DiaEffectItem( SvStream& rIn );
 
     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create( SvStream& rIn, sal_uInt16 nVer ) const override;
-            sal_uInt16          GetValueCount() const override { return FADE_EFFECT_COUNT; }
+            sal_uInt16      GetValueCount() const override { return FADE_EFFECT_COUNT; }
 };
 
-class DiaSpeedItem : public SfxEnumItem
+class DiaSpeedItem : public SfxEnumItem<sal_uInt16>
 {
 public:
             DiaSpeedItem( SvStream& rIn );
 
     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create( SvStream& rIn, sal_uInt16 nVer ) const override;
-            sal_uInt16          GetValueCount() const override { return FADE_SPEED_COUNT; }
+            sal_uInt16      GetValueCount() const override { return FADE_SPEED_COUNT; }
 };
 
-class DiaAutoItem : public SfxEnumItem
+class DiaAutoItem : public SfxEnumItem<PresChange>
 {
 public:
             DiaAutoItem( SvStream& rIn );
 
     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
     virtual SfxPoolItem*    Create( SvStream& rIn, sal_uInt16 nVer ) const override;
-            sal_uInt16          GetValueCount() const override { return PRESCHANGE_COUNT; }
+            sal_uInt16      GetValueCount() const override { return PRESCHANGE_COUNT; }
 };
 
 #endif // INCLUDED_SD_INC_SDATTR_HXX
diff --git a/svl/source/items/aeitem.cxx b/svl/source/items/aeitem.cxx
index 7f17698..00c6149 100644
--- a/svl/source/items/aeitem.cxx
+++ b/svl/source/items/aeitem.cxx
@@ -35,7 +35,7 @@ class SfxAllEnumValueArr : public std::vector<SfxAllEnumValue_Impl> {};
 
 
 SfxAllEnumItem::SfxAllEnumItem() :
-    SfxEnumItem(),
+    SfxEnumItem<sal_uInt16>(0, 0),
     pValues( nullptr ),
     pDisabledValues( nullptr )
 {
diff --git a/svl/source/items/cenumitm.cxx b/svl/source/items/cenumitm.cxx
index 55d3fbe..8e91217 100644
--- a/svl/source/items/cenumitm.cxx
+++ b/svl/source/items/cenumitm.cxx
@@ -101,38 +101,8 @@ bool SfxEnumItemInterface::GetBoolValue() const
 void SfxEnumItemInterface::SetBoolValue(bool)
 {}
 
-SfxEnumItem::SfxEnumItem(sal_uInt16 const nWhich, SvStream & rStream)
-    : SfxEnumItemInterface(nWhich)
-{
-    m_nValue = 0;
-    rStream.ReadUInt16( m_nValue );
-}
-
-
-// virtual
-SvStream & SfxEnumItem::Store(SvStream & rStream, sal_uInt16) const
-{
-    rStream.WriteUInt16( m_nValue );
-    return rStream;
-}
-
-// virtual
-sal_uInt16 SfxEnumItem::GetEnumValue() const
-{
-    return GetValue();
-}
 
-// virtual
-void SfxEnumItem::SetEnumValue(sal_uInt16 const nTheValue)
-{
-    SetValue(nTheValue);
-}
-
-void SfxEnumItem::SetValue(sal_uInt16 const nTheValue)
-{
-    assert(GetRefCount() == 0 && "SfxEnumItem::SetValue(): Pooled item");
-    m_nValue = nTheValue;
-}
+template class SfxEnumItem<sal_uInt16>;
 
 SfxPoolItem* SfxBoolItem::CreateDefault()
 {
diff --git a/svx/inc/sxcikitm.hxx b/svx/inc/sxcikitm.hxx
index 4aab9ea..5f918c2 100644
--- a/svx/inc/sxcikitm.hxx
+++ b/svx/inc/sxcikitm.hxx
@@ -27,14 +27,13 @@ enum SdrCircKind {SDRCIRC_FULL,
                   SDRCIRC_CUT,
                   SDRCIRC_ARC};
 
-class SdrCircKindItem: public SfxEnumItem {
+class SdrCircKindItem: public SfxEnumItem<SdrCircKind> {
 public:
-    SdrCircKindItem(SdrCircKind eKind=SDRCIRC_FULL): SfxEnumItem(SDRATTR_CIRCKIND,sal::static_int_cast< sal_uInt16 >(eKind)) {}
+    SdrCircKindItem(SdrCircKind eKind=SDRCIRC_FULL): SfxEnumItem(SDRATTR_CIRCKIND, eKind) {}
     SdrCircKindItem(SvStream& rIn)                 : SfxEnumItem(SDRATTR_CIRCKIND,rIn)   {}
     virtual SfxPoolItem* Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem* Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16       GetValueCount() const override; // { return 4; }
-            SdrCircKind  GetValue() const      { return (SdrCircKind)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16   GetValueCount() const override; // { return 4; }
 
     virtual bool QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/svx/inc/sxmkitm.hxx b/svx/inc/sxmkitm.hxx
index cbd93c5..bf695a4 100644
--- a/svx/inc/sxmkitm.hxx
+++ b/svx/inc/sxmkitm.hxx
@@ -27,14 +27,13 @@ enum SdrMeasureKind     {SDRMEASURE_STD,SDRMEASURE_RADIUS}; // n.i.
 
 // class SdrMeasureKindItem (n.i.)
 
-class SdrMeasureKindItem: public SfxEnumItem {
+class SdrMeasureKindItem: public SfxEnumItem<SdrMeasureKind> {
 public:
-    SdrMeasureKindItem(SdrMeasureKind eKind=SDRMEASURE_STD): SfxEnumItem(SDRATTR_MEASUREKIND,sal::static_int_cast< sal_uInt16 >(eKind)) {}
+    SdrMeasureKindItem(SdrMeasureKind eKind=SDRMEASURE_STD): SfxEnumItem(SDRATTR_MEASUREKIND, eKind) {}
     SdrMeasureKindItem(SvStream& rIn)                      : SfxEnumItem(SDRATTR_MEASUREKIND,rIn)    {}
     virtual SfxPoolItem*   Clone(SfxItemPool* pPool=nullptr) const override;
     virtual SfxPoolItem*   Create(SvStream& rIn, sal_uInt16 nVer) const override;
-    virtual sal_uInt16         GetValueCount() const override; // { return 2; }
-            SdrMeasureKind GetValue() const { return (SdrMeasureKind)SfxEnumItem::GetValue(); }
+    virtual sal_uInt16     GetValueCount() const override; // { return 2; }
 
     virtual bool           QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool           PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx
index f7df00a..afef2e6 100644
--- a/svx/source/items/algitem.cxx
+++ b/svx/source/items/algitem.cxx
@@ -46,12 +46,12 @@ SfxPoolItem* SvxMarginItem::CreateDefault() { return new  SvxMarginItem(0) ;}
 
 SvxOrientationItem::SvxOrientationItem( const SvxCellOrientation eOrientation,
                                         const sal_uInt16 nId):
-    SfxEnumItem( nId, (sal_uInt16)eOrientation )
+    SfxEnumItem( nId, eOrientation )
 {
 }
 
 SvxOrientationItem::SvxOrientationItem( sal_Int32 nRotation, bool bStacked, const sal_uInt16 nId ) :
-    SfxEnumItem( nId )
+    SfxEnumItem( nId, SvxCellOrientation::SVX_ORIENTATION_STANDARD )
 {
     if( bStacked )
     {
@@ -111,7 +111,7 @@ bool SvxOrientationItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
         case table::CellOrientation_STACKED:    eSvx = SVX_ORIENTATION_STACKED;   break;
         default: ; //prevent warning
     }
-    SetValue( (sal_uInt16)eSvx );
+    SetValue( eSvx );
     return true;
 }
 
diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx
index 945ed3e..4680dde 100644
--- a/svx/source/items/chrtitem.cxx
+++ b/svx/source/items/chrtitem.cxx
@@ -34,7 +34,7 @@ SfxPoolItem* SvxDoubleItem::CreateDefault() { return new  SvxDoubleItem(0.0, 0);
 
 SvxChartTextOrderItem::SvxChartTextOrderItem(SvxChartTextOrder eOrder,
                                              sal_uInt16 nId) :
-    SfxEnumItem(nId, (sal_uInt16)eOrder)
+    SfxEnumItem(nId, eOrder)
 {
 }
 
@@ -110,28 +110,11 @@ bool SvxChartTextOrderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMe
             return false;
     }
 
-    SetValue( (sal_uInt16)eOrder );
+    SetValue( eOrder );
 
     return true;
 }
 
-SvxChartTextOrientItem::SvxChartTextOrientItem(SvStream& rIn, sal_uInt16 nId) :
-    SfxEnumItem(nId, rIn)
-{
-}
-
-
-SfxPoolItem* SvxChartTextOrientItem::Clone(SfxItemPool* /*pPool*/) const
-{
-    return new SvxChartTextOrientItem(*this);
-}
-
-
-SfxPoolItem* SvxChartTextOrientItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) const
-{
-    return new SvxChartTextOrientItem(rIn, Which());
-}
-
 SvxDoubleItem::SvxDoubleItem(double fValue, sal_uInt16 nId) :
     SfxPoolItem(nId),
     fVal(fValue)
@@ -201,7 +184,7 @@ bool SvxDoubleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
 
 SvxChartKindErrorItem::SvxChartKindErrorItem(SvxChartKindError eOrient,
                                                sal_uInt16 nId) :
-    SfxEnumItem(nId, (sal_uInt16)eOrient)
+    SfxEnumItem(nId, eOrient)
 {
 }
 
@@ -233,7 +216,7 @@ sal_uInt16 SvxChartKindErrorItem::GetVersion (sal_uInt16 nFileFormatVersion) con
 
 SvxChartIndicateItem::SvxChartIndicateItem(SvxChartIndicate eOrient,
                                                sal_uInt16 nId) :
-    SfxEnumItem(nId, (sal_uInt16)eOrient)
+    SfxEnumItem(nId, eOrient)
 {
 }
 
@@ -265,7 +248,7 @@ sal_uInt16 SvxChartIndicateItem::GetVersion (sal_uInt16 nFileFormatVersion) cons
 
 SvxChartRegressItem::SvxChartRegressItem(SvxChartRegress eOrient,
                                                sal_uInt16 nId) :
-    SfxEnumItem(nId, (sal_uInt16)eOrient)
+    SfxEnumItem(nId, eOrient)
 {
 }
 
diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx
index 41262a8..52ab474 100644
--- a/svx/source/items/rotmodit.cxx
+++ b/svx/source/items/rotmodit.cxx
@@ -44,7 +44,7 @@ SfxPoolItem* SvxRotateModeItem::CreateDefault() { return new  SvxRotateModeItem(
 
 
 SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, sal_uInt16 _nWhich )
-    : SfxEnumItem( _nWhich, (sal_uInt16)eMode )
+    : SfxEnumItem( _nWhich, eMode )
 {
 }
 
@@ -133,7 +133,7 @@ bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
         case table::CellVertJustify2::BOTTOM:   eSvx = SVX_ROTATE_MODE_BOTTOM;   break;
         default: ;//prevent warning
     }
-    SetValue( (sal_uInt16)eSvx );
+    SetValue( eSvx );
     return true;
 }
 
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index e150b19..1c5535c 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -23,6 +23,7 @@
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <svx/xlineit0.hxx>
 #include <svx/xfillit0.hxx>
+#include <svx/xflbmpit.hxx>
 #include <svx/xlntrit.hxx>
 #include <svx/xlnwtit.hxx>
 #include <svx/xlinjoit.hxx>
@@ -699,11 +700,10 @@ namespace drawinglayer
                 aSize,
                 aOffset,
                 aOffsetPosition,
-                RectPointToB2DVector(
-                    (RectPoint)static_cast<const SfxEnumItem&>(rSet.Get(XATTR_FILLBMP_POS)).GetValue()),
-                    static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_TILE)).GetValue(),
-                    static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_STRETCH)).GetValue(),
-                    static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_SIZELOG)).GetValue());
+                RectPointToB2DVector(rSet.GetItem<XFillBmpPosItem>(XATTR_FILLBMP_POS)->GetValue()),
+                static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_TILE)).GetValue(),
+                static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_STRETCH)).GetValue(),
+                static_cast<const SfxBoolItem&>(rSet.Get(XATTR_FILLBMP_SIZELOG)).GetValue());
         }
 
         attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute(
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index fcf56a6..7320c1c 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -1036,7 +1036,7 @@ bool SdrTextFitToSizeTypeItem::GetBoolValue() const { return GetValue()!=SdrFitT
 
 void SdrTextFitToSizeTypeItem::SetBoolValue(bool bVal)
 {
-    SetValue(sal::static_int_cast< sal_uInt16 >(bVal ? SdrFitToSizeType::Proportional : SdrFitToSizeType::NONE));
+    SetValue(bVal ? SdrFitToSizeType::Proportional : SdrFitToSizeType::NONE);
 }
 
 bool SdrTextFitToSizeTypeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
@@ -1059,7 +1059,7 @@ bool SdrTextFitToSizeTypeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemb
         eFS = (drawing::TextFitToSizeType) nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrFitToSizeType)eFS ) );
+    SetValue( (SdrFitToSizeType)eFS );
 
     return true;
 }
@@ -1107,7 +1107,7 @@ bool SdrTextVertAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberI
         eAdj = (drawing::TextVerticalAdjust)nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextVertAdjust)eAdj ) );
+    SetValue( (SdrTextVertAdjust)eAdj );
 
     return true;
 }
@@ -1162,7 +1162,7 @@ bool SdrTextHorzAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberI
         eAdj = (drawing::TextHorizontalAdjust)nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextHorzAdjust)eAdj ) );
+    SetValue( (SdrTextHorzAdjust)eAdj );
 
     return true;
 }
@@ -1209,7 +1209,7 @@ bool SdrTextAniKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
         eKind = (drawing::TextAnimationKind)nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextAniKind)eKind ) );
+    SetValue( (SdrTextAniKind)eKind );
 
     return true;
 }
@@ -1257,7 +1257,7 @@ bool SdrTextAniDirectionItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMembe
         eDir = (drawing::TextAnimationDirection)nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrTextAniDirection)eDir ) );
+    SetValue( (SdrTextAniDirection)eDir );
 
     return true;
 }
@@ -1615,7 +1615,7 @@ bool SdrEdgeKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
         default:
             OSL_FAIL( "SdrEdgeKindItem::PuValue : unknown enum" );
     }
-    SetValue( sal::static_int_cast< sal_uInt16 >( eEK ) );
+    SetValue( eEK );
 
     return true;
 }
@@ -1756,7 +1756,7 @@ bool SdrMeasureKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
         eKind = (drawing::MeasureKind)nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrMeasureKind)eKind ) );
+    SetValue( (SdrMeasureKind)eKind );
     return true;
 }
 
@@ -1803,7 +1803,7 @@ bool SdrMeasureTextHPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMember
         ePos = (drawing::MeasureTextHorzPos)nEnum;
     }
 
-    SetValue(sal::static_int_cast<sal_uInt16>(ePos));
+    SetValue(ePos);
     return true;
 }
 
@@ -1850,7 +1850,7 @@ bool SdrMeasureTextVPosItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMember
         ePos = (drawing::MeasureTextVertPos)nEnum;
     }
 
-    SetValue(sal::static_int_cast<sal_uInt16>(ePos));
+    SetValue(ePos);
     return true;
 }
 
@@ -1897,7 +1897,7 @@ bool SdrMeasureUnitItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
     if(!(rVal >>= nMeasure))
         return false;
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (FieldUnit)nMeasure ) );
+    SetValue( (FieldUnit)nMeasure );
     return true;
 }
 
@@ -1944,7 +1944,7 @@ bool SdrCircKindItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
         eKind = (drawing::CircleKind)nEnum;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( (SdrCircKind)eKind ) );
+    SetValue( (SdrCircKind)eKind );
     return true;
 }
 
diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx
index 4f84f67..c7e3365 100644
--- a/svx/source/xoutdev/xattr.cxx
+++ b/svx/source/xoutdev/xattr.cxx
@@ -359,7 +359,7 @@ bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
 SfxPoolItem* XLineStyleItem::CreateDefault() { return new XLineStyleItem; }
 
 XLineStyleItem::XLineStyleItem(css::drawing::LineStyle eTheLineStyle) :
-    SfxEnumItem(XATTR_LINESTYLE, sal::static_int_cast< sal_uInt16 >(eTheLineStyle))
+    SfxEnumItem(XATTR_LINESTYLE, eTheLineStyle)
 {
 }
 
@@ -424,7 +424,7 @@ bool XLineStyleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*
         eLS = (css::drawing::LineStyle)nLS;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( eLS ) );
+    SetValue( eLS );
     return true;
 }
 
@@ -2115,7 +2115,7 @@ bool XLineEndCenterItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMembe
 SfxPoolItem* XFillStyleItem::CreateDefault() { return new XFillStyleItem; }
 
 XFillStyleItem::XFillStyleItem(drawing::FillStyle eFillStyle) :
-    SfxEnumItem(XATTR_FILLSTYLE, sal::static_int_cast< sal_uInt16 >(eFillStyle))
+    SfxEnumItem(XATTR_FILLSTYLE, eFillStyle)
 {
 }
 
@@ -2196,7 +2196,7 @@ bool XFillStyleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*
         eFS = (css::drawing::FillStyle)nFS;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( eFS ) );
+    SetValue( eFS );
 
     return true;
 }
@@ -3164,7 +3164,7 @@ XFillHatchItem* XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
 SfxPoolItem* XFormTextStyleItem::CreateDefault() { return new XFormTextStyleItem; }
 
 XFormTextStyleItem::XFormTextStyleItem(XFormTextStyle eTheStyle) :
-    SfxEnumItem(XATTR_FORMTXTSTYLE, sal::static_int_cast< sal_uInt16 >(eTheStyle))
+    SfxEnumItem(XATTR_FORMTXTSTYLE, eTheStyle)
 {
 }
 
@@ -3198,7 +3198,7 @@ bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
 {
     sal_Int32 nValue = 0;
     rVal >>= nValue;
-    SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+    SetValue((XFormTextStyle)nValue);
 
     return true;
 }
@@ -3207,7 +3207,7 @@ bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/
 SfxPoolItem* XFormTextAdjustItem::CreateDefault() { return new XFormTextAdjustItem; }
 
 XFormTextAdjustItem::XFormTextAdjustItem(XFormTextAdjust eTheAdjust) :
-    SfxEnumItem(XATTR_FORMTXTADJUST, sal::static_int_cast< sal_uInt16 >(eTheAdjust))
+    SfxEnumItem(XATTR_FORMTXTADJUST, eTheAdjust)
 {
 }
 
@@ -3241,7 +3241,7 @@ bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*
 {
     sal_Int32 nValue = 0;
     rVal >>= nValue;
-    SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+    SetValue((XFormTextAdjust)nValue);
 
     return true;
 }
@@ -3341,8 +3341,7 @@ SfxPoolItem* XFormTextOutlineItem::Create(SvStream& rIn, sal_uInt16 /*nVer*/) co
 SfxPoolItem* XFormTextShadowItem::CreateDefault() { return new XFormTextShadowItem; }
 
 XFormTextShadowItem::XFormTextShadowItem(XFormTextShadow eFormTextShadow) :
-    SfxEnumItem(
-        XATTR_FORMTXTSHADOW, sal::static_int_cast< sal_uInt16 >(eFormTextShadow))
+    SfxEnumItem(XATTR_FORMTXTSHADOW, eFormTextShadow)
 {
 }
 
@@ -3376,7 +3375,7 @@ bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*
 {
     sal_Int32 nValue = 0;
     rVal >>= nValue;
-    SetValue(sal::static_int_cast< sal_uInt16 >(nValue));
+    SetValue((XFormTextShadow)nValue);
 
     return true;
 }
diff --git a/svx/source/xoutdev/xattr2.cxx b/svx/source/xoutdev/xattr2.cxx
index 0307e31..26f9f26 100644
--- a/svx/source/xoutdev/xattr2.cxx
+++ b/svx/source/xoutdev/xattr2.cxx
@@ -84,7 +84,7 @@ bool XLineTransparenceItem::GetPresentation
 SfxPoolItem* XLineJointItem::CreateDefault() { return new XLineJointItem; }
 
 XLineJointItem::XLineJointItem( css::drawing::LineJoint eLineJoint ) :
-    SfxEnumItem(XATTR_LINEJOINT, sal::static_int_cast< sal_uInt16 >(eLineJoint))
+    SfxEnumItem(XATTR_LINEJOINT, eLineJoint)
 {
 }
 
@@ -173,7 +173,7 @@ bool XLineJointItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*
         eUnoJoint = (css::drawing::LineJoint)nLJ;
     }
 
-    SetValue( sal::static_int_cast< sal_uInt16 >( eUnoJoint ) );
+    SetValue( eUnoJoint );
 
     return true;
 }
@@ -288,7 +288,7 @@ bool AffineMatrixItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberI
 SfxPoolItem* XLineCapItem::CreateDefault() { return new XLineCapItem; }
 
 XLineCapItem::XLineCapItem(css::drawing::LineCap eLineCap)
-:   SfxEnumItem(XATTR_LINECAP, sal::static_int_cast< sal_uInt16 >(eLineCap))
+:   SfxEnumItem(XATTR_LINECAP, eLineCap)
 {
 }
 
@@ -373,7 +373,7 @@ bool XLineCapItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
         || css::drawing::LineCap_ROUND == eUnoCap
         || css::drawing::LineCap_SQUARE == eUnoCap, "Unknown enum value in XATTR_LINECAP (!)");
 
-    SetValue(sal::static_int_cast< sal_uInt16 >(eUnoCap));
+    SetValue(eUnoCap);
 
     return true;
 }
@@ -558,7 +558,7 @@ void XFillBmpTileItem::dumpAsXml(xmlTextWriterPtr pWriter) const
 SfxPoolItem* XFillBmpPosItem::CreateDefault() {return new XFillBmpPosItem;}
 
 XFillBmpPosItem::XFillBmpPosItem( RectPoint eRP ) :
-    SfxEnumItem( XATTR_FILLBMP_POS, sal::static_int_cast< sal_uInt16 >( eRP ) )
+    SfxEnumItem( XATTR_FILLBMP_POS, eRP )
 {
 }
 
diff --git a/sw/inc/fmtfordr.hxx b/sw/inc/fmtfordr.hxx
index 5a09efb..eec6343 100644
--- a/sw/inc/fmtfordr.hxx
+++ b/sw/inc/fmtfordr.hxx
@@ -33,7 +33,7 @@ enum SwFillOrder
     SW_FILL_ORDER_END
 };
 
-class SwFormatFillOrder: public SfxEnumItem
+class SwFormatFillOrder: public SfxEnumItem<SwFillOrder>
 {
 public:
     SwFormatFillOrder( SwFillOrder = ATT_TOP_DOWN );
@@ -41,7 +41,7 @@ public:
 
     /// "Pure virtual methods" of SfxPoolItem.
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
-    virtual sal_uInt16          GetValueCount() const override;
+    virtual sal_uInt16      GetValueCount() const override;
 };
 
 inline SwFormatFillOrder &SwFormatFillOrder::operator=( const SwFormatFillOrder &rCpy )
diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx
index dfd4813..c46441a 100644
--- a/sw/inc/fmtftntx.hxx
+++ b/sw/inc/fmtftntx.hxx
@@ -34,7 +34,7 @@ enum SwFootnoteEndPosEnum
     FTNEND_ATTXTEND_END
 };
 
-class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem
+class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem<SwFootnoteEndPosEnum>
 {
     OUString sPrefix;
     OUString sSuffix;
@@ -43,7 +43,7 @@ class SW_DLLPUBLIC SwFormatFootnoteEndAtTextEnd : public SfxEnumItem
 
 protected:
     SwFormatFootnoteEndAtTextEnd( sal_uInt16 nWhichL, SwFootnoteEndPosEnum ePos )
-        : SfxEnumItem( nWhichL, sal::static_int_cast< sal_uInt16 >(ePos) ), nOffset( 0 )
+        : SfxEnumItem( nWhichL, ePos ), nOffset( 0 )
     {}
     SwFormatFootnoteEndAtTextEnd( const SwFormatFootnoteEndAtTextEnd& rAttr )
         : SfxEnumItem( rAttr ), sPrefix( rAttr.sPrefix ),
@@ -52,7 +52,7 @@ protected:
     {}
 
 public:
-    virtual sal_uInt16          GetValueCount() const override;
+    virtual sal_uInt16       GetValueCount() const override;
 
     virtual bool             operator==( const SfxPoolItem& ) const override;
 
diff --git a/sw/inc/fmtsrnd.hxx b/sw/inc/fmtsrnd.hxx
index 02bf0e0..74e429d 100644
--- a/sw/inc/fmtsrnd.hxx
+++ b/sw/inc/fmtsrnd.hxx
@@ -28,7 +28,7 @@
 class IntlWrapper;
 
 // SwFormatSurround: How document content under the frame shall behave.
-class SW_DLLPUBLIC SwFormatSurround: public SfxEnumItem
+class SW_DLLPUBLIC SwFormatSurround: public SfxEnumItem<css::text::WrapTextMode>
 {
     bool    bAnchorOnly :1;
     bool    bContour    :1;
@@ -41,7 +41,7 @@ public:
     // "Pure virtual Methods" of SfxPoolItem.
     virtual bool            operator==( const SfxPoolItem& ) const override;
     virtual SfxPoolItem*    Clone( SfxItemPool* pPool = nullptr ) const override;
-    virtual sal_uInt16          GetValueCount() const override;
+    virtual sal_uInt16      GetValueCount() const override;
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                   MapUnit eCoreMetric,
                                   MapUnit ePresMetric,
@@ -50,11 +50,11 @@ public:
     virtual bool             QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const override;
     virtual bool             PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) override;
 
-    css::text::WrapTextMode GetSurround()const { return css::text::WrapTextMode( GetValue() ); }
+    css::text::WrapTextMode GetSurround() const { return GetValue(); }
     bool    IsAnchorOnly()  const { return bAnchorOnly; }
     bool    IsContour()     const { return bContour; }
     bool    IsOutside()     const { return bOutside; }
-    void    SetSurround  ( css::text::WrapTextMode eNew ){ SfxEnumItem::SetValue( sal_uInt16( eNew ) ); }
+    void    SetSurround  ( css::text::WrapTextMode eNew ) { SetValue( eNew ); }
     void    SetAnchorOnly( bool bNew )      { bAnchorOnly = bNew; }
     void    SetContour( bool bNew )         { bContour = bNew; }
     void    SetOutside( bool bNew )         { bOutside = bNew; }
diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx
index de586e9..9c9b625 100644
--- a/sw/inc/grfatr.hxx
+++ b/sw/inc/grfatr.hxx
@@ -38,13 +38,13 @@ RES_MIRROR_GRAPH_BEGIN,
 RES_MIRROR_GRAPH_END
 };
 
-class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem
+class SW_DLLPUBLIC SwMirrorGrf : public SfxEnumItem<MirrorGraph>
 {
     bool bGrfToggle; // Flip graphics on even pages.
 
 public:
     SwMirrorGrf( MirrorGraph eMiro = RES_MIRROR_GRAPH_DONT )
-        : SfxEnumItem( RES_GRFATR_MIRRORGRF, static_cast< sal_uInt16 >(eMiro) ), bGrfToggle( false )
+        : SfxEnumItem( RES_GRFATR_MIRRORGRF, eMiro ), bGrfToggle( false )
     {}
     SwMirrorGrf( const SwMirrorGrf &rMirrorGrf )
         : SfxEnumItem( RES_GRFATR_MIRRORGRF, rMirrorGrf.GetValue()),
@@ -55,7 +55,7 @@ public:
     virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override;
 
     // pure virtual methods of SfxEnumItem
-    virtual sal_uInt16          GetValueCount() const override;
+    virtual sal_uInt16      GetValueCount() const override;
     virtual bool            operator==( const SfxPoolItem& ) const override;
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                   MapUnit eCoreMetric,
@@ -260,7 +260,7 @@ public:
                                         sal_uInt8 nMemberId ) override;
 };
 
-class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem
+class SW_DLLPUBLIC SwDrawModeGrf : public SfxEnumItem<sal_uInt16>
 {
 public:
     SwDrawModeGrf( sal_uInt16 nMode = 0 )
@@ -271,7 +271,7 @@ public:
     virtual SfxPoolItem*    Clone( SfxItemPool *pPool = nullptr ) const override;
 
     // pure virtual methods of SfxEnumItem
-    virtual sal_uInt16          GetValueCount() const override;
+    virtual sal_uInt16      GetValueCount() const override;
     virtual bool GetPresentation( SfxItemPresentation ePres,
                                   MapUnit eCoreMetric,
                                   MapUnit ePresMetric,
diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx
index b9a7098..a2c95ca 100644
--- a/sw/qa/extras/ww8export/ww8export.cxx
+++ b/sw/qa/extras/ww8export/ww8export.cxx
@@ -1202,7 +1202,7 @@ DECLARE_WW8EXPORT_TEST(testRES_MIRROR_GRAPH_BOTH, "tdf56321_flipImage_both.doc")
         SwNode* pNode = pDoc->GetNodes()[ n ];
         if (SwGrfNode *pGrfNode = pNode->GetGrfNode())
         {
-            CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt16>(3), pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue());
+            CPPUNIT_ASSERT_EQUAL(RES_MIRROR_GRAPH_BOTH, pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue());
             break;
         }
     }
diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx
index 3ac4cab..8c38558 100644
--- a/sw/source/core/graphic/grfatr.cxx
+++ b/sw/source/core/graphic/grfatr.cxx
@@ -42,7 +42,7 @@ sal_uInt16 SwMirrorGrf::GetValueCount() const
 
 bool SwMirrorGrf::operator==( const SfxPoolItem& rItem) const
 {
-    return SfxEnumItem::operator==(rItem) &&
+    return SfxEnumItem::operator==(static_cast<const SfxEnumItem<MirrorGraph>&>(rItem)) &&
             static_cast<const SwMirrorGrf&>(rItem).IsGrfToggle() == IsGrfToggle();
 }
 
@@ -107,7 +107,7 @@ bool SwMirrorGrf::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
                     bIsVert ? RES_MIRROR_GRAPH_BOTH : RES_MIRROR_GRAPH_VERT :
                         bIsVert ? RES_MIRROR_GRAPH_HOR : RES_MIRROR_GRAPH_DONT;
             bool bToggle = bOnOddPages != bOnEvenPages;
-            SetValue(static_cast<sal_uInt16>(nEnum));
+            SetValue(nEnum);
             SetGrfToggle( bToggle );
         }
         break;
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index e5b2ace..eaab3ba 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -1028,6 +1028,7 @@ GraphicAttr& SwGrfNode::GetGraphicAttr( GraphicAttr& rGA,
         case RES_MIRROR_GRAPH_HOR:
             nMirror = BmpMirrorFlags::Vertical;
             break;
+        default: break;
         }
 
     rGA.SetMirrorFlags( nMirror );
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 546bc16..5f14ed9 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -424,7 +424,7 @@ void SwFormatFrameSize::dumpAsXml(xmlTextWriterPtr pWriter) const
 
 // Partially implemented inline in hxx
 SwFormatFillOrder::SwFormatFillOrder( SwFillOrder nFO )
-    : SfxEnumItem( RES_FILL_ORDER, sal_uInt16(nFO) )
+    : SfxEnumItem( RES_FILL_ORDER, nFO )
 {}
 SfxPoolItem*  SwFormatFillOrder::Clone( SfxItemPool* ) const
 {
@@ -1143,7 +1143,7 @@ void SwFormatCol::dumpAsXml(xmlTextWriterPtr pWriter) const
 
 // Partially implemented inline in hxx
 SwFormatSurround::SwFormatSurround( css::text::WrapTextMode eFly ) :
-    SfxEnumItem( RES_SURROUND, sal_uInt16( eFly ) )
+    SfxEnumItem( RES_SURROUND, eFly )
 {
     bAnchorOnly = bContour = bOutside = false;
 }
@@ -1212,7 +1212,7 @@ bool SwFormatSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
         {
             sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal );
             if( eVal >= css::text::WrapTextMode_NONE && eVal <= css::text::WrapTextMode_RIGHT )
-                SetValue( static_cast<sal_uInt16>(eVal) );
+                SetValue( (css::text::WrapTextMode)eVal );
             else {
                 //exception
                 ;
diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 62c7564..21f6924 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -1790,6 +1790,7 @@ static Writer& OutHTML_FrameFormatGrfNode( Writer& rWrt, const SwFrameFormat& rF
             case RES_MIRROR_GRAPH_BOTH:
                 nFlags = XOutFlags::MirrorVert | XOutFlags::MirrorHorz;
                 break;
+            default: break;
             }
 
             Size aMM100Size;
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6f7acdb..7b9da4c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -4371,7 +4371,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size
 
     if ( pGrfNode && SfxItemState::SET == pGrfNode->GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE, true, &pItem))
     {
-        nMode = static_cast<const SfxEnumItem*>(pItem)->GetValue();
+        nMode = static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
         if (nMode == GRAPHICDRAWMODE_GREYS)
             m_pSerializer->singleElementNS (XML_a, XML_grayscl, FSEND);
         else if (nMode == GRAPHICDRAWMODE_MONO) //black/white has a 0,5 threshold in LibreOffice
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 08d6429..3b7707d 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -1762,7 +1762,7 @@ void SwBasicEscherEx::WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat&
     if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE,
         true, &pItem))
     {
-        nMode = static_cast<const SfxEnumItem*>(pItem)->GetValue();
+        nMode = static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
         if (nMode == GRAPHICDRAWMODE_WATERMARK)
         {
             /*
diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx
index 9180263..017df5b 100644
--- a/sw/source/filter/ww8/ww8atr.cxx
+++ b/sw/source/filter/ww8/ww8atr.cxx
@@ -3446,7 +3446,7 @@ void AttributeOutputBase::FormatBreak( const SvxFormatBreakItem& rBreak )
             case SvxBreak::NONE:
             case SvxBreak::PageBefore:
             case SvxBreak::PageBoth:
-                PageBreakBefore( rBreak.GetValue() );
+                PageBreakBefore( rBreak.GetValue() != SvxBreak::NONE );
                 break;
             default:
                 break;
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 7c1569b..456bf1a 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -1894,7 +1894,8 @@ bool SwSectionFootnoteEndTabPage::FillItemSet( SfxItemSet* rSet )
 
     case FTNEND_ATTXTEND_OWNNUMSEQ:
         aFootnote.SetOffset( static_cast< sal_uInt16 >( m_pFootnoteOffsetField->GetValue()-1 ) );
-        // no break;
+        break;
+    default: break;
     }
 
     SwFormatEndAtTextEnd aEnd( m_pEndNtAtTextEndCB->IsChecked()
@@ -1915,7 +1916,8 @@ bool SwSectionFootnoteEndTabPage::FillItemSet( SfxItemSet* rSet )
 
     case FTNEND_ATTXTEND_OWNNUMSEQ:
         aEnd.SetOffset( static_cast< sal_uInt16 >( m_pEndOffsetField->GetValue()-1 ) );
-        // no break;
+        break;
+    default: break;
     }
 
     rSet->Put( aFootnote );
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index 82569db..3cd06bb 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -110,8 +110,8 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq)
     //Special case align by menu
     if(pItem && nSlotId == SID_OBJECT_ALIGN)
     {
-        OSL_ENSURE(dynamic_cast<const SfxEnumItem*>( pItem),"SfxEnumItem expected" );
-        nSlotId = nSlotId + static_cast<const SfxEnumItem*>(pItem)->GetValue();
+        OSL_ENSURE(dynamic_cast<const SfxEnumItemInterface*>( pItem),"SfxEnumItem expected" );
+        nSlotId = nSlotId + static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue();
         nSlotId++;
     }
 
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 5a21c5e..9f3cb37 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -541,7 +541,7 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
                     case RES_MIRROR_GRAPH_BOTH: nMirror = RES_MIRROR_GRAPH_VERT;
                                                 break;
                     }
-                aMirror.SetValue( nMirror );
+                aMirror.SetValue( (MirrorGraph)nMirror );
                 aGrfSet.ClearItem();
                 aGrfSet.Put( aMirror );
             }


More information about the Libreoffice-commits mailing list