From abf7b94123a555c4f3e90a0ae41bd7a842d1c1fb Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Fri, 12 Jan 2018 20:16:43 +0100 Subject: More loplugin:cstylecast: sd auto-rewrite with "Enable loplugin:cstylecast for some more cases" plus solenv/clang-format/reformat-formatted-files Change-Id: I144975b94fe2725ac740a953ca2133e99f8a3fce --- sd/source/core/sdpage.cxx | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'sd/source/core/sdpage.cxx') diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index 9479976ac74e..8d20e7a1692e 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -1132,14 +1132,14 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind) { // scale actually page size into handout rectangle double fH = pRefPage->GetWidth() == 0 - ? 0 : (double) aPartArea.Width() / pRefPage->GetWidth(); + ? 0 : static_cast(aPartArea.Width()) / pRefPage->GetWidth(); double fV = pRefPage->GetHeight() == 0 - ? 0 : (double) aPartArea.Height() / pRefPage->GetHeight(); + ? 0 : static_cast(aPartArea.Height()) / pRefPage->GetHeight(); if ( fH > fV ) fH = fV; - aSize.Width() = (long) (fH * pRefPage->GetWidth()); - aSize.Height() = (long) (fH * pRefPage->GetHeight()); + aSize.Width() = static_cast(fH * pRefPage->GetWidth()); + aSize.Height() = static_cast(fH * pRefPage->GetHeight()); aPos.X() += (aPartArea.Width() - aSize.Width()) / 2; aPos.Y() += (aPartArea.Height()- aSize.Height())/ 2; @@ -1950,14 +1950,14 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN const SvxFontHeightItem& rOldHgt = rSet.Get(EE_CHAR_FONTHEIGHT); sal_uLong nFontHeight = rOldHgt.GetHeight(); - nFontHeight = long(nFontHeight * (double) aFractY); + nFontHeight = long(nFontHeight * static_cast(aFractY)); rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT)); if( SfxItemState::DEFAULT == rSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) ) { const SvxFontHeightItem& rOldHgt2 = rSet.Get(EE_CHAR_FONTHEIGHT_CJK); nFontHeight = rOldHgt2.GetHeight(); - nFontHeight = long(nFontHeight * (double) aFractY); + nFontHeight = long(nFontHeight * static_cast(aFractY)); rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK)); } @@ -1965,7 +1965,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN { const SvxFontHeightItem& rOldHgt2 = rSet.Get(EE_CHAR_FONTHEIGHT_CTL); nFontHeight = rOldHgt2.GetHeight(); - nFontHeight = long(nFontHeight * (double) aFractY); + nFontHeight = long(nFontHeight * static_cast(aFractY)); rSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL)); } @@ -1989,14 +1989,14 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN const SvxFontHeightItem& rOldHgt = aTempSet.Get(EE_CHAR_FONTHEIGHT); sal_uLong nFontHeight = rOldHgt.GetHeight(); - nFontHeight = long(nFontHeight * (double) aFractY); + nFontHeight = long(nFontHeight * static_cast(aFractY)); aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT)); if( SfxItemState::DEFAULT == aTempSet.GetItemState( EE_CHAR_FONTHEIGHT_CJK ) ) { const SvxFontHeightItem& rOldHgt2 = aTempSet.Get(EE_CHAR_FONTHEIGHT_CJK); nFontHeight = rOldHgt2.GetHeight(); - nFontHeight = long(nFontHeight * (double) aFractY); + nFontHeight = long(nFontHeight * static_cast(aFractY)); aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK)); } @@ -2004,7 +2004,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN { const SvxFontHeightItem& rOldHgt2 = aTempSet.Get(EE_CHAR_FONTHEIGHT_CTL); nFontHeight = rOldHgt2.GetHeight(); - nFontHeight = long(nFontHeight * (double) aFractY); + nFontHeight = long(nFontHeight * static_cast(aFractY)); aTempSet.Put(SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CTL)); } @@ -2040,7 +2040,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN if (pNotesSheet) { sal_uLong nHeight = pObj->GetLogicRect().GetSize().Height(); - sal_uLong nFontHeight = (sal_uLong) (nHeight * 0.0741); + sal_uLong nFontHeight = static_cast(nHeight * 0.0741); SfxItemSet& rSet = pNotesSheet->GetItemSet(); rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT )); rSet.Put( SvxFontHeightItem(nFontHeight, 100, EE_CHAR_FONTHEIGHT_CJK )); @@ -2066,7 +2066,7 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN // use more modern method to scale the text height sal_uInt32 nFontHeight = static_cast(pObj->GetMergedItem(nWhich)).GetHeight(); - sal_uInt32 nNewFontHeight = sal_uInt32((double)nFontHeight * (double)aFractY); + sal_uInt32 nNewFontHeight = sal_uInt32(static_cast(nFontHeight) * static_cast(aFractY)); pObj->SetMergedItem(SvxFontHeightItem(nNewFontHeight, 100, nWhich)); } @@ -2082,8 +2082,8 @@ void SdPage::ScaleObjects(const Size& rNewPageSize, const ::tools::Rectangle& rN // corrected scaling; only distances may be scaled // use aTopLeft as original TopLeft - aNewPos.X() = long((aTopLeft.X() - GetLeftBorder()) * (double)aFractX) + nLeft; - aNewPos.Y() = long((aTopLeft.Y() - GetUpperBorder()) * (double)aFractY) + nUpper; + aNewPos.X() = long((aTopLeft.X() - GetLeftBorder()) * static_cast(aFractX)) + nLeft; + aNewPos.Y() = long((aTopLeft.Y() - GetUpperBorder()) * static_cast(aFractY)) + nUpper; Size aVec(aNewPos.X() - aTopLeft.X(), aNewPos.Y() - aTopLeft.Y()); @@ -2578,7 +2578,7 @@ const OUString& SdPage::GetName() const // if the document has number none as a formatting // for page numbers we still default to arabic numbering // to keep the default page names unique - aCreatedPageName += OUString::number( (sal_Int32)nNum ); + aCreatedPageName += OUString::number( static_cast(nNum) ); } else { @@ -3067,14 +3067,14 @@ void SdPage::CalculateHandoutAreas( SdDrawDocument& rModel, AutoLayout eLayout, if (pFirstPage && pFirstPage->GetWidth() && pFirstPage->GetHeight()) { // scale actual size into handout rect - double fScale = (double)aPartArea.Width() / (double)pFirstPage->GetWidth(); + double fScale = static_cast(aPartArea.Width()) / static_cast(pFirstPage->GetWidth()); - aSize.Height() = (long)(fScale * pFirstPage->GetHeight() ); + aSize.Height() = static_cast(fScale * pFirstPage->GetHeight() ); if( aSize.Height() > aPartArea.Height() ) { - fScale = (double)aPartArea.Height() / (double)pFirstPage->GetHeight(); + fScale = static_cast(aPartArea.Height()) / static_cast(pFirstPage->GetHeight()); aSize.Height() = aPartArea.Height(); - aSize.Width() = (long)(fScale * pFirstPage->GetWidth()); + aSize.Width() = static_cast(fScale * pFirstPage->GetWidth()); } else { -- cgit