diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx index 9760f8988bda..0f4788fed7d4 100644 --- a/sw/source/filter/writer/writer.cxx +++ b/sw/source/filter/writer/writer.cxx @@ -352,15 +352,15 @@ void Writer::PutEditEngFontsInAttrPool( bool bIncl_CJK_CTL ) void Writer::_AddFontItems( SfxItemPool& rPool, sal_uInt16 nW ) { - const SvxFontItem* pFont = (const SvxFontItem*)&rPool.GetDefaultItem( nW ); + const SvxFontItem* pFont = static_cast(&rPool.GetDefaultItem( nW )); _AddFontItem( rPool, *pFont ); - if( 0 != ( pFont = (const SvxFontItem*)rPool.GetPoolDefaultItem( nW )) ) + if( 0 != ( pFont = static_cast(rPool.GetPoolDefaultItem( nW ))) ) _AddFontItem( rPool, *pFont ); sal_uInt32 nMaxItem = rPool.GetItemCount2( nW ); for( sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet ) - if( 0 != (pFont = (const SvxFontItem*)rPool.GetItem2( nW, nGet )) ) + if( 0 != (pFont = static_cast(rPool.GetItem2( nW, nGet ))) ) _AddFontItem( rPool, *pFont ); } @@ -371,10 +371,10 @@ void Writer::_AddFontItem( SfxItemPool& rPool, const SvxFontItem& rFont ) { SvxFontItem aFont( rFont ); aFont.SetWhich( RES_CHRATR_FONT ); - pItem = (SvxFontItem*)&rPool.Put( aFont ); + pItem = static_cast(&rPool.Put( aFont )); } else - pItem = (SvxFontItem*)&rPool.Put( rFont ); + pItem = static_cast(&rPool.Put( rFont )); if( 1 < pItem->GetRefCount() ) rPool.Remove( *pItem ); diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx index fb5d2aff68c0..968a3ddd1d95 100644 --- a/sw/source/filter/writer/wrtswtbl.cxx +++ b/sw/source/filter/writer/wrtswtbl.cxx @@ -82,7 +82,7 @@ sal_uInt32 SwWriteTable::GetBoxWidth( const SwTableBox *pBox ) { const SwFrmFmt *pFmt = pBox->GetFrmFmt(); const SwFmtFrmSize& aFrmSize= - (const SwFmtFrmSize&)pFmt->GetFmtAttr( RES_FRM_SIZE ); + static_cast(pFmt->GetFmtAttr( RES_FRM_SIZE )); return sal::static_int_cast(aFrmSize.GetSize().Width()); } @@ -176,11 +176,11 @@ const SvxBrushItem *SwWriteTable::GetLineBrush( const SwTableBox *pBox, if( !pLine->GetUpper() ) { if( !pRow->GetBackground() ) - pRow->SetBackground( (const SvxBrushItem *)pItem ); + pRow->SetBackground( static_cast(pItem) ); pItem = 0; } - return (const SvxBrushItem *)pItem; + return static_cast(pItem); } pBox = pLine->GetUpper(); @@ -230,7 +230,7 @@ sal_uInt16 SwWriteTable::MergeBoxBorders( const SwTableBox *pBox, sal_uInt16 nBorderMask = 0; const SwFrmFmt *pFrmFmt = pBox->GetFrmFmt(); - const SvxBoxItem& rBoxItem = (const SvxBoxItem&)pFrmFmt->GetFmtAttr( RES_BOX ); + const SvxBoxItem& rBoxItem = static_cast(pFrmFmt->GetFmtAttr( RES_BOX )); if( rBoxItem.GetTop() ) { @@ -596,7 +596,7 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow, if( SfxItemState::SET == rItemSet.GetItemState( RES_BACKGROUND, false, &pItem ) ) { - pLineBrush = (const SvxBrushItem *)pItem; + pLineBrush = static_cast(pItem); // If the row spans the entire table, we can // print out the background to the row. Otherwise diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 81db98a05043..862d75486f79 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1424,7 +1424,7 @@ void DocxAttributeOutput::StartField_Impl( FieldInfos& rInfos, bool bWriteRun ) WriteFFData( rInfos ); if ( rInfos.pField ) { - const SwDropDownField& rFld2 = *(SwDropDownField*)rInfos.pField; + const SwDropDownField& rFld2 = *static_cast(rInfos.pField); uno::Sequence aItems = rFld2.GetItemSequence(); GetExport().DoComboBox(rFld2.GetName(), @@ -3590,7 +3590,7 @@ void DocxAttributeOutput::TableVerticalCell( ww8::WW8TableNodeInfoInner::Pointer aPam.GetPoint()->nNode++; if (aPam.GetPoint()->nNode.GetNode().IsTxtNode()) { - const SwTxtNode& rTxtNode = (const SwTxtNode&)aPam.GetPoint()->nNode.GetNode(); + const SwTxtNode& rTxtNode = static_cast(aPam.GetPoint()->nNode.GetNode()); if( const SwAttrSet* pAttrSet = rTxtNode.GetpSwAttrSet()) { const SvxCharRotateItem& rCharRotate = pAttrSet->GetCharRotate(); @@ -5494,7 +5494,7 @@ void DocxAttributeOutput::SectionPageBorders( const SwFrmFmt* pFmt, const SwFrmF const SfxPoolItem* pItem = GetExport().HasItem( RES_SHADOW ); if ( pItem ) { - const SvxShadowItem* pShadowItem = (const SvxShadowItem*)pItem; + const SvxShadowItem* pShadowItem = static_cast(pItem); aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation(); } @@ -5570,7 +5570,7 @@ static OString impl_LevelNFC( sal_uInt16 nNumberingType , const SfxItemSet *pOut case style::NumberingType::NUMBER_LOWER_ZH: aType="taiwaneseCountingThousand"; if (pOutSet) { - const SvxLanguageItem rLang = (const SvxLanguageItem&) pOutSet->Get( RES_CHRATR_CJK_LANGUAGE,true); + const SvxLanguageItem rLang = static_cast( pOutSet->Get( RES_CHRATR_CJK_LANGUAGE,true) ); const LanguageType eLang = rLang.GetLanguage(); if (LANGUAGE_CHINESE_SIMPLIFIED == eLang) { @@ -6596,12 +6596,12 @@ void DocxAttributeOutput::WriteField_Impl( const SwField* pFld, ww::eField eType // TODO Any other field types here ? if ( ( nType == RES_SETEXPFLD ) && ( nSubType & nsSwGetSetExpType::GSE_STRING ) ) { - const SwSetExpField *pSet = ( const SwSetExpField* )( pFld ); + const SwSetExpField *pSet = static_cast( pFld ); m_sFieldBkm = pSet->GetPar1( ); } else if ( nType == RES_DROPDOWN ) { - const SwDropDownField* pDropDown = ( const SwDropDownField* )( pFld ); + const SwDropDownField* pDropDown = static_cast( pFld ); m_sFieldBkm = pDropDown->GetName( ); } } @@ -7762,7 +7762,7 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox ) const SfxPoolItem* pItem = GetExport().HasItem( RES_SHADOW ); if ( pItem ) { - const SvxShadowItem* pShadowItem = (const SvxShadowItem*)pItem; + const SvxShadowItem* pShadowItem = static_cast(pItem); aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation(); } diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 5d3be74efc3e..197eac9a1bcc 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -489,7 +489,7 @@ void DocxExport::OutputEndNode( const SwEndNode& rEndNode ) { const SwSectionFmt* pParentFmt = rSect.GetFmt()->GetParent(); if( !pParentFmt ) - pParentFmt = (SwSectionFmt*)0xFFFFFFFF; + pParentFmt = reinterpret_cast(0xFFFFFFFF) ; sal_uLong nRstLnNum; if( rNd.IsCntntNode() ) diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx index 51a4c62fa713..816a7e5a6ec9 100644 --- a/sw/source/filter/ww8/rtfattributeoutput.cxx +++ b/sw/source/filter/ww8/rtfattributeoutput.cxx @@ -651,7 +651,7 @@ void RtfAttributeOutput::TableDefaultBorders(ww8::WW8TableNodeInfoInner::Pointer const SfxPoolItem* pItem; if (pCellFmt->GetAttrSet().HasItem(RES_BOX, &pItem)) { - const SvxBoxItem& rBox = (SvxBoxItem&)*pItem; + const SvxBoxItem& rBox = static_cast(*pItem); static const sal_uInt16 aBorders[] = { BOX_LINE_TOP, BOX_LINE_LEFT, BOX_LINE_BOTTOM, BOX_LINE_RIGHT @@ -695,7 +695,7 @@ void RtfAttributeOutput::TableBackgrounds(ww8::WW8TableNodeInfoInner::Pointer_t const SfxPoolItem* pItem; if (pCellFmt->GetAttrSet().HasItem(RES_BACKGROUND, &pItem)) { - const SvxBrushItem& rBack = (SvxBrushItem&)*pItem; + const SvxBrushItem& rBack = static_cast(*pItem); if (!rBack.GetColor().GetTransparency()) { m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLCBPAT); @@ -782,7 +782,7 @@ void RtfAttributeOutput::TableVerticalCell(ww8::WW8TableNodeInfoInner::Pointer_t // vertical alignment if (pCellFmt->GetAttrSet().HasItem(RES_VERT_ORIENT, &pItem)) - switch (((SwFmtVertOrient*)pItem)->GetVertOrient()) + switch (static_cast(pItem)->GetVertOrient()) { case text::VertOrientation::CENTER: m_aRowDefs.append(OOO_STRING_SVTOOLS_RTF_CLVERTALC); @@ -1311,7 +1311,7 @@ void RtfAttributeOutput::NumberingLevel(sal_uInt8 nLevel, nVal=35; if (pOutSet) { - const SvxLanguageItem rlang = (const SvxLanguageItem&) pOutSet->Get(RES_CHRATR_CJK_LANGUAGE,true); + const SvxLanguageItem rlang = static_cast( pOutSet->Get(RES_CHRATR_CJK_LANGUAGE,true) ); if (LANGUAGE_CHINESE_SIMPLIFIED == rlang.GetLanguage()) { nVal=39; @@ -2098,7 +2098,7 @@ void RtfAttributeOutput::CharEscapement(const SvxEscapementItem& rEsc) const char* pUpDn; - SwTwips nH = ((SvxFontHeightItem&)m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); + SwTwips nH = static_cast(m_rExport.GetItem(RES_CHRATR_FONTSIZE)).GetHeight(); if (0 < rEsc.GetEsc()) pUpDn = OOO_STRING_SVTOOLS_RTF_UP; @@ -2600,7 +2600,7 @@ void RtfAttributeOutput::ParaWidows(const SvxWidowsItem& rWidows) void RtfAttributeOutput::ParaTabStop(const SvxTabStopItem& rTabStop) { - long nOffset = ((SvxLRSpaceItem&)m_rExport.GetItem(RES_LR_SPACE)).GetTxtLeft(); + long nOffset = static_cast(m_rExport.GetItem(RES_LR_SPACE)).GetTxtLeft(); for (sal_uInt16 n = 0; n < rTabStop.Count(); n++) { const SvxTabStop& rTS = rTabStop[ n ]; @@ -2699,7 +2699,7 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTxtNode* pTxtNd, sal_Int32 nLv m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PLAIN); m_aStyles.append(' '); - SvxLRSpaceItem aLR((SvxLRSpaceItem&)rNdSet.Get(RES_LR_SPACE)); + SvxLRSpaceItem aLR(static_cast(rNdSet.Get(RES_LR_SPACE))); aLR.SetTxtLeft(aLR.GetTxtLeft() + pFmt->GetIndentAt()); aLR.SetTxtFirstLineOfst(pFmt->GetFirstLineOffset()); @@ -3297,7 +3297,7 @@ void RtfAttributeOutput::SetField(const SwField& /*rFld*/, ww::eField /*eType*/, void RtfAttributeOutput::PostitField(const SwField* pFld) { - const SwPostItField& rPFld = *(SwPostItField*)pFld; + const SwPostItField& rPFld = *static_cast(pFld); OString aName = OUStringToOString(rPFld.GetName(), RTL_TEXTENCODING_UTF8); std::map::iterator it = m_rOpenedAnnotationMarksIds.find(aName); @@ -3628,7 +3628,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrmFmt* pFlyFrmFmt, S aRendered.Height() = rSize.Height(); const Graphic* pGraphic = rOLENode.GetGraphic(); Size aMapped(pGraphic->GetPrefSize()); - const SwCropGrf& rCr = (const SwCropGrf&)rOLENode.GetAttr(RES_GRFATR_CROPGRF); + const SwCropGrf& rCr = static_cast(rOLENode.GetAttr(RES_GRFATR_CROPGRF)); const sal_Char* pBLIPType = OOO_STRING_SVTOOLS_RTF_PNGBLIP; const sal_uInt8* pGraphicAry = 0; SvMemoryStream aStream; @@ -3756,7 +3756,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw Size aMapped(eGraphicType == GRAPHIC_BITMAP ? rGraphic.GetSizePixel() : rGraphic.GetPrefSize()); - const SwCropGrf& rCr = (const SwCropGrf&)pGrfNode->GetAttr(RES_GRFATR_CROPGRF); + const SwCropGrf& rCr = static_cast(pGrfNode->GetAttr(RES_GRFATR_CROPGRF)); //Get original size in twips Size aSize(pGrfNode->GetTwipSize()); diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index 5949a28bdac5..fc7acc1eb985 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -491,7 +492,7 @@ void RtfExport::ExportDocument_Impl() Strm().WriteChar('{').WriteCharPtr(OOO_STRING_SVTOOLS_RTF_RTF).WriteChar('1') .WriteCharPtr(OOO_STRING_SVTOOLS_RTF_ANSI); Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_DEFF); - OutULong(maFontHelper.GetId((SvxFontItem&)pDoc->GetAttrPool().GetDefaultItem(RES_CHRATR_FONT))); + OutULong(maFontHelper.GetId(static_cast(pDoc->GetAttrPool().GetDefaultItem(RES_CHRATR_FONT)))); // If this not exist, MS don't understand our ansi characters (0x80-0xff). Strm().WriteCharPtr("\\adeflang1025"); @@ -536,7 +537,7 @@ void RtfExport::ExportDocument_Impl() sal_uInt32 const nMaxItem = rPool.GetItemCount2(RES_PROTECT); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - const SvxProtectItem* pProtect = (const SvxProtectItem*)rPool.GetItem2(RES_PROTECT, n); + const SvxProtectItem* pProtect = static_cast(rPool.GetItem2(RES_PROTECT, n)); if (pProtect && pProtect->IsCntntProtected()) { Strm().WriteCharPtr(OOO_STRING_SVTOOLS_RTF_FORMPROT); @@ -570,7 +571,7 @@ void RtfExport::ExportDocument_Impl() if (pSet) { sal_uInt16 nPosInDoc; - pSttPgDsc = (SwFmtPageDesc*)&pSet->Get(RES_PAGEDESC); + pSttPgDsc = static_cast(&pSet->Get(RES_PAGEDESC)); if (!pSttPgDsc->GetPageDesc()) pSttPgDsc = 0; else if (pDoc->FindPageDesc(pSttPgDsc->GetPageDesc()->GetName(), &nPosInDoc)) @@ -946,33 +947,33 @@ void RtfExport::OutColorTable() // char color { - const SvxColorItem* pCol = (const SvxColorItem*)GetDfltAttr(RES_CHRATR_COLOR); + const SvxColorItem* pCol = static_cast(GetDfltAttr(RES_CHRATR_COLOR)); InsColor(pCol->GetValue()); - if (0 != (pCol = (const SvxColorItem*)rPool.GetPoolDefaultItem(RES_CHRATR_COLOR))) + if (0 != (pCol = static_cast(rPool.GetPoolDefaultItem(RES_CHRATR_COLOR)))) InsColor(pCol->GetValue()); nMaxItem = rPool.GetItemCount2(RES_CHRATR_COLOR); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pCol = (const SvxColorItem*)rPool.GetItem2(RES_CHRATR_COLOR, n))) + if (0 != (pCol = static_cast(rPool.GetItem2(RES_CHRATR_COLOR, n)))) InsColor(pCol->GetValue()); } - const SvxUnderlineItem* pUnder = (const SvxUnderlineItem*)GetDfltAttr(RES_CHRATR_UNDERLINE); + const SvxUnderlineItem* pUnder = static_cast(GetDfltAttr(RES_CHRATR_UNDERLINE)); InsColor(pUnder->GetColor()); nMaxItem = rPool.GetItemCount2(RES_CHRATR_UNDERLINE); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pUnder = (const SvxUnderlineItem*)rPool.GetItem2(RES_CHRATR_UNDERLINE, n))) + if (0 != (pUnder = static_cast(rPool.GetItem2(RES_CHRATR_UNDERLINE, n)))) InsColor(pUnder->GetColor()); } - const SvxOverlineItem* pOver = (const SvxOverlineItem*)GetDfltAttr(RES_CHRATR_OVERLINE); + const SvxOverlineItem* pOver = static_cast(GetDfltAttr(RES_CHRATR_OVERLINE)); InsColor(pOver->GetColor()); nMaxItem = rPool.GetItemCount2(RES_CHRATR_OVERLINE); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pOver = (const SvxOverlineItem*)rPool.GetItem2(RES_CHRATR_OVERLINE, n))) + if (0 != (pOver = static_cast(rPool.GetItem2(RES_CHRATR_OVERLINE, n)))) InsColor(pOver->GetColor()); } @@ -987,16 +988,16 @@ void RtfExport::OutColorTable() for (const sal_uInt16* pIds = aBrushIds; *pIds; ++pIds) { - const SvxBrushItem* pBkgrd = (const SvxBrushItem*)GetDfltAttr(*pIds); + const SvxBrushItem* pBkgrd = static_cast(GetDfltAttr(*pIds)); InsColor(pBkgrd->GetColor()); - if (0 != (pBkgrd = (const SvxBrushItem*)rPool.GetPoolDefaultItem(*pIds))) + if (0 != (pBkgrd = static_cast(rPool.GetPoolDefaultItem(*pIds)))) { InsColor(pBkgrd->GetColor()); } nMaxItem = rPool.GetItemCount2(*pIds); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pBkgrd = (const SvxBrushItem*)rPool.GetItem2(*pIds , n))) + if (0 != (pBkgrd = static_cast(rPool.GetItem2(*pIds , n)))) { InsColor(pBkgrd->GetColor()); } @@ -1005,16 +1006,16 @@ void RtfExport::OutColorTable() // shadow color { - const SvxShadowItem* pShadow = (const SvxShadowItem*)GetDfltAttr(RES_SHADOW); + const SvxShadowItem* pShadow = static_cast(GetDfltAttr(RES_SHADOW)); InsColor(pShadow->GetColor()); - if (0 != (pShadow = (const SvxShadowItem*)rPool.GetPoolDefaultItem(RES_SHADOW))) + if (0 != (pShadow = static_cast(rPool.GetPoolDefaultItem(RES_SHADOW)))) { InsColor(pShadow->GetColor()); } nMaxItem = rPool.GetItemCount2(RES_SHADOW); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pShadow = (const SvxShadowItem*)rPool.GetItem2(RES_SHADOW, n))) + if (0 != (pShadow = static_cast(rPool.GetItem2(RES_SHADOW, n)))) { InsColor(pShadow->GetColor()); } @@ -1024,24 +1025,24 @@ void RtfExport::OutColorTable() // frame border color { const SvxBoxItem* pBox; - if (0 != (pBox = (const SvxBoxItem*)rPool.GetPoolDefaultItem(RES_BOX))) + if (0 != (pBox = static_cast(rPool.GetPoolDefaultItem(RES_BOX)))) InsColorLine(*pBox); nMaxItem = rPool.GetItemCount2(RES_BOX); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pBox = (const SvxBoxItem*)rPool.GetItem2(RES_BOX, n))) + if (0 != (pBox = static_cast(rPool.GetItem2(RES_BOX, n)))) InsColorLine(*pBox); } } { const SvxBoxItem* pCharBox; - if (0 != (pCharBox = (const SvxBoxItem*)rPool.GetPoolDefaultItem(RES_CHRATR_BOX))) + if (0 != (pCharBox = static_cast(rPool.GetPoolDefaultItem(RES_CHRATR_BOX)))) InsColorLine(*pCharBox); nMaxItem = rPool.GetItemCount2(RES_CHRATR_BOX); for (sal_uInt32 n = 0; n < nMaxItem; ++n) { - if (0 != (pCharBox = (const SvxBoxItem*)rPool.GetItem2(RES_CHRATR_BOX, n))) + if (0 != (pCharBox = static_cast(rPool.GetItem2(RES_CHRATR_BOX, n)))) InsColorLine(*pCharBox); } } @@ -1153,13 +1154,13 @@ void RtfExport::WriteHeaderFooter(const SfxPoolItem& rItem, bool bHeader) { if (bHeader) { - const SwFmtHeader& rHeader = (const SwFmtHeader&)rItem; + const SwFmtHeader& rHeader = static_cast(rItem); if (!rHeader.IsActive()) return; } else { - const SwFmtFooter& rFooter = (const SwFmtFooter&)rItem; + const SwFmtFooter& rFooter = static_cast(rItem); if (!rFooter.IsActive()) return; } diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx index ecf12eef04c6..24acdcbb41c1 100644 --- a/sw/source/filter/ww8/rtfsdrexport.cxx +++ b/sw/source/filter/ww8/rtfsdrexport.cxx @@ -35,7 +35,7 @@ using namespace css; RtfSdrExport::RtfSdrExport(RtfExport& rExport) : EscherEx(EscherExGlobalRef(new EscherExGlobal), 0), m_rExport(rExport), - m_rAttrOutput((RtfAttributeOutput&)m_rExport.AttrOutput()), + m_rAttrOutput(static_cast(m_rExport.AttrOutput())), m_pSdrObject(NULL), m_nShapeType(ESCHER_ShpInst_Nil), m_nShapeFlags(0) , diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 2b534ffcd203..3f2707fe4cf9 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1143,13 +1143,13 @@ void MSWord_SdrAttrIter::SetCharSet(const EECharAttrib& rAttr, bool bStart) void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) { - const SvxFieldItem &rField = (const SvxFieldItem &)rHt; + const SvxFieldItem &rField = static_cast(rHt); const SvxFieldData *pFld = rField.GetField(); if (pFld && pFld->ISA(SvxURLField)) { sal_uInt8 nOldTxtTyp = m_rExport.nTxtTyp; m_rExport.nTxtTyp = mnTyp; - const SvxURLField *pURL = (const SvxURLField *)pFld; + const SvxURLField *pURL = static_cast(pFld); m_rExport.AttrOutput().StartURL( pURL->GetURL(), pURL->GetTargetFrame() ); const OUString &rStr = pURL->GetRepresentation(); @@ -1988,14 +1988,14 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt, const SwAttrSet& rAttrSet = rFmt.GetAttrSet(); if (SfxItemState::SET == rAttrSet.GetItemState(RES_BOX, false, &pItem)) { - const SvxBoxItem* pBox = (const SvxBoxItem*)pItem; + const SvxBoxItem* pBox = static_cast(pItem); if( pBox ) { const SfxPoolItem* pShadItem; if (SfxItemState::SET == rAttrSet.GetItemState(RES_SHADOW, true, &pShadItem)) { - const SvxShadowItem* pSI = (const SvxShadowItem*)pShadItem; + const SvxShadowItem* pSI = static_cast(pShadItem); const sal_uInt16 nCstScale = 635; // unit scale between AOO and MS Word const sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value. @@ -2325,7 +2325,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt) &pItem); if (SfxItemState::SET == eState && pItem) { - const SvxBrushItem* pBrush = (const SvxBrushItem*)pItem; + const SvxBrushItem* pBrush = static_cast(pItem); WriteBrushAttr(*pBrush, aPropOpt); SvxGraphicPosition ePos = pBrush->GetGraphicPos(); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 3dac90607203..12339906c9a0 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -393,7 +393,7 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bRuby ) sal_uInt16 nFontId = GetWhichOfScript( RES_CHRATR_FONT, GetScript() ); const SvxFontItem &rParentFont = ItemGet( - (const SwTxtFmtColl&)rNd.GetAnyFmtColl(), nFontId); + static_cast(rNd.GetAnyFmtColl()), nFontId); const SvxFontItem *pFont = &rParentFont; const SfxPoolItem *pGrabBag = 0; @@ -811,8 +811,8 @@ void WW8AttributeOutput::StartRuby( const SwTxtNode& rNode, sal_Int32 /*nPos*/, const SwAttrSet& rSet = rNode.GetSwAttrSet(); const SvxFontHeightItem &rHeightItem = - ( const SvxFontHeightItem& )rSet.Get( - GetWhichOfScript( RES_CHRATR_FONTSIZE, nRubyScript ) ); + static_cast< const SvxFontHeightItem& >(rSet.Get( + GetWhichOfScript( RES_CHRATR_FONTSIZE, nRubyScript ) )); nHeight = (rHeightItem.GetHeight() + 10)/20-1; aStr += OUString::number(nHeight); aStr += "("; @@ -1433,11 +1433,11 @@ short MSWordExportBase::GetDefaultFrameDirection( ) const { if ( bOutFlyFrmAttrs ) //frame { - nDir = TrueFrameDirection( *( const SwFrmFmt * ) pOutFmtNode ); + nDir = TrueFrameDirection( *static_cast< const SwFrmFmt * >(pOutFmtNode) ); } else if ( pOutFmtNode->ISA( SwCntntNode ) ) //pagagraph { - const SwCntntNode *pNd = ( const SwCntntNode * ) pOutFmtNode; + const SwCntntNode *pNd = static_cast(pOutFmtNode); SwPosition aPos( *pNd ); nDir = pDoc->GetTextDirection( aPos ); } @@ -1505,7 +1505,7 @@ const SvxBrushItem* WW8Export::GetCurrentPageBgBrush() const //If not set, or "no fill", get real bg SfxItemState eState = rFmt.GetItemState(RES_BACKGROUND, true, &pItem); - const SvxBrushItem* pRet = (const SvxBrushItem*)pItem; + const SvxBrushItem* pRet = static_cast(pItem); if (SfxItemState::SET != eState || (!pRet->GetGraphic() && pRet->GetColor() == COL_TRANSPARENT)) { @@ -1525,7 +1525,7 @@ SvxBrushItem WW8Export::TrueFrameBgBrush(const SwFrmFmt &rFlyFmt) const const SfxPoolItem* pItem = 0; SfxItemState eState = pFlyFmt->GetItemState(RES_BACKGROUND, true, &pItem); - pRet = (const SvxBrushItem*)pItem; + pRet = static_cast(pItem); if (SfxItemState::SET != eState || (!pRet->GetGraphic() && pRet->GetColor() == COL_TRANSPARENT)) { @@ -2433,7 +2433,7 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) static_cast(pItem)->GetLower()) )) { pTmpSet = new SfxItemSet( rNode.GetSwAttrSet() ); - SvxULSpaceItem aUL( *(SvxULSpaceItem*)pItem ); + SvxULSpaceItem aUL( *static_cast(pItem) ); // #i25901#- consider compatibility option if (!pDoc->getIDocumentSettingAccess().get(IDocumentSettingAccess::PARA_SPACE_MAX_AT_PAGES)) { @@ -2531,8 +2531,8 @@ void MSWordExportBase::OutputTextNode( const SwTxtNode& rNode ) cannot export that, its its ltr then that's ok as thats word's default. Otherwise we must add a RTL attribute to our export list */ - const SvxFrameDirectionItem* pItem = (const SvxFrameDirectionItem*) - rNode.GetSwAttrSet().GetItem(RES_FRAMEDIR); + const SvxFrameDirectionItem* pItem = static_cast( + rNode.GetSwAttrSet().GetItem(RES_FRAMEDIR)); if ( (!pItem || pItem->GetValue() == FRMDIR_ENVIRONMENT) && aAttrIter.IsParaRTL() @@ -2894,7 +2894,7 @@ void WW8Export::OutWW6FlyFrmsInCntnt( const SwTxtNode& rNd ) { // attribute bound to a character const SwFmtFlyCnt& rFlyCntnt = pAttr->GetFlyCnt(); - const SwFlyFrmFmt& rFlyFrmFmt = *(SwFlyFrmFmt*)rFlyCntnt.GetFrmFmt(); + const SwFlyFrmFmt& rFlyFrmFmt = *static_cast(rFlyCntnt.GetFrmFmt()); const SwNodeIndex* pNodeIndex = rFlyFrmFmt.GetCntnt().GetCntntIdx(); if( pNodeIndex ) diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index 359bdbd89b2e..79abf1df7c08 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -204,7 +204,7 @@ static sal_uInt8 GetLevelNFC( sal_uInt16 eNumType, const SfxItemSet *pOutSet) case SVX_NUM_NUMBER_LOWER_ZH: nRet = 35; if ( pOutSet ) { - const SvxLanguageItem rLang = (const SvxLanguageItem&) pOutSet->Get( RES_CHRATR_CJK_LANGUAGE,true); + const SvxLanguageItem rLang = static_cast( pOutSet->Get( RES_CHRATR_CJK_LANGUAGE,true) ); const LanguageType eLang = rLang.GetLanguage(); if (LANGUAGE_CHINESE_SIMPLIFIED ==eLang) { nRet = 39; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index cd6b3e926cc8..ae6fafe5640e 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -548,7 +548,7 @@ void MSWordStyles::GetStyleData( SwFmt* pFmt, bool& bFmtColl, sal_uInt16& nBase, SwFmt* pNext; if ( bFmtColl ) - pNext = &((SwTxtFmtColl*)pFmt)->GetNextTxtFmtColl(); + pNext = &static_cast(pFmt)->GetNextTxtFmtColl(); else pNext = pFmt; // CharFmt: next CharFmt == self @@ -902,13 +902,13 @@ void wwFontHelper::InitFontTable(bool bWrtWW8,const SwDoc& rDoc) GetId(wwFont(OUString("Arial"), PITCH_VARIABLE, FAMILY_SWISS, RTL_TEXTENCODING_MS_1252,bWrtWW8)); - const SvxFontItem* pFont = (const SvxFontItem*)GetDfltAttr(RES_CHRATR_FONT); + const SvxFontItem* pFont = static_cast(GetDfltAttr(RES_CHRATR_FONT)); GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), pFont->GetFamily(), pFont->GetCharSet(),bWrtWW8)); const SfxItemPool& rPool = rDoc.GetAttrPool(); - if (0 != (pFont = (const SvxFontItem*)rPool.GetPoolDefaultItem(RES_CHRATR_FONT))) + if (0 != (pFont = static_cast(rPool.GetPoolDefaultItem(RES_CHRATR_FONT)))) { GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), pFont->GetFamily(), pFont->GetCharSet(),bWrtWW8)); @@ -923,7 +923,7 @@ void wwFontHelper::InitFontTable(bool bWrtWW8,const SwDoc& rDoc) sal_uInt32 const nMaxItem = rPool.GetItemCount2( *pId ); for (sal_uInt32 nGet = 0; nGet < nMaxItem; ++nGet) { - pFont = (const SvxFontItem*)rPool.GetItem2( *pId, nGet ); + pFont = static_cast(rPool.GetItem2( *pId, nGet )); if (0 != pFont) { GetId(wwFont(pFont->GetFamilyName(), pFont->GetPitch(), @@ -1043,9 +1043,9 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport ) const SfxPoolItem* pI; const SwNode* pNd = rExport.pCurPam->GetCntntNode(); - const SfxItemSet* pSet = pNd ? &((SwCntntNode*)pNd)->GetSwAttrSet() : 0; + const SfxItemSet* pSet = pNd ? &static_cast(pNd)->GetSwAttrSet() : 0; - sal_uLong nRstLnNum = pSet ? ((SwFmtLineNumber&)pSet->Get( RES_LINENUMBER )).GetStartValue() : 0; + sal_uLong nRstLnNum = pSet ? static_cast(pSet->Get( RES_LINENUMBER )).GetStartValue() : 0; const SwTableNode* pTblNd = rExport.pCurPam->GetNode().FindTableNode(); const SwSectionNode* pSectNd; @@ -1075,9 +1075,9 @@ MSWordSections::MSWordSections( MSWordExportBase& rExport ) // Hole evtl. Pagedesc des 1. Nodes if ( pSet && SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC, true, &pI ) && - ( (SwFmtPageDesc*)pI )->GetPageDesc() ) + static_cast(pI)->GetPageDesc() ) { - AppendSection( *(SwFmtPageDesc*)pI, *pNd, pFmt, nRstLnNum ); + AppendSection( *static_cast(pI), *pNd, pFmt, nRstLnNum ); } else AppendSection( rExport.pAktPageDesc, pFmt, nRstLnNum ); @@ -1138,10 +1138,10 @@ sal_uInt16 MSWordSections::NumberOfColumns( const SwDoc &rDoc, const WW8_SepInfo aSet.SetParent( &rSet ); //0xffffffff, what the hell is going on with that!, fixme most terribly - if ( rInfo.pSectionFmt && (SwSectionFmt*)0xFFFFFFFF != rInfo.pSectionFmt ) + if ( rInfo.pSectionFmt && reinterpret_cast(0xFFFFFFFF) != rInfo.pSectionFmt ) aSet.Put( rInfo.pSectionFmt->GetFmtAttr( RES_COL ) ); - const SwFmtCol& rCol = (const SwFmtCol&)aSet.Get( RES_COL ); + const SwFmtCol& rCol = static_cast(aSet.Get( RES_COL )); const SwColumns& rColumns = rCol.GetColumns(); return rColumns.size(); } @@ -1276,8 +1276,8 @@ void MSWordSections::SetHeaderFlag( sal_uInt8& rHeadFootFlags, const SwFmt& rFmt { const SfxPoolItem* pItem; if( SfxItemState::SET == rFmt.GetItemState(RES_HEADER, true, &pItem) - && ((SwFmtHeader*)pItem)->IsActive() && - ((SwFmtHeader*)pItem)->GetHeaderFmt() ) + && static_cast(pItem)->IsActive() && + static_cast(pItem)->GetHeaderFmt() ) rHeadFootFlags |= nFlag; } @@ -1286,8 +1286,8 @@ void MSWordSections::SetFooterFlag( sal_uInt8& rHeadFootFlags, const SwFmt& rFmt { const SfxPoolItem* pItem; if( SfxItemState::SET == rFmt.GetItemState(RES_FOOTER, true, &pItem) - && ((SwFmtFooter*)pItem)->IsActive() && - ((SwFmtFooter*)pItem)->GetFooterFmt() ) + && static_cast(pItem)->IsActive() && + static_cast(pItem)->GetFooterFmt() ) rHeadFootFlags |= nFlag; } @@ -1325,7 +1325,7 @@ bool WW8_SepInfo::IsProtected() const bool bRet = false; if ( pSectionFmt && - ((SwSectionFmt*)0xFFFFFFFF != pSectionFmt) + (reinterpret_cast(0xFFFFFFFF) != pSectionFmt) ) { const SwSection *pSection = pSectionFmt->GetSection(); @@ -1394,10 +1394,10 @@ bool MSWordSections::HasBorderItem( const SwFmt& rFmt ) { const SfxPoolItem* pItem; return SfxItemState::SET == rFmt.GetItemState(RES_BOX, true, &pItem) && - ( ((SvxBoxItem*)pItem)->GetTop() || - ((SvxBoxItem*)pItem)->GetBottom() || - ((SvxBoxItem*)pItem)->GetLeft() || - ((SvxBoxItem*)pItem)->GetRight() ); + ( static_cast(pItem)->GetTop() || + static_cast(pItem)->GetBottom() || + static_cast(pItem)->GetLeft() || + static_cast(pItem)->GetRight() ); } void WW8AttributeOutput::StartSection() @@ -1661,7 +1661,7 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt } } - if ( (SwSectionFmt*)0xFFFFFFFF != rSepInfo.pSectionFmt ) + if ( reinterpret_cast(0xFFFFFFFF) != rSepInfo.pSectionFmt ) { if ( nBreakCode == 0 ) bOutPgDscSet = false; diff --git a/sw/source/uibase/wrtsh/delete.cxx b/sw/source/uibase/wrtsh/delete.cxx index ae07f4b9c902..68f2eaba05a4 100644 --- a/sw/source/uibase/wrtsh/delete.cxx +++ b/sw/source/uibase/wrtsh/delete.cxx @@ -52,7 +52,7 @@ bool SwWrtShell::TryRemoveIndent() SfxItemSet aAttrSet(GetAttrPool(), RES_LR_SPACE, RES_LR_SPACE); GetCurAttr(aAttrSet); - SvxLRSpaceItem aItem = (const SvxLRSpaceItem &)aAttrSet.Get(RES_LR_SPACE); + SvxLRSpaceItem aItem = static_cast(aAttrSet.Get(RES_LR_SPACE)); short aOldFirstLineOfst = aItem.GetTxtFirstLineOfst(); if (aOldFirstLineOfst > 0) diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx index 8e058602f1bd..a2a2f036ed1d 100644 --- a/sw/source/uibase/wrtsh/select.cxx +++ b/sw/source/uibase/wrtsh/select.cxx @@ -55,7 +55,7 @@ void SwWrtShell::Invalidate() // to avoid making the slot volatile, invalidate it every time if something could have been changed // this is still much cheaper than asking for the state every 200 ms (and avoid background processing) GetView().GetViewFrame()->GetBindings().Invalidate( FN_STAT_SELMODE ); - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } @@ -396,7 +396,7 @@ void SwWrtShell::EndSelect() fnKillSel = &SwWrtShell::ResetSelect; } } - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(GetView().GetViewFrame()->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx index 8841f0cb333c..e6972174cda7 100644 --- a/sw/source/uibase/wrtsh/wrtsh1.cxx +++ b/sw/source/uibase/wrtsh/wrtsh1.cxx @@ -311,13 +311,13 @@ void SwWrtShell::Insert( const OUString &rPath, const OUString &rFilter, if( aGrfSize.Width() > aBound.Width() ) { aGrfSize.Width() = aBound.Width(); - aGrfSize.Height() = ((BigInt)aBound.Width()) * aTempHeight / aTempWidth; + aGrfSize.Height() = BigInt(aBound.Width()) * aTempHeight / aTempWidth; } // Fit hight if necessary, scale down the width proportional thereafter. if( aGrfSize.Height() > aBound.Height() ) { aGrfSize.Height() = aBound.Height(); - aGrfSize.Width() = ((BigInt)aBound.Height()) * aTempWidth / aTempHeight; + aGrfSize.Width() = BigInt(aBound.Height()) * aTempWidth / aTempHeight; } pFrmMgr->SetSize( aGrfSize ); pFrmMgr->UpdateFlyFrm(); @@ -1462,7 +1462,7 @@ SwCharFmt *SwWrtShell::GetCharStyle(const OUString &rFmtName, GetStyle eCreate ) { sal_uInt16 nId = SwStyleNameMapper::GetPoolIdFromUIName( rFmtName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT ); if( USHRT_MAX != nId || GETSTYLE_CREATEANY == eCreate ) - pFmt = (SwCharFmt*)GetFmtFromPool( nId ); + pFmt = static_cast(GetFmtFromPool( nId )); } return pFmt; } diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 98f68300fa60..1f78a7b22f7c 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -348,7 +348,7 @@ void SwWrtShell::ClickToField( const SwField& rFld ) case RES_MACROFLD: { - const SwMacroField *pFld = (const SwMacroField*)&rFld; + const SwMacroField *pFld = static_cast(&rFld); const OUString sText( rFld.GetPar2() ); OUString sRet( sText ); ExecMacro( pFld->GetSvxMacro(), &sRet ); @@ -459,7 +459,7 @@ void LoadURL( SwViewShell& rVSh, const OUString& rURL, sal_uInt16 nFilter, return; //A CrsrShell is always a WrtShell - SwWrtShell &rSh = (SwWrtShell&)rVSh; + SwWrtShell &rSh = static_cast(rVSh); SwDocShell* pDShell = rSh.GetView().GetDocShell(); OSL_ENSURE( pDShell, "No DocShell?!");