diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-15 09:02:22 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-15 09:02:22 +0100 |
commit | a5eddfbf45277eea21dd2271b36e9668313eadf3 (patch) | |
tree | 21ed6f32d767656ad1c577fd7cc948f5ca22f0f3 /sw | |
parent | 87e3d60776db4e2ff1ba0040b04a0fa348a46ffa (diff) |
More loplugin:cstylecast: sw
Change-Id: I75f75b53e58221a3bd0a6eb837483e7ebae3a02b
Diffstat (limited to 'sw')
95 files changed, 316 insertions, 323 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index a81be11690c2..8450c2f82f79 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -891,7 +891,7 @@ void Test::testRedlineFlags() // tdf#97103 check that redline mode is properly restored CPPUNIT_ASSERT_EQUAL_MESSAGE( OString(OString("redline mode not restored in ") + aFilterNames[nFilter]).getStr(), - (int)nRedlineFlags, (int)rIDRA.GetRedlineFlags()); + static_cast<int>(nRedlineFlags), static_cast<int>(rIDRA.GetRedlineFlags())); } } diff --git a/sw/qa/extras/rtfexport/rtfexport2.cxx b/sw/qa/extras/rtfexport/rtfexport2.cxx index 60032e92a145..efab6c848c6c 100644 --- a/sw/qa/extras/rtfexport/rtfexport2.cxx +++ b/sw/qa/extras/rtfexport/rtfexport2.cxx @@ -1326,7 +1326,7 @@ DECLARE_RTFEXPORT_TEST(testFooterPara, "footer-para.rtf") CPPUNIT_ASSERT_EQUAL(OUString("All Rights Reserved."), uno::Reference<text::XTextRange>(xParagraph, uno::UNO_QUERY)->getString()); CPPUNIT_ASSERT_EQUAL( - (sal_Int16)style::ParagraphAdjust_CENTER, + sal_Int16(style::ParagraphAdjust_CENTER), getProperty</*style::ParagraphAdjust*/ sal_Int16>(xParagraph, "ParaAdjust")); } diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index 5949f6f8f7a2..3dd1335e50f9 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -399,7 +399,7 @@ void SwTiledRenderingTest::testSetGraphicSelection() CPPUNIT_ASSERT_EQUAL(static_cast<sal_uInt32>(8), pObject->GetHdlCount()); // Take the bottom center one. SdrHdl* pHdl = pObject->GetHdl(6); - CPPUNIT_ASSERT_EQUAL((int)SdrHdlKind::Lower, (int)pHdl->GetKind()); + CPPUNIT_ASSERT_EQUAL(int(SdrHdlKind::Lower), static_cast<int>(pHdl->GetKind())); tools::Rectangle aShapeBefore = pObject->GetSnapRect(); // Resize. pXTextDocument->setGraphicSelection(LOK_SETGRAPHICSELECTION_START, pHdl->GetPos().getX(), pHdl->GetPos().getY()); diff --git a/sw/qa/extras/ww8export/ww8export.cxx b/sw/qa/extras/ww8export/ww8export.cxx index fa143dad4e4b..fab47934835f 100644 --- a/sw/qa/extras/ww8export/ww8export.cxx +++ b/sw/qa/extras/ww8export/ww8export.cxx @@ -1222,7 +1222,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((int)MirrorGraph::Both, (int)pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue()); + CPPUNIT_ASSERT_EQUAL(int(MirrorGraph::Both), static_cast<int>(pGrfNode->GetSwAttrSet().GetMirrorGrf().GetValue())); break; } } diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index cf7e1a4ac513..aadcb6db70a0 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -1012,7 +1012,7 @@ SwSbxValue SwCalc::Term() if( USHRT_MAX != nSbxOper ) { // #i47706: cast to SbxOperator AFTER comparing to USHRT_MAX - SbxOperator eSbxOper = (SbxOperator)nSbxOper; + SbxOperator eSbxOper = static_cast<SbxOperator>(nSbxOper); GetToken(); if( SbxEQ <= eSbxOper && eSbxOper <= SbxGE ) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 5f58c77ecc49..0360962657f4 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -508,7 +508,7 @@ bool SwCursorShell::UpDown( bool bUp, sal_uInt16 nCnt ) { CursorFlag eUpdateMode = SwCursorShell::SCROLLWIN; if( !bTableMode ) - eUpdateMode = (CursorFlag) (eUpdateMode + eUpdateMode = static_cast<CursorFlag>(eUpdateMode | SwCursorShell::UPDOWN | SwCursorShell::CHKRANGE); UpdateCursor( static_cast<sal_uInt16>(eUpdateMode) ); } diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 8cbdc024fb3b..61038ff3d98c 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -766,7 +766,7 @@ const char * dbg_out(SwNodes & rNodes) static OUString lcl_dbg_out(const SwUndo & rUndo) { - return "[ " + OUString::number((int)rUndo.GetId()) + return "[ " + OUString::number(static_cast<int>(rUndo.GetId())) + ": " + rUndo.GetComment() + " ]"; } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ec41a235f125..598ba687070b 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -961,21 +961,21 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu SwPaM aCpyPam( aSourceIdx, aSourceEndIdx ); #ifdef DBG_UTIL - SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType() + SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType()) << std::dec << " " << aSourceIdx.GetNode().GetIndex() ); aSourceIdx++; - SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType() + SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType()) << std::dec << " " << aSourceIdx.GetNode().GetIndex() ); if ( aSourceIdx.GetNode().GetNodeType() != SwNodeType::End ) { aSourceIdx++; - SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceIdx.GetNode().GetNodeType() << std::dec ); + SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceIdx.GetNode().GetNodeType()) << std::dec ); aSourceIdx--; } aSourceIdx--; SAL_INFO( "sw.docappend", ".." ); - SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceEndIdx.GetNode().GetNodeType() + SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType()) << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() ); - SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << (int) aSourceEndIdx.GetNode().GetNodeType() + SAL_INFO( "sw.docappend", "NodeType 0x" << std::hex << static_cast<int>(aSourceEndIdx.GetNode().GetNodeType()) << std::dec << " " << aSourceEndIdx.GetNode().GetIndex() ); SAL_INFO( "sw.docappend", "Src-Nd: " << CNTNT_DOC( &rSource ) ); SAL_INFO( "sw.docappend", "Nd: " << CNTNT_DOC( this ) ); @@ -1087,9 +1087,9 @@ SwNodeIndex SwDoc::AppendDoc(const SwDoc& rSource, sal_uInt16 const nStartPageNu #ifdef DBG_UTIL SAL_INFO( "sw.docappend", "Pam-Nd: " << aCpyPam.GetNode().GetIndex() - aCpyPam.GetNode( false ).GetIndex() + 1 - << " (0x" << std::hex << (int) aCpyPam.GetNode( false ).GetNodeType() << std::dec + << " (0x" << std::hex << static_cast<int>(aCpyPam.GetNode( false ).GetNodeType()) << std::dec << " " << aCpyPam.GetNode( false ).GetIndex() - << " - 0x" << std::hex << (int) aCpyPam.GetNode().GetNodeType() << std::dec + << " - 0x" << std::hex << static_cast<int>(aCpyPam.GetNode().GetNodeType()) << std::dec << " " << aCpyPam.GetNode().GetIndex() << ")" ); #endif diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx index 5e242f388a83..03e262ee2eb7 100644 --- a/sw/source/core/docnode/node.cxx +++ b/sw/source/core/docnode/node.cxx @@ -874,7 +874,7 @@ void SwNode::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterStartElement(pWriter, BAD_CAST(pName)); xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number((sal_uInt8)GetNodeType()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr())); xmlTextWriterEndElement(pWriter); @@ -958,7 +958,7 @@ void SwStartNode::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterStartElement(pWriter, BAD_CAST(pName)); xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number((sal_uInt8)GetNodeType()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("type"), BAD_CAST(OString::number(static_cast<sal_uInt8>(GetNodeType())).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(GetIndex()).getStr())); if (IsTableNode()) diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 04f718761373..b44374de6241 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -1530,7 +1530,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) aFormat.SetCharFormat( pCFormat ); if( !aNumTypes.isEmpty() ) - aFormat.SetNumberingType((SvxNumType)(aNumTypes[ 0 ] - '0')); + aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ 0 ] - '0')); if( bRTL ) aFormat.SetNumAdjust( SvxAdjust::Right ); @@ -1551,7 +1551,7 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) aFormat.SetSuffix( aPostfix.getToken( n, u'\x0001' )); aFormat.SetIncludeUpperLevels( MAXLEVEL ); if( n < aNumTypes.getLength() ) - aFormat.SetNumberingType((SvxNumType)(aNumTypes[ n ] - '0')); + aFormat.SetNumberingType(static_cast<SvxNumType>(aNumTypes[ n ] - '0')); aFormat.SetAbsLSpace( sal_uInt16( nSpaceSteps * n ) + lNumIndent ); diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index df38e7b9674b..9c3e9e0f0f72 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -196,8 +196,8 @@ bool SwAuthorityFieldType::ChangeEntryContent(const SwAuthEntry* pNewEntry) { for(int i = 0; i < AUTH_FIELD_END; ++i) { - rpTemp->SetAuthorField((ToxAuthorityField) i, - pNewEntry->GetAuthorField((ToxAuthorityField)i)); + rpTemp->SetAuthorField(static_cast<ToxAuthorityField>(i), + pNewEntry->GetAuthorField(static_cast<ToxAuthorityField>(i))); } return true; } @@ -447,7 +447,7 @@ bool SwAuthorityFieldType::PutValue( const Any& rAny, sal_uInt16 nWhichId ) { sal_Int16 nVal = -1; pValue[j].Value >>= nVal; if(nVal >= 0 && nVal < AUTH_FIELD_END) - aSortKey.eField = (ToxAuthorityField) nVal; + aSortKey.eField = static_cast<ToxAuthorityField>(nVal); else bRet = false; } @@ -642,7 +642,7 @@ bool SwAuthorityField::QueryValue( Any& rAny, sal_uInt16 /*nWhichId*/ ) const for(int i = 0; i < AUTH_FIELD_END; ++i) { pValues[i].Name = OUString::createFromAscii(aFieldNames[i]); - const OUString sField = pAuthEntry->GetAuthorField((ToxAuthorityField) i); + const OUString sField = pAuthEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)); if(i == AUTH_FIELD_AUTHORITY_TYPE) pValues[i].Value <<= sal_Int16(sField.toInt32()); else diff --git a/sw/source/core/fields/dbfld.cxx b/sw/source/core/fields/dbfld.cxx index 04bc60b6dcb6..2d1036918eb0 100644 --- a/sw/source/core/fields/dbfld.cxx +++ b/sw/source/core/fields/dbfld.cxx @@ -816,7 +816,7 @@ OUString SwDBSetNumberField::Expand() const { if(0 !=(GetSubType() & nsSwExtendedSubType::SUB_INVISIBLE) || nNumber == 0) return OUString(); - return FormatNumber(nNumber, (SvxNumType)GetFormat()); + return FormatNumber(nNumber, static_cast<SvxNumType>(GetFormat())); } void SwDBSetNumberField::Evaluate(SwDoc const * pDoc) diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index 67ade96872d2..2b9158b52a6e 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -188,22 +188,22 @@ OUString SwPageNumberField::Expand() const if( PG_NEXT == nSubType && 1 != nOffset ) { - sRet = pFieldType->Expand((SvxNumType)GetFormat(), 1, m_nPageNumber, m_nMaxPage, sUserStr); + sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), 1, m_nPageNumber, m_nMaxPage, sUserStr); if (!sRet.isEmpty()) { - sRet = pFieldType->Expand((SvxNumType)GetFormat(), nOffset, m_nPageNumber, m_nMaxPage, sUserStr); + sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), nOffset, m_nPageNumber, m_nMaxPage, sUserStr); } } else if( PG_PREV == nSubType && -1 != nOffset ) { - sRet = pFieldType->Expand((SvxNumType)GetFormat(), -1, m_nPageNumber, m_nMaxPage, sUserStr); + sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), -1, m_nPageNumber, m_nMaxPage, sUserStr); if (!sRet.isEmpty()) { - sRet = pFieldType->Expand((SvxNumType)GetFormat(), nOffset, m_nPageNumber, m_nMaxPage, sUserStr); + sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), nOffset, m_nPageNumber, m_nMaxPage, sUserStr); } } else - sRet = pFieldType->Expand((SvxNumType)GetFormat(), nOffset, m_nPageNumber, m_nMaxPage, sUserStr); + sRet = pFieldType->Expand(static_cast<SvxNumType>(GetFormat()), nOffset, m_nPageNumber, m_nMaxPage, sUserStr); return sRet; } @@ -283,7 +283,7 @@ bool SwPageNumberField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) nOffset = nSet; break; case FIELD_PROP_SUBTYPE: - switch( (text::PageNumberType) SWUnoHelper::GetEnumAsInt32( rAny ) ) + switch( static_cast<text::PageNumberType>(SWUnoHelper::GetEnumAsInt32( rAny )) ) { case text::PageNumberType_CURRENT: nSubType = PG_RANDOM; @@ -767,7 +767,7 @@ SwDocStatField::SwDocStatField(SwDocStatFieldType* pTyp, sal_uInt16 nSub, sal_uI OUString SwDocStatField::Expand() const { - return static_cast<SwDocStatFieldType*>(GetTyp())->Expand(nSubType, (SvxNumType)GetFormat()); + return static_cast<SwDocStatFieldType*>(GetTyp())->Expand(nSubType, static_cast<SvxNumType>(GetFormat())); } SwField* SwDocStatField::Copy() const @@ -2263,11 +2263,11 @@ void SwRefPageGetFieldType::UpdateField( SwTextField const * pTextField, pRefFrame->FindPageFrame()->GetPhyPageNum() + 1 : 1; - SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == (SvxNumType)pGetField->GetFormat() + SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == static_cast<SvxNumType>(pGetField->GetFormat()) ? ( !pPgFrame ? SVX_NUM_ARABIC : pPgFrame->GetPageDesc()->GetNumType().GetNumberingType() ) - : (SvxNumType)pGetField->GetFormat(); + : static_cast<SvxNumType>(pGetField->GetFormat()); const short nPageNum = std::max<short>(0, pSetField->GetOffset() + nDiff); pGetField->SetText( FormatNumber( nPageNum, nTmpFormat ) ); } @@ -2349,7 +2349,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrame* pFrame, SwRefPageGetField* pGetField = const_cast<SwRefPageGetField*>(static_cast<const SwRefPageGetField*>(pField->GetFormatField().GetField())); SvxNumType nTmpFormat = SVX_NUM_PAGEDESC == pGetField->GetFormat() ? pPgFrame->GetPageDesc()->GetNumType().GetNumberingType() - : (SvxNumType)pGetField->GetFormat(); + : static_cast<SvxNumType>(pGetField->GetFormat()); const short nPageNum = std::max<short>(0, pSetField->GetOffset() + nDiff); pGetField->SetText( FormatNumber( nPageNum, nTmpFormat ) ); } diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 43c471f4c2ac..47ebfabd28b2 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -867,7 +867,7 @@ void SwSetExpField::SetValue( const double& rAny ) SwValueField::SetValue(rAny); if( IsSequenceField() ) - sExpand = FormatNumber( GetValue(), (SvxNumType)GetFormat() ); + sExpand = FormatNumber( GetValue(), static_cast<SvxNumType>(GetFormat()) ); else sExpand = static_cast<SwValueFieldType*>(GetTyp())->ExpandValue( rAny, GetFormat(), GetLanguage()); diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 31d19e06748a..637a8fd44fa6 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -655,7 +655,7 @@ void SwFEShell::SetDragMode( SdrDragMode eDragMode ) SdrDragMode SwFEShell::GetDragMode() const { - SdrDragMode nRet = (SdrDragMode)0; + SdrDragMode nRet = SdrDragMode(0); if ( Imp()->HasDrawView() ) { nRet = Imp()->GetDrawView()->GetDragMode(); @@ -2197,7 +2197,7 @@ void SwFEShell::BreakMark() RndStdIds SwFEShell::GetAnchorId() const { - RndStdIds nRet = (RndStdIds)SHRT_MAX; + RndStdIds nRet = RndStdIds(SHRT_MAX); if ( Imp()->HasDrawView() ) { const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); @@ -2211,7 +2211,7 @@ RndStdIds SwFEShell::GetAnchorId() const } SwDrawContact *pContact = static_cast<SwDrawContact*>(GetUserCall(pObj)); RndStdIds nId = pContact->GetFormat()->GetAnchor().GetAnchorId(); - if ( nRet == (RndStdIds)SHRT_MAX ) + if ( nRet == RndStdIds(SHRT_MAX) ) nRet = nId; else if ( nRet != nId ) { @@ -2220,7 +2220,7 @@ RndStdIds SwFEShell::GetAnchorId() const } } } - if ( nRet == (RndStdIds)SHRT_MAX ) + if ( nRet == RndStdIds(SHRT_MAX) ) nRet = RndStdIds::UNKNOWN; return nRet; } diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx index 53a1df5601d4..16565fe405e3 100644 --- a/sw/source/core/graphic/grfatr.cxx +++ b/sw/source/core/graphic/grfatr.cxx @@ -288,13 +288,13 @@ SfxPoolItem* SwDrawModeGrf::Clone( SfxItemPool * ) const sal_uInt16 SwDrawModeGrf::GetValueCount() const { - return (sal_uInt16)GraphicDrawMode::Watermark + 1; + return sal_uInt16(GraphicDrawMode::Watermark) + 1; } bool SwDrawModeGrf::QueryValue( uno::Any& rVal, sal_uInt8 ) const { - drawing::ColorMode eRet = (drawing::ColorMode)GetEnumValue(); + drawing::ColorMode eRet = static_cast<drawing::ColorMode>(GetEnumValue()); rVal <<= eRet; return true; } @@ -303,7 +303,7 @@ bool SwDrawModeGrf::PutValue( const uno::Any& rVal, sal_uInt8 ) { sal_Int32 eVal = SWUnoHelper::GetEnumAsInt32( rVal ); - if(eVal >= 0 && eVal <= (sal_uInt16)GraphicDrawMode::Watermark) + if(eVal >= 0 && eVal <= sal_uInt16(GraphicDrawMode::Watermark)) { SetEnumValue(static_cast<sal_uInt16>(eVal)); return true; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 168ca934de67..dc16db754289 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -376,7 +376,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nType = 0; if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE ) { - SetHeightSizeType((SwFrameSize)nType); + SetHeightSizeType(static_cast<SwFrameSize>(nType)); } else bRet = false; @@ -393,7 +393,7 @@ bool SwFormatFrameSize::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) sal_Int16 nType = 0; if((rVal >>= nType) && nType >= 0 && nType <= ATT_MIN_SIZE ) { - SetWidthSizeType((SwFrameSize)nType); + SetWidthSizeType(static_cast<SwFrameSize>(nType)); } else bRet = false; @@ -1124,7 +1124,7 @@ void SwFormatCol::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatCol")); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eLineStyle"), BAD_CAST(OString::number((sal_Int16)m_eLineStyle).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eLineStyle"), BAD_CAST(OString::number(static_cast<sal_Int16>(m_eLineStyle)).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineWidth"), BAD_CAST(OString::number(m_nLineWidth).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aLineColor"), BAD_CAST(m_aLineColor.AsRGBHexString().toUtf8().getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLineHeight"), BAD_CAST(OString::number(m_nLineHeight).getStr())); @@ -1202,7 +1202,7 @@ bool SwFormatSurround::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) { case MID_SURROUND_SURROUNDTYPE: { - css::text::WrapTextMode eVal = (css::text::WrapTextMode) SWUnoHelper::GetEnumAsInt32( rVal ); + css::text::WrapTextMode eVal = static_cast<css::text::WrapTextMode>(SWUnoHelper::GetEnumAsInt32( rVal )); if( eVal >= css::text::WrapTextMode_NONE && eVal <= css::text::WrapTextMode_RIGHT ) SetValue( eVal ); else { @@ -1232,7 +1232,7 @@ void SwFormatSurround::dumpAsXml(xmlTextWriterPtr pWriter) const { xmlTextWriterStartElement(pWriter, BAD_CAST("SwFormatSurround")); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number((sal_Int32)GetValue()).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(static_cast<sal_Int32>(GetValue())).getStr())); OUString aPresentation; IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag()); @@ -1625,7 +1625,7 @@ bool SwFormatAnchor::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) case MID_ANCHOR_ANCHORTYPE: { RndStdIds eAnchor; - switch( (text::TextContentAnchorType) SWUnoHelper::GetEnumAsInt32( rVal ) ) + switch( static_cast<text::TextContentAnchorType>(SWUnoHelper::GetEnumAsInt32( rVal )) ) { case text::TextContentAnchorType_AS_CHARACTER: eAnchor = RndStdIds::FLY_AS_CHAR; @@ -1696,7 +1696,7 @@ void SwFormatAnchor::dumpAsXml(xmlTextWriterPtr pWriter) const } else xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pContentAnchor"), "%p", m_pContentAnchor.get()); - xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_eAnchorType"), BAD_CAST(OString::number((int)m_eAnchorId).getStr())); + xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_eAnchorType"), BAD_CAST(OString::number(static_cast<int>(m_eAnchorId)).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nPageNumber"), BAD_CAST(OString::number(m_nPageNumber).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nOrder"), BAD_CAST(OString::number(m_nOrder).getStr())); xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nOrderCounter"), BAD_CAST(OString::number(m_nOrderCounter).getStr())); @@ -1990,7 +1990,7 @@ bool SwFormatFootnoteEndAtTextEnd::PutValue( const uno::Any& rVal, sal_uInt8 nMe (nVal <= SVX_NUM_ARABIC || SVX_NUM_CHARS_UPPER_LETTER_N == nVal || SVX_NUM_CHARS_LOWER_LETTER_N == nVal )) - aFormat.SetNumberingType((SvxNumType)nVal); + aFormat.SetNumberingType(static_cast<SvxNumType>(nVal)); else bRet = false; } diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index 0f9f854bd10c..4fdb596890a8 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -1773,8 +1773,8 @@ bool SwScriptInfo::IsArabicText( const OUString& rText, sal_Int32 nStt, sal_Int3 { using namespace ::com::sun::star::i18n; static const ScriptTypeList typeList[] = { - { UnicodeScript_kArabic, UnicodeScript_kArabic, (sal_Int16)UnicodeScript_kArabic }, // 11, - { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, (sal_Int16)UnicodeScript_kScriptCount } // 88 + { UnicodeScript_kArabic, UnicodeScript_kArabic, sal_Int16(UnicodeScript_kArabic) }, // 11, + { UnicodeScript_kScriptCount, UnicodeScript_kScriptCount, sal_Int16(UnicodeScript_kScriptCount) } // 88 }; // go forward if current position does not hold a regular character: @@ -1799,8 +1799,8 @@ bool SwScriptInfo::IsArabicText( const OUString& rText, sal_Int32 nStt, sal_Int3 if( nIdx >= 0 ) { const sal_Unicode cCh = rText[nIdx]; - const sal_Int16 type = unicode::getUnicodeScriptType( cCh, typeList, (sal_Int16)UnicodeScript_kScriptCount ); - return type == (sal_Int16)UnicodeScript_kArabic; + const sal_Int16 type = unicode::getUnicodeScriptType( cCh, typeList, sal_Int16(UnicodeScript_kScriptCount) ); + return type == sal_Int16(UnicodeScript_kArabic); } return false; } diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index ab06a65c8f30..3dde379f61a2 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -159,13 +159,13 @@ SwExpandPortion *SwTextFormatter::NewFieldPortion( SwTextFormatInfo &rInf, sal_uInt16 nVirtNum = pFrame->GetVirtPageNum(); sal_uInt16 nNumPages = pTmpRootFrame->GetPageNum(); - SvxNumType nNumFormat = (SvxNumType)-1; + SvxNumType nNumFormat = SvxNumType(-1); if(SVX_NUM_PAGEDESC == pField->GetFormat()) nNumFormat = pFrame->FindPageFrame()->GetPageDesc()->GetNumType().GetNumberingType(); static_cast<SwPageNumberField*>(pField) ->ChangeExpansion(nVirtNum, nNumPages); pPageNr->ChangeExpansion(pDoc, - bVirt, nNumFormat != (SvxNumType)-1 ? &nNumFormat : nullptr); + bVirt, nNumFormat != SvxNumType(-1) ? &nNumFormat : nullptr); } { OUString const aStr( bName diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx index 3742fd1e3cd0..2d47ce052191 100644 --- a/sw/source/core/tox/ToxTextGenerator.cxx +++ b/sw/source/core/tox/ToxTextGenerator.cxx @@ -235,7 +235,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<SwTOXSortTabBase*> case TOKEN_AUTHORITY: { - ToxAuthorityField eField = (ToxAuthorityField)aToken.nAuthorityField; + ToxAuthorityField eField = static_cast<ToxAuthorityField>(aToken.nAuthorityField); SwIndex aIdx( pTOXNd, rText.getLength() ); rBase.FillText( *pTOXNd, aIdx, static_cast<sal_uInt16>(eField) ); } diff --git a/sw/source/core/tox/txmsrt.cxx b/sw/source/core/tox/txmsrt.cxx index 1dbf513ea962..12ebbda94dc7 100644 --- a/sw/source/core/tox/txmsrt.cxx +++ b/sw/source/core/tox/txmsrt.cxx @@ -711,10 +711,10 @@ void SwTOXAuthority::FillText( SwTextNode& rNd, { sal_uInt16 nLevel = GetLevel(); if(nLevel) - sText = SwAuthorityFieldType::GetAuthTypeName((ToxAuthorityType) --nLevel); + sText = SwAuthorityFieldType::GetAuthTypeName(static_cast<ToxAuthorityType>(--nLevel)); } else - sText = pField->GetFieldText((ToxAuthorityField) nAuthField); + sText = pField->GetFieldText(static_cast<ToxAuthorityField>(nAuthField)); rNd.InsertText( sText, rInsPos ); } diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index 846e93e93566..c1d25970f7d1 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -443,7 +443,7 @@ bool SwFormatRuby::QueryValue( uno::Any& rVal, switch( nMemberId ) { case MID_RUBY_TEXT: rVal <<= m_sRubyText; break; - case MID_RUBY_ADJUST: rVal <<= (sal_Int16)m_eAdjustment; break; + case MID_RUBY_ADJUST: rVal <<= static_cast<sal_Int16>(m_eAdjustment); break; case MID_RUBY_CHARSTYLE: { OUString aString; @@ -475,8 +475,8 @@ bool SwFormatRuby::PutValue( const uno::Any& rVal, { sal_Int16 nSet = 0; rVal >>= nSet; - if(nSet >= (sal_Int16)text::RubyAdjust_LEFT && nSet <= (sal_Int16)text::RubyAdjust_INDENT_BLOCK) - m_eAdjustment = (text::RubyAdjust)nSet; + if(nSet >= sal_Int16(text::RubyAdjust_LEFT) && nSet <= sal_Int16(text::RubyAdjust_INDENT_BLOCK)) + m_eAdjustment = static_cast<text::RubyAdjust>(nSet); else bRet = false; } diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 3f6168b95d6d..fa185a4a24af 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -288,7 +288,7 @@ UndoManager::StartUndo(SwUndoId const i_eUndoId, if (const SwView* pView = m_pDocShell->GetView()) nViewShellId = pView->GetViewShellId(); } - SdrUndoManager::EnterListAction(comment, comment, (sal_uInt16)eUndoId, nViewShellId); + SdrUndoManager::EnterListAction(comment, comment, static_cast<sal_uInt16>(eUndoId), nViewShellId); return eUndoId; } @@ -320,7 +320,7 @@ UndoManager::EndUndo(SwUndoId eUndoId, SwRewriter const*const pRewriter) assert(pListAction); if (SwUndoId::END != eUndoId) { - OSL_ENSURE((SwUndoId)pListAction->GetId() == eUndoId, + OSL_ENSURE(static_cast<SwUndoId>(pListAction->GetId()) == eUndoId, "EndUndo(): given ID different from StartUndo()"); // comment set by caller of EndUndo OUString comment = GetUndoComment(eUndoId); @@ -330,7 +330,7 @@ UndoManager::EndUndo(SwUndoId eUndoId, SwRewriter const*const pRewriter) } pListAction->SetComment(comment); } - else if (SwUndoId::START != (SwUndoId)pListAction->GetId()) + else if (SwUndoId::START != static_cast<SwUndoId>(pListAction->GetId())) { // comment set by caller of StartUndo: nothing to do here } @@ -386,7 +386,7 @@ UndoManager::GetLastUndoInfo( if (o_pId) { if (auto pListAction = dynamic_cast<const SfxListUndoAction*>(pAction)) - *o_pId = (SwUndoId)pListAction->GetId(); + *o_pId = static_cast<SwUndoId>(pListAction->GetId()); else if (auto pSwAction = dynamic_cast<const SwUndo*>(pAction)) *o_pId = pSwAction->GetId(); else @@ -449,7 +449,7 @@ bool UndoManager::GetFirstRedoInfo(OUString *const o_pStr, if (o_pId) { if (auto pListAction = dynamic_cast<const SfxListUndoAction*>(pAction)) - *o_pId = (SwUndoId)pListAction->GetId(); + *o_pId = static_cast<SwUndoId>(pListAction->GetId()); else if (auto pSwAction = dynamic_cast<const SwUndo*>(pAction)) *o_pId = pSwAction->GetId(); else @@ -690,7 +690,7 @@ bool UndoManager::Repeat(::sw::RepeatContext & rContext, if (const SwView* pView = m_pDocShell->GetView()) nViewShellId = pView->GetViewShellId(); } - EnterListAction(comment, rcomment, (sal_uInt16)nId, nViewShellId); + EnterListAction(comment, rcomment, static_cast<sal_uInt16>(nId), nViewShellId); } SwPaM* pTmp = rContext.m_pCurrentPaM; diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 40c7131895eb..449479da46e9 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -1255,7 +1255,7 @@ void SwUndoSaveSection::RestoreSection( SwDoc* pDoc, SwNodeIndex* pIdx, // move the content from UndoNodes array into Fly SwStartNode* pSttNd = SwNodes::MakeEmptySection( aSttIdx, - (SwStartNodeType)nSectType ); + static_cast<SwStartNodeType>(nSectType) ); RestoreSection( pDoc, SwNodeIndex( *pSttNd->EndOfSectionNode() )); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 16046257a0af..924016037b52 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -1844,7 +1844,7 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext) SwTable& rTable = pTableNd->GetTable(); SwTableBox* pBox = rTable.GetTableBox( nCurrBox ); TableChgMode eOldMode = rTable.GetTableChgMode(); - rTable.SetTableChgMode( (TableChgMode)nCount ); + rTable.SetTableChgMode( static_cast<TableChgMode>(nCount) ); rDoc.SetColRowWidthHeight( *pBox, nSetColType, nAbsDiff, nRelDiff ); rTable.SetTableChgMode( eOldMode ); } @@ -1876,7 +1876,7 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext) SwTableBox* pBox = rTable.GetTableBox( nCurrBox ); TableChgMode eOldMode = rTable.GetTableChgMode(); - rTable.SetTableChgMode( (TableChgMode)nCount ); + rTable.SetTableChgMode( static_cast<TableChgMode>(nCount) ); // need the SaveSections! rDoc.GetIDocumentUndoRedo().DoUndo( true ); diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index fb30f4624f2b..a74c3710b1e4 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -475,8 +475,8 @@ OUString SwXServiceProvider::GetProviderName(SwServiceType nObjectType) SolarMutexGuard aGuard; OUString sRet; const sal_uInt16 nEntries = SAL_N_ELEMENTS(aProvNamesId); - if((sal_uInt16)nObjectType < nEntries) - sRet = OUString::createFromAscii(aProvNamesId[(sal_uInt16)nObjectType].pName); + if(static_cast<sal_uInt16>(nObjectType) < nEntries) + sRet = OUString::createFromAscii(aProvNamesId[static_cast<sal_uInt16>(nObjectType)].pName); return sRet; } diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx index bd16087cb7a1..d207d0cf2106 100644 --- a/sw/source/core/unocore/unodraw.cxx +++ b/sw/source/core/unocore/unodraw.cxx @@ -1231,7 +1231,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a aList.InsertEntry(aMark); sal_Int32 nAnchor = 0; cppu::enum2int( nAnchor, aValue ); - pDoc->ChgAnchor( aList, (RndStdIds)nAnchor, + pDoc->ChgAnchor( aList, static_cast<RndStdIds>(nAnchor), false, true ); } else @@ -1276,7 +1276,7 @@ void SwXShape::setPropertyValue(const OUString& rPropertyName, const uno::Any& a if(RES_ANCHOR == pEntry->nWID && MID_ANCHOR_ANCHORTYPE == pEntry->nMemberId) { bool bSetAttr = true; - text::TextContentAnchorType eNewAnchor = (text::TextContentAnchorType)SWUnoHelper::GetEnumAsInt32( aValue ); + text::TextContentAnchorType eNewAnchor = static_cast<text::TextContentAnchorType>(SWUnoHelper::GetEnumAsInt32( aValue )); //if old anchor was in_cntnt the related text attribute has to be removed const SwFormatAnchor& rOldAnchor = pFormat->GetAnchor(); diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 61d40eb889ea..de09842ea8e8 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1508,7 +1508,7 @@ void SAL_CALL SwXTextField::attach( { SwFieldType* pFieldType = pDoc->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DocInfo); sal_uInt16 nSubType = aDocInfoSubTypeFromService[ - (sal_uInt16)m_pImpl->m_nServiceId - (sal_uInt16)SwServiceType::FieldTypeDocInfoChangeAuthor]; + static_cast<sal_uInt16>(m_pImpl->m_nServiceId) - sal_uInt16(SwServiceType::FieldTypeDocInfoChangeAuthor)]; if (SwServiceType::FieldTypeDocInfoChangeDateTime == m_pImpl->m_nServiceId || SwServiceType::FieldTypeDocInfoCreateDateTime == m_pImpl->m_nServiceId || SwServiceType::FieldTypeDocInfoPrintDateTime == m_pImpl->m_nServiceId || diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index a347b0820708..4eea5204a6c8 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -625,7 +625,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI throw lang::IllegalArgumentException(); } - eMode = (drawing::BitmapMode)nMode; + eMode = static_cast<drawing::BitmapMode>(nMode); } rToSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); @@ -1818,7 +1818,7 @@ void SwXFrame::setPropertyValue(const OUString& rPropertyName, const ::uno::Any& throw lang::IllegalArgumentException(); } - eMode = (drawing::BitmapMode)nMode; + eMode = static_cast<drawing::BitmapMode>(nMode); } aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx index 4cafb4bd51ee..8841f50de1db 100644 --- a/sw/source/core/unocore/unosett.cxx +++ b/sw/source/core/unocore/unosett.cxx @@ -252,9 +252,9 @@ const o3tl::enumarray<SvxAdjust, unsigned short> aSvxToUnoAdjust const unsigned short aUnoToSvxAdjust[] = { USHRT_MAX, - (unsigned short)SvxAdjust::Right, // 1 - (unsigned short)SvxAdjust::Center, // 3 - (unsigned short)SvxAdjust::Left, // 0 + static_cast<unsigned short>(SvxAdjust::Right), // 1 + static_cast<unsigned short>(SvxAdjust::Center), // 3 + static_cast<unsigned short>(SvxAdjust::Left), // 0 USHRT_MAX, USHRT_MAX }; @@ -330,7 +330,7 @@ void SwXFootnoteProperties::setPropertyValue(const OUString& rPropertyName, cons nTmp > SVX_NUM_BITMAP))) throw lang::IllegalArgumentException(); - aFootnoteInfo.aFormat.SetNumberingType((SvxNumType)nTmp); + aFootnoteInfo.aFormat.SetNumberingType(static_cast<SvxNumType>(nTmp)); } break; @@ -613,7 +613,7 @@ void SwXEndnoteProperties::setPropertyValue(const OUString& rPropertyName, const { sal_Int16 nTmp = 0; aValue >>= nTmp; - aEndInfo.aFormat.SetNumberingType((SvxNumType)nTmp); + aEndInfo.aFormat.SetNumberingType(static_cast<SvxNumType>(nTmp)); } break; case WID_START_AT: @@ -828,7 +828,7 @@ void SwXLineNumberingProperties::setPropertyValue( SvxNumberType aNumType(aFontMetric.GetNumType()); sal_Int16 nTmp = 0; aValue >>= nTmp; - aNumType.SetNumberingType((SvxNumType)nTmp); + aNumType.SetNumberingType(static_cast<SvxNumType>(nTmp)); aFontMetric.SetNumType(aNumType); } break; @@ -1648,7 +1648,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( nValue <= text::HoriOrientation::LEFT && USHRT_MAX != aUnoToSvxAdjust[nValue]) { - aFormat.SetNumAdjust((SvxAdjust)aUnoToSvxAdjust[nValue]); + aFormat.SetNumAdjust(static_cast<SvxAdjust>(aUnoToSvxAdjust[nValue])); } else bWrongArg = true; @@ -1837,7 +1837,7 @@ void SwXNumberingRules::SetPropertiesToNumFormat( sal_Int16 nSet = 0; pProp->Value >>= nSet; if(nSet >= 0) - aFormat.SetNumberingType((SvxNumType)nSet); + aFormat.SetNumberingType(static_cast<SvxNumType>(nSet)); else bWrongArg = true; } @@ -2446,7 +2446,7 @@ void SwXTextColumns::setPropertyValue( const OUString& rPropertyName, const Any& sal_Int8 nTmp = 0; if (! ( aValue >>= nTmp ) ) throw IllegalArgumentException(); - nSepLineVertAlign = (style::VerticalAlignment)nTmp; + nSepLineVertAlign = static_cast<style::VerticalAlignment>(nTmp); } else nSepLineVertAlign = eAlign; diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index b83289107d26..78c172462a5d 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -1664,7 +1664,7 @@ void SwXStyle::SetPropertyValue<OWN_ATTR_FILLBMP_MODE>(const SfxItemPropertySimp { if(!rValue.has<sal_Int32>()) throw lang::IllegalArgumentException(); - eMode = ((drawing::BitmapMode)rValue.get<sal_Int32>()); + eMode = static_cast<drawing::BitmapMode>(rValue.get<sal_Int32>()); } SfxItemSet& rStyleSet = o_rStyleBase.GetItemSet(); rStyleSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); @@ -3661,7 +3661,7 @@ uno::Reference< style::XAutoStyle > SwXAutoStyleFamily::insertStyle( throw lang::IllegalArgumentException(); } - eMode = (drawing::BitmapMode)nMode; + eMode = static_cast<drawing::BitmapMode>(nMode); } aSet.Put(XFillBmpStretchItem(drawing::BitmapMode_STRETCH == eMode)); diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index f96d295d2513..5ccea69bb624 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -1205,8 +1205,7 @@ HTMLOnOffState HTMLEndPosLst::GetHTMLItemState( const SfxPoolItem& rItem ) break; case RES_CHRATR_ESCAPEMENT: - switch( (SvxEscapement) - static_cast<const SvxEscapementItem&>(rItem).GetEnumValue() ) + switch( static_cast<SvxEscapement>(static_cast<const SvxEscapementItem&>(rItem).GetEnumValue()) ) { case SvxEscapement::Superscript: case SvxEscapement::Subscript: @@ -2778,7 +2777,7 @@ static Writer& OutHTML_SvxEscapement( Writer& rWrt, const SfxPoolItem& rHt ) return rWrt; const SvxEscapement eEscape = - (SvxEscapement)static_cast<const SvxEscapementItem&>(rHt).GetEnumValue(); + static_cast<SvxEscapement>(static_cast<const SvxEscapementItem&>(rHt).GetEnumValue()); const sal_Char *pStr = nullptr; switch( eEscape ) { @@ -2830,7 +2829,7 @@ static Writer& OutHTML_SwFlyCnt( Writer& rWrt, const SfxPoolItem& rHt ) const SdrObject *pSdrObj = nullptr; SwHTMLFrameType eType = - (SwHTMLFrameType)rHTMLWrt.GuessFrameType( rFormat, pSdrObj ); + static_cast<SwHTMLFrameType>(rHTMLWrt.GuessFrameType( rFormat, pSdrObj )); AllHtmlFlags nMode = aHTMLOutFrameAsCharTable[eType][rHTMLWrt.m_nExportMode]; rHTMLWrt.OutFrameFormat( nMode, rFormat, pSdrObj ); return rWrt; diff --git a/sw/source/filter/html/htmldrawreader.cxx b/sw/source/filter/html/htmldrawreader.cxx index f6d64cdf2646..a6514534d4b5 100644 --- a/sw/source/filter/html/htmldrawreader.cxx +++ b/sw/source/filter/html/htmldrawreader.cxx @@ -60,14 +60,14 @@ static HTMLOptionEnum<SdrTextAniKind> aHTMLMarqBehaviorTable[] = { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll, SdrTextAniKind::Scroll }, { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate, SdrTextAniKind::Alternate }, { OOO_STRING_SVTOOLS_HTML_BEHAV_slide, SdrTextAniKind::Slide }, - { nullptr, (SdrTextAniKind)0 } + { nullptr, SdrTextAniKind(0) } }; static HTMLOptionEnum<SdrTextAniDirection> aHTMLMarqDirectionTable[] = { { OOO_STRING_SVTOOLS_HTML_AL_left, SdrTextAniDirection::Left }, { OOO_STRING_SVTOOLS_HTML_AL_right, SdrTextAniDirection::Right }, - { nullptr, (SdrTextAniDirection)0 } + { nullptr, SdrTextAniDirection(0) } }; void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj, diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 0ee651f50568..d02e48de9082 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -54,7 +54,7 @@ static HTMLOptionEnum<SwFieldIds> aHTMLFieldTypeTable[] = { OOO_STRING_SW_HTML_FT_docinfo, SwFieldIds::DocInfo }, { OOO_STRING_SW_HTML_FT_docstat, SwFieldIds::DocStat }, { OOO_STRING_SW_HTML_FT_filename, SwFieldIds::Filename }, - { nullptr, (SwFieldIds)0 } + { nullptr, SwFieldIds(0) } }; static HTMLNumFormatTableEntry aHTMLDateFieldFormatTable[] = @@ -99,7 +99,7 @@ static HTMLOptionEnum<SvxNumType> aHTMLPageNumFieldFormatTable[] = { OOO_STRING_SW_HTML_FF_page, SVX_NUM_PAGEDESC }, { OOO_STRING_SW_HTML_FF_ulettern, SVX_NUM_CHARS_UPPER_LETTER_N }, { OOO_STRING_SW_HTML_FF_llettern, SVX_NUM_CHARS_LOWER_LETTER_N }, - { nullptr, (SvxNumType)0 } + { nullptr, SvxNumType(0) } }; static HTMLOptionEnum<SwExtUserSubType> aHTMLExtUsrFieldSubTable[] = @@ -119,14 +119,14 @@ static HTMLOptionEnum<SwExtUserSubType> aHTMLExtUsrFieldSubTable[] = { OOO_STRING_SW_HTML_FS_fax, EU_FAX }, { OOO_STRING_SW_HTML_FS_email, EU_EMAIL }, { OOO_STRING_SW_HTML_FS_state, EU_STATE }, - { nullptr, (SwExtUserSubType)0 } + { nullptr, SwExtUserSubType(0) } }; static HTMLOptionEnum<SwAuthorFormat> aHTMLAuthorFieldFormatTable[] = { { OOO_STRING_SW_HTML_FF_name, AF_NAME }, { OOO_STRING_SW_HTML_FF_shortcut, AF_SHORTCUT }, - { nullptr, (SwAuthorFormat)0 } + { nullptr, SwAuthorFormat(0) } }; static HTMLOptionEnum<SwPageNumSubType> aHTMLPageNumFieldSubTable[] = @@ -134,7 +134,7 @@ static HTMLOptionEnum<SwPageNumSubType> aHTMLPageNumFieldSubTable[] = { OOO_STRING_SW_HTML_FS_random, PG_RANDOM }, { OOO_STRING_SW_HTML_FS_next, PG_NEXT }, { OOO_STRING_SW_HTML_FS_prev, PG_PREV }, - { nullptr, (SwPageNumSubType)0 } + { nullptr, SwPageNumSubType(0) } }; // UGLY: these are extensions of nsSwDocInfoSubType (in inc/docufld.hxx) @@ -178,7 +178,7 @@ static HTMLOptionEnum<SwDocStatSubType> aHTMLDocStatFieldSubTable[] = { OOO_STRING_SW_HTML_FS_tbl, DS_TBL }, { OOO_STRING_SW_HTML_FS_grf, DS_GRF }, { OOO_STRING_SW_HTML_FS_ole, DS_OLE }, - { nullptr, (SwDocStatSubType)0 } + { nullptr, SwDocStatSubType(0) } }; static HTMLOptionEnum<SwFileNameFormat> aHTMLFileNameFieldFormatTable[] = @@ -187,7 +187,7 @@ static HTMLOptionEnum<SwFileNameFormat> aHTMLFileNameFieldFormatTable[] = { OOO_STRING_SW_HTML_FF_pathname, FF_PATHNAME }, { OOO_STRING_SW_HTML_FF_path, FF_PATH }, { OOO_STRING_SW_HTML_FF_name_noext, FF_NAME_NOEXT }, - { nullptr, (SwFileNameFormat)0 } + { nullptr, SwFileNameFormat(0) } }; SvxNumType SwHTMLParser::GetNumType( const OUString& rStr, SvxNumType nDfltType ) @@ -308,7 +308,7 @@ void SwHTMLParser::NewField() pFormatOption->GetEnum( nFormat, aHTMLAuthorFieldFormatTable ); if( bFixed ) { - nFormat = (SwAuthorFormat)(static_cast<int>(nFormat) | AF_FIXED); + nFormat = static_cast<SwAuthorFormat>(static_cast<int>(nFormat) | AF_FIXED); bInsOnEndTag = true; } @@ -502,7 +502,7 @@ void SwHTMLParser::NewField() pFormatOption->GetEnum( nFormat, aHTMLFileNameFieldFormatTable ); if( bFixed ) { - nFormat = (SwFileNameFormat)(static_cast<int>(nFormat) | FF_FIXED); + nFormat = static_cast<SwFileNameFormat>(static_cast<int>(nFormat) | FF_FIXED); bInsOnEndTag = true; } diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 5d1d22114fb7..e1abdba1735d 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -41,7 +41,7 @@ const sal_Char *SwHTMLWriter::GetNumFormat( sal_uInt16 nFormat ) { const sal_Char *pFormatStr = nullptr; - switch( (SvxNumType)nFormat ) + switch( static_cast<SvxNumType>(nFormat) ) { case SVX_NUM_CHARS_UPPER_LETTER: pFormatStr = OOO_STRING_SW_HTML_FF_uletter; break; case SVX_NUM_CHARS_LOWER_LETTER: pFormatStr = OOO_STRING_SW_HTML_FF_lletter; break; @@ -83,7 +83,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, { case SwFieldIds::ExtUser: pTypeStr = OOO_STRING_SW_HTML_FT_sender; - switch( (SwExtUserSubType)pField->GetSubType() ) + switch( static_cast<SwExtUserSubType>(pField->GetSubType()) ) { case EU_COMPANY: pSubStr = OOO_STRING_SW_HTML_FS_company; break; case EU_FIRSTNAME: pSubStr = OOO_STRING_SW_HTML_FS_firstname; break; @@ -109,7 +109,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, case SwFieldIds::Author: pTypeStr = OOO_STRING_SW_HTML_FT_author; - switch( (SwAuthorFormat)nFormat & 0xff) + switch( static_cast<SwAuthorFormat>(nFormat) & 0xff) { case AF_NAME: pFormatStr = OOO_STRING_SW_HTML_FF_name; break; case AF_SHORTCUT: pFormatStr = OOO_STRING_SW_HTML_FF_shortcut; break; @@ -131,7 +131,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, case SwFieldIds::PageNumber: { pTypeStr = OOO_STRING_SW_HTML_FT_page; - SwPageNumSubType eSubType = (SwPageNumSubType)pField->GetSubType(); + SwPageNumSubType eSubType = static_cast<SwPageNumSubType>(pField->GetSubType()); switch( eSubType ) { case PG_RANDOM: pSubStr = OOO_STRING_SW_HTML_FS_random; break; @@ -141,7 +141,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, OSL_ENSURE( pSubStr, "unknown sub type for SwPageNumberField" ); pFormatStr = SwHTMLWriter::GetNumFormat( static_cast< sal_uInt16 >(nFormat) ); - if( (SvxNumType)nFormat==SVX_NUM_CHAR_SPECIAL ) + if( static_cast<SvxNumType>(nFormat)==SVX_NUM_CHAR_SPECIAL ) { aValue = static_cast<const SwPageNumberField *>(pField)->GetUserString(); } @@ -240,7 +240,7 @@ static Writer& OutHTML_SwField( Writer& rWrt, const SwField* pField, case SwFieldIds::Filename: pTypeStr = OOO_STRING_SW_HTML_FT_filename; - switch( (SwFileNameFormat)(nFormat & ~FF_FIXED) ) + switch( static_cast<SwFileNameFormat>(nFormat & ~FF_FIXED) ) { case FF_NAME: pFormatStr = OOO_STRING_SW_HTML_FF_name; break; case FF_PATHNAME: pFormatStr = OOO_STRING_SW_HTML_FF_pathname; break; diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 68d3046e1eef..757a08378df4 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -205,7 +205,7 @@ sal_uInt16 SwHTMLWriter::GuessFrameType( const SwFrameFormat& rFrameFormat, else if( pNd->IsOLENode() ) { // applet, plugin, floating frame - eType = (SwHTMLFrameType)GuessOLENodeFrameType( *pNd ); + eType = static_cast<SwHTMLFrameType>(GuessOLENodeFrameType( *pNd )); } else { @@ -301,7 +301,7 @@ void SwHTMLWriter::CollectFlyFrames() const SdrObject *pSdrObj = nullptr; const SwPosition *pAPos; const SwContentNode *pACNd; - SwHTMLFrameType eType = (SwHTMLFrameType)GuessFrameType( rFrameFormat, pSdrObj ); + SwHTMLFrameType eType = static_cast<SwHTMLFrameType>(GuessFrameType( rFrameFormat, pSdrObj )); AllHtmlFlags nMode; const SwFormatAnchor& rAnchor = rFrameFormat.GetAnchor(); diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 71d461ba7bff..c40d30bf543d 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -91,7 +91,7 @@ static HTMLOptionEnum<FormSubmitMethod> aHTMLFormMethodTable[] = { { OOO_STRING_SVTOOLS_HTML_METHOD_get, FormSubmitMethod_GET }, { OOO_STRING_SVTOOLS_HTML_METHOD_post, FormSubmitMethod_POST }, - { nullptr, (FormSubmitMethod)0 } + { nullptr, FormSubmitMethod(0) } }; static HTMLOptionEnum<FormSubmitEncoding> aHTMLFormEncTypeTable[] = @@ -99,7 +99,7 @@ static HTMLOptionEnum<FormSubmitEncoding> aHTMLFormEncTypeTable[] = { OOO_STRING_SVTOOLS_HTML_ET_url, FormSubmitEncoding_URL }, { OOO_STRING_SVTOOLS_HTML_ET_multipart, FormSubmitEncoding_MULTIPART }, { OOO_STRING_SVTOOLS_HTML_ET_text, FormSubmitEncoding_TEXT }, - { nullptr, (FormSubmitEncoding)0 } + { nullptr, FormSubmitEncoding(0) } }; enum HTMLWordWrapMode { HTML_WM_OFF, HTML_WM_HARD, HTML_WM_SOFT }; @@ -111,7 +111,7 @@ static HTMLOptionEnum<HTMLWordWrapMode> aHTMLTextAreaWrapTable[] = { OOO_STRING_SVTOOLS_HTML_WW_soft, HTML_WM_SOFT }, { OOO_STRING_SVTOOLS_HTML_WW_physical, HTML_WM_HARD }, { OOO_STRING_SVTOOLS_HTML_WW_virtual, HTML_WM_SOFT }, - { nullptr, (HTMLWordWrapMode)0 } + { nullptr, HTMLWordWrapMode(0) } }; static SvMacroItemId aEventTypeTable[] = diff --git a/sw/source/filter/html/htmlforw.cxx b/sw/source/filter/html/htmlforw.cxx index cf12af48e9c9..cd2548cd0a26 100644 --- a/sw/source/filter/html/htmlforw.cxx +++ b/sw/source/filter/html/htmlforw.cxx @@ -1088,7 +1088,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, { auto aTmp2 = xPropSet->getPropertyValue( "FontFamily" ); if( auto n = o3tl::tryAccess<sal_Int16>(aTmp2) ) - eFamily = (FontFamily)*n; + eFamily = static_cast<FontFamily>(*n); } SvxFontItem aItem( eFamily, *aFName, aEmptyOUStr, PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT ); aItemSet.Put( aItem ); @@ -1112,7 +1112,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, aTmp = xPropSet->getPropertyValue( "FontSlant" ); if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) ) { - FontItalic eItalic = (FontItalic)*n; + FontItalic eItalic = static_cast<FontItalic>(*n); if( eItalic != ITALIC_DONTKNOW && eItalic != ITALIC_NONE ) aItemSet.Put( SvxPostureItem( eItalic, RES_CHRATR_POSTURE ) ); } @@ -1122,7 +1122,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, aTmp = xPropSet->getPropertyValue( "FontLineStyle" ); if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) ) { - FontLineStyle eUnderline = (FontLineStyle)*n; + FontLineStyle eUnderline = static_cast<FontLineStyle>(*n); if( eUnderline != LINESTYLE_DONTKNOW && eUnderline != LINESTYLE_NONE ) aItemSet.Put( SvxUnderlineItem( eUnderline, RES_CHRATR_UNDERLINE ) ); @@ -1133,7 +1133,7 @@ Writer& OutHTML_DrawFrameFormatAsControl( Writer& rWrt, aTmp = xPropSet->getPropertyValue( "FontStrikeout" ); if( auto n = o3tl::tryAccess<sal_Int16>(aTmp) ) { - FontStrikeout eStrikeout = (FontStrikeout)*n; + FontStrikeout eStrikeout = static_cast<FontStrikeout>(*n); if( eStrikeout != STRIKEOUT_DONTKNOW && eStrikeout != STRIKEOUT_NONE ) aItemSet.Put( SvxCrossedOutItem( eStrikeout, RES_CHRATR_CROSSEDOUT ) ); diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index ce3651553e0c..53800ef351f2 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -103,24 +103,24 @@ static CSS1PropertyEnum const aFontStyleTable[] = static CSS1PropertyEnum const aFontVariantTable[] = { - { "normal", (sal_uInt16)SvxCaseMap::NotMapped }, - { "small-caps", (sal_uInt16)SvxCaseMap::SmallCaps }, + { "normal", sal_uInt16(SvxCaseMap::NotMapped) }, + { "small-caps", sal_uInt16(SvxCaseMap::SmallCaps) }, { nullptr, 0 } }; static CSS1PropertyEnum const aTextTransformTable[] = { - { "uppercase", (sal_uInt16)SvxCaseMap::Uppercase }, - { "lowercase", (sal_uInt16)SvxCaseMap::Lowercase }, - { "capitalize", (sal_uInt16)SvxCaseMap::Capitalize }, + { "uppercase", sal_uInt16(SvxCaseMap::Uppercase) }, + { "lowercase", sal_uInt16(SvxCaseMap::Lowercase) }, + { "capitalize", sal_uInt16(SvxCaseMap::Capitalize) }, { nullptr, 0 } }; static CSS1PropertyEnum const aDirectionTable[] = { - { "ltr", (sal_uInt16)SvxFrameDirection::Horizontal_LR_TB }, - { "rtl", (sal_uInt16)SvxFrameDirection::Horizontal_RL_TB }, - { "inherit", (sal_uInt16)SvxFrameDirection::Environment }, + { "ltr", sal_uInt16(SvxFrameDirection::Horizontal_LR_TB) }, + { "rtl", sal_uInt16(SvxFrameDirection::Horizontal_RL_TB) }, + { "inherit", sal_uInt16(SvxFrameDirection::Environment) }, { nullptr, 0 } }; @@ -151,10 +151,10 @@ static CSS1PropertyEnum const aBGVertPosTable[] = static CSS1PropertyEnum const aTextAlignTable[] = { - { "left", (sal_uInt16)SvxAdjust::Left }, - { "center", (sal_uInt16)SvxAdjust::Center }, - { "right", (sal_uInt16)SvxAdjust::Right }, - { "justify", (sal_uInt16)SvxAdjust::Block }, + { "left", sal_uInt16(SvxAdjust::Left) }, + { "center", sal_uInt16(SvxAdjust::Center) }, + { "right", sal_uInt16(SvxAdjust::Right) }, + { "justify", sal_uInt16(SvxAdjust::Block) }, { nullptr, 0 } }; @@ -184,9 +184,9 @@ static CSS1PropertyEnum const aBorderStyleTable[] = static CSS1PropertyEnum const aFloatTable[] = { - { "left", (sal_uInt16)SvxAdjust::Left }, - { "right", (sal_uInt16)SvxAdjust::Right }, - { "none", (sal_uInt16)SvxAdjust::End }, + { "left", sal_uInt16(SvxAdjust::Left) }, + { "right", sal_uInt16(SvxAdjust::Right) }, + { "none", sal_uInt16(SvxAdjust::End) }, { nullptr, 0 } }; @@ -1162,7 +1162,7 @@ static void ParseCSS1_font_weight( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aFontWeightTable, pExpr->GetString(), nWeight ) ) { - SvxWeightItem aWeight( (FontWeight)nWeight, aItemIds.nWeight ); + SvxWeightItem aWeight( static_cast<FontWeight>(nWeight), aItemIds.nWeight ); if( rParser.IsSetWesternProps() ) rItemSet.Put( aWeight ); if( rParser.IsSetCJKProps() ) @@ -1230,7 +1230,7 @@ static void ParseCSS1_font_style( const CSS1Expression *pExpr, sal_uInt16 nItalic; if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nItalic ) ) { - eItalic = (FontItalic)nItalic; + eItalic = static_cast<FontItalic>(nItalic); if( !bCaseMap && ITALIC_NONE==eItalic ) { // for 'normal' we must also exclude case-map @@ -1288,7 +1288,7 @@ static void ParseCSS1_font_variant( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aFontVariantTable, pExpr->GetString(), nCaseMap ) ) { - rItemSet.Put( SvxCaseMapItem( (SvxCaseMap)nCaseMap, + rItemSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(nCaseMap), aItemIds.nCaseMap ) ); } break; @@ -1315,7 +1315,7 @@ static void ParseCSS1_text_transform( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aTextTransformTable, pExpr->GetString(), nCaseMap ) ) { - rItemSet.Put( SvxCaseMapItem( (SvxCaseMap)nCaseMap, + rItemSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(nCaseMap), aItemIds.nCaseMap ) ); } break; @@ -1532,17 +1532,17 @@ static void ParseCSS1_background( const CSS1Expression *pExpr, } if( SvxCSS1Parser::GetEnum( aBGRepeatTable, rValue, nEnum ) ) { - eRepeat = (SvxGraphicPosition)nEnum; + eRepeat = static_cast<SvxGraphicPosition>(nEnum); } else if( SvxCSS1Parser::GetEnum( aBGHoriPosTable, rValue, nEnum ) ) { // <position>, horizontal - MergeHori( ePos, (SvxGraphicPosition)nEnum ); + MergeHori( ePos, static_cast<SvxGraphicPosition>(nEnum) ); } else if( SvxCSS1Parser::GetEnum( aBGVertPosTable, rValue, nEnum ) ) { // <position>, vertical - MergeVert( ePos, (SvxGraphicPosition)nEnum ); + MergeVert( ePos, static_cast<SvxGraphicPosition>(nEnum) ); } else if( !bColor ) { @@ -1719,7 +1719,7 @@ static void ParseCSS1_list_style_type( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aNumberStyleTable, rValue, nEnum ) ) { rPropInfo.m_bNumbering = true; - rPropInfo.m_nNumberingType = (SvxNumType)nEnum; + rPropInfo.m_nNumberingType = static_cast<SvxNumType>(nEnum); } if( SvxCSS1Parser::GetEnum( aBulletStyleTable, rValue, nEnum ) ) { @@ -1755,15 +1755,15 @@ static void ParseCSS1_font( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aFontStyleTable, rValue, nEnum ) ) { - eItalic = (FontItalic)nEnum; + eItalic = static_cast<FontItalic>(nEnum); } else if( SvxCSS1Parser::GetEnum( aFontVariantTable, rValue, nEnum ) ) { - eCaseMap = (SvxCaseMap)nEnum; + eCaseMap = static_cast<SvxCaseMap>(nEnum); } else if( SvxCSS1Parser::GetEnum( aFontWeightTable, rValue, nEnum ) ) { - eWeight = (FontWeight)nEnum; + eWeight = static_cast<FontWeight>(nEnum); } } else @@ -2000,7 +2000,7 @@ static void ParseCSS1_text_align( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aTextAlignTable, pExpr->GetString(), nAdjust ) ) { - rItemSet.Put( SvxAdjustItem( (SvxAdjust)nAdjust, + rItemSet.Put( SvxAdjustItem( static_cast<SvxAdjust>(nAdjust), aItemIds.nAdjust ) ); } } @@ -2582,7 +2582,7 @@ static void ParseCSS1_border_xxx( const CSS1Expression *pExpr, } else if( SvxCSS1Parser::GetEnum( aBorderStyleTable, rValue, nValue ) ) { - eStyle = (CSS1BorderStyle)nValue; + eStyle = static_cast<CSS1BorderStyle>(nValue); } else if( pExpr->GetColor( aColor ) ) { @@ -2782,7 +2782,7 @@ static void ParseCSS1_border_style( const CSS1Expression *pExpr, SvxCSS1Parser::GetEnum( aBorderStyleTable, pExpr->GetString(), nValue ) ) { - rPropInfo.GetBorderInfo( nLine )->eStyle = (CSS1BorderStyle)nValue; + rPropInfo.GetBorderInfo( nLine )->eStyle = static_cast<CSS1BorderStyle>(nValue); } rPropInfo.CopyBorderInfo( n, SVX_CSS1_BORDERINFO_STYLE ); @@ -2842,7 +2842,7 @@ static void ParseCSS1_float( const CSS1Expression *pExpr, { sal_uInt16 nFloat; if( SvxCSS1Parser::GetEnum( aFloatTable, pExpr->GetString(), nFloat ) ) - rPropInfo.m_eFloat = (SvxAdjust)nFloat; + rPropInfo.m_eFloat = static_cast<SvxAdjust>(nFloat); } } @@ -2857,7 +2857,7 @@ static void ParseCSS1_position( const CSS1Expression *pExpr, { sal_uInt16 nPos; if( SvxCSS1Parser::GetEnum( aPositionTable, pExpr->GetString(), nPos ) ) - rPropInfo.m_ePosition = (SvxCSS1Position)nPos; + rPropInfo.m_ePosition = static_cast<SvxCSS1Position>(nPos); } } @@ -2958,7 +2958,7 @@ static void ParseCSS1_size( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aSizeTable, pExpr->GetString(), nValue ) ) { - rPropInfo.m_eSizeType = (SvxCSS1SizeType)nValue; + rPropInfo.m_eSizeType = static_cast<SvxCSS1SizeType>(nValue); } } break; @@ -3000,7 +3000,7 @@ static void ParseCSS1_page_break_xxx( const CSS1Expression *pExpr, if( SvxCSS1Parser::GetEnum( aPageBreakTable, pExpr->GetString(), nValue ) ) { - rPBreak = (SvxCSS1PageBreak)nValue; + rPBreak = static_cast<SvxCSS1PageBreak>(nValue); } } } diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index 9215f4f35dcc..aad798936453 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -138,7 +138,7 @@ HTMLOptionEnum<SvxAdjust> aHTMLPAlignTable[] = { OOO_STRING_SVTOOLS_HTML_AL_right, SvxAdjust::Right }, { OOO_STRING_SVTOOLS_HTML_AL_justify, SvxAdjust::Block }, { OOO_STRING_SVTOOLS_HTML_AL_char, SvxAdjust::Left }, - { nullptr, (SvxAdjust)0 } + { nullptr, SvxAdjust(0) } }; // <SPACER TYPE=...> diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 9f7ce8cc1547..72a1fc372439 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -2967,7 +2967,7 @@ static void impl_borderLine( FSHelperPtr const & pSerializer, sal_Int32 elementT // if they are equal, it means that they were style-defined and there is // no need to write them. if( rStyleProps != nullptr && pBorderLine && !pBorderLine->isEmpty() && - pBorderLine->GetBorderLineStyle() == (SvxBorderLineStyle)rStyleProps->LineStyle && + pBorderLine->GetBorderLineStyle() == static_cast<SvxBorderLineStyle>(rStyleProps->LineStyle) && pBorderLine->GetColor() == rStyleProps->Color && pBorderLine->GetWidth() == convertMm100ToTwip( rStyleProps->LineWidth ) ) return; @@ -4689,7 +4689,7 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size if ( pGrfNode && SfxItemState::SET == pGrfNode->GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE, true, &pItem)) { - nMode = (GraphicDrawMode)static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue(); + nMode = static_cast<GraphicDrawMode>(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/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 61ed96720ae5..4da44ceab223 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -639,7 +639,7 @@ void RtfExport::WritePageDescTable() .WriteChar('{') .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSC); OutULong(n).WriteCharPtr(OOO_STRING_SVTOOLS_RTF_PGDSCUSE); - OutULong((sal_uLong)rPageDesc.ReadUseOn()); + OutULong(static_cast<sal_uLong>(rPageDesc.ReadUseOn())); OutPageDescription(rPageDesc, false); diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index d8756282b0f0..522d9de719bd 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1674,7 +1674,7 @@ void SwBasicEscherEx::WriteGrfAttr(const SwNoTextNode& rNd, const SwFrameFormat& if (SfxItemState::SET == rNd.GetSwAttrSet().GetItemState(RES_GRFATR_DRAWMODE, true, &pItem)) { - nMode = (GraphicDrawMode)static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue(); + nMode = static_cast<GraphicDrawMode>(static_cast<const SfxEnumItemInterface*>(pItem)->GetEnumValue()); if (nMode == GraphicDrawMode::Watermark) { /* diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index b49a86aa1ba4..48a6098f5eb9 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2418,7 +2418,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { OUString sFieldId; it->second >>= sFieldId; - eFieldId = (ww::eField)sFieldId.toInt32(); + eFieldId = static_cast<ww::eField>(sFieldId.toInt32()); } it = pFieldmark->GetParameters()->find( ODF_CODE_PARAM ); @@ -2465,7 +2465,7 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) { OUString sFieldId; it->second >>= sFieldId; - eFieldId = (ww::eField)sFieldId.toInt32(); + eFieldId = static_cast<ww::eField>(sFieldId.toInt32()); } } @@ -3331,7 +3331,7 @@ void MSWordExportBase::OutputContentNode( SwContentNode& rNode ) OutputOLENode( *rNode.GetOLENode() ); break; default: - SAL_WARN("sw.ww8", "Unhandled node, type == " << (int)rNode.GetNodeType() ); + SAL_WARN("sw.ww8", "Unhandled node, type == " << static_cast<int>(rNode.GetNodeType()) ); break; } } diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index c79f447b1a90..eb3ff52f1a4c 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -1584,7 +1584,7 @@ sal_Int32 SwWW8ImplReader::MatchSdrBoxIntoFlyBoxItem(const Color& rLineColor, nIdx = SvxBorderLineStyle::DOUBLE; break; // no line style is set - case (MSO_LineStyle)USHRT_MAX: + case MSO_LineStyle(USHRT_MAX): break; // erroneously not implemented line style is set default: diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 50f57141a9ab..9ab1e55a7ef5 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -692,7 +692,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, bool bVerticalText = false; if ( IsProperty( DFF_Prop_txflTextFlow ) ) { - MSO_TextFlow eTextFlow = (MSO_TextFlow)(GetPropertyValue( + MSO_TextFlow eTextFlow = static_cast<MSO_TextFlow>(GetPropertyValue( DFF_Prop_txflTextFlow, 0) & 0xFFFF); switch( eTextFlow ) { @@ -797,8 +797,7 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, aSet.Put( makeSdrTextAutoGrowWidthItem( false ) ); } - switch ( (MSO_WrapMode) - GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare ) ) + switch ( static_cast<MSO_WrapMode>(GetPropertyValue( DFF_Prop_WrapText, mso_wrapSquare )) ) { case mso_wrapNone : aSet.Put( makeSdrTextAutoGrowWidthItem( true ) ); @@ -1037,12 +1036,12 @@ SdrObject* SwMSDffManager::ProcessObj(SvStream& rSt, } pImpRec->eLineStyle = (nLineFlags & 8) - ? (MSO_LineStyle)GetPropertyValue( + ? static_cast<MSO_LineStyle>(GetPropertyValue( DFF_Prop_lineStyle, - mso_lineSimple ) - : (MSO_LineStyle)USHRT_MAX; - pImpRec->eLineDashing = (MSO_LineDashing)GetPropertyValue( - DFF_Prop_lineDashing, mso_lineSolid ); + mso_lineSimple )) + : MSO_LineStyle(USHRT_MAX); + pImpRec->eLineDashing = static_cast<MSO_LineDashing>(GetPropertyValue( + DFF_Prop_lineDashing, mso_lineSolid )); pImpRec->nFlags = rObjData.nSpFlags; @@ -1948,7 +1947,7 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo) } m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::KERN_ASIAN_PUNCTUATION, rTypo.fKerningPunct); - m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType((CharCompressType)rTypo.iJustification); + m_rDoc.getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(rTypo.iJustification)); } /** diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 9acf6575441a..cc487a888925 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2548,7 +2548,7 @@ bool SwMSConvertControls::InsertControl( else nTemp = text::TextContentAnchorType_AS_CHARACTER; - xShapePropSet->setPropertyValue("AnchorType", uno::Any((sal_Int16)nTemp) ); + xShapePropSet->setPropertyValue("AnchorType", uno::Any(static_cast<sal_Int16>(nTemp)) ); xShapePropSet->setPropertyValue("VertOrient", uno::Any(sal_Int16(text::VertOrientation::TOP)) ); diff --git a/sw/source/filter/xml/xmlithlp.cxx b/sw/source/filter/xml/xmlithlp.cxx index 7272cd5ae31b..119f72671683 100644 --- a/sw/source/filter/xml/xmlithlp.cxx +++ b/sw/source/filter/xml/xmlithlp.cxx @@ -242,21 +242,21 @@ const struct SvXMLEnumMapEntry<SvxGraphicPosition> psXML_BrushRepeat[] = { XML_BACKGROUND_REPEAT, GPOS_TILED }, { XML_BACKGROUND_NO_REPEAT, GPOS_MM }, { XML_BACKGROUND_STRETCH, GPOS_AREA }, - { XML_TOKEN_INVALID, (SvxGraphicPosition)0 } + { XML_TOKEN_INVALID, SvxGraphicPosition(0) } }; const struct SvXMLEnumMapEntry<SvxGraphicPosition> psXML_BrushHoriPos[] = { { XML_LEFT, GPOS_LM }, { XML_RIGHT, GPOS_RM }, - { XML_TOKEN_INVALID, (SvxGraphicPosition)0 } + { XML_TOKEN_INVALID, SvxGraphicPosition(0) } }; const struct SvXMLEnumMapEntry<SvxGraphicPosition> psXML_BrushVertPos[] = { { XML_TOP, GPOS_MT }, { XML_BOTTOM, GPOS_MB }, - { XML_TOKEN_INVALID, (SvxGraphicPosition)0 } + { XML_TOKEN_INVALID, SvxGraphicPosition(0) } }; void sw_frmitems_MergeXMLHoriPos( SvxGraphicPosition& ePos, diff --git a/sw/source/ui/chrdlg/numpara.cxx b/sw/source/ui/chrdlg/numpara.cxx index 998c68db1507..be1a34dab0a8 100644 --- a/sw/source/ui/chrdlg/numpara.cxx +++ b/sw/source/ui/chrdlg/numpara.cxx @@ -350,7 +350,7 @@ bool SwParagraphNumTabPage::ExecuteEditNumStyle_Impl( SfxDispatcher &rDispatcher = *SfxViewShell::Current()->GetDispatcher(); SfxStringItem aItem(nId, rStr); - SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)nFamily); + SfxUInt16Item aFamily(SID_STYLE_FAMILY, static_cast<sal_uInt16>(nFamily)); SfxStringItem aRefName( SID_STYLE_REFERENCE, rRefStr ); const SfxPoolItem* pItems[ 6 ]; sal_uInt16 nCount = 0; diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx index 6a09f0003446..9ef014b0aca2 100644 --- a/sw/source/ui/config/optload.cxx +++ b/sw/source/ui/config/optload.cxx @@ -325,7 +325,7 @@ void SwLoadOptPage::Reset( const SfxItemSet* rSet) if ( rSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT ) { const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(rSet->Get( SID_ATTR_METRIC )); - FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue(); + FieldUnit eFieldUnit = static_cast<FieldUnit>(rItem.GetValue()); for ( sal_Int32 i = 0; i < m_pMetricLB->GetEntryCount(); ++i ) { @@ -382,7 +382,7 @@ IMPL_LINK_NOARG(SwLoadOptPage, MetricHdl, ListBox&, void) if(nMPos != LISTBOX_ENTRY_NOTFOUND) { // Double-Cast for VA3.0 - FieldUnit eFieldUnit = (FieldUnit)reinterpret_cast<sal_IntPtr>(m_pMetricLB->GetEntryData( nMPos )); + FieldUnit eFieldUnit = static_cast<FieldUnit>(reinterpret_cast<sal_IntPtr>(m_pMetricLB->GetEntryData( nMPos ))); bool bModified = m_pTabMF->IsModified(); long nVal = bModified ? sal::static_int_cast<sal_Int32, sal_Int64 >( m_pTabMF->Denormalize( m_pTabMF->GetValue( FUNIT_TWIP ) )) : diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 8b9eb8f6fbcc..9c856f4a8f55 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -205,7 +205,7 @@ static void lcl_SelectMetricLB(ListBox* rMetric, sal_uInt16 nSID, const SfxItemS const SfxPoolItem* pItem; if( rSet.GetItemState( nSID, false, &pItem ) >= SfxItemState::DEFAULT ) { - FieldUnit eFieldUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + FieldUnit eFieldUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); for ( sal_Int32 i = 0; i < rMetric->GetEntryCount(); ++i ) { if ( static_cast<int>(reinterpret_cast<sal_IntPtr>(rMetric->GetEntryData( i ))) == static_cast<int>(eFieldUnit) ) @@ -1240,7 +1240,7 @@ void SwTableOptionsTabPage::Reset( const SfxItemSet* rSet) if ( rSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT ) { const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(rSet->Get( SID_ATTR_METRIC )); - FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue(); + FieldUnit eFieldUnit = static_cast<FieldUnit>(rItem.GetValue()); ::SetFieldUnit( *m_pRowMoveMF, eFieldUnit ); ::SetFieldUnit( *m_pColMoveMF, eFieldUnit ); ::SetFieldUnit( *m_pRowInsertMF, eFieldUnit ); @@ -1539,16 +1539,16 @@ struct CharAttr // Edit corresponds to Paste-attributes static CharAttr aRedlineAttr[] = { - { SID_ATTR_CHAR_CASEMAP, (sal_uInt16)SvxCaseMap::NotMapped }, + { SID_ATTR_CHAR_CASEMAP, sal_uInt16(SvxCaseMap::NotMapped) }, { SID_ATTR_CHAR_WEIGHT, WEIGHT_BOLD }, { SID_ATTR_CHAR_POSTURE, ITALIC_NORMAL }, { SID_ATTR_CHAR_UNDERLINE, LINESTYLE_SINGLE }, { SID_ATTR_CHAR_UNDERLINE, LINESTYLE_DOUBLE }, { SID_ATTR_CHAR_STRIKEOUT, STRIKEOUT_SINGLE }, - { SID_ATTR_CHAR_CASEMAP, (sal_uInt16)SvxCaseMap::Uppercase }, - { SID_ATTR_CHAR_CASEMAP, (sal_uInt16)SvxCaseMap::Lowercase }, - { SID_ATTR_CHAR_CASEMAP, (sal_uInt16)SvxCaseMap::SmallCaps }, - { SID_ATTR_CHAR_CASEMAP, (sal_uInt16)SvxCaseMap::Capitalize }, + { SID_ATTR_CHAR_CASEMAP, sal_uInt16(SvxCaseMap::Uppercase) }, + { SID_ATTR_CHAR_CASEMAP, sal_uInt16(SvxCaseMap::Lowercase) }, + { SID_ATTR_CHAR_CASEMAP, sal_uInt16(SvxCaseMap::SmallCaps) }, + { SID_ATTR_CHAR_CASEMAP, sal_uInt16(SvxCaseMap::Capitalize) }, { SID_ATTR_BRUSH, 0 } }; // Items from aRedlineAttr relevant for InsertAttr: strikethrough is @@ -2013,28 +2013,28 @@ IMPL_LINK( SwRedlineOptionsTabPage, AttribHdl, ListBox&, rLB, void ) switch (pAttr->nItemId) { case SID_ATTR_CHAR_WEIGHT: - rFont.SetWeight( ( FontWeight ) pAttr->nAttr ); - rCJKFont.SetWeight( ( FontWeight ) pAttr->nAttr ); + rFont.SetWeight( static_cast<FontWeight>(pAttr->nAttr) ); + rCJKFont.SetWeight( static_cast<FontWeight>(pAttr->nAttr) ); break; case SID_ATTR_CHAR_POSTURE: - rFont.SetItalic( ( FontItalic ) pAttr->nAttr ); - rCJKFont.SetItalic( ( FontItalic ) pAttr->nAttr ); + rFont.SetItalic( static_cast<FontItalic>(pAttr->nAttr) ); + rCJKFont.SetItalic( static_cast<FontItalic>(pAttr->nAttr) ); break; case SID_ATTR_CHAR_UNDERLINE: - rFont.SetUnderline( ( FontLineStyle ) pAttr->nAttr ); - rCJKFont.SetUnderline( ( FontLineStyle ) pAttr->nAttr ); + rFont.SetUnderline( static_cast<FontLineStyle>(pAttr->nAttr) ); + rCJKFont.SetUnderline( static_cast<FontLineStyle>(pAttr->nAttr) ); break; case SID_ATTR_CHAR_STRIKEOUT: - rFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr ); - rCJKFont.SetStrikeout( ( FontStrikeout ) pAttr->nAttr ); + rFont.SetStrikeout( static_cast<FontStrikeout>(pAttr->nAttr) ); + rCJKFont.SetStrikeout( static_cast<FontStrikeout>(pAttr->nAttr) ); break; case SID_ATTR_CHAR_CASEMAP: - rFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr ); - rCJKFont.SetCaseMap( ( SvxCaseMap ) pAttr->nAttr ); + rFont.SetCaseMap( static_cast<SvxCaseMap>(pAttr->nAttr) ); + rCJKFont.SetCaseMap( static_cast<SvxCaseMap>(pAttr->nAttr) ); break; case SID_ATTR_BRUSH: diff --git a/sw/source/ui/dbui/mmlayoutpage.cxx b/sw/source/ui/dbui/mmlayoutpage.cxx index 4627abbbac44..fbe1fa1a88b0 100644 --- a/sw/source/ui/dbui/mmlayoutpage.cxx +++ b/sw/source/ui/dbui/mmlayoutpage.cxx @@ -482,8 +482,8 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig eGender <= SwMailMergeConfigItem::NEUTRAL; ++eGender) { Sequence< OUString > aEntries = - rConfigItem.GetGreetings((SwMailMergeConfigItem::Gender)eGender); - sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting((SwMailMergeConfigItem::Gender)eGender); + rConfigItem.GetGreetings(static_cast<SwMailMergeConfigItem::Gender>(eGender)); + sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting(static_cast<SwMailMergeConfigItem::Gender>(eGender)); if( nCurrent >= 0 && nCurrent < aEntries.getLength()) { // Greeting @@ -522,8 +522,8 @@ void SwMailMergeLayoutPage::InsertGreeting(SwWrtShell& rShell, SwMailMergeConfig for(sal_Int8 eGender = SwMailMergeConfigItem::FEMALE; eGender <= SwMailMergeConfigItem::NEUTRAL; ++eGender) { - Sequence< OUString> aEntries = rConfigItem.GetGreetings((SwMailMergeConfigItem::Gender)eGender); - sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting((SwMailMergeConfigItem::Gender)eGender); + Sequence< OUString> aEntries = rConfigItem.GetGreetings(static_cast<SwMailMergeConfigItem::Gender>(eGender)); + sal_Int32 nCurrent = rConfigItem.GetCurrentGreeting(static_cast<SwMailMergeConfigItem::Gender>(eGender)); if( nCurrent >= 0 && nCurrent < aEntries.getLength()) { const OUString sGreeting = aEntries[nCurrent]; diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 8f81eb63d70e..8da402716929 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -324,7 +324,7 @@ LineEnd SwAsciiFilterDlg::GetCRLF() const IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, ListBox&, rListBox, void ) { SvxTextEncodingBox* pBox = static_cast<SvxTextEncodingBox*>(&rListBox); - LineEnd eOldEnd = GetCRLF(), eEnd = (LineEnd)-1; + LineEnd eOldEnd = GetCRLF(), eEnd = LineEnd(-1); LanguageType nLng = m_pFontLB->IsVisible() ? m_pLanguageLB->GetSelectLanguage() : LANGUAGE_SYSTEM, @@ -378,7 +378,7 @@ IMPL_LINK( SwAsciiFilterDlg, CharSetSelHdl, ListBox&, rListBox, void ) } m_bSaveLineStatus = false; - if( eEnd != (LineEnd)-1 ) // changed? + if( eEnd != LineEnd(-1) ) // changed? { if( eOldEnd != eEnd ) SetCRLF( eEnd ); diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx index 057982b2a7b1..f4a90609cb3a 100644 --- a/sw/source/ui/envelp/envfmt.cxx +++ b/sw/source/ui/envelp/envfmt.cxx @@ -176,7 +176,7 @@ SwEnvFormatPage::SwEnvFormatPage(vcl::Window* pParent, const SfxItemSet& rSet) { if (i != PAPER_USER) { - const OUString aPaperName = SvxPaperInfo::GetName((Paper) i); + const OUString aPaperName = SvxPaperInfo::GetName(static_cast<Paper>(i)); if (aPaperName.isEmpty()) continue; @@ -393,7 +393,7 @@ IMPL_LINK_NOARG(SwEnvFormatPage, FormatHdl, ListBox&, void) const sal_uInt16 nPaper = aIDs[m_pSizeFormatBox->GetSelectedEntryPos()]; if (nPaper != sal_uInt16(PAPER_USER)) { - Size aSz = SvxPaperInfo::GetPaperSize((Paper)nPaper); + Size aSz = SvxPaperInfo::GetPaperSize(static_cast<Paper>(nPaper)); lWidth = std::max(aSz.Width(), aSz.Height()); lHeight = std::min(aSz.Width(), aSz.Height()); } @@ -495,8 +495,8 @@ void SwEnvFormatPage::FillItem(SwEnvItem& rItem) } else { - long lWVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Width (); - long lHVal = SvxPaperInfo::GetPaperSize((Paper)nPaper).Height(); + long lWVal = SvxPaperInfo::GetPaperSize(static_cast<Paper>(nPaper)).Width (); + long lHVal = SvxPaperInfo::GetPaperSize(static_cast<Paper>(nPaper)).Height(); rItem.m_nWidth = std::max(lWVal, lHVal); rItem.m_nHeight = std::min(lWVal, lHVal); } diff --git a/sw/source/ui/envelp/envprt.cxx b/sw/source/ui/envelp/envprt.cxx index 9a410b6130bc..5568e9194f55 100644 --- a/sw/source/ui/envelp/envprt.cxx +++ b/sw/source/ui/envelp/envprt.cxx @@ -171,7 +171,7 @@ void SwEnvPrtPage::FillItem(SwEnvItem& rItem) } } - rItem.m_eAlign = (SwEnvAlign)nOrient; + rItem.m_eAlign = static_cast<SwEnvAlign>(nOrient); rItem.m_bPrintFromAbove = m_pTopButton->IsChecked(); rItem.m_nShiftRight = static_cast< sal_Int32 >(GetFieldVal(*m_pRightField)); rItem.m_nShiftDown = static_cast< sal_Int32 >(GetFieldVal(*m_pDownField )); diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index f272c10db37c..c4dd10f50cc3 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -74,9 +74,9 @@ SwTemplateDlg::SwTemplateDlg(vcl::Window* pParent, SwWrtShell* pActShell, bool bNew) : SfxStyleDialog(pParent, - "TemplateDialog" + OUString::number((sal_uInt16)nRegion), + "TemplateDialog" + OUString::number(static_cast<sal_uInt16>(nRegion)), "modules/swriter/ui/templatedialog" + - OUString::number((sal_uInt16)nRegion) + ".ui", + OUString::number(static_cast<sal_uInt16>(nRegion)) + ".ui", rBase) , nType(nRegion) , pWrtShell(pActShell) diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 62a65de07e8f..e243af0417b9 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -1537,11 +1537,11 @@ void SwFramePage::FillRelLB( const FrameMap* _pMap, for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1) { - if (nLBRelations & (LB)nBit) + if (nLBRelations & static_cast<LB>(nBit)) { for (RelationMap & rMap : aRelationMap) { - if (rMap.nLBRelation == (LB)nBit) + if (rMap.nLBRelation == static_cast<LB>(nBit)) { SvxSwFramePosString::StringId eStrId1 = m_pMirrorPagesCB->IsChecked() ? rMap.eMirrorStrId : rMap.eStrId; diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index f2947e4a76ec..bd4e812f8680 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -367,7 +367,7 @@ void SwMultiTOXTabDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { static_cast<SwTOXSelectTabPage&>(rPage).SetWrtShell(m_rWrtShell); if(USHRT_MAX != m_nInitialTOXType) - static_cast<SwTOXSelectTabPage&>(rPage).SelectType((TOXTypes)m_nInitialTOXType); + static_cast<SwTOXSelectTabPage&>(rPage).SelectType(static_cast<TOXTypes>(m_nInitialTOXType)); } } @@ -1192,7 +1192,7 @@ void SwTOXSelectTabPage::FillTOXDescription() case TOX_TABLES : rDesc.SetCreateFromObjectNames(m_pFromObjectNamesRB->IsChecked()); rDesc.SetSequenceName(m_pCaptionSequenceLB->GetSelectedEntry()); - rDesc.SetCaptionDisplay((SwCaptionDisplay)m_pDisplayTypeLB->GetSelectedEntryPos()); + rDesc.SetCaptionDisplay(static_cast<SwCaptionDisplay>(m_pDisplayTypeLB->GetSelectedEntryPos())); break; case TOX_OBJECTS: { @@ -1903,7 +1903,7 @@ SwTOXEntryTabPage::SwTOXEntryTabPage(vcl::Window* pParent, const SfxItemSet& rAt m_pLevelLB->SetHighlightRange(); // select full width m_pLevelLB->Show(); - aLastTOXType.eType = (TOXTypes)USHRT_MAX; + aLastTOXType.eType = TOXTypes(USHRT_MAX); aLastTOXType.nIndex = 0; SetExchangeSupport(); @@ -2114,7 +2114,7 @@ void SwTOXEntryTabPage::ActivatePage( const SfxItemSet& /*rSet*/) { if(bToxIsAuthorities) m_pLevelLB->InsertEntry( SwAuthorityFieldType::GetAuthTypeName( - (ToxAuthorityType) (i - 1)) ); + static_cast<ToxAuthorityType>(i - 1)) ); else if( bToxIsIndex ) { if(i == 1) @@ -2221,11 +2221,11 @@ void SwTOXEntryTabPage::UpdateDescriptor() { rDesc.SetSortByDocument(m_pSortDocPosRB->IsChecked()); SwTOXSortKey aKey1, aKey2, aKey3; - aKey1.eField = (ToxAuthorityField)reinterpret_cast<sal_uIntPtr>(m_pFirstKeyLB->GetSelectedEntryData()); + aKey1.eField = static_cast<ToxAuthorityField>(reinterpret_cast<sal_uIntPtr>(m_pFirstKeyLB->GetSelectedEntryData())); aKey1.bSortAscending = m_pFirstSortUpRB->IsChecked(); - aKey2.eField = (ToxAuthorityField)reinterpret_cast<sal_uIntPtr>(m_pSecondKeyLB->GetSelectedEntryData()); + aKey2.eField = static_cast<ToxAuthorityField>(reinterpret_cast<sal_uIntPtr>(m_pSecondKeyLB->GetSelectedEntryData())); aKey2.bSortAscending = m_pSecondSortUpRB->IsChecked(); - aKey3.eField = (ToxAuthorityField)reinterpret_cast<sal_uIntPtr>(m_pThirdKeyLB->GetSelectedEntryData()); + aKey3.eField = static_cast<ToxAuthorityField>(reinterpret_cast<sal_uIntPtr>(m_pThirdKeyLB->GetSelectedEntryData())); aKey3.bSortAscending = m_pThirdSortUpRB->IsChecked(); rDesc.SetSortKeys(aKey1, aKey2, aKey3); @@ -2255,7 +2255,7 @@ IMPL_LINK_NOARG(SwTOXEntryTabPage, EditStyleHdl, Button*, void) if( LISTBOX_ENTRY_NOTFOUND != m_pCharStyleLB->GetSelectedEntryPos()) { SfxStringItem aStyle(SID_STYLE_EDIT, m_pCharStyleLB->GetSelectedEntry()); - SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)SfxStyleFamily::Char); + SfxUInt16Item aFamily(SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Char)); static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(). GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_STYLE_EDIT, SfxCallMode::SYNCHRON|SfxCallMode::MODAL, @@ -2986,7 +2986,7 @@ Control* SwTokenWindow::InsertItem(const OUString& rText, const SwFormToken& { //use the first two chars as symbol OUString sTmp(SwAuthorityFieldType::GetAuthFieldName( - (ToxAuthorityField)rToken.nAuthorityField)); + static_cast<ToxAuthorityField>(rToken.nAuthorityField))); pButton->SetText(sTmp.copy(0, 2)); } @@ -3194,7 +3194,7 @@ void SwTokenWindow::InsertAtSelection(const OUString& rText, const SwFormToken& { //use the first two chars as symbol OUString sTmp(SwAuthorityFieldType::GetAuthFieldName( - (ToxAuthorityField)aToInsertToken.nAuthorityField)); + static_cast<ToxAuthorityField>(aToInsertToken.nAuthorityField))); pButton->SetText(sTmp.copy(0, 2)); } @@ -3478,7 +3478,7 @@ bool SwTokenWindow::CreateQuickHelp(Control const * pCtrl, if(rToken.eTokenType == TOKEN_AUTHORITY ) { sEntry += SwAuthorityFieldType::GetAuthFieldName( - (ToxAuthorityField) rToken.nAuthorityField); + static_cast<ToxAuthorityField>(rToken.nAuthorityField)); } Point aPos = OutputToScreenPixel(pCtrl->GetPosPixel()); @@ -3783,7 +3783,7 @@ IMPL_LINK_NOARG(SwTOXStylesTabPage, EditStyleHdl, Button *, void) if( LISTBOX_ENTRY_NOTFOUND != m_pParaLayLB->GetSelectedEntryPos()) { SfxStringItem aStyle(SID_STYLE_EDIT, m_pParaLayLB->GetSelectedEntry()); - SfxUInt16Item aFamily(SID_STYLE_FAMILY, (sal_uInt16)SfxStyleFamily::Para); + SfxUInt16Item aFamily(SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Para)); SwWrtShell& rSh = static_cast<SwMultiTOXTabDialog*>(GetTabDialog())->GetWrtShell(); rSh.GetView().GetViewFrame()->GetDispatcher()->ExecuteList(SID_STYLE_EDIT, SfxCallMode::SYNCHRON|SfxCallMode::MODAL, diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 6c2561065cff..4de77fd36e65 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -1187,7 +1187,7 @@ IMPL_LINK( SwAuthorMarkPane, CompEntryHdl, ListBox&, rBox, void) const SwAuthEntry* pEntry = pFType ? pFType->GetEntryByIdentifier(sEntry) : nullptr; for(int i = 0; i < AUTH_FIELD_END; i++) m_sFields[i] = pEntry ? - pEntry->GetAuthorField((ToxAuthorityField)i) : OUString(); + pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)) : OUString(); } } if (rBox.GetSelectedEntry().isEmpty()) @@ -1216,7 +1216,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void) if(pEntry) { for(int i = 0; i < AUTH_FIELD_END && !bDifferent; i++) - bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i); + bDifferent |= m_sFields[i] != pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)); if(bDifferent) { ScopedVclPtrInstance< MessageDialog > aQuery(&m_rDialog, SwResId(STR_QUERY_CHANGE_AUTH_ENTRY), VclMessageType::Question, VclButtonsType::YesNo); @@ -1237,7 +1237,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl, Button*, void) { SwAuthEntry aNewData; for(int i = 0; i < AUTH_FIELD_END; i++) - aNewData.SetAuthorField((ToxAuthorityField)i, m_sFields[i]); + aNewData.SetAuthorField(static_cast<ToxAuthorityField>(i), m_sFields[i]); pSh->ChangeAuthorityData(&aNewData); } SwInsertField_Data aData(TYP_AUTHORITY, 0, sFields, OUString(), 0 ); @@ -1273,7 +1273,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, Button*, pButton, void) } for(int i = 0; i < AUTH_FIELD_END; i++) { - m_sFields[i] = aDlg->GetEntryText((ToxAuthorityField)i); + m_sFields[i] = aDlg->GetEntryText(static_cast<ToxAuthorityField>(i)); m_sCreatedEntry[i] = m_sFields[i]; } if(bNewEntry && !m_pFromDocContentRB->IsChecked()) @@ -1415,7 +1415,7 @@ void SwAuthorMarkPane::InitControls() if(!pEntry) return; for(int i = 0; i < AUTH_FIELD_END; i++) - m_sFields[i] = pEntry->GetAuthorField((ToxAuthorityField)i); + m_sFields[i] = pEntry->GetAuthorField(static_cast<ToxAuthorityField>(i)); m_pEntryED->SetText(pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER)); m_pAuthorFI->SetText(pEntry->GetAuthorField(AUTH_FIELD_AUTHOR)); diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index dab6962eb74a..731c8fca41b7 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -219,7 +219,7 @@ IMPL_LINK_NOARG(SwLineNumberingDlg, OKHdl, Button*, void) aInf.SetNumType(aType); // position - aInf.SetPos((LineNumberPosition)m_pPosLB->GetSelectedEntryPos()); + aInf.SetPos(static_cast<LineNumberPosition>(m_pPosLB->GetSelectedEntryPos())); // offset aInf.SetPosFromLeft(static_cast<sal_uInt16>(m_pOffsetMF->Denormalize(m_pOffsetMF->GetValue(FUNIT_TWIP)))); diff --git a/sw/source/ui/misc/pgfnote.cxx b/sw/source/ui/misc/pgfnote.cxx index 3da76ea63a5b..5959276dd6db 100644 --- a/sw/source/ui/misc/pgfnote.cxx +++ b/sw/source/ui/misc/pgfnote.cxx @@ -266,7 +266,7 @@ bool SwFootNotePage::FillItemSet(SfxItemSet *rSet) rFootnoteInfo.SetLineColor( m_pLineColorBox->GetSelectEntryColor() ); // Position - rFootnoteInfo.SetAdj((css::text::HorizontalAdjust)m_pLinePosBox->GetSelectedEntryPos()); + rFootnoteInfo.SetAdj(static_cast<css::text::HorizontalAdjust>(m_pLinePosBox->GetSelectedEntryPos())); // Width rFootnoteInfo.SetWidth(Fraction( static_cast< long >(m_pLineLengthEdit->GetValue()), 100)); diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index d7d005c92778..adb9b4366c23 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -707,7 +707,7 @@ void SwModule::ExecOther(SfxRequest& rReq) case SID_ATTR_METRIC: if(pArgs && SfxItemState::SET == pArgs->GetItemState(nWhich, false, &pItem)) { - FieldUnit eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + FieldUnit eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); switch( eUnit ) { case FUNIT_MM: diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index da877cea1e92..fff3d7e941f3 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -299,7 +299,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SfxGetpApp()->SetOptions(rSet); PutItem(*pItem); const SfxUInt16Item* pMetricItem = static_cast<const SfxUInt16Item*>(pItem); - ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog); + ::SetDfltMetric(static_cast<FieldUnit>(pMetricItem->GetValue()), !bTextDialog); } if( SfxItemState::SET == rSet.GetItemState(SID_ATTR_APPLYCHARUNIT, false, &pItem ) ) @@ -312,7 +312,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if( SfxItemState::SET == rSet.GetItemState(FN_HSCROLL_METRIC, false, &pItem ) ) { const SfxUInt16Item* pMetricItem = static_cast<const SfxUInt16Item*>(pItem); - FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue(); + FieldUnit eUnit = static_cast<FieldUnit>(pMetricItem->GetValue()); pPref->SetHScrollMetric(eUnit); if(pAppView) pAppView->ChangeTabMetric(eUnit); @@ -321,7 +321,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) if( SfxItemState::SET == rSet.GetItemState(FN_VSCROLL_METRIC, false, &pItem ) ) { const SfxUInt16Item* pMetricItem = static_cast<const SfxUInt16Item*>(pItem); - FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue(); + FieldUnit eUnit = static_cast<FieldUnit>(pMetricItem->GetValue()); pPref->SetVScrollMetric(eUnit); if(pAppView) pAppView->ChangeVRulerMetric(eUnit); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index b43dbdc2a903..2b9d958be96f 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -564,7 +564,7 @@ void SwDocShell::Execute(SfxRequest& rReq) nFlags = pNewFileDlg->GetTemplateFlags(); rReq.AppendItem( SfxStringItem( SID_TEMPLATE_NAME, aFileName ) ); - rReq.AppendItem( SfxInt32Item( SID_TEMPLATE_LOAD, (long) nFlags ) ); + rReq.AppendItem( SfxInt32Item( SID_TEMPLATE_LOAD, static_cast<long>(nFlags) ) ); } if( !aFileName.isEmpty() ) diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 48fca81e24ec..1ae3a3ebf066 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -93,7 +93,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) { SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - SfxStyleFamily nActualFamily = (SfxStyleFamily)USHRT_MAX; + SfxStyleFamily nActualFamily = SfxStyleFamily(USHRT_MAX); SwWrtShell* pShell = pSh ? pSh : GetWrtShell(); if(!pShell) @@ -242,7 +242,7 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) { SwEditWin& rEdtWin = pShell->GetView().GetEditWin(); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != (SfxStyleFamily)0)); + rSet.Put(SfxBoolItem(nWhich, pApply && pApply->eType != SfxStyleFamily(0))); } break; case SID_STYLE_UPDATE_BY_EXAMPLE: @@ -305,7 +305,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, false, &pItem )) { - const SfxStyleFamily nFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + const SfxStyleFamily nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); OUString sName; sal_uInt16 nMask = 0; @@ -423,7 +423,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILY, false, &pItem )) - nFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + nFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); if( SfxItemState::SET == pArgs->GetItemState(SID_STYLE_FAMILYNAME, false, &pItem )) { @@ -512,16 +512,16 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) break; case SID_STYLE_APPLY: // Shell-switch in ApplyStyles - nRet = (sal_uInt16) ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() ); + nRet = static_cast<sal_uInt16>(ApplyStyles(aParam, nFamily, pActShell, rReq.GetModifier() )); break; case SID_STYLE_WATERCAN: - nRet = (sal_uInt16) DoWaterCan(aParam, nFamily); + nRet = static_cast<sal_uInt16>(DoWaterCan(aParam, nFamily)); break; case SID_STYLE_UPDATE_BY_EXAMPLE: - nRet = (sal_uInt16) UpdateStyle(aParam, nFamily, pActShell); + nRet = static_cast<sal_uInt16>(UpdateStyle(aParam, nFamily, pActShell)); break; case SID_STYLE_NEW_BY_EXAMPLE: - nRet = (sal_uInt16) MakeByExample(aParam, nFamily, nMask, pActShell ); + nRet = static_cast<sal_uInt16>(MakeByExample(aParam, nFamily, nMask, pActShell )); break; default: @@ -1020,7 +1020,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam SwEditWin& rEdtWin = m_pView->GetEditWin(); SwApplyTemplate* pApply = rEdtWin.GetApplyTemplate(); - bool bWaterCan = !(pApply && pApply->eType != (SfxStyleFamily)0); + bool bWaterCan = !(pApply && pApply->eType != SfxStyleFamily(0)); if( rName.isEmpty() ) bWaterCan = false; @@ -1060,7 +1060,7 @@ SfxStyleFamily SwDocShell::DoWaterCan(const OUString &rName, SfxStyleFamily nFam } } else - aTemplate.eType = (SfxStyleFamily)0; + aTemplate.eType = SfxStyleFamily(0); m_pView->GetEditWin().SetApplyTemplate(aTemplate); diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index 38a7371c61f3..28833656231b 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -493,7 +493,7 @@ static void lcl_FillAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet, { case SID_ATTR_CHAR_WEIGHT: { - SvxWeightItem aW( (FontWeight)rAttr.m_nAttr, RES_CHRATR_WEIGHT ); + SvxWeightItem aW( static_cast<FontWeight>(rAttr.m_nAttr), RES_CHRATR_WEIGHT ); rSet.Put( aW ); aW.SetWhich( RES_CHRATR_CJK_WEIGHT ); rSet.Put( aW ); @@ -504,7 +504,7 @@ static void lcl_FillAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet, case SID_ATTR_CHAR_POSTURE: { - SvxPostureItem aP( (FontItalic)rAttr.m_nAttr, RES_CHRATR_POSTURE ); + SvxPostureItem aP( static_cast<FontItalic>(rAttr.m_nAttr), RES_CHRATR_POSTURE ); rSet.Put( aP ); aP.SetWhich( RES_CHRATR_CJK_POSTURE ); rSet.Put( aP ); @@ -514,17 +514,17 @@ static void lcl_FillAuthorAttr( std::size_t nAuthor, SfxItemSet &rSet, break; case SID_ATTR_CHAR_UNDERLINE: - rSet.Put( SvxUnderlineItem( (FontLineStyle)rAttr.m_nAttr, + rSet.Put( SvxUnderlineItem( static_cast<FontLineStyle>(rAttr.m_nAttr), RES_CHRATR_UNDERLINE)); break; case SID_ATTR_CHAR_STRIKEOUT: - rSet.Put(SvxCrossedOutItem( (FontStrikeout)rAttr.m_nAttr, + rSet.Put(SvxCrossedOutItem( static_cast<FontStrikeout>(rAttr.m_nAttr), RES_CHRATR_CROSSEDOUT)); break; case SID_ATTR_CHAR_CASEMAP: - rSet.Put( SvxCaseMapItem( (SvxCaseMap)rAttr.m_nAttr, + rSet.Put( SvxCaseMapItem( static_cast<SvxCaseMap>(rAttr.m_nAttr), RES_CHRATR_CASEMAP)); break; diff --git a/sw/source/uibase/config/barcfg.cxx b/sw/source/uibase/config/barcfg.cxx index 671f81811a25..3dddef500eeb 100644 --- a/sw/source/uibase/config/barcfg.cxx +++ b/sw/source/uibase/config/barcfg.cxx @@ -86,7 +86,7 @@ void SwToolbarConfigItem::SetTopToolbar(SelectionType nSelType, ToolbarId eBarId sal_Int32 nProp = lcl_getArrayIndex(nSelType); if(nProp >= 0) { - aTbxIdArray[nProp] = (sal_Int32)eBarId; + aTbxIdArray[nProp] = static_cast<sal_Int32>(eBarId); SetModified(); } } diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx index d90eaa50b47b..3b7e19a82206 100644 --- a/sw/source/uibase/config/modcfg.cxx +++ b/sw/source/uibase/config/modcfg.cxx @@ -276,7 +276,7 @@ static sal_Int32 lcl_ConvertAttrToCfg(const AuthorCharAttr& rAttr) case SID_ATTR_CHAR_STRIKEOUT: nRet = 3; break; case SID_ATTR_CHAR_CASEMAP: { - switch((SvxCaseMap)rAttr.m_nAttr) + switch(static_cast<SvxCaseMap>(rAttr.m_nAttr)) { case SvxCaseMap::Uppercase : nRet = 5;break; case SvxCaseMap::Lowercase : nRet = 6;break; @@ -337,10 +337,10 @@ static void lcl_ConvertCfgToAttr(sal_Int32 nVal, AuthorCharAttr& rAttr, bool bDe } break; case 4: rAttr.m_nItemId = SID_ATTR_CHAR_UNDERLINE;rAttr.m_nAttr = LINESTYLE_DOUBLE ; break; - case 5: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = (sal_uInt16)SvxCaseMap::Uppercase; break; - case 6: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = (sal_uInt16)SvxCaseMap::Lowercase; break; - case 7: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = (sal_uInt16)SvxCaseMap::SmallCaps; break; - case 8: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = (sal_uInt16)SvxCaseMap::Capitalize; break; + case 5: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::Uppercase); break; + case 6: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::Lowercase); break; + case 7: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::SmallCaps); break; + case 8: rAttr.m_nItemId = SID_ATTR_CHAR_CASEMAP; rAttr.m_nAttr = sal_uInt16(SvxCaseMap::Capitalize); break; case 9: rAttr.m_nItemId = SID_ATTR_BRUSH; break; } } @@ -1155,7 +1155,7 @@ void SwTableConfig::ImplCommit() case 1 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(nTableVMove)); break; //"Shift/Column", case 2 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(nTableHInsert)); break; //"Insert/Row", case 3 : pValues[nProp] <<= static_cast<sal_Int32>(convertTwipToMm100(nTableVInsert)); break; //"Insert/Column", - case 4 : pValues[nProp] <<= (sal_Int32)eTableChgMode; break; //"Change/Effect", + case 4 : pValues[nProp] <<= static_cast<sal_Int32>(eTableChgMode); break; //"Change/Effect", case 5 : pValues[nProp] <<= bInsTableFormatNum; break; //"Input/NumberRecognition", case 6 : pValues[nProp] <<= bInsTableChangeNumFormat; break; //"Input/NumberFormatRecognition", case 7 : pValues[nProp] <<= bInsTableAlignNum; break; //"Input/Alignment" @@ -1181,7 +1181,7 @@ void SwTableConfig::Load() case 1 : pValues[nProp] >>= nTemp; nTableVMove = static_cast<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Shift/Column", case 2 : pValues[nProp] >>= nTemp; nTableHInsert = static_cast<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Insert/Row", case 3 : pValues[nProp] >>= nTemp; nTableVInsert = static_cast<sal_uInt16>(convertMm100ToTwip(nTemp)); break; //"Insert/Column", - case 4 : pValues[nProp] >>= nTemp; eTableChgMode = (TableChgMode)nTemp; break; //"Change/Effect", + case 4 : pValues[nProp] >>= nTemp; eTableChgMode = static_cast<TableChgMode>(nTemp); break; //"Change/Effect", case 5 : bInsTableFormatNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberRecognition", case 6 : bInsTableChangeNumFormat = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/NumberFormatRecognition", case 7 : bInsTableAlignNum = *o3tl::doAccess<bool>(pValues[nProp]); break; //"Input/Alignment" @@ -1347,7 +1347,7 @@ void SwCompareConfig::ImplCommit() Sequence<Any> aValues(aNames.getLength()); Any* pValues = aValues.getArray(); - pValues[0] <<= (sal_Int32) eCmpMode; + pValues[0] <<= static_cast<sal_Int32>(eCmpMode); pValues[1] <<= bUseRsid; pValues[2] <<= bIgnorePieces; pValues[3] <<= static_cast<sal_Int32>(nPieceLen); @@ -1371,7 +1371,7 @@ void SwCompareConfig::Load() switch(nProp) { - case 0 : eCmpMode = (SwCompareMode) nVal; break; + case 0 : eCmpMode = static_cast<SwCompareMode>(nVal); break; case 1 : bUseRsid = *o3tl::doAccess<bool>(pValues[nProp]); break; case 2 : bIgnorePieces = *o3tl::doAccess<bool>(pValues[nProp]); break; case 3 : nPieceLen = nVal; break; diff --git a/sw/source/uibase/config/prtopt.cxx b/sw/source/uibase/config/prtopt.cxx index 7a64b884e140..1b54c1eccb39 100644 --- a/sw/source/uibase/config/prtopt.cxx +++ b/sw/source/uibase/config/prtopt.cxx @@ -143,7 +143,7 @@ void SwPrintOptions::ImplCommit() case 2: pValues[nProp] <<= m_bPrintControl; break; case 3: pValues[nProp] <<= m_bPrintPageBackground; break; case 4: pValues[nProp] <<= m_bPrintBlackFont; break; - case 5: pValues[nProp] <<= (sal_Int32)m_nPrintPostIts ; break; + case 5: pValues[nProp] <<= static_cast<sal_Int32>(m_nPrintPostIts) ; break; case 6: pValues[nProp] <<= m_bPrintReverse; break; case 7: pValues[nProp] <<= m_bPrintProspect; break; case 8: pValues[nProp] <<= m_bPrintProspectRTL; break; diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx index 222ebe47b424..b2c5db331231 100644 --- a/sw/source/uibase/config/usrpref.cxx +++ b/sw/source/uibase/config/usrpref.cxx @@ -296,7 +296,7 @@ void SwLayoutViewConfig::ImplCommit() break; case 8: rVal <<= rParent.IsSmoothScroll(); break; // "Window/SmoothScroll", case 9: rVal <<= static_cast<sal_Int32>(rParent.GetZoom()); break; // "Zoom/Value", - case 10: rVal <<= (sal_Int32)rParent.GetZoomType(); break; // "Zoom/Type", + case 10: rVal <<= static_cast<sal_Int32>(rParent.GetZoomType()); break; // "Zoom/Type", case 11: rVal <<= rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline" case 12: rVal <<= static_cast<sal_Int32>(rParent.GetMetric()); break; // "Other/MeasureUnit", case 13: rVal <<= static_cast<sal_Int32>(convertTwipToMm100(rParent.GetDefTab())); break;// "Other/TabStop", @@ -339,20 +339,20 @@ void SwLayoutViewConfig::Load() case 6: { rParent.m_bIsHScrollMetricSet = true; - rParent.m_eHScrollMetric = ((FieldUnit)nInt32Val); // "Window/HorizontalRulerUnit" + rParent.m_eHScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/HorizontalRulerUnit" } break; case 7: { rParent.m_bIsVScrollMetricSet = true; - rParent.m_eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit" + rParent.m_eVScrollMetric = static_cast<FieldUnit>(nInt32Val); // "Window/VerticalRulerUnit" } break; case 8: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll", case 9: rParent.SetZoom( static_cast< sal_uInt16 >(nInt32Val) ); break;// "Zoom/Value", case 10: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type", case 11: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline" - case 12: rParent.SetMetric((FieldUnit)nInt32Val, true); break;// "Other/MeasureUnit", + case 12: rParent.SetMetric(static_cast<FieldUnit>(nInt32Val), true); break;// "Other/MeasureUnit", case 13: rParent.SetDefTab(convertMm100ToTwip(nInt32Val), true); break;// "Other/TabStop", case 14: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", case 15: rParent.SetViewLayoutColumns( static_cast<sal_uInt16>(nInt32Val) ); break;// "ViewLayout/Columns", diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 7bdc2deea632..832a20bcc4c4 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -4240,7 +4240,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) { SwRect aRect; sal_Int16 eOrient; - SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCursorFillMode(); + SwFillMode eMode = static_cast<SwFillMode>(rSh.GetViewOptions()->GetShdwCursorFillMode()); if( rSh.GetShadowCursorPos( aDocPt, eMode, aRect, eOrient )) { if( !m_pShadCursor ) @@ -4737,7 +4737,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) rSh.Undo(); } } - SwFillMode eMode = (SwFillMode)rSh.GetViewOptions()->GetShdwCursorFillMode(); + SwFillMode eMode = static_cast<SwFillMode>(rSh.GetViewOptions()->GetShdwCursorFillMode()); rSh.SetShadowCursorPos( aDocPt, eMode ); } } @@ -4905,7 +4905,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) { SfxRequest aReq( m_rView.GetViewFrame(), SID_STYLE_APPLY ); aReq.AppendItem( SfxStringItem( SID_STYLE_APPLY, aStyleName ) ); - aReq.AppendItem( SfxUInt16Item( SID_STYLE_FAMILY, (sal_uInt16) m_pApplyTempl->eType ) ); + aReq.AppendItem( SfxUInt16Item( SID_STYLE_FAMILY, static_cast<sal_uInt16>(m_pApplyTempl->eType) ) ); aReq.Done(); } } diff --git a/sw/source/uibase/envelp/envimg.cxx b/sw/source/uibase/envelp/envimg.cxx index 4830eb7f1e7b..c09159802628 100644 --- a/sw/source/uibase/envelp/envimg.cxx +++ b/sw/source/uibase/envelp/envimg.cxx @@ -198,7 +198,7 @@ SwEnvCfgItem::SwEnvCfgItem() : case 9: { sal_Int32 nTemp = 0; - pValues[nProp] >>= nTemp; aEnvItem.m_eAlign = (SwEnvAlign)nTemp; break;// "Print/Alignment", + pValues[nProp] >>= nTemp; aEnvItem.m_eAlign = static_cast<SwEnvAlign>(nTemp); break;// "Print/Alignment", } case 10: aEnvItem.m_bPrintFromAbove = *o3tl::doAccess<bool>(pValues[nProp]); break;// "Print/FromAbove", case 11: diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 0b32da4ab064..efc72ec5a2e0 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1654,7 +1654,7 @@ void SwFieldMgr::UpdateCurField(sal_uInt32 nFormat, SwAuthorityFieldType* pAuthorityType = static_cast<SwAuthorityFieldType*>(pType); SwAuthEntry aTempEntry; for( sal_uInt16 i = 0; i < AUTH_FIELD_END; ++i ) - aTempEntry.SetAuthorField( (ToxAuthorityField)i, + aTempEntry.SetAuthorField( static_cast<ToxAuthorityField>(i), rPar1.getToken( i, TOX_STYLE_DELIMITER )); if( pAuthorityType->ChangeEntryContent( &aTempEntry ) ) { diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx index b89d45986e6e..31f7c5de9cc4 100644 --- a/sw/source/uibase/misc/numberingtypelistbox.cxx +++ b/sw/source/uibase/misc/numberingtypelistbox.cxx @@ -169,7 +169,7 @@ SvxNumType SwNumberingTypeListBox::GetSelectedNumberingType() SvxNumType nRet = SVX_NUM_CHARS_UPPER_LETTER; sal_Int32 nSelPos = GetSelectedEntryPos(); if(LISTBOX_ENTRY_NOTFOUND != nSelPos) - nRet = (SvxNumType)reinterpret_cast<sal_uLong>(GetEntryData(nSelPos)); + nRet = static_cast<SvxNumType>(reinterpret_cast<sal_uLong>(GetEntryData(nSelPos))); #if OSL_DEBUG_LEVEL > 0 else OSL_FAIL("SwNumberingTypeListBox not selected"); diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 8888531bca41..da1f9880e303 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -356,8 +356,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case FN_SET_SUPER_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) - aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Superscript ) aItem.SetEscapement( SvxEscapement::Off ); @@ -369,8 +368,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case FN_SET_SUB_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) - aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Subscript ) aItem.SetEscapement( SvxEscapement::Off ); @@ -1086,7 +1084,7 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet) } sal_uInt16 nHtmlMode = ::GetHtmlMode(rView.GetDocShell()); - aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | + aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() | ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0))); rSet.Put(aHLinkItem); diff --git a/sw/source/uibase/shells/drformsh.cxx b/sw/source/uibase/shells/drformsh.cxx index b34c5f818d41..237ed48c671f 100644 --- a/sw/source/uibase/shells/drformsh.cxx +++ b/sw/source/uibase/shells/drformsh.cxx @@ -232,7 +232,7 @@ void SwDrawFormShell::GetState(SfxItemSet& rSet) } } sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); - aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | + aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() | ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0))); rSet.Put(aHLinkItem); diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index 53aa72233b20..a672625fae0b 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -217,7 +217,7 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) if (bCaption) pSdrView->GetAttributes( aSet ); - aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, (sal_Int16)nAnchor)); + aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_ANCHOR, static_cast<sal_Int16>(nAnchor))); bool bRTL; bool bVertL2R; aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_IN_VERTICAL_TEXT, pSh->IsFrameVertical(true, bRTL, bVertL2R))); @@ -270,12 +270,12 @@ void SwDrawBaseShell::Execute(SfxRequest const &rReq) SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem)) { if(!bSingleSelection) - pSh->ChgAnchor((RndStdIds)static_cast<const SfxInt16Item*>(pAnchorItem) - ->GetValue(), false, bPosCorr ); + pSh->ChgAnchor(static_cast<RndStdIds>(static_cast<const SfxInt16Item*>(pAnchorItem) + ->GetValue()), false, bPosCorr ); else { SwFormatAnchor aAnchor(pFrameFormat->GetAnchor()); - aAnchor.SetType((RndStdIds)static_cast<const SfxInt16Item*>(pAnchorItem)->GetValue()); + aAnchor.SetType(static_cast<RndStdIds>(static_cast<const SfxInt16Item*>(pAnchorItem)->GetValue())); aFrameAttrSet.Put( aAnchor ); } } diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index dd62e7aff9ff..9fb3d1b86739 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -302,8 +302,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case FN_SET_SUPER_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) - aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Superscript ) aItem.SetEscapement( SvxEscapement::Off ); @@ -315,8 +314,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case FN_SET_SUB_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) - aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Subscript ) aItem.SetEscapement( SvxEscapement::Off ); @@ -1098,7 +1096,7 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet) } sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); - aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | + aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() | ((nHtmlMode & HTMLMODE_ON) != 0 ? HLINK_HTMLMODE : 0))); rSet.Put(aHLinkItem); diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 790c291aa5d9..39f60b564b0e 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -858,7 +858,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) aHLinkItem.SetName(rSh.GetFlyName()); } - aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | + aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() | (bHtmlMode ? HLINK_HTMLMODE : 0))); rSet.Put(aHLinkItem); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index a8d2850bccbd..0fd6daf05927 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -678,7 +678,7 @@ void SwGrfShell::ExecAttr( SfxRequest const &rReq ) case SID_ATTR_GRAF_MODE: if( pItem ) aGrfSet.Put( SwDrawModeGrf( - (GraphicDrawMode)static_cast<const SfxUInt16Item*>(pItem)->GetValue() )); + static_cast<GraphicDrawMode>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )); break; case SID_COLOR_SETTINGS: @@ -870,8 +870,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) case SID_ATTR_GRAF_MODE: if( !bParentCntProt ) - rSet.Put( SfxUInt16Item( nWhich, (sal_uInt16) - aCoreSet.Get(RES_GRFATR_DRAWMODE).GetValue() )); + rSet.Put( SfxUInt16Item( nWhich, static_cast<sal_uInt16>(aCoreSet.Get(RES_GRFATR_DRAWMODE).GetValue()) )); break; case SID_GRFFILTER: diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 0231476eef58..0d4d05993909 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -1003,14 +1003,14 @@ void SwTableShell::Execute(SfxRequest &rReq) const SfxUInt16Item* pType = rReq.GetArg<SfxUInt16Item>(FN_PARAM_1); if( pType ) { - switch( (SplitTable_HeadlineOption)pType->GetValue() ) + switch( static_cast<SplitTable_HeadlineOption>(pType->GetValue()) ) { case SplitTable_HeadlineOption::NONE : case SplitTable_HeadlineOption::BorderCopy: case SplitTable_HeadlineOption::ContentCopy: case SplitTable_HeadlineOption::BoxAttrCopy: case SplitTable_HeadlineOption::BoxAttrAllCopy: - rSh.SplitTable((SplitTable_HeadlineOption)pType->GetValue()) ; + rSh.SplitTable(static_cast<SplitTable_HeadlineOption>(pType->GetValue())) ; break; default: ;//wrong parameter, do nothing } @@ -1023,7 +1023,7 @@ void SwTableShell::Execute(SfxRequest &rReq) ScopedVclPtr<AbstractSplitTableDialog> pDlg(pFact->CreateSplitTableDialog( GetView().GetWindow(), rSh )); OSL_ENSURE(pDlg, "Dialog creation failed!"); pDlg->Execute(); - rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, (sal_uInt16)pDlg->GetSplitMode() ) ); + rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(pDlg->GetSplitMode()) ) ); bCallDone = true; } break; diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index 5f12d98a3a5d..58fcb9b33d52 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -267,8 +267,8 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) try { ScrollingMode eScroll = ScrollingMode::Auto; - if( pScrollingItem && pScrollingItem->GetValue() <= (int)ScrollingMode::Auto ) - eScroll = (ScrollingMode) pScrollingItem->GetValue(); + if( pScrollingItem && pScrollingItem->GetValue() <= int(ScrollingMode::Auto) ) + eScroll = static_cast<ScrollingMode>(pScrollingItem->GetValue()); Size aMargin; if ( pMarginItem ) @@ -438,7 +438,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) Point aPos = aMgr.GetPos(); RndStdIds eAnchor = RndStdIds::FLY_AT_PARA; if(pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) - eAnchor = (RndStdIds)static_cast<const SfxUInt16Item *>(pItem)->GetValue(); + eAnchor = static_cast<RndStdIds>(static_cast<const SfxUInt16Item *>(pItem)->GetValue()); if(pArgs->GetItemState(FN_PARAM_1, false, &pItem) == SfxItemState::SET) aPos = static_cast<const SfxPointItem *>(pItem)->GetValue(); if(pArgs->GetItemState(FN_PARAM_2, false, &pItem) == SfxItemState::SET) @@ -498,7 +498,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) if ( xRecorder.is() ) { //FN_INSERT_FRAME - sal_uInt16 nAnchor = (sal_uInt16)aMgr.GetAnchor(); + sal_uInt16 nAnchor = static_cast<sal_uInt16>(aMgr.GetAnchor()); rReq.AppendItem(SfxUInt16Item(nSlot, nAnchor)); rReq.AppendItem(SfxPointItem(FN_PARAM_1, rShell.GetObjAbsPos())); rReq.AppendItem(SvxSizeItem(FN_PARAM_2, rShell.GetObjSize())); @@ -676,7 +676,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) aHLinkItem.SetName(comphelper::string::stripEnd(sReturn, ' ')); } - aHLinkItem.SetInsertMode((SvxLinkInsertMode)(aHLinkItem.GetInsertMode() | + aHLinkItem.SetInsertMode(static_cast<SvxLinkInsertMode>(aHLinkItem.GetInsertMode() | (bHtmlModeOn ? HLINK_HTMLMODE : 0))); aHLinkItem.SetMacroEvents ( HyperDialogEvent::MouseOverObject| HyperDialogEvent::MouseClickObject | HyperDialogEvent::MouseOutObject ); diff --git a/sw/source/uibase/sidebar/PageFormatPanel.cxx b/sw/source/uibase/sidebar/PageFormatPanel.cxx index 59301a7b6bd7..82c182dd8a36 100644 --- a/sw/source/uibase/sidebar/PageFormatPanel.cxx +++ b/sw/source/uibase/sidebar/PageFormatPanel.cxx @@ -285,7 +285,7 @@ FieldUnit PageFormatPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolIte FieldUnit eUnit = FUNIT_NONE; if ( pState && eState >= SfxItemState::DEFAULT ) - eUnit = (FieldUnit) static_cast<const SfxUInt16Item*>(pState)->GetValue(); + eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pState)->GetValue()); else { SfxViewFrame* pFrame = SfxViewFrame::Current(); @@ -299,7 +299,7 @@ FieldUnit PageFormatPanel::GetCurrentUnit( SfxItemState eState, const SfxPoolIte { const SfxPoolItem* pItem = pModule->GetItem( SID_ATTR_METRIC ); if ( pItem ) - eUnit = (FieldUnit) static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); } else { diff --git a/sw/source/uibase/sidebar/PageMarginControl.cxx b/sw/source/uibase/sidebar/PageMarginControl.cxx index 2dc454cde2b7..84ed8c5dddab 100644 --- a/sw/source/uibase/sidebar/PageMarginControl.cxx +++ b/sw/source/uibase/sidebar/PageMarginControl.cxx @@ -54,7 +54,7 @@ namespace SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_METRIC, pItem ); if ( pItem && eState >= SfxItemState::DEFAULT ) { - eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>( pItem )->GetValue(); + eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>( pItem )->GetValue()); } else { diff --git a/sw/source/uibase/sidebar/PageSizeControl.cxx b/sw/source/uibase/sidebar/PageSizeControl.cxx index ee31d4c597c9..9dbb836ccb31 100644 --- a/sw/source/uibase/sidebar/PageSizeControl.cxx +++ b/sw/source/uibase/sidebar/PageSizeControl.cxx @@ -45,7 +45,7 @@ namespace SfxItemState eState = SfxViewFrame::Current()->GetBindings().GetDispatcher()->QueryState( SID_ATTR_METRIC, pItem ); if ( pItem && eState >= SfxItemState::DEFAULT ) { - eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); } else { diff --git a/sw/source/uibase/sidebar/PageStylesPanel.cxx b/sw/source/uibase/sidebar/PageStylesPanel.cxx index 25dfef9adf95..496ab873e6a1 100644 --- a/sw/source/uibase/sidebar/PageStylesPanel.cxx +++ b/sw/source/uibase/sidebar/PageStylesPanel.cxx @@ -168,7 +168,7 @@ void PageStylesPanel::Initialize() void PageStylesPanel::Update() { - const eFillStyle eXFS = (eFillStyle)mpBgFillType->GetSelectedEntryPos(); + const eFillStyle eXFS = static_cast<eFillStyle>(mpBgFillType->GetSelectedEntryPos()); SfxObjectShell* pSh = SfxObjectShell::Current(); switch(eXFS) { @@ -481,7 +481,7 @@ IMPL_LINK_NOARG( PageStylesPanel, ModifyLayoutHdl, ListBox&, void ) IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, ListBox&, void) { - const eFillStyle eXFS = (eFillStyle)mpBgFillType->GetSelectedEntryPos(); + const eFillStyle eXFS = static_cast<eFillStyle>(mpBgFillType->GetSelectedEntryPos()); Update(); switch (eXFS) @@ -530,7 +530,7 @@ IMPL_LINK_NOARG(PageStylesPanel, ModifyFillStyleHdl, ListBox&, void) void PageStylesPanel::ModifyFillColor() { - const eFillStyle eXFS = (eFillStyle)mpBgFillType->GetSelectedEntryPos(); + const eFillStyle eXFS = static_cast<eFillStyle>(mpBgFillType->GetSelectedEntryPos()); SfxObjectShell* pSh = SfxObjectShell::Current(); switch(eXFS) { diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 4c4644bc81ab..556d3a9ce44a 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1094,7 +1094,7 @@ void SwView::WriteUserData( OUString &rUserData, bool bBrowse ) rUserData += OUString::number( bBrowse ? SAL_MIN_INT32 : rVis.Bottom()); rUserData += ";"; rUserData += OUString::number( - (sal_uInt16)m_pWrtShell->GetViewOptions()->GetZoomType());//eZoom; + static_cast<sal_uInt16>(m_pWrtShell->GetViewOptions()->GetZoomType()));//eZoom; rUserData += ";"; rUserData += FrameTypeFlags::NONE == m_pWrtShell->GetSelFrameType() ? OUString("0") : OUString("1"); } @@ -1152,7 +1152,7 @@ void SwView::ReadUserData( const OUString &rUserData, bool bBrowse ) sal_Int32 nOff = 0; SvxZoomType eZoom; if( !m_pWrtShell->GetViewOptions()->getBrowseMode() ) - eZoom = (SvxZoomType) static_cast<sal_uInt16>(rUserData.getToken(nOff, ';', nPos ).toInt32()); + eZoom = static_cast<SvxZoomType>(static_cast<sal_uInt16>(rUserData.getToken(nOff, ';', nPos ).toInt32())); else { eZoom = SvxZoomType::PERCENT; diff --git a/sw/source/uibase/uiview/viewcoll.cxx b/sw/source/uibase/uiview/viewcoll.cxx index cf37be0dac25..fa322098a6fa 100644 --- a/sw/source/uibase/uiview/viewcoll.cxx +++ b/sw/source/uibase/uiview/viewcoll.cxx @@ -55,7 +55,7 @@ void SwView::ExecColl(SfxRequest const &rReq) SfxStringItem aName(SID_STYLE_APPLY, static_cast<const SfxStringItem*>(pItem)->GetValue()); SfxUInt16Item aFamItem( SID_STYLE_FAMILY, - (sal_uInt16) SfxStyleFamily::Page); + sal_uInt16(SfxStyleFamily::Page)); SwPtrItem aShell(FN_PARAM_WRTSHELL, GetWrtShellPtr()); SfxRequest aReq(SID_STYLE_APPLY, SfxCallMode::SLOT, GetPool()); aReq.AppendItem(aName); diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index e3f328a3b3c3..9de01bf198ba 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -117,7 +117,7 @@ void SwView::AutoCaption(const sal_uInt16 nType, const SvGlobalName *pOleId) bool bWeb = dynamic_cast<SwWebView*>( this ) != nullptr; if (pModOpt->IsInsWithCaption(bWeb)) { - const InsCaptionOpt *pOpt = pModOpt->GetCapOption(bWeb, (SwCapObjType)nType, pOleId); + const InsCaptionOpt *pOpt = pModOpt->GetCapOption(bWeb, static_cast<SwCapObjType>(nType), pOleId); if (pOpt && pOpt->UseCaption()) InsertCaption(pOpt); } diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index d7009cd20b26..132fddc777de 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -465,7 +465,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf { sal_Int16 nMode = 0; rValue >>= nMode; - switch ((CharCompressType)nMode) + switch (static_cast<CharCompressType>(nMode)) { case CharCompressType::NONE: case CharCompressType::PunctuationOnly: @@ -474,7 +474,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf default: throw IllegalArgumentException(); } - mpDoc->getIDocumentSettingAccess().setCharacterCompressionType((CharCompressType)nMode); + mpDoc->getIDocumentSettingAccess().setCharacterCompressionType(static_cast<CharCompressType>(nMode)); } break; case HANDLE_APPLY_USER_DATA: diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 1161997994a5..c03857e128b6 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -781,7 +781,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > bool bCancel; nResult = static_cast<sal_Int32>(pUnoCursor->Find( aSearch, !pSearch->m_bStyles, eStart, eEnd, bCancel, - (FindRanges)eRanges, + static_cast<FindRanges>(eRanges), !pSearch->m_sSearchText.isEmpty() ? &aSearchOpt : nullptr, &aReplace )); } @@ -793,7 +793,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > bool bCancel; nResult = pUnoCursor->Find( *pSearchColl, eStart, eEnd, bCancel, - (FindRanges)eRanges, pReplaceColl ); + static_cast<FindRanges>(eRanges), pReplaceColl ); } else @@ -802,7 +802,7 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > bool bCancel; nResult = pUnoCursor->Find( aSearchOpt, false/*bSearchInNotes*/, eStart, eEnd, bCancel, - (FindRanges)eRanges, + static_cast<FindRanges>(eRanges), true ); } return static_cast<sal_Int32>(nResult); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index ffb464c5b20a..b4a244499114 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -543,7 +543,7 @@ Sequence< Sequence< PropertyValue > > SwXTextView::getRubyList( sal_Bool /*bAuto SwStyleNameMapper::FillProgName(rAttr.GetCharFormatName(), aString, SwGetPoolIdFromName::ChrFmt ); pValues[2].Value <<= aString; pValues[3].Name = UNO_NAME_RUBY_ADJUST; - pValues[3].Value <<= (sal_Int16)rAttr.GetAdjustment(); + pValues[3].Value <<= static_cast<sal_Int16>(rAttr.GetAdjustment()); pValues[4].Name = UNO_NAME_RUBY_IS_ABOVE; pValues[4].Value <<= !rAttr.GetPosition(); } @@ -603,7 +603,7 @@ void SAL_CALL SwXTextView::setRubyList( { sal_Int16 nTmp = 0; if(pProperties[nProp].Value >>= nTmp) - pEntry->GetRubyAttr().SetAdjustment((css::text::RubyAdjust)nTmp); + pEntry->GetRubyAttr().SetAdjustment(static_cast<css::text::RubyAdjust>(nTmp)); } else if(pProperties[nProp].Name == UNO_NAME_RUBY_IS_ABOVE) { diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index d924f7058b47..f58c15a6e358 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -247,8 +247,8 @@ SwContentType::SwContentType(SwWrtShell* pShell, ContentTypeId nType, sal_uInt8 SwTypeNumber(CTYPE_CTT), pWrtShell(pShell), pMember(nullptr), - sContentTypeName(SwResId(STR_CONTENT_TYPE_ARY[(int)nType])), - sSingleContentTypeName(SwResId(STR_CONTENT_TYPE_SINGLE_ARY[(int)nType])), + sContentTypeName(SwResId(STR_CONTENT_TYPE_ARY[static_cast<int>(nType)])), + sSingleContentTypeName(SwResId(STR_CONTENT_TYPE_SINGLE_ARY[static_cast<int>(nType)])), nMemberCount(0), nContentType(nType), nOutlineLevel(nLevel), @@ -1452,7 +1452,7 @@ bool SwContentTree::Expand( SvTreeListEntry* pParent ) if(lcl_IsContentType(pParent)) { SwContentType* pCntType = static_cast<SwContentType*>(pParent->GetUserData()); - const sal_Int32 nOr = 1 << (int)pCntType->GetType(); //linear -> Bitposition + const sal_Int32 nOr = 1 << static_cast<int>(pCntType->GetType()); //linear -> Bitposition if (State::HIDDEN != m_eState) { m_nActiveBlock |= nOr; @@ -1512,7 +1512,7 @@ bool SwContentTree::Collapse( SvTreeListEntry* pParent ) if(m_bIsRoot) return false; SwContentType* pCntType = static_cast<SwContentType*>(pParent->GetUserData()); - const sal_Int32 nAnd = ~(1 << (int)pCntType->GetType()); + const sal_Int32 nAnd = ~(1 << static_cast<int>(pCntType->GetType())); if (State::HIDDEN != m_eState) { m_nActiveBlock &= nAnd; @@ -1685,7 +1685,7 @@ void SwContentTree::Display( bool bActive ) sal_Int32 nExpandOptions = (State::HIDDEN == m_eState) ? m_nHiddenBlock : m_nActiveBlock; - if(nExpandOptions & (1 << (int)nCntType)) + if(nExpandOptions & (1 << static_cast<int>(nCntType))) { Expand(pEntry); if(nEntryRelPos && nCntType == m_nLastSelType) @@ -2588,7 +2588,7 @@ DragDropMode SwContentTree::NotifyStartDrag( TransferDataContainer& rContainer, SvTreeListEntry* pEntry ) { - DragDropMode eMode = (DragDropMode)0; + DragDropMode eMode = DragDropMode(0); if (State::ACTIVE == m_eState && m_nRootType == ContentTypeId::OUTLINE && GetModel()->GetAbsPos( pEntry ) > 0 && !GetWrtShell()->GetView().GetDocShell()->IsReadOnly()) @@ -3528,7 +3528,7 @@ void NaviContentBookmark::Copy( TransferDataContainer& rData ) const OString sStrBuf(OUStringToOString(aUrl, eSysCSet) + OString(NAVI_BOOKMARK_DELIM) + OUStringToOString(aDescr, eSysCSet) + OString(NAVI_BOOKMARK_DELIM) + - OString::number((int)nDefDrag) + OString(NAVI_BOOKMARK_DELIM) + + OString::number(static_cast<int>(nDefDrag)) + OString(NAVI_BOOKMARK_DELIM) + OString::number(nDocSh)); rData.CopyByteString(SotClipboardFormatId::SONLK, sStrBuf); } diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx index c613f1d7213f..e842ee41cebd 100644 --- a/sw/source/uibase/utlui/numfmtlb.cxx +++ b/sw/source/uibase/utlui/numfmtlb.cxx @@ -199,7 +199,7 @@ void NumFormatListBox::SetFormatType(const SvNumFormatType nFormatType) for( long nIndex = eOffsetStart; nIndex <= eOffsetEnd; ++nIndex ) { const sal_uInt32 nFormat = pFormatter->GetFormatIndex( - (NfIndexTableOffset)nIndex, eCurLanguage ); + static_cast<NfIndexTableOffset>(nIndex), eCurLanguage ); pFormat = pFormatter->GetEntry( nFormat ); if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD, diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx index cf14a67ed9aa..8b3f02a74b8a 100644 --- a/sw/source/uibase/utlui/uiitems.cxx +++ b/sw/source/uibase/utlui/uiitems.cxx @@ -86,7 +86,7 @@ bool SwPageFootnoteInfoItem::QueryValue( Any& rVal, sal_uInt8 nMemberId ) const rVal <<= static_cast<sal_Int8>(static_cast<long>(aTmp)); } break; - case MID_LINE_ADJUST : rVal <<= (sal_Int16)aFootnoteInfo.GetAdj();break;//text::HorizontalAdjust + case MID_LINE_ADJUST : rVal <<= static_cast<sal_Int16>(aFootnoteInfo.GetAdj());break;//text::HorizontalAdjust case MID_LINE_TEXT_DIST : rVal <<= static_cast<sal_Int32>(convertTwipToMm100(aFootnoteInfo.GetTopDist()));break; case MID_LINE_FOOTNOTE_DIST: rVal <<= static_cast<sal_Int32>(convertTwipToMm100(aFootnoteInfo.GetBottomDist()));break; case MID_FTN_LINE_STYLE : @@ -159,7 +159,7 @@ bool SwPageFootnoteInfoItem::PutValue(const Any& rVal, sal_uInt8 nMemberId) sal_Int16 nSet = 0; rVal >>= nSet; if(nSet >= 0 && nSet < 3) //text::HorizontalAdjust - aFootnoteInfo.SetAdj((css::text::HorizontalAdjust)nSet); + aFootnoteInfo.SetAdj(static_cast<css::text::HorizontalAdjust>(nSet)); else bRet = false; } |