diff options
author | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2011-05-16 22:09:46 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2011-05-16 22:09:46 +0200 |
commit | 3bc9bde9abbf304f181279ec541cd18f0e5dcf8e (patch) | |
tree | 01cb631df85657d3e699ef2357ebabad9e37720c | |
parent | d890debd3738927c3c4b0515606d117471cfece2 (diff) |
WaE - add explicit casting (decimal-types → integer types)
-rw-r--r-- | chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/axes/ScaleAutomatism.cxx | 2 | ||||
-rw-r--r-- | chart2/source/view/axes/Tickmarks_Dates.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 4 | ||||
-rw-r--r-- | chart2/source/view/main/VLegend.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/data/drwlayer.cxx | 8 | ||||
-rw-r--r-- | sc/source/filter/excel/xeescher.cxx | 8 | ||||
-rw-r--r-- | sc/source/ui/dbgui/fieldwnd.cxx | 10 | ||||
-rw-r--r-- | sc/source/ui/vba/vbasheetobjects.cxx | 4 |
9 files changed, 24 insertions, 24 deletions
diff --git a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx index 724d90fd3..2a9015bdf 100644 --- a/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/AxisItemConverter.cxx @@ -619,7 +619,7 @@ bool AxisItemConverter::ApplySpecialItem( sal_uInt16 nWhichId, const SfxItemSet { TimeInterval aTimeInterval; aScale.TimeIncrement.MajorTimeInterval >>= aTimeInterval; - aTimeInterval.Number = static_cast<double>(fValue); + aTimeInterval.Number = static_cast<sal_Int32>(fValue); aScale.TimeIncrement.MajorTimeInterval = uno::makeAny( aTimeInterval ); bSetScale = true; } diff --git a/chart2/source/view/axes/ScaleAutomatism.cxx b/chart2/source/view/axes/ScaleAutomatism.cxx index cb9be009a..461ba21f1 100644 --- a/chart2/source/view/axes/ScaleAutomatism.cxx +++ b/chart2/source/view/axes/ScaleAutomatism.cxx @@ -714,7 +714,7 @@ void ScaleAutomatism::calculateExplicitIncrementAndScaleForDateTimeAxis( } } rExplicitIncrement.MajorTimeInterval.Number = nNumer; - nMainIncrementCount = nDayCount/(nNumer*nDaysPerInterval); + nMainIncrementCount = static_cast<long>(nDayCount/(nNumer*nDaysPerInterval)); } //choose minor time interval: diff --git a/chart2/source/view/axes/Tickmarks_Dates.cxx b/chart2/source/view/axes/Tickmarks_Dates.cxx index 9a9cc85ef..98849b7be 100644 --- a/chart2/source/view/axes/Tickmarks_Dates.cxx +++ b/chart2/source/view/axes/Tickmarks_Dates.cxx @@ -82,8 +82,8 @@ void DateTickFactory::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& r Date aNull(m_aScale.NullDate); - Date aDate = aNull + ::rtl::math::approxFloor(m_aScale.Minimum); - Date aMaxDate = aNull + ::rtl::math::approxFloor(m_aScale.Maximum); + Date aDate = aNull + static_cast<long>(::rtl::math::approxFloor(m_aScale.Minimum)); + Date aMaxDate = aNull + static_cast<long>(::rtl::math::approxFloor(m_aScale.Maximum)); uno::Reference< chart2::XScaling > xScaling(m_aScale.Scaling); uno::Reference< chart2::XScaling > xInverseScaling(m_xInverseScaling); @@ -125,7 +125,7 @@ void DateTickFactory::getAllTicks( ::std::vector< ::std::vector< TickInfo > >& r } //create minor date tickinfos - aDate = aNull + ::rtl::math::approxFloor(m_aScale.Minimum); + aDate = aNull + static_cast<long>(::rtl::math::approxFloor(m_aScale.Minimum)); while( aDate<= aMaxDate ) { if( bShifted && aDate==aMaxDate ) diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 2bd8afe4b..00c466613 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -1189,11 +1189,11 @@ long VSeriesPlotter::calculateTimeResolutionOnXAxis() aNullDate = m_apNumberFormatterWrapper->getNullDate(); if( aIt!=aEnd ) { - Date aPrevious(aNullDate); aPrevious+=rtl::math::approxFloor(aIt->fValue); + Date aPrevious(aNullDate); aPrevious+=static_cast<long>(rtl::math::approxFloor(aIt->fValue)); ++aIt; for(;aIt!=aEnd;++aIt) { - Date aCurrent(aNullDate); aCurrent+=rtl::math::approxFloor(aIt->fValue); + Date aCurrent(aNullDate); aCurrent+=static_cast<long>(rtl::math::approxFloor(aIt->fValue)); if( ::com::sun::star::chart::TimeUnit::YEAR == nRet ) { if( DateHelper::IsInSameYear( aPrevious, aCurrent ) ) diff --git a/chart2/source/view/main/VLegend.cxx b/chart2/source/view/main/VLegend.cxx index b872ee4d9..cbfef004b 100644 --- a/chart2/source/view/main/VLegend.cxx +++ b/chart2/source/view/main/VLegend.cxx @@ -898,8 +898,8 @@ void VLegend::createShapes( RelativeSize aRelativeSize; if ((xLegendProp->getPropertyValue( C2U( "RelativeSize" )) >>= aRelativeSize)) { - aLegendSize.Width = ::rtl::math::approxCeil( aRelativeSize.Primary * rPageSize.Width ); - aLegendSize.Height = ::rtl::math::approxCeil( aRelativeSize.Secondary * rPageSize.Height ); + aLegendSize.Width = static_cast<sal_Int32>(::rtl::math::approxCeil( aRelativeSize.Primary * rPageSize.Width )); + aLegendSize.Height = static_cast<sal_Int32>(::rtl::math::approxCeil( aRelativeSize.Secondary * rPageSize.Height )); } else eExpansion = ::com::sun::star::chart::ChartLegendExpansion_HIGH; diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx index 9cb01925f..8e133fca7 100644 --- a/sc/source/core/data/drwlayer.cxx +++ b/sc/source/core/data/drwlayer.cxx @@ -552,8 +552,8 @@ namespace Point lcl_calcAvailableDiff(ScDocument &rDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, const Point &aWantedDiff) { Point aAvailableDiff(aWantedDiff); - long nHeight = rDoc.GetRowHeight( nRow, nTab ) * HMM_PER_TWIPS; - long nWidth = rDoc.GetColWidth( nCol, nTab ) * HMM_PER_TWIPS; + long nHeight = static_cast<long>(rDoc.GetRowHeight( nRow, nTab ) * HMM_PER_TWIPS); + long nWidth = static_cast<long>(rDoc.GetColWidth( nCol, nTab ) * HMM_PER_TWIPS); if (aAvailableDiff.Y() > nHeight) aAvailableDiff.Y() = nHeight; if (aAvailableDiff.X() > nWidth) @@ -565,8 +565,8 @@ namespace { rCalcPoly.setB2DPoint(nWhichPoint, basegfx::B2DPoint(rPos.X(), rPos.Y())); basegfx::B2DRange aRange(basegfx::tools::getRange(rCalcPoly)); - return Rectangle(aRange.getMinX(), aRange.getMinY(), - aRange.getMaxX(), aRange.getMaxY()); + return Rectangle(static_cast<long>(aRange.getMinX()), static_cast<long>(aRange.getMinY()), + static_cast<long>(aRange.getMaxX()), static_cast<long>(aRange.getMaxY())); } } diff --git a/sc/source/filter/excel/xeescher.cxx b/sc/source/filter/excel/xeescher.cxx index b80d4c90a..e0faf0ea0 100644 --- a/sc/source/filter/excel/xeescher.cxx +++ b/sc/source/filter/excel/xeescher.cxx @@ -196,8 +196,8 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ } if( r.Left() > aRect.Left() && r.Top() > aRect.Top() ) { - aFrom = Rectangle( nCol-1, HMM2XL( nColOff ), - nRow-1, HMM2XL( nRowOff ) ); + aFrom = Rectangle( nCol-1, static_cast<long>(HMM2XL( nColOff )), + nRow-1, static_cast<long>(HMM2XL( nRowOff )) ); bTo=true; } } @@ -209,8 +209,8 @@ static void lcl_GetFromTo( const XclExpRoot& rRoot, const Rectangle &aRect, sal_ nRow++; if( r.Right() >= aRect.Right() && r.Bottom() >= aRect.Bottom() ) { - aTo = Rectangle( nCol, HMM2XL( aRect.Right() - r.Left() ), - nRow, HMM2XL( aRect.Bottom() - r.Top() )); + aTo = Rectangle( nCol, static_cast<long>(HMM2XL( aRect.Right() - r.Left() )), + nRow, static_cast<long>(HMM2XL( aRect.Bottom() - r.Top() ))); break; } } diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx index eadd0f474..b32bc9f34 100644 --- a/sc/source/ui/dbgui/fieldwnd.cxx +++ b/sc/source/ui/dbgui/fieldwnd.cxx @@ -846,8 +846,8 @@ size_t ScDPHorFieldControl::CalcNewFieldIndex(SCsCOL nDX, SCsROW nDY) const size_t nFldCount = GetFieldCount(); SCsROW nRow = nSel % mnFieldBtnRowCount; SCsCOL nCol = nSel / mnFieldBtnRowCount; - SCsCOL nColUpper = ceil( - static_cast<double>(nFldCount) / static_cast<double>(mnFieldBtnRowCount)) - 1; + SCsCOL nColUpper = static_cast<SCsCOL>(ceil( + static_cast<double>(nFldCount) / static_cast<double>(mnFieldBtnRowCount)) - 1); SCsROW nRowUpper = mnFieldBtnRowCount - 1; nCol += nDX; @@ -912,8 +912,8 @@ void ScDPHorFieldControl::ScrollToShowSelection() void ScDPHorFieldControl::ResetScrollBar() { long nOldMax = maScroll.GetRangeMax(); - long nNewMax = ceil( - static_cast<double>(GetFieldCount()) / static_cast<double>(mnFieldBtnRowCount)); + long nNewMax = static_cast<long>(ceil( + static_cast<double>(GetFieldCount()) / static_cast<double>(mnFieldBtnRowCount))); if (nOldMax != nNewMax) { @@ -1281,7 +1281,7 @@ ScDPFieldType ScDPDataFieldControl::GetFieldType() const Size ScDPDataFieldControl::GetFieldSize() const { Size aWndSize = GetSizePixel(); - long nFieldObjWidth = aWndSize.Width() / 2.0 - OUTER_MARGIN_HOR - DATA_FIELD_BTN_GAP/2; + long nFieldObjWidth = static_cast<long>(aWndSize.Width() / 2.0 - OUTER_MARGIN_HOR - DATA_FIELD_BTN_GAP/2); Size aFieldSize(nFieldObjWidth, FIELD_BTN_HEIGHT); return aFieldSize; } diff --git a/sc/source/ui/vba/vbasheetobjects.cxx b/sc/source/ui/vba/vbasheetobjects.cxx index b05aa8272..b3507448d 100644 --- a/sc/source/ui/vba/vbasheetobjects.cxx +++ b/sc/source/ui/vba/vbasheetobjects.cxx @@ -342,8 +342,8 @@ uno::Any SAL_CALL ScVbaGraphicObjectsBase::Add( const uno::Any& rLeft, const uno /* Extract double values from passed Anys (the lclPointsToHmm() helper function will throw a RuntimeException on any error), and convert from points to 1/100 mm. */ - awt::Point aPos( lclPointsToHmm( rLeft ), lclPointsToHmm( rTop ) ); - awt::Size aSize( lclPointsToHmm( rWidth ), lclPointsToHmm( rHeight ) ); + awt::Point aPos( static_cast<sal_Int32>(lclPointsToHmm( rLeft )), static_cast<sal_Int32>(lclPointsToHmm( rTop )) ); + awt::Size aSize( static_cast<sal_Int32>(lclPointsToHmm( rWidth )), static_cast<sal_Int32>(lclPointsToHmm( rHeight )) ); // TODO: translate coordinates for RTL sheets if( (aPos.X < 0) || (aPos.Y < 0) || (aSize.Width <= 0) || (aSize.Height <= 0) ) throw uno::RuntimeException(); |