[Libreoffice-commits] core.git: basic/source bridges/source compilerplugins/clang cui/source editeng/source forms/source framework/source sc/source sd/source svtools/source svx/source sw/source tools/source vbahelper/source vcl/headless vcl/unx xmloff/source

Noel Grandin noel.grandin at collabora.co.uk
Wed Mar 22 06:48:02 UTC 2017


 basic/source/runtime/runtime.cxx                        |    2 
 bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx    |    2 
 compilerplugins/clang/check.cxx                         |   10 ++++
 compilerplugins/clang/check.hxx                         |    2 
 compilerplugins/clang/redundantcast.cxx                 |   20 ++++++++
 compilerplugins/clang/test/redundantcast.cxx            |    5 ++
 cui/source/tabpages/chardlg.cxx                         |    6 +-
 cui/source/tabpages/grfpage.cxx                         |    2 
 cui/source/tabpages/labdlg.cxx                          |    2 
 cui/source/tabpages/numpages.cxx                        |   12 ++---
 cui/source/tabpages/page.cxx                            |    6 +-
 cui/source/tabpages/paragrph.cxx                        |    2 
 cui/source/tabpages/tabstpge.cxx                        |    8 +--
 cui/source/tabpages/tpline.cxx                          |   10 ++--
 cui/source/tabpages/transfrm.cxx                        |    2 
 editeng/source/editeng/editdoc.cxx                      |    4 -
 editeng/source/editeng/eertfpar.cxx                     |    2 
 editeng/source/editeng/impedit4.cxx                     |    2 
 editeng/source/items/itemtype.cxx                       |    8 +--
 editeng/source/items/textitem.cxx                       |    2 
 forms/source/richtext/rtattributehandler.cxx            |    6 +-
 framework/source/layoutmanager/toolbarlayoutmanager.cxx |    2 
 framework/source/services/substitutepathvars.cxx        |   10 ++--
 sc/source/core/data/dptabsrc.cxx                        |    4 -
 sc/source/core/tool/interpr1.cxx                        |    2 
 sc/source/ui/vba/vbarange.cxx                           |    2 
 sd/source/ui/sidebar/SlideBackground.cxx                |    2 
 sd/source/ui/view/drviews3.cxx                          |    2 
 svtools/source/misc/unitconv.cxx                        |    4 -
 svtools/source/svhtml/htmlsupp.cxx                      |    2 
 svx/source/dialog/fntctrl.cxx                           |    8 +--
 svx/source/sdr/primitive2d/sdrattributecreator.cxx      |    2 
 svx/source/sidebar/line/LinePropertyPanelBase.cxx       |    2 
 svx/source/sidebar/line/LineWidthPopup.cxx              |    8 +--
 svx/source/sidebar/nbdtmg.cxx                           |    2 
 svx/source/sidebar/paragraph/ParaPropertyPanel.cxx      |   38 ++++++++--------
 svx/source/sidebar/text/TextCharacterSpacingControl.cxx |    4 -
 svx/source/svdraw/svdattr.cxx                           |    8 +--
 svx/source/xoutdev/_xpoly.cxx                           |    6 +-
 sw/source/core/edit/edtox.cxx                           |    4 -
 sw/source/core/table/swtable.cxx                        |    2 
 sw/source/core/txtnode/fntcache.cxx                     |    2 
 sw/source/core/undo/undobj1.cxx                         |    6 +-
 sw/source/filter/html/wrthtml.cxx                       |    2 
 sw/source/ui/frmdlg/frmpage.cxx                         |    6 +-
 sw/source/uibase/app/docst.cxx                          |    8 +--
 sw/source/uibase/docvw/srcedtw.cxx                      |    2 
 sw/source/uibase/shells/grfsh.cxx                       |    2 
 sw/source/uibase/sidebar/PageFormatPanel.cxx            |    2 
 sw/source/uibase/sidebar/PageSizeControl.cxx            |    2 
 sw/source/uibase/uiview/pview.cxx                       |    6 --
 sw/source/uibase/uiview/view0.cxx                       |    2 
 sw/source/uibase/uiview/view2.cxx                       |    4 -
 sw/source/uibase/uiview/viewport.cxx                    |    6 +-
 sw/source/uibase/uno/unomod.cxx                         |   10 ++--
 sw/source/uibase/uno/unotxdoc.cxx                       |    6 +-
 tools/source/generic/poly.cxx                           |    6 +-
 vbahelper/source/vbahelper/vbahelper.cxx                |    2 
 vcl/headless/svpprn.cxx                                 |    2 
 vcl/unx/generic/print/genprnpsp.cxx                     |    4 -
 xmloff/source/text/XMLTextMarkImportContext.cxx         |    8 +--
 61 files changed, 175 insertions(+), 142 deletions(-)

New commits:
commit 7299481834b15c920f996f4b0f3b5f821a82a10d
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Mar 20 09:01:33 2017 +0200

    loplugin:redundantcast find redundant c-style enum casts
    
    Change-Id: I2dab376d87804521aed6b6bd41ad7762830fa349
    Reviewed-on: https://gerrit.libreoffice.org/35467
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 7f01c6d1ff9e..b34534db6e52 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -4482,7 +4482,7 @@ void SbiRuntime::StepLOCAL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
 void SbiRuntime::StepPUBLIC_Impl( sal_uInt32 nOp1, sal_uInt32 nOp2, bool bUsedForClassModule )
 {
     OUString aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
-    SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);
+    SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
     bool bFlag = pMod->IsSet( SbxFlagBits::NoModify );
     pMod->SetFlag( SbxFlagBits::NoModify );
     SbxVariableRef p = pMod->Find( aName, SbxClassType::Property );
diff --git a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
index af1d83909f69..f5c4dc0facdf 100644
--- a/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_x86-64/cpp2uno.cxx
@@ -239,7 +239,7 @@ static typelib_TypeClass cpp2uno_call(
         }
         if ( pReturnTypeDescr )
         {
-            typelib_TypeClass eRet = (typelib_TypeClass)pReturnTypeDescr->eTypeClass;
+            typelib_TypeClass eRet = pReturnTypeDescr->eTypeClass;
             TYPELIB_DANGER_RELEASE( pReturnTypeDescr );
             return eRet;
         }
diff --git a/compilerplugins/clang/check.cxx b/compilerplugins/clang/check.cxx
index 22f58ebd7ac9..f7647ac8c9c9 100644
--- a/compilerplugins/clang/check.cxx
+++ b/compilerplugins/clang/check.cxx
@@ -103,6 +103,16 @@ TypeCheck TypeCheck::Pointer() const {
     return TypeCheck();
 }
 
+TerminalCheck TypeCheck::Enum() const {
+    if (!type_.isNull()) {
+        auto const t = type_->getAs<clang::EnumType>();
+        if (t != nullptr) {
+            return TerminalCheck(true);
+        }
+    }
+    return TerminalCheck(false);
+}
+
 TypeCheck TypeCheck::Typedef() const {
     if (!type_.isNull()) {
         if (auto const t = type_->getAs<clang::TypedefType>()) {
diff --git a/compilerplugins/clang/check.hxx b/compilerplugins/clang/check.hxx
index 8c3edf773ea1..cf91dfd2aee2 100644
--- a/compilerplugins/clang/check.hxx
+++ b/compilerplugins/clang/check.hxx
@@ -53,6 +53,8 @@ public:
 
     TypeCheck Pointer() const;
 
+    TerminalCheck Enum() const;
+
     TypeCheck LvalueReference() const;
 
     template<std::size_t N> inline ContextCheck Class(char const (& id)[N])
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 0525fa51f584..4bef116f481b 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -138,6 +138,8 @@ public:
 
     bool VisitCXXDeleteExpr(CXXDeleteExpr const * expr);
 
+    bool VisitCStyleCastExpr(CStyleCastExpr const * expr);
+
     bool VisitBinSub(BinaryOperator const * expr)
     { return visitBinOp(expr); }
 
@@ -288,6 +290,24 @@ bool RedundantCast::VisitImplicitCastExpr(const ImplicitCastExpr * expr) {
     return true;
 }
 
+bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
+    if (ignoreLocation(expr)) {
+        return true;
+    }
+    if (isInUnoIncludeFile(compiler.getSourceManager().getSpellingLoc(expr->getLocStart()))) {
+        return true;
+    }
+    auto t1 = getSubExprAsWritten(expr)->getType();
+    auto t2 = expr->getTypeAsWritten();
+    if (loplugin::TypeCheck(t1).Enum() && loplugin::TypeCheck(t2).Enum() && t1 == t2) {
+        report(
+            DiagnosticsEngine::Warning,
+            "redundant cstyle enum cast from %0 to %1", expr->getExprLoc())
+            << t1 << t2 << expr->getSourceRange();
+    }
+    return true;
+}
+
 bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) {
     if (ignoreLocation(expr)) {
         return true;
diff --git a/compilerplugins/clang/test/redundantcast.cxx b/compilerplugins/clang/test/redundantcast.cxx
index e8be3013cd86..a7516c1a058f 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -10,6 +10,8 @@
 void f1(char *) {}
 void f2(char const *) {}
 
+enum Enum1 { X };
+
 int main() {
     char * p1;
     char const * p2;
@@ -27,6 +29,9 @@ int main() {
     f2(const_cast<char * const>(p2)); // expected-error {{redundant const_cast from 'const char *' to 'char *', result is implictly cast to 'const char *' [loplugin:redundantcast]}}
     f2(const_cast<char const *>(p2)); // expected-error {{redundant const_cast from 'const char *' to 'const char *' [loplugin:redundantcast]}}
     f2(const_cast<char const * const>(p2)); // expected-error {{redundant const_cast from 'const char *' to 'const char *const' [loplugin:redundantcast]}}
+
+    Enum1 e = (Enum1)Enum1::X; // expected-error {{redundant cstyle enum cast from 'Enum1' to 'Enum1' [loplugin:redundantcast]}}
+    (void)e;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/tabpages/chardlg.cxx b/cui/source/tabpages/chardlg.cxx
index cc5f57191b4e..f4edebab4286 100644
--- a/cui/source/tabpages/chardlg.cxx
+++ b/cui/source/tabpages/chardlg.cxx
@@ -2879,13 +2879,13 @@ void SvxCharPositionPage::Reset( const SfxItemSet* rSet )
     {
         const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>(rSet->Get( nWhich ));
         MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
-        MapUnit eOrgUnit = (MapUnit)eUnit;
+        MapUnit eOrgUnit = eUnit;
         MapUnit ePntUnit( MapUnit::MapPoint );
         long nBig = static_cast<long>(m_pKerningMF->Normalize( static_cast<long>(rItem.GetValue()) ));
         long nKerning = LogicToLogic( nBig, eOrgUnit, ePntUnit );
 
         // set Kerning at the Font, convert into Twips before
-        long nKern = LogicToLogic( rItem.GetValue(), (MapUnit)eUnit, MapUnit::MapTwip );
+        long nKern = LogicToLogic( rItem.GetValue(), eUnit, MapUnit::MapTwip );
         rFont.SetFixKerning( (short)nKern );
         rCJKFont.SetFixKerning( (short)nKern );
         rCTLFont.SetFixKerning( (short)nKern );
@@ -3054,7 +3054,7 @@ bool SvxCharPositionPage::FillItemSet( SfxItemSet* rSet )
     MapUnit eUnit = rSet->GetPool()->GetMetric( nWhich );
 
     long nTmp = static_cast<long>(m_pKerningMF->GetValue());
-    long nVal = LogicToLogic( nTmp, MapUnit::MapPoint, (MapUnit)eUnit );
+    long nVal = LogicToLogic( nTmp, MapUnit::MapPoint, eUnit );
     nKerning = (short)m_pKerningMF->Denormalize( nVal );
 
     SfxItemState eOldKernState = rOldSet.GetItemState( nWhich, false );
diff --git a/cui/source/tabpages/grfpage.cxx b/cui/source/tabpages/grfpage.cxx
index beef6ec36b7e..003649c09684 100644
--- a/cui/source/tabpages/grfpage.cxx
+++ b/cui/source/tabpages/grfpage.cxx
@@ -218,7 +218,7 @@ void SvxGrfCropPage::Reset( const SfxItemSet *rSet )
         aPageSize = OutputDevice::LogicToLogic(
                         Size( CM_1_TO_TWIP,  CM_1_TO_TWIP ),
                         MapMode( MapUnit::MapTwip ),
-                        MapMode( (MapUnit)rSet->GetPool()->GetMetric( nW ) ) );
+                        MapMode( rSet->GetPool()->GetMetric( nW ) ) );
     }
 
     bool bFound = false;
diff --git a/cui/source/tabpages/labdlg.cxx b/cui/source/tabpages/labdlg.cxx
index e255e9cec723..40aa0bbb3cc9 100644
--- a/cui/source/tabpages/labdlg.cxx
+++ b/cui/source/tabpages/labdlg.cxx
@@ -174,7 +174,7 @@ bool SvxCaptionTabPage::FillItemSet( SfxItemSet*  _rOutAttrs)
 
     nCaptionType = (SdrCaptionType) (m_pCT_CAPTTYPE->GetSelectItemId()-1);
 
-    _rOutAttrs->Put( SdrCaptionTypeItem( (SdrCaptionType) nCaptionType ) );
+    _rOutAttrs->Put( SdrCaptionTypeItem( nCaptionType ) );
 
     if( m_pMF_ABSTAND->IsValueModified() )
     {
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index edd9a15056b4..063e265ca04f 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -965,7 +965,7 @@ IMPL_LINK_NOARG(SvxBitmapPickTabPage, NumSelectHdl_Impl, ValueSet*, void)
                 {
                     Size aSize = SvxNumberFormat::GetGraphicSizeMM100(&aGraphic);
                     sal_Int16 eOrient = text::VertOrientation::LINE_CENTER;
-                    aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, (MapUnit)eCoreUnit);
+                    aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, eCoreUnit);
                     SvxBrushItem aBrush(aGraphic, GPOS_AREA, SID_ATTR_BRUSH );
                     aFmt.SetGraphicBrush( &aBrush, &aSize, &eOrient );
                 }
@@ -1984,7 +1984,7 @@ IMPL_LINK( SvxNumOptionsTabPage, GraphicHdl_Impl, MenuButton *, pButton, void )
     }
     if(bSucc)
     {
-        aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, (MapUnit)eCoreUnit);
+        aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, eCoreUnit);
 
         sal_uInt16 nMask = 1;
         for(sal_uInt16 i = 0; i < pActNum->GetLevelCount(); i++)
@@ -2142,9 +2142,9 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, Edit&, rField, void)
     long nWidthVal = static_cast<long>(m_pWidthMF->Denormalize(m_pWidthMF->GetValue(FUNIT_100TH_MM)));
     long nHeightVal = static_cast<long>(m_pHeightMF->Denormalize(m_pHeightMF->GetValue(FUNIT_100TH_MM)));
     nWidthVal = OutputDevice::LogicToLogic( nWidthVal ,
-                                                MapUnit::Map100thMM, (MapUnit)eCoreUnit );
+                                                MapUnit::Map100thMM, eCoreUnit );
     nHeightVal = OutputDevice::LogicToLogic( nHeightVal,
-                                                MapUnit::Map100thMM, (MapUnit)eCoreUnit);
+                                                MapUnit::Map100thMM, eCoreUnit);
     double  fSizeRatio;
 
     bool bRepaint = false;
@@ -2172,7 +2172,7 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, Edit&, rField, void)
                     {
                         aSize.Height() = aInitSize[i].Height() + (long)((double)nDelta / fSizeRatio);
                         m_pHeightMF->SetUserValue(m_pHeightMF->Normalize(
-                            OutputDevice::LogicToLogic( aSize.Height(), (MapUnit)eCoreUnit, MapUnit::Map100thMM )),
+                            OutputDevice::LogicToLogic( aSize.Height(), eCoreUnit, MapUnit::Map100thMM )),
                                 FUNIT_100TH_MM);
                     }
                 }
@@ -2184,7 +2184,7 @@ IMPL_LINK( SvxNumOptionsTabPage, SizeHdl_Impl, Edit&, rField, void)
                     {
                         aSize.Width() = aInitSize[i].Width() + (long)((double)nDelta * fSizeRatio);
                         m_pWidthMF->SetUserValue(m_pWidthMF->Normalize(
-                            OutputDevice::LogicToLogic( aSize.Width(), (MapUnit)eCoreUnit, MapUnit::Map100thMM )),
+                            OutputDevice::LogicToLogic( aSize.Width(), eCoreUnit, MapUnit::Map100thMM )),
                                 FUNIT_100TH_MM);
                     }
                 }
diff --git a/cui/source/tabpages/page.cxx b/cui/source/tabpages/page.cxx
index dab4e0a9064f..97534fc5ab6a 100644
--- a/cui/source/tabpages/page.cxx
+++ b/cui/source/tabpages/page.cxx
@@ -510,7 +510,7 @@ void SvxPageDescPage::Reset( const SfxItemSet* rSet )
     m_pBspWin->SetSize( Size( ConvertLong_Impl( aPaperSize.Width(), eUnit ),
                            ConvertLong_Impl( aPaperSize.Height(), eUnit ) ) );
 
-    aPaperSize = OutputDevice::LogicToLogic(aPaperSize, (MapUnit)eUnit, MapUnit::Map100thMM);
+    aPaperSize = OutputDevice::LogicToLogic(aPaperSize, eUnit, MapUnit::Map100thMM);
     if ( bLandscape )
         Swap( aPaperSize );
 
@@ -749,7 +749,7 @@ bool SvxPageDescPage::FillItemSet( SfxItemSet* rSet )
     {
         if ( nOld != nPos || m_pLandscapeBtn->IsValueChangedFromSaved() )
         {
-            Size aSize( SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)eUnit ) );
+            Size aSize( SvxPaperInfo::GetPaperSize( ePaper, eUnit ) );
 
             if ( bChecked )
                 Swap( aSize );
@@ -997,7 +997,7 @@ IMPL_LINK_NOARG(SvxPageDescPage, PaperSizeModify_Impl, Edit&, void)
     MapUnit eUnit = GetItemSet().GetPool()->GetMetric( nWhich );
     Size aSize( GetCoreValue( *m_pPaperWidthEdit, eUnit ),
                 GetCoreValue( *m_pPaperHeightEdit, eUnit ) );
-    Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, (MapUnit)eUnit, true );
+    Paper ePaper = SvxPaperInfo::GetSvxPaper( aSize, eUnit, true );
 
     m_pPaperSizeBox->SetSelection( ePaper );
     UpdateExample_Impl( true );
diff --git a/cui/source/tabpages/paragrph.cxx b/cui/source/tabpages/paragrph.cxx
index c2622a09783d..812b5851982b 100644
--- a/cui/source/tabpages/paragrph.cxx
+++ b/cui/source/tabpages/paragrph.cxx
@@ -362,7 +362,7 @@ bool SvxStdParagraphTabPage::FillItemSet( SfxItemSet* rOutSet )
 
     if ( bNullTab )
     {
-        MapUnit eUnit = (MapUnit)pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+        MapUnit eUnit = pPool->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
         if ( MapUnit::Map100thMM != eUnit )
         {
 
diff --git a/cui/source/tabpages/tabstpge.cxx b/cui/source/tabpages/tabstpge.cxx
index 239406398e9f..6b7842618acf 100644
--- a/cui/source/tabpages/tabstpge.cxx
+++ b/cui/source/tabpages/tabstpge.cxx
@@ -221,7 +221,7 @@ bool SvxTabulatorTabPage::FillItemSet(SfxItemSet* rSet)
 
     FillUpWithDefTabs_Impl(nDefDist, aNewTabs);
     SfxItemPool* pPool = rSet->GetPool();
-    MapUnit eUnit = (MapUnit)pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP));
+    MapUnit eUnit = pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP));
     const SfxPoolItem* pOld = GetOldItem(*rSet, SID_ATTR_TABSTOP);
 
     if (MapUnit::Map100thMM != eUnit)
@@ -271,7 +271,7 @@ VclPtr<SfxTabPage> SvxTabulatorTabPage::Create(vcl::Window* pParent, const SfxIt
 void SvxTabulatorTabPage::Reset(const SfxItemSet* rSet)
 {
     SfxItemPool* pPool = rSet->GetPool();
-    MapUnit eUnit = (MapUnit)pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP));
+    MapUnit eUnit = pPool->GetMetric(GetWhich(SID_ATTR_TABSTOP));
 
     // Current tabs
     const SfxPoolItem* pItem = GetItem(*rSet, SID_ATTR_TABSTOP);
@@ -372,7 +372,7 @@ void SvxTabulatorTabPage::InitTabPos_Impl( sal_uInt16 nTabPos )
     if (GetItemSet().GetItemState(SID_ATTR_TABSTOP_OFFSET, true, &pItem) == SfxItemState::SET)
     {
         nOffset = static_cast<const SfxInt32Item*>(pItem)->GetValue();
-        MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric(GetWhich(SID_ATTR_TABSTOP));
+        MapUnit eUnit = GetItemSet().GetPool()->GetMetric(GetWhich(SID_ATTR_TABSTOP));
         nOffset = OutputDevice::LogicToLogic(nOffset, eUnit, MapUnit::Map100thMM);
     }
 
@@ -478,7 +478,7 @@ IMPL_LINK( SvxTabulatorTabPage, NewHdl_Impl, Button *, pBtn, void )
          SfxItemState::SET )
     {
         nOffset = static_cast<const SfxInt32Item*>(pItem)->GetValue();
-        MapUnit eUnit = (MapUnit)GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
+        MapUnit eUnit = GetItemSet().GetPool()->GetMetric( GetWhich( SID_ATTR_TABSTOP ) );
         nOffset = OutputDevice::LogicToLogic( nOffset, eUnit, MapUnit::Map100thMM  );
     }
     const long nReal = nVal - nOffset;
diff --git a/cui/source/tabpages/tpline.cxx b/cui/source/tabpages/tpline.cxx
index c42b9f3302a1..d01c4aa03f36 100644
--- a/cui/source/tabpages/tpline.cxx
+++ b/cui/source/tabpages/tpline.cxx
@@ -484,7 +484,7 @@ void SvxLineTabPage::SymbolSelected(MenuButton* pButton)
     if(pGraphic)
     {
         Size aSize = SvxNumberFormat::GetGraphicSizeMM100(pGraphic);
-        aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, (MapUnit)m_ePoolUnit);
+        aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, m_ePoolUnit);
         m_aSymbolGraphic=*pGraphic;
         if( bResetSize )
         {
@@ -1704,8 +1704,8 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void)
     bool bRatio = m_pSymbolRatioCB->IsChecked();
     long nWidthVal = static_cast<long>(m_pSymbolWidthMF->Denormalize(m_pSymbolWidthMF->GetValue(FUNIT_100TH_MM)));
     long nHeightVal= static_cast<long>(m_pSymbolHeightMF->Denormalize(m_pSymbolHeightMF->GetValue(FUNIT_100TH_MM)));
-    nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM,(MapUnit)m_ePoolUnit );
-    nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM,(MapUnit)m_ePoolUnit);
+    nWidthVal = OutputDevice::LogicToLogic(nWidthVal,MapUnit::Map100thMM, m_ePoolUnit );
+    nHeightVal = OutputDevice::LogicToLogic(nHeightVal,MapUnit::Map100thMM, m_ePoolUnit);
     m_aSymbolSize = Size(nWidthVal,nHeightVal);
     double fSizeRatio = (double)1;
 
@@ -1724,7 +1724,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void)
         if (bRatio)
         {
             m_aSymbolSize.Height() = m_aSymbolLastSize.Height() + (long)((double)nDelta / fSizeRatio);
-            m_aSymbolSize.Height() = OutputDevice::LogicToLogic( m_aSymbolSize.Height(),(MapUnit)m_ePoolUnit, MapUnit::Map100thMM );
+            m_aSymbolSize.Height() = OutputDevice::LogicToLogic( m_aSymbolSize.Height(), m_ePoolUnit, MapUnit::Map100thMM );
             m_pSymbolHeightMF->SetUserValue(m_pSymbolHeightMF->Normalize(m_aSymbolSize.Height()), FUNIT_100TH_MM);
         }
     }
@@ -1735,7 +1735,7 @@ IMPL_LINK( SvxLineTabPage, SizeHdl_Impl, Edit&, rField, void)
         if (bRatio)
         {
             m_aSymbolSize.Width() = m_aSymbolLastSize.Width() + (long)((double)nDelta * fSizeRatio);
-            m_aSymbolSize.Width() = OutputDevice::LogicToLogic( m_aSymbolSize.Width(), (MapUnit)m_ePoolUnit, MapUnit::Map100thMM );
+            m_aSymbolSize.Width() = OutputDevice::LogicToLogic( m_aSymbolSize.Width(), m_ePoolUnit, MapUnit::Map100thMM );
             m_pSymbolWidthMF->SetUserValue(m_pSymbolWidthMF->Normalize(m_aSymbolSize.Width()), FUNIT_100TH_MM);
         }
     }
diff --git a/cui/source/tabpages/transfrm.cxx b/cui/source/tabpages/transfrm.cxx
index 3e791e23b18c..d8916301c142 100644
--- a/cui/source/tabpages/transfrm.cxx
+++ b/cui/source/tabpages/transfrm.cxx
@@ -253,7 +253,7 @@ void SvxAngleTabPage::Construct()
 
     // take UI units into account
     sal_uInt16 nDigits(m_pMtrPosX->GetDecimalDigits());
-    TransfrmHelper::ConvertRect(maRange, nDigits, (MapUnit)ePoolUnit, eDlgUnit);
+    TransfrmHelper::ConvertRect(maRange, nDigits, ePoolUnit, eDlgUnit);
 
     if(!pView->IsRotateAllowed())
     {
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 95fbb4ddd850..2b2356d07745 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -941,8 +941,8 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map
 
         if ( rSource.GetItemState( nSourceWhich, false ) == SfxItemState::SET )
         {
-            MapUnit eSourceUnit = pSourceUnit ? *pSourceUnit : (MapUnit)pSourcePool->GetMetric( nSourceWhich );
-            MapUnit eDestUnit = pDestUnit ? *pDestUnit : (MapUnit)pDestPool->GetMetric( nWhich );
+            MapUnit eSourceUnit = pSourceUnit ? *pSourceUnit : pSourcePool->GetMetric( nSourceWhich );
+            MapUnit eDestUnit = pDestUnit ? *pDestUnit : pDestPool->GetMetric( nWhich );
             if ( eSourceUnit != eDestUnit )
             {
                 SfxPoolItem* pItem = rSource.Get( nSourceWhich ).Clone();
diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index 65e24dd5adf0..22ca573a5588 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -305,7 +305,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
     const SfxPoolItem* pItem;
 
     // #i66167# adapt font heights to destination MapUnit if necessary
-    const MapUnit eDestUnit = (MapUnit)(mpEditEngine->GetEditDoc().GetItemPool().GetMetric(0));
+    const MapUnit eDestUnit = mpEditEngine->GetEditDoc().GetItemPool().GetMetric(0);
     const MapUnit eSrcUnit  = aRTFMapMode.GetMapUnit();
     if (eDestUnit != eSrcUnit)
     {
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index d7cb3c4a654f..5e01db42458a 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1224,7 +1224,7 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject
     if (rTextObject.mpImpl->HasMetric())
     {
         eSourceUnit = (MapUnit)rTextObject.mpImpl->GetMetric();
-        eDestUnit = (MapUnit)aEditDoc.GetItemPool().GetMetric( DEF_METRIC );
+        eDestUnit = aEditDoc.GetItemPool().GetMetric( DEF_METRIC );
         if ( eSourceUnit != eDestUnit )
             bConvertMetricOfItems = true;
     }
diff --git a/editeng/source/items/itemtype.cxx b/editeng/source/items/itemtype.cxx
index 7cb94d69e718..70036f7c2d34 100644
--- a/editeng/source/items/itemtype.cxx
+++ b/editeng/source/items/itemtype.cxx
@@ -44,8 +44,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In
         case MapUnit::MapMM:
         case MapUnit::MapCM:
         {
-            nRet = (long)OutputDevice::LogicToLogic(
-                nVal, (MapUnit)eSrcUnit, (MapUnit)MapUnit::Map100thMM );
+            nRet = (long)OutputDevice::LogicToLogic( nVal, eSrcUnit, MapUnit::Map100thMM );
 
             switch ( eDestUnit )
             {
@@ -62,8 +61,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In
         case MapUnit::Map10thInch:
         case MapUnit::MapInch:
         {
-            nRet = OutputDevice::LogicToLogic(
-                nVal, (MapUnit)eSrcUnit, (MapUnit)MapUnit::Map1000thInch );
+            nRet = OutputDevice::LogicToLogic( nVal, eSrcUnit, MapUnit::Map1000thInch );
 
             switch ( eDestUnit )
             {
@@ -79,7 +77,7 @@ OUString GetMetricText( long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const In
         case MapUnit::MapTwip:
         case MapUnit::MapPixel:
             return OUString::number( (long)OutputDevice::LogicToLogic(
-                        nVal, (MapUnit)eSrcUnit, (MapUnit)eDestUnit ));
+                        nVal, eSrcUnit, eDestUnit ));
 
         default:
             OSL_FAIL( "not supported mapunit" );
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index a5258e0563d8..ab5cd092dd92 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -752,7 +752,7 @@ SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
     }
 
     SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
-    pItem->SetProp( nprop, (MapUnit)nPropUnit );
+    pItem->SetProp( nprop, nPropUnit );
     return pItem;
 }
 
diff --git a/forms/source/richtext/rtattributehandler.cxx b/forms/source/richtext/rtattributehandler.cxx
index 39f2948d48bf..0b34312c4433 100644
--- a/forms/source/richtext/rtattributehandler.cxx
+++ b/forms/source/richtext/rtattributehandler.cxx
@@ -330,7 +330,7 @@ namespace frm
             {
                 nHeight = OutputDevice::LogicToLogic(
                     Size( 0, nHeight ),
-                    MapMode( (MapUnit)( _rAttribs.GetPool()->GetMetric( getWhich() ) ) ),
+                    MapMode(  _rAttribs.GetPool()->GetMetric( getWhich() ) ),
                     MapMode( MapUnit::MapTwip )
                 ).Height();
             }
@@ -358,8 +358,8 @@ namespace frm
             {
                 nHeight = OutputDevice::LogicToLogic(
                     Size( 0, nHeight ),
-                    MapMode( (MapUnit)( MapUnit::MapTwip ) ),
-                    MapMode( (MapUnit)( _rNewAttribs.GetPool()->GetMetric( getWhich() ) ) )
+                    MapMode( MapUnit::MapTwip ),
+                    MapMode( _rNewAttribs.GetPool()->GetMetric( getWhich() ) )
                 ).Height();
             }
 
diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
index 98edc791193e..befb53f0f27b 100644
--- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx
+++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx
@@ -1434,7 +1434,7 @@ void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno
             }
             if ( pToolBox )
             {
-                pToolBox->SetButtonType( (ButtonType)rElement.m_nStyle );
+                pToolBox->SetButtonType( rElement.m_nStyle );
                 if ( rElement.m_bNoClose )
                     pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE );
             }
diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx
index 2f38a872a094..c3660d2b7320 100644
--- a/framework/source/services/substitutepathvars.cxx
+++ b/framework/source/services/substitutepathvars.cxx
@@ -366,13 +366,13 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText
                 if ( nIndex == PREDEFVAR_WORK && !bWorkRetrieved )
                 {
                     // Transient value, retrieve it again
-                    m_aPreDefVars.m_FixedVar[ (PreDefVariable)nIndex ] = GetWorkVariableValue();
+                    m_aPreDefVars.m_FixedVar[ nIndex ] = GetWorkVariableValue();
                     bWorkRetrieved = true;
                 }
                 else if ( nIndex == PREDEFVAR_WORKDIRURL && !bWorkDirURLRetrieved )
                 {
                     // Transient value, retrieve it again
-                    m_aPreDefVars.m_FixedVar[ (PreDefVariable)nIndex ] = GetWorkPath();
+                    m_aPreDefVars.m_FixedVar[ nIndex ] = GetWorkPath();
                     bWorkDirURLRetrieved = true;
                 }
 
@@ -380,9 +380,9 @@ OUString SubstitutePathVariables::impl_substituteVariable( const OUString& rText
                 // 1. A path variable can only be substituted if it follows a ';'!
                 // 2. It's located exactly at the start of the string being substituted!
                 if (( aFixedVarTable[ int( nIndex ) ].bAbsPath && (( nPosition == 0 ) || (( nPosition > 0 ) && ( aWorkText[nPosition-1] == ';')))) ||
-            ( !aFixedVarTable[ int( nIndex ) ].bAbsPath ))
-        {
-                    aReplacement = m_aPreDefVars.m_FixedVar[ (PreDefVariable)nIndex ];
+                    ( !aFixedVarTable[ int( nIndex ) ].bAbsPath ))
+                {
+                    aReplacement = m_aPreDefVars.m_FixedVar[ nIndex ];
                     nReplaceLength = nLength;
                 }
             }
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index 1b650bfb8641..27a79cdd93db 100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -1587,10 +1587,10 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName
         case sheet::DataPilotFieldReferenceType::ROW_PERCENTAGE:
         case sheet::DataPilotFieldReferenceType::COLUMN_PERCENTAGE:
         case sheet::DataPilotFieldReferenceType::TOTAL_PERCENTAGE:
-            nFormat = pSource->GetData()->GetNumberFormatByIdx( (NfIndexTableOffset)NF_PERCENT_DEC2 );
+            nFormat = pSource->GetData()->GetNumberFormatByIdx( NF_PERCENT_DEC2 );
             break;
         case sheet::DataPilotFieldReferenceType::INDEX:
-            nFormat = pSource->GetData()->GetNumberFormatByIdx( (NfIndexTableOffset)NF_NUMBER_SYSTEM );
+            nFormat = pSource->GetData()->GetNumberFormatByIdx( NF_NUMBER_SYSTEM );
             break;
         default:
             break;
diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx
index 96fee0feaee2..fc5e8384c9b6 100644
--- a/sc/source/core/tool/interpr1.cxx
+++ b/sc/source/core/tool/interpr1.cxx
@@ -8077,7 +8077,7 @@ bool SAL_CALL lcl_getScriptClass(sal_uInt32 currentChar)
         return true;
     sal_uInt16 i;
     static bool bRet = false;
-    UBlockCode block = (UBlockCode)ublock_getCode((sal_uInt32)currentChar);
+    UBlockCode block = ublock_getCode((sal_uInt32)currentChar);
     for ( i = 0; i < scriptListCount; i++) {
         if (block <= scriptList[i].to) break;
     }
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 6a35cd4ece88..534c2922fdc4 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -3604,7 +3604,7 @@ ScVbaRange::End( ::sal_Int32 Direction )
         }
         if ( pDispatcher )
         {
-            pDispatcher->Execute( nSID, (SfxCallMode)SfxCallMode::SYNCHRON, aArgs );
+            pDispatcher->Execute( nSID, SfxCallMode::SYNCHRON, aArgs );
         }
     }
 
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx
index e89fd867819d..a4e31e24e1a1 100644
--- a/sd/source/ui/sidebar/SlideBackground.cxx
+++ b/sd/source/ui/sidebar/SlideBackground.cxx
@@ -788,7 +788,7 @@ IMPL_LINK_NOARG(SlideBackground, FillStyleModifyHdl, ListBox&, void)
 IMPL_LINK_NOARG(SlideBackground, PaperSizeModifyHdl, ListBox&, void)
 {
     Paper ePaper =  mpPaperSizeBox->GetSelection();
-    Size  aSize(SvxPaperInfo::GetPaperSize(ePaper, (MapUnit)(meUnit)));
+    Size  aSize(SvxPaperInfo::GetPaperSize(ePaper, meUnit));
 
     if(mpPaperOrientation->GetSelectEntryPos() == 0)
         Swap(aSize);
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 68d0971029a5..3a56d0d0d4fa 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -171,7 +171,7 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
                         }
 
                         nSelectedPage = (short) nWhatPage;
-                        mePageKind    = (PageKind) nWhatKind;
+                        mePageKind    = nWhatKind;
                     }
                 }
                 else
diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx
index 68dcb5f87b63..b20e22c3c30a 100644
--- a/svtools/source/misc/unitconv.cxx
+++ b/svtools/source/misc/unitconv.cxx
@@ -111,7 +111,7 @@ void SetFieldUnit( MetricBox& rBox, FieldUnit eUnit )
 
 void SetMetricValue( MetricField& rField, long nCoreValue, MapUnit eUnit )
 {
-    sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, (MapUnit)eUnit, MapUnit::Map100thMM );
+    sal_Int64 nVal = OutputDevice::LogicToLogic( nCoreValue, eUnit, MapUnit::Map100thMM );
     nVal = rField.Normalize( nVal );
     rField.SetValue( nVal, FUNIT_100TH_MM );
 
@@ -136,7 +136,7 @@ long GetCoreValue( const MetricField& rField, MapUnit eUnit )
     }
     if( bRoundBefore )
         nVal = rField.Denormalize( nVal );
-    sal_Int64 nUnitVal = OutputDevice::LogicToLogic( static_cast<long>(nVal), MapUnit::Map100thMM, (MapUnit)eUnit );
+    sal_Int64 nUnitVal = OutputDevice::LogicToLogic( static_cast<long>(nVal), MapUnit::Map100thMM, eUnit );
     if( ! bRoundBefore )
         nUnitVal = rField.Denormalize( nUnitVal );
     return static_cast<long>(nUnitVal);
diff --git a/svtools/source/svhtml/htmlsupp.cxx b/svtools/source/svhtml/htmlsupp.cxx
index d60c5d575451..7e0fe1cd5e1b 100644
--- a/svtools/source/svhtml/htmlsupp.cxx
+++ b/svtools/source/svhtml/htmlsupp.cxx
@@ -59,7 +59,7 @@ void HTMLParser::ParseScriptOptions( OUString& rLangString, const OUString& rBas
                 rLangString = aOption.GetString();
                 HTMLScriptLanguage nLang;
                 if( aOption.GetEnum( nLang, aScriptLangOptEnums ) )
-                    rLang = (HTMLScriptLanguage)nLang;
+                    rLang = nLang;
                 else
                     rLang = HTMLScriptLanguage::Unknown;
             }
diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx
index 0632773624cc..626065a5c412 100644
--- a/svx/source/dialog/fntctrl.cxx
+++ b/svx/source/dialog/fntctrl.cxx
@@ -890,8 +890,8 @@ void SvxFontPrevWindow::SetFontSize( const SfxItemSet& rSet, sal_uInt16 nSlot, S
     if (GetWhich(rSet, nSlot, nWhich))
     {
         nH = LogicToLogic(static_cast<const SvxFontHeightItem&>(rSet.Get(nWhich)).GetHeight(),
-                            (MapUnit) rSet.GetPool()->GetMetric(nWhich),
-                            MapUnit::MapTwip);
+                          rSet.GetPool()->GetMetric(nWhich),
+                          MapUnit::MapTwip);
     }
     else
         nH = 240;// as default 12pt
@@ -1107,7 +1107,7 @@ void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBack
     {
         const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) );
         short nKern = ( short )
-                        LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip );
+                        LogicToLogic( rItem.GetValue(), rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip );
         rFont.SetFixKerning( nKern );
         rCJKFont.SetFixKerning( nKern );
         rCTLFont.SetFixKerning( nKern );
@@ -1351,7 +1351,7 @@ void SvxFontPrevWindow::Init(const SfxItemSet& rSet)
     {
         const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) );
         short nKern = ( short )
-                        LogicToLogic( rItem.GetValue(), ( MapUnit ) rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip );
+                        LogicToLogic( rItem.GetValue(), rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip );
         rFont.SetFixKerning( nKern );
         rCJKFont.SetFixKerning( nKern );
         rCTLFont.SetFixKerning( nKern );
diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
index 6bef1b477a4d..d04fdf41579f 100644
--- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx
+++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx
@@ -655,7 +655,7 @@ namespace drawinglayer
             }
 
             // convert size and MapMode to destination logical size and MapMode
-            const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0));
+            const MapUnit aDestinationMapUnit(rSet.GetPool()->GetMetric(0));
             basegfx::B2DVector aGraphicLogicSize(aGraphic.GetPrefSize().Width(), aGraphic.GetPrefSize().Height());
 
             if(aGraphic.GetPrefMapMode() != aDestinationMapUnit)
diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
index daf2816cf763..7a57b4dce02e 100644
--- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx
+++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx
@@ -704,7 +704,7 @@ void LinePropertyPanelBase::SetWidthIcon()
         return;
     }
 
-    long nVal = LogicToLogic(mnWidthCoreValue * 10,(MapUnit)meMapUnit , MapUnit::MapPoint);
+    long nVal = LogicToLogic(mnWidthCoreValue * 10, meMapUnit, MapUnit::MapPoint);
     const sal_uInt16 nIdWidth = mpTBWidth->GetItemId(UNO_SELECTWIDTH);
 
     if(nVal <= 6)
diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx
index e89b2d707eef..cce33f314726 100644
--- a/svx/source/sidebar/line/LineWidthPopup.cxx
+++ b/svx/source/sidebar/line/LineWidthPopup.cxx
@@ -116,7 +116,7 @@ IMPL_LINK(LineWidthPopup, VSSelectHdl, ValueSet*, /*pControl*/, void)
     sal_uInt16 iPos = m_xVSWidth->GetSelectItemId();
     if (iPos >= 1 && iPos <= 8)
     {
-        sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(m_xVSWidth->GetItemData( iPos )), MapUnit::MapPoint, (MapUnit)m_eMapUnit);
+        sal_IntPtr nVal = LogicToLogic(reinterpret_cast<sal_IntPtr>(m_xVSWidth->GetItemData( iPos )), MapUnit::MapPoint, m_eMapUnit);
         nVal = m_xMFWidth->Denormalize(nVal);
         XLineWidthItem aWidthItem( nVal );
         m_rParent.setLineWidth(aWidthItem);
@@ -130,7 +130,7 @@ IMPL_LINK(LineWidthPopup, VSSelectHdl, ValueSet*, /*pControl*/, void)
         //modified
         if (m_bCustom)
         {
-            long nVal = LogicToLogic(m_nCustomWidth , MapUnit::MapPoint, (MapUnit)m_eMapUnit);
+            long nVal = LogicToLogic(m_nCustomWidth , MapUnit::MapPoint, m_eMapUnit);
             nVal = m_xMFWidth->Denormalize(nVal);
             XLineWidthItem aWidthItem( nVal );
             m_rParent.setLineWidth(aWidthItem);
@@ -165,7 +165,7 @@ IMPL_LINK(LineWidthPopup, MFModifyHdl, Edit&, /*rControl*/, void)
         m_xVSWidth->StartSelection();
     }
     long nTmp = static_cast<long>(m_xMFWidth->GetValue());
-    long nVal = LogicToLogic( nTmp, MapUnit::MapPoint, (MapUnit)m_eMapUnit );
+    long nVal = LogicToLogic( nTmp, MapUnit::MapPoint, m_eMapUnit );
     sal_Int32 nNewWidth = (short)m_xMFWidth->Denormalize( nVal );
     XLineWidthItem aWidthItem(nNewWidth);
     m_rParent.setLineWidth(aWidthItem);
@@ -208,7 +208,7 @@ void LineWidthPopup::SetWidthSelect(long lValue, bool bValuable, MapUnit eMapUni
 
     if (bValuable)
     {
-        sal_Int64 nVal = OutputDevice::LogicToLogic(lValue, (MapUnit) eMapUnit, MapUnit::Map100thMM );
+        sal_Int64 nVal = OutputDevice::LogicToLogic(lValue, eMapUnit, MapUnit::Map100thMM );
         nVal = m_xMFWidth->Normalize(nVal);
         m_xMFWidth->SetValue( nVal, FUNIT_100TH_MM );
     }
diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx
index b753deb2b891..b1c1f6a4386f 100644
--- a/svx/source/sidebar/nbdtmg.cxx
+++ b/svx/source/sidebar/nbdtmg.cxx
@@ -928,7 +928,7 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1
                             aSize = SvxNumberFormat::GetGraphicSizeMM100( pGrf );
                         }
                     }
-                    aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, (MapUnit)GetMapUnit());
+                    aSize = OutputDevice::LogicToLogic(aSize, MapUnit::Map100thMM, GetMapUnit());
                     aFmt.SetGraphicBrush( pLevelSettings->pBrushItem, &aSize, &eOrient );
             }
         } else
diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
index 5511a633dc67..2e290a1ea4e9 100644
--- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
+++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx
@@ -213,8 +213,8 @@ IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl, v
                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
 
                     maTxtLeft += INDENT_STEP;
-                    sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
-                    nVal = OutputDevice::LogicToLogic( (long)nVal, MapUnit::Map100thMM, (MapUnit)m_eLRSpaceUnit );
+                    sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::MapTwip, MapUnit::Map100thMM );
+                    nVal = OutputDevice::LogicToLogic( (long)nVal, MapUnit::Map100thMM, m_eLRSpaceUnit );
                     aMargin.SetTextLeft( (const long)nVal );
                     aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
                     aMargin.SetTextFirstLineOfst( (const short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) );
@@ -246,8 +246,8 @@ IMPL_LINK(ParaPropertyPanel, ClickIndent_IncDec_Hdl_Impl, ToolBox *, pControl, v
 
                     SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE );
 
-                    sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
-                    nVal = OutputDevice::LogicToLogic( (long)nVal, MapUnit::Map100thMM, (MapUnit)m_eLRSpaceUnit );
+                    sal_Int64 nVal = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::MapTwip, MapUnit::Map100thMM );
+                    nVal = OutputDevice::LogicToLogic( (long)nVal, MapUnit::Map100thMM, m_eLRSpaceUnit );
 
                     aMargin.SetTextLeft( (const long)nVal );
                     aMargin.SetRight( (const long)GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) );
@@ -357,18 +357,18 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
     {
         const SvxLRSpaceItem* pSpace = static_cast<const SvxLRSpaceItem*>(pState);
         maTxtLeft = pSpace->GetTextLeft();
-        maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)m_eLRSpaceUnit, MapUnit::Map100thMM );
-        maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::Map100thMM, (MapUnit)(MapUnit::MapTwip) );
+        maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, m_eLRSpaceUnit, MapUnit::Map100thMM );
+        maTxtLeft = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::Map100thMM, MapUnit::MapTwip );
 
         long aTxtRight = pSpace->GetRight();
-        aTxtRight = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)m_eLRSpaceUnit, MapUnit::Map100thMM );
-        aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MapUnit::Map100thMM, (MapUnit)(MapUnit::MapTwip) );
+        aTxtRight = OutputDevice::LogicToLogic( aTxtRight, m_eLRSpaceUnit, MapUnit::Map100thMM );
+        aTxtRight = OutputDevice::LogicToLogic( aTxtRight, MapUnit::Map100thMM, MapUnit::MapTwip );
 
         long aTxtFirstLineOfst = pSpace->GetTextFirstLineOfst();
-        aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)m_eLRSpaceUnit, MapUnit::Map100thMM );
-        aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::Map100thMM, (MapUnit)(MapUnit::MapTwip) );
+        aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, m_eLRSpaceUnit, MapUnit::Map100thMM );
+        aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::Map100thMM, MapUnit::MapTwip );
 
-        long nVal = OutputDevice::LogicToLogic( maTxtLeft, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
+        long nVal = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::MapTwip, MapUnit::Map100thMM );
         nVal = (long)mpLeftIndent->Normalize( (long)nVal );
 
         if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Text)
@@ -378,7 +378,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
             mpFLineIndent->SetMin( nVal*(-1), FUNIT_100TH_MM );
         }
 
-        long nrVal = OutputDevice::LogicToLogic( aTxtRight, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
+        long nrVal = OutputDevice::LogicToLogic( aTxtRight, MapUnit::MapTwip, MapUnit::Map100thMM );
         nrVal = (long)mpRightIndent->Normalize( (long)nrVal );
 
         switch (maContext.GetCombinedContext_DI())
@@ -409,7 +409,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( sal_uInt16 /*nSID*/, SfxItemStat
         mpLeftIndent->SetValue( nVal, FUNIT_100TH_MM );
         mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM );
 
-        long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
+        long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::MapTwip, MapUnit::Map100thMM );
         nfVal = (long)mpFLineIndent->Normalize( (long)nfVal );
         mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM );
 
@@ -463,18 +463,18 @@ void ParaPropertyPanel::StateChangedULImpl( sal_uInt16 /*nSID*/, SfxItemState eS
         const SvxULSpaceItem* pOldItem = static_cast<const SvxULSpaceItem*>(pState);
 
         maUpper = pOldItem->GetUpper();
-        maUpper = OutputDevice::LogicToLogic( maUpper, (MapUnit)m_eULSpaceUnit, MapUnit::Map100thMM );
-        maUpper = OutputDevice::LogicToLogic( maUpper, MapUnit::Map100thMM, (MapUnit)(MapUnit::MapTwip) );
+        maUpper = OutputDevice::LogicToLogic( maUpper, m_eULSpaceUnit, MapUnit::Map100thMM );
+        maUpper = OutputDevice::LogicToLogic( maUpper, MapUnit::Map100thMM, MapUnit::MapTwip );
 
         maLower = pOldItem->GetLower();
-        maLower = OutputDevice::LogicToLogic( maLower, (MapUnit)m_eULSpaceUnit, MapUnit::Map100thMM );
-        maLower = OutputDevice::LogicToLogic( maLower, MapUnit::Map100thMM, (MapUnit)(MapUnit::MapTwip) );
+        maLower = OutputDevice::LogicToLogic( maLower, m_eULSpaceUnit, MapUnit::Map100thMM );
+        maLower = OutputDevice::LogicToLogic( maLower, MapUnit::Map100thMM, MapUnit::MapTwip );
 
-        sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
+        sal_Int64 nVal = OutputDevice::LogicToLogic( maUpper, MapUnit::MapTwip, MapUnit::Map100thMM );
         nVal = mpTopDist->Normalize( nVal );
         mpTopDist->SetValue( nVal, FUNIT_100TH_MM );
 
-        nVal = OutputDevice::LogicToLogic( maLower, (MapUnit)(MapUnit::MapTwip), MapUnit::Map100thMM );
+        nVal = OutputDevice::LogicToLogic( maLower, MapUnit::MapTwip, MapUnit::Map100thMM );
         nVal = mpBottomDist->Normalize( nVal );
         mpBottomDist->SetValue( nVal, FUNIT_100TH_MM );
     }
diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
index eb13510ad924..7bbd9a0129d3 100644
--- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
+++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx
@@ -125,7 +125,7 @@ void TextCharacterSpacingControl::Initialize()
     if(eState >= SfxItemState::DEFAULT)
     {
         MapUnit eUnit = GetCoreMetric();
-        MapUnit eOrgUnit = (MapUnit)eUnit;
+        MapUnit eOrgUnit = eUnit;
         MapUnit ePntUnit(MapUnit::MapPoint);
         long nBig = maEditKerning->Normalize(nKerning);
         nKerning = LogicToLogic(nBig, eOrgUnit, ePntUnit);
@@ -150,7 +150,7 @@ void TextCharacterSpacingControl::ExecuteCharacterSpacing(long nValue, bool bClo
     long nSign = (nValue < 0) ? -1 : 1;
     nValue = nValue * nSign;
 
-    long nVal = LogicToLogic(nValue, MapUnit::MapPoint, (MapUnit)eUnit);
+    long nVal = LogicToLogic(nValue, MapUnit::MapPoint, eUnit);
     short nKern = (nValue == 0) ? 0 : (short)maEditKerning->Denormalize(nVal);
 
     SvxKerningItem aKernItem(nSign * nKern, SID_ATTR_CHAR_KERNING);
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index 7320c1c7aa66..ca28596f8666 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -931,10 +931,10 @@ bool SdrMetricItem::GetPresentation(SfxItemPresentation ePres,
                       MapUnit eCoreMetric, MapUnit ePresMetric, OUString& rText, const IntlWrapper *) const
 {
     long nValue=GetValue();
-    SdrFormatter aFmt((MapUnit)eCoreMetric,(MapUnit)ePresMetric);
+    SdrFormatter aFmt(eCoreMetric,ePresMetric);
     aFmt.TakeStr(nValue,rText);
     OUString aStr;
-    SdrFormatter::TakeUnitStr((MapUnit)ePresMetric,aStr);
+    SdrFormatter::TakeUnitStr(ePresMetric,aStr);
     rText += " " + aStr;
     if (ePres==SfxItemPresentation::Complete) {
         OUString aStr2;
@@ -1320,11 +1320,11 @@ bool SdrTextAniAmountItem::GetPresentation(
     }
     else
     {
-        SdrFormatter aFmt((MapUnit)eCoreMetric, (MapUnit)ePresMetric);
+        SdrFormatter aFmt(eCoreMetric, ePresMetric);
         OUString aStr;
 
         aFmt.TakeStr(nValue, rText);
-        SdrFormatter::TakeUnitStr((MapUnit)ePresMetric, aStr);
+        SdrFormatter::TakeUnitStr(ePresMetric, aStr);
         rText += aStr;
     }
 
diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx
index e289a45627d6..ce8ff47d37cf 100644
--- a/svx/source/xoutdev/_xpoly.cxx
+++ b/svx/source/xoutdev/_xpoly.cxx
@@ -474,7 +474,7 @@ bool XPolygon::operator==( const XPolygon& rXPoly ) const
 PolyFlags XPolygon::GetFlags( sal_uInt16 nPos ) const
 {
     pImpXPolygon->CheckPointDelete();
-    return (PolyFlags) pImpXPolygon->pFlagAry[nPos];
+    return pImpXPolygon->pFlagAry[nPos];
 }
 
 /// set the flags for the point at the given position
@@ -487,13 +487,13 @@ void XPolygon::SetFlags( sal_uInt16 nPos, PolyFlags eFlags )
 /// short path to read the CONTROL flag directly (TODO: better explain what the sense behind this flag is!)
 bool XPolygon::IsControl(sal_uInt16 nPos) const
 {
-    return ( (PolyFlags) pImpXPolygon->pFlagAry[nPos] == PolyFlags::Control );
+    return pImpXPolygon->pFlagAry[nPos] == PolyFlags::Control;
 }
 
 /// short path to read the SMOOTH and SYMMTR flag directly (TODO: better explain what the sense behind these flags is!)
 bool XPolygon::IsSmooth(sal_uInt16 nPos) const
 {
-    PolyFlags eFlag = (PolyFlags) pImpXPolygon->pFlagAry[nPos];
+    PolyFlags eFlag = pImpXPolygon->pFlagAry[nPos];
     return ( eFlag == PolyFlags::Smooth || eFlag == PolyFlags::Symmetric );
 }
 
diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx
index 14d38ece657d..478d915f7490 100644
--- a/sw/source/core/edit/edtox.cxx
+++ b/sw/source/core/edit/edtox.cxx
@@ -372,8 +372,8 @@ void SwEditShell::ApplyAutoMark()
 
                     // todo/mba: assuming that notes shouldn't be searched
                     bool bSearchInNotes = false;
-                    sal_uLong nRet = Find( aSearchOpt,  bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel,
-                                    (FindRanges)(FindRanges::InSelAll) );
+                    sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel,
+                                    FindRanges::InSelAll );
 
                     if(nRet)
                     {
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index dc8d917b8a62..fa66f9148795 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -214,7 +214,7 @@ SwTable::SwTable()
     m_bNewModel( true )
 {
     // default value set in the options
-    m_eTableChgMode = (TableChgMode)GetTableChgDefaultMode();
+    m_eTableChgMode = GetTableChgDefaultMode();
 }
 
 SwTable::SwTable( const SwTable& rTable )
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index cfd02c46d468..85bf990db61c 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -82,7 +82,7 @@ long EvalGridWidthAdd( const SwTextGridItem *const pGrid, const SwDrawTextInfo &
 
     OUString sString(SW_RESSTR(STR_POOLCOLL_STANDARD));
 
-    SfxStyleSheetBase* pStyle = pBasePool->Find(sString, (SfxStyleFamily)SfxStyleFamily::Para);
+    SfxStyleSheetBase* pStyle = pBasePool->Find(sString, SfxStyleFamily::Para);
     SfxItemSet& aTmpSet = pStyle->GetItemSet();
     const SvxFontHeightItem &aDefaultFontItem = static_cast<const SvxFontHeightItem&>(aTmpSet.Get(RES_CHRATR_CJK_FONTSIZE));
 
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index fb6d81acc208..f788d790f689 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -67,7 +67,7 @@ void SwUndoFlyBase::InsFly(::sw::UndoRedoContext & rContext, bool bShowSelFrame)
     if ( RES_DRAWFRMFMT == pFrameFormat->Which() )
         pFrameFormat->CallSwClientNotify(sw::DrawFrameFormatHint(sw::DrawFrameFormatHintId::PREP_INSERT_FLY));
 
-    SwFormatAnchor aAnchor( (RndStdIds)nRndId );
+    SwFormatAnchor aAnchor( nRndId );
 
     if (RndStdIds::FLY_AT_PAGE == nRndId)
     {
@@ -569,7 +569,7 @@ void SwUndoSetFlyFormat::UndoImpl(::sw::UndoRedoContext & rContext)
             }
 
             // reposition anchor
-            SwFormatAnchor aNewAnchor( (RndStdIds) nOldAnchorTyp );
+            SwFormatAnchor aNewAnchor( nOldAnchorTyp );
             GetAnchor( aNewAnchor, nOldNode, nOldContent );
             pFrameFormat->SetFormatAttr( aNewAnchor );
 
@@ -597,7 +597,7 @@ void SwUndoSetFlyFormat::RedoImpl(::sw::UndoRedoContext & rContext)
 
         if( bAnchorChgd )
         {
-            SwFormatAnchor aNewAnchor( (RndStdIds) nNewAnchorTyp );
+            SwFormatAnchor aNewAnchor( nNewAnchorTyp );
             GetAnchor( aNewAnchor, nNewNode, nNewContent );
             SfxItemSet aSet( rDoc.GetAttrPool(), aFrameFormatSetRange );
             aSet.Put( aNewAnchor );
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index ef319e744969..5f2ac9468534 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -239,7 +239,7 @@ sal_uLong SwHTMLWriter::WriteStream()
             m_nHTMLMode |= HTMLMODE_NO_BR_AT_PAREND;
     }
 
-    m_eCSS1Unit = (FieldUnit)SW_MOD()->GetMetric( pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) );
+    m_eCSS1Unit = SW_MOD()->GetMetric( pDoc->getIDocumentSettingAccess().get(DocumentSettingId::HTML_MODE) );
 
     bool bWriteUTF8 = bWriteClipboardDoc;
     m_eDestEnc = bWriteUTF8 ? RTL_TEXTENCODING_UTF8 : rHtmlOptions.GetTextEncoding();
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index d604a807a006..c5f236eecd43 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -1075,7 +1075,7 @@ bool SwFramePage::FillItemSet(SfxItemSet *rSet)
     const SfxItemSet& rOldSet = GetItemSet();
     const SfxPoolItem* pOldItem = nullptr;
 
-    RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+    RndStdIds eAnchorId = GetAnchor();
 
     if ( !m_bFormat )
     {
@@ -1753,7 +1753,7 @@ DeactivateRC SwFramePage::DeactivatePage(SfxItemSet * _pSet)
         //the original. But for the other pages we need the current anchor.
         SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell()
                             : getFrameDlgParentShell();
-        RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+        RndStdIds eAnchorId = GetAnchor();
         SwFormatAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() );
         _pSet->Put( aAnc );
     }
@@ -2269,7 +2269,7 @@ void SwFramePage::Init(const SfxItemSet& rSet, bool bReset)
     SwFormatCol aCol( static_cast<const SwFormatCol&>(rSet.Get(RES_COL)) );
     ::FitToActualSize( aCol, (sal_uInt16)rSize.GetWidth() );
 
-    RndStdIds eAnchorId = (RndStdIds)GetAnchor();
+    RndStdIds eAnchorId = GetAnchor();
 
     if ( m_bNew && !m_bFormat )
         InitPos(eAnchorId, -1, 0, -1, 0, LONG_MAX, LONG_MAX);
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 32cc62f7eafb..1316084f082c 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -1012,7 +1012,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam
     if(bWaterCan)
     {
         SwDocStyleSheet* pStyle =
-            static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, (SfxStyleFamily)nFamily) );
+            static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) );
 
         SAL_WARN_IF( !pStyle, "sw.ui", "Where's the StyleSheet" );
 
@@ -1055,7 +1055,7 @@ SfxStyleFamily SwDocShell::UpdateStyle(const OUString &rName, SfxStyleFamily nFa
     assert( pCurrWrtShell );
 
     SwDocStyleSheet* pStyle =
-        static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, (SfxStyleFamily)nFamily) );
+        static_cast<SwDocStyleSheet*>( m_xBasePool->Find(rName, nFamily) );
 
     if(!pStyle)
         return nFamily;
@@ -1153,7 +1153,7 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily
 {
     SwWrtShell* pCurrWrtShell = pShell ? pShell : GetWrtShell();
     SwDocStyleSheet* pStyle = static_cast<SwDocStyleSheet*>( m_xBasePool->Find(
-                                            rName, (SfxStyleFamily)nFamily ) );
+                                            rName, nFamily ) );
     if(!pStyle)
     {
         // preserve the current mask of PI, then the new one is
@@ -1164,7 +1164,7 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily
             nMask |= SFXSTYLEBIT_USERDEF;
 
         pStyle = static_cast<SwDocStyleSheet*>( &m_xBasePool->Make(rName,
-                                (SfxStyleFamily)nFamily, nMask ) );
+                                nFamily, nMask ) );
     }
 
     switch(nFamily)
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 44dce31a8ddf..71922d57bfe8 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -724,7 +724,7 @@ void SwSrcEditWindow::ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineO
             r.eType != svtools::HTMLKEYWORD &&
             r.eType != svtools::HTMLUNKNOWN)
                 r.eType = svtools::HTMLUNKNOWN;
-        Color aColor((ColorData)SW_MOD()->GetColorConfig().GetColorValue((svtools::ColorConfigEntry)r.eType).nColor);
+        Color aColor((ColorData)SW_MOD()->GetColorConfig().GetColorValue(r.eType).nColor);
         sal_uInt16 nLine = nLineOff+r.nLine;
         m_pTextEngine->SetAttrib( TextAttribFontColor( aColor ), nLine, r.nStart, r.nEnd+1 );
     }
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 4a7e9cfcae5d..6792d70fbe90 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 MirrorGraph::Both: nMirror = MirrorGraph::Vertical;
                                                 break;
                     }
-                aMirror.SetValue( (MirrorGraph)nMirror );
+                aMirror.SetValue( nMirror );
                 aGrfSet.ClearItem();
                 aGrfSet.Put( aMirror );
             }
diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx
index b44b4899d81d..ad245f714c87 100644
--- a/sw/source/uibase/sidebar/PageFormatPanel.cxx
+++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx
@@ -217,7 +217,7 @@ void PageFormatPanel::NotifyItemUpdate(
 IMPL_LINK_NOARG(PageFormatPanel, PaperFormatModifyHdl, ListBox&, void)
 {
     Paper ePaper = mpPaperSizeBox->GetSelection();
-    Size  aSize(SvxPaperInfo::GetPaperSize(ePaper, (MapUnit)(meUnit)));
+    Size  aSize(SvxPaperInfo::GetPaperSize(ePaper, meUnit));
 
     if(mpPaperOrientation->GetSelectEntryPos() == 1)
         Swap(aSize);
diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx
index 52f3e55d6f54..ae6916488950 100644
--- a/sw/source/uibase/sidebar/PageSizeControl.cxx
+++ b/sw/source/uibase/sidebar/PageSizeControl.cxx
@@ -204,7 +204,7 @@ void PageSizeControl::ExecuteSizeChange( const Paper ePaper )
         bLandscape = static_cast<const SvxPageItem*>(pItem)->IsLandscape();
 
         std::unique_ptr<SvxSizeItem> pPageSizeItem( new SvxSizeItem(SID_ATTR_PAGE_SIZE) );
-        Size aPageSize = SvxPaperInfo::GetPaperSize( ePaper, (MapUnit)(eUnit) );
+        Size aPageSize = SvxPaperInfo::GetPaperSize( ePaper, eUnit );
         if ( bLandscape )
         {
             Swap( aPageSize );
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 843f926062ea..34de777ec435 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -764,8 +764,7 @@ void  SwPagePreview::Execute( SfxRequest &rReq )
             {
                 SfxItemSet aCoreSet(GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM);
                 const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
-                SvxZoomItem aZoom( (SvxZoomType)pVOpt->GetZoomType(),
-                                            pVOpt->GetZoom() );
+                SvxZoomItem aZoom( pVOpt->GetZoomType(), pVOpt->GetZoom() );
                 aZoom.SetValueSet(
                         SvxZoomEnableFlags::N50|
                         SvxZoomEnableFlags::N75|
@@ -1024,8 +1023,7 @@ void  SwPagePreview::GetState( SfxItemSet& rSet )
         case FN_STAT_ZOOM:
             {
                     const SwViewOption* pVOpt = GetViewShell()->GetViewOptions();
-                    SvxZoomItem aZoom((SvxZoomType)pVOpt->GetZoomType(),
-                                        pVOpt->GetZoom());
+                    SvxZoomItem aZoom(pVOpt->GetZoomType(), pVOpt->GetZoom());
                     aZoom.SetValueSet(
                             SvxZoomEnableFlags::N50|
                             SvxZoomEnableFlags::N75|
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index 0d19b2d3449e..160df2edd845 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -218,7 +218,7 @@ void SwView::RecheckBrowseMode()
     CheckVisArea();
 
     SvxZoomType eType;
-    if( GetWrtShell().GetViewOptions()->getBrowseMode() && SvxZoomType::PERCENT != (eType = (SvxZoomType)
+    if( GetWrtShell().GetViewOptions()->getBrowseMode() && SvxZoomType::PERCENT != (eType =
         GetWrtShell().GetViewOptions()->GetZoomType()) )
         SetZoom( eType );
     InvalidateBorder();
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 6fd4a14d59a3..c4bc01bc5498 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -1393,7 +1393,7 @@ void SwView::StateStatusLine(SfxItemSet &rSet)
                 if ( ( GetDocShell()->GetCreateMode() != SfxObjectCreateMode::EMBEDDED ) || !GetDocShell()->IsInPlaceActive() )
                 {
                     const SwViewOption* pVOpt = rShell.GetViewOptions();
-                    SvxZoomType eZoom = (SvxZoomType) pVOpt->GetZoomType();
+                    SvxZoomType eZoom = pVOpt->GetZoomType();
                     SvxZoomItem aZoom(eZoom,
                                         pVOpt->GetZoom());
                     if( pVOpt->getBrowseMode() )
@@ -1700,7 +1700,7 @@ void SwView::ExecuteStatusLine(SfxRequest &rReq)
                 {
                     const SwViewOption& rViewOptions = *rSh.GetViewOptions();
                     SfxItemSet aCoreSet(m_pShell->GetPool(), SID_ATTR_ZOOM, SID_ATTR_ZOOM, SID_ATTR_VIEWLAYOUT, SID_ATTR_VIEWLAYOUT, 0 );
-                    SvxZoomItem aZoom( (SvxZoomType)rViewOptions.GetZoomType(), rViewOptions.GetZoom() );
+                    SvxZoomItem aZoom( rViewOptions.GetZoomType(), rViewOptions.GetZoom() );
 
                     const bool bBrowseMode = rSh.GetViewOptions()->getBrowseMode();
                     if( bBrowseMode )
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 477ce1f18899..59dc0a234c96 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -69,12 +69,12 @@ bool SwView::IsDocumentBorder()
         return false;
 
     return m_pWrtShell->GetViewOptions()->getBrowseMode() ||
-           SvxZoomType::PAGEWIDTH_NOBORDER == (SvxZoomType)m_pWrtShell->GetViewOptions()->GetZoomType();
+           SvxZoomType::PAGEWIDTH_NOBORDER == m_pWrtShell->GetViewOptions()->GetZoomType();
 }
 
 inline long GetLeftMargin( SwView &rView )
 {
-    SvxZoomType eType = (SvxZoomType)rView.GetWrtShell().GetViewOptions()->GetZoomType();
+    SvxZoomType eType = rView.GetWrtShell().GetViewOptions()->GetZoomType();
     long lRet = rView.GetWrtShell().GetAnyCurRect(CurRectType::PagePrt).Left();
     return eType == SvxZoomType::PERCENT   ? lRet + DOCUMENTBORDER :
            eType == SvxZoomType::PAGEWIDTH || eType == SvxZoomType::PAGEWIDTH_NOBORDER ? 0 :
@@ -1117,7 +1117,7 @@ void SwView::OuterResizePixel( const Point &rOfst, const Size &rSize )
                             pDocSh->SfxInPlaceObject::GetVisArea() );*/
         if ( m_pWrtShell->GetViewOptions()->GetZoomType() != SvxZoomType::PERCENT &&
              !m_pWrtShell->GetViewOptions()->getBrowseMode() )
-            SetZoom_( aEditSz, (SvxZoomType)m_pWrtShell->GetViewOptions()->GetZoomType(), 100, true );
+            SetZoom_( aEditSz, m_pWrtShell->GetViewOptions()->GetZoomType(), 100, true );
         m_pWrtShell->EndAction();
 
         bRepeat = bScroll1 != m_pVScrollbar->IsVisible(true);
diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 3d9af0634b78..0a54ad6f9843 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -763,20 +763,20 @@ void SwXViewSettings::_postSetValues()
     if( pView )
     {
         if(mbApplyZoom )
-            pView->SetZoom( (SvxZoomType)mpViewOption->GetZoomType(),
+            pView->SetZoom( mpViewOption->GetZoomType(),
                             mpViewOption->GetZoom(), true );
         if(mbApplyHRulerMetric)
-            pView->ChangeTabMetric((FieldUnit)eHRulerUnit);
+            pView->ChangeTabMetric(eHRulerUnit);
         if(mbApplyVRulerMetric)
-            pView->ChangeVRulerMetric((FieldUnit)eVRulerUnit);
+            pView->ChangeVRulerMetric(eVRulerUnit);
 
     }
     else
     {
         if(mbApplyHRulerMetric)
-            SW_MOD()->ApplyRulerMetric( (FieldUnit)eHRulerUnit, true, false );
+            SW_MOD()->ApplyRulerMetric( eHRulerUnit, true, false );
         if(mbApplyVRulerMetric)
-            SW_MOD()->ApplyRulerMetric( (FieldUnit)eVRulerUnit, false, false );
+            SW_MOD()->ApplyRulerMetric( eVRulerUnit, false, false );
     }
 
     SW_MOD()->ApplyUsrPref( *mpViewOption, pView, pView ? SvViewOpt::DestViewOnly
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index a93469fb96f0..d23b31d7ed43 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -907,7 +907,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
             bool bCancel;
             nResult = (sal_Int32)pUnoCursor->Find( aSearch, !pSearch->m_bStyles,
                         eStart, eEnd, bCancel,
-                        (FindRanges)eRanges,
+                        eRanges,
                         !pSearch->m_sSearchText.isEmpty() ? &aSearchOpt : nullptr );
         }
         else if(pSearch->m_bStyles)
@@ -918,7 +918,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
             bool bCancel;
             nResult = (sal_Int32)pUnoCursor->Find( *pSearchColl,
                         eStart, eEnd, bCancel,
-                        (FindRanges)eRanges, pReplaceColl );
+                        eRanges, pReplaceColl );
         }
         else
         {
@@ -927,7 +927,7 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor >
             bool bCancel;
             nResult = (sal_Int32)pUnoCursor->Find( aSearchOpt, bSearchInNotes,
                     eStart, eEnd, bCancel,
-                    (FindRanges)eRanges );
+                    eRanges );
         }
         if(nResult || (eRanges&(FindRanges::InSelAll|FindRanges::InOther)))
             break;
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index b66f21691933..9d546499f3ee 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -842,9 +842,9 @@ PolyFlags Polygon::GetFlags( sal_uInt16 nPos ) const
 {
     DBG_ASSERT( nPos < mpImplPolygon->mnPoints,
                 "Polygon::GetFlags(): nPos >= nPoints" );
-    return( mpImplPolygon->mpFlagAry ?
-            (PolyFlags) mpImplPolygon->mpFlagAry[ nPos ] :
-            PolyFlags::Normal );
+    return mpImplPolygon->mpFlagAry
+           ? mpImplPolygon->mpFlagAry[ nPos ]
+           : PolyFlags::Normal;
 }
 
 bool Polygon::HasFlags() const
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index aa201d9c6fdf..43d8c702b0f2 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -405,7 +405,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
                 }
             }
             else
-                pDispatcher->Execute( (sal_uInt16)SID_PRINTDOC, (SfxCallMode)SfxCallMode::SYNCHRON, aArgs );
+                pDispatcher->Execute( (sal_uInt16)SID_PRINTDOC, SfxCallMode::SYNCHRON, aArgs );
         }
 
     }
diff --git a/vcl/headless/svpprn.cxx b/vcl/headless/svpprn.cxx
index 0db8fd8cfad4..dfef1239dc0f 100644
--- a/vcl/headless/svpprn.cxx
+++ b/vcl/headless/svpprn.cxx
@@ -60,7 +60,7 @@ inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778
 
 static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
 {
-    pJobSetup->SetOrientation( (Orientation)(rData.m_eOrientation == orientation::Landscape ? Orientation::Landscape : Orientation::Portrait) );
+    pJobSetup->SetOrientation( rData.m_eOrientation == orientation::Landscape ? Orientation::Landscape : Orientation::Portrait );
 
     // copy page size
     OUString aPaper;
diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx
index f8321b73d650..43948c8da01e 100644
--- a/vcl/unx/generic/print/genprnpsp.cxx
+++ b/vcl/unx/generic/print/genprnpsp.cxx
@@ -153,8 +153,8 @@ inline int TenMuToPt( int nUnits ) { return (int)((((double)nUnits)/35.27777778)
 
 static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData )
 {
-    pJobSetup->SetOrientation( (Orientation)(rData.m_eOrientation == orientation::Landscape ?
-        Orientation::Landscape : Orientation::Portrait));
+    pJobSetup->SetOrientation( rData.m_eOrientation == orientation::Landscape ?
+        Orientation::Landscape : Orientation::Portrait );
 
     // copy page size
     OUString aPaper;
diff --git a/xmloff/source/text/XMLTextMarkImportContext.cxx b/xmloff/source/text/XMLTextMarkImportContext.cxx
index 58a0e1092ea7..b73ae0166d6b 100644
--- a/xmloff/source/text/XMLTextMarkImportContext.cxx
+++ b/xmloff/source/text/XMLTextMarkImportContext.cxx
@@ -213,7 +213,7 @@ void XMLTextMarkImportContext::EndElement()
                 case TypeFieldmark:
                     {
                         const char *formFieldmarkName=lcl_getFormFieldmarkName(m_sFieldName);
-                        bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmark && formFieldmarkName!=nullptr); //@TODO handle abbreviation cases..
+                        bool bImportAsField = (nTmp==TypeFieldmark && formFieldmarkName!=nullptr); //@TODO handle abbreviation cases..
                         // export point bookmark
                         const Reference<XInterface> xContent(
                             CreateAndInsertMark(GetImport(),
@@ -221,7 +221,7 @@ void XMLTextMarkImportContext::EndElement()
                                 m_sBookmarkName,
                                 m_rHelper.GetCursorAsRange()->getStart(),
                                 m_sXmlId) );
-                        if ((lcl_MarkType)nTmp==TypeFieldmark) {
+                        if (nTmp==TypeFieldmark) {
                             if (xContent.is() && bImportAsField) {
                                 // setup fieldmark...
                                 Reference< css::text::XFormField> xFormField(xContent, UNO_QUERY);
@@ -311,7 +311,7 @@ void XMLTextMarkImportContext::EndElement()
                             // create a file with subsequence
                             // start/end elements
 
-                            bool bImportAsField=((lcl_MarkType)nTmp==TypeFieldmarkEnd && m_rHelper.hasCurrentFieldCtx());
+                            bool bImportAsField = (nTmp==TypeFieldmarkEnd && m_rHelper.hasCurrentFieldCtx());
 
                             // fdo#86795 check if it's actually a checkbox first
                             bool isInvalid(false);
@@ -349,7 +349,7 @@ void XMLTextMarkImportContext::EndElement()
                                 }
                             }
 
-                            if ((lcl_MarkType)nTmp==TypeFieldmarkEnd) {
+                            if (nTmp==TypeFieldmarkEnd) {
                                 if (xContent.is() && bImportAsField) {
                                     // setup fieldmark...
                                     Reference< css::text::XFormField> xFormField(xContent, UNO_QUERY);


More information about the Libreoffice-commits mailing list