diff options
Diffstat (limited to 'vcl/source/control')
-rw-r--r-- | vcl/source/control/button.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/combobox.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/ctrl.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 8 | ||||
-rw-r--r-- | vcl/source/control/field.cxx | 32 | ||||
-rw-r--r-- | vcl/source/control/field2.cxx | 32 | ||||
-rw-r--r-- | vcl/source/control/imp_listbox.cxx | 42 | ||||
-rw-r--r-- | vcl/source/control/listbox.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/longcurr.cxx | 8 | ||||
-rw-r--r-- | vcl/source/control/prgsbar.cxx | 2 | ||||
-rw-r--r-- | vcl/source/control/scrbar.cxx | 28 | ||||
-rw-r--r-- | vcl/source/control/slider.cxx | 6 | ||||
-rw-r--r-- | vcl/source/control/tabctrl.cxx | 10 | ||||
-rw-r--r-- | vcl/source/control/thumbpos.hxx | 4 |
14 files changed, 99 insertions, 99 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index bd03840e34bb..dd4583de0181 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -65,8 +65,8 @@ using namespace css; WB_TOP | WB_VCENTER | WB_BOTTOM | \ WB_WORDBREAK | WB_NOLABEL) -#define STYLE_RADIOBUTTON_MONO ((sal_uInt16)0x0001) // legacy -#define STYLE_CHECKBOX_MONO ((sal_uInt16)0x0001) // legacy +#define STYLE_RADIOBUTTON_MONO (sal_uInt16(0x0001)) // legacy +#define STYLE_CHECKBOX_MONO (sal_uInt16(0x0001)) // legacy class ImplCommonButtonData { diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 02000ff0d7f2..531284cf86eb 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -145,7 +145,7 @@ void ComboBox::ImplCalcEditHeight() { sal_Int32 nLeft, nTop, nRight, nBottom; GetBorder( nLeft, nTop, nRight, nBottom ); - m_pImpl->m_nDDHeight = (sal_uInt16)(m_pImpl->m_pSubEdit->GetTextHeight() + nTop + nBottom + 4); + m_pImpl->m_nDDHeight = static_cast<sal_uInt16>(m_pImpl->m_pSubEdit->GetTextHeight() + nTop + nBottom + 4); if ( !IsDropDownBox() ) m_pImpl->m_nDDHeight += 4; @@ -311,7 +311,7 @@ IMPL_LINK(ComboBox::Impl, ImplAutocompleteHdl, Edit&, rEdit, void) { OUString aFullText = rEdit.GetText(); - OUString aStartText = aFullText.copy( 0, (sal_Int32)aSel.Max() ); + OUString aStartText = aFullText.copy( 0, static_cast<sal_Int32>(aSel.Max()) ); sal_Int32 nStart = m_pImplLB->GetCurrentPos(); if ( nStart == LISTBOX_ENTRY_NOTFOUND ) @@ -1127,13 +1127,13 @@ void ComboBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines if ( !IsDropDownBox() ) { Size aOutSz = m_pImpl->m_pImplLB->GetMainWindow()->GetOutputSizePixel(); - rnCols = (nCharWidth > 0) ? (sal_uInt16)(aOutSz.Width()/nCharWidth) : 1; - rnLines = (sal_uInt16)(aOutSz.Height()/m_pImpl->m_pImplLB->GetEntryHeight()); + rnCols = (nCharWidth > 0) ? static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth) : 1; + rnLines = static_cast<sal_uInt16>(aOutSz.Height()/m_pImpl->m_pImplLB->GetEntryHeight()); } else { Size aOutSz = m_pImpl->m_pSubEdit->GetOutputSizePixel(); - rnCols = (nCharWidth > 0) ? (sal_uInt16)(aOutSz.Width()/nCharWidth) : 1; + rnCols = (nCharWidth > 0) ? static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth) : 1; rnLines = 1; } } diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx index 03ceb04adcac..6a512eb4171f 100644 --- a/vcl/source/control/ctrl.cxx +++ b/vcl/source/control/ctrl.cxx @@ -110,7 +110,7 @@ ControlLayoutData::ControlLayoutData() : m_pParent( nullptr ) tools::Rectangle ControlLayoutData::GetCharacterBounds( long nIndex ) const { - return (nIndex >= 0 && nIndex < (long) m_aUnicodeBoundRects.size()) ? m_aUnicodeBoundRects[ nIndex ] : tools::Rectangle(); + return (nIndex >= 0 && nIndex < static_cast<long>(m_aUnicodeBoundRects.size())) ? m_aUnicodeBoundRects[ nIndex ] : tools::Rectangle(); } tools::Rectangle Control::GetCharacterBounds( long nIndex ) const diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 7560860de9de..fc8d7299780c 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -489,7 +489,7 @@ void Edit::ImplRepaint(vcl::RenderContext& rRenderContext, const tools::Rectangl if (nLen) { - if ((size_t) (2 * nLen) > SAL_N_ELEMENTS(nDXBuffer)) + if (static_cast<size_t>(2 * nLen) > SAL_N_ELEMENTS(nDXBuffer)) { pDXBuffer.reset(new long[2 * (nLen + 1)]); pDX = pDXBuffer.get(); @@ -1084,7 +1084,7 @@ void Edit::ImplShowCursor( bool bOnlyIfVisible ) if( !aText.isEmpty() ) { - if( (size_t) (2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) + if( static_cast<size_t>(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { pDXBuffer.reset(new long[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); @@ -1200,7 +1200,7 @@ sal_Int32 Edit::ImplGetCharPos( const Point& rWindowPos ) const long nDXBuffer[256]; std::unique_ptr<long[]> pDXBuffer; long* pDX = nDXBuffer; - if( (size_t) (2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) + if( static_cast<size_t>(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { pDXBuffer.reset(new long[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); @@ -2136,7 +2136,7 @@ void Edit::Command( const CommandEvent& rCEvt ) if( !aText.isEmpty() ) { - if( (size_t) (2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) + if( static_cast<size_t>(2*aText.getLength()) > SAL_N_ELEMENTS(nDXBuffer) ) { pDXBuffer.reset(new long[2*(aText.getLength()+1)]); pDX = pDXBuffer.get(); diff --git a/vcl/source/control/field.cxx b/vcl/source/control/field.cxx index 220da283ba86..bd341cfe06fd 100644 --- a/vcl/source/control/field.cxx +++ b/vcl/source/control/field.cxx @@ -234,7 +234,7 @@ bool ImplNumericGetValue( const OUString& rStr, sal_Int64& rValue, sal_Int64 nNum = aStrNum.makeStringAndClear().toInt64(); sal_Int64 nDenom = aStrDenom.makeStringAndClear().toInt64(); if (nDenom == 0) return false; // Division by zero - double nFrac2Dec = nWholeNum + (double)nNum/nDenom; // Convert to double for floating point precision + double nFrac2Dec = nWholeNum + static_cast<double>(nNum)/nDenom; // Convert to double for floating point precision aStrFrac.append(nFrac2Dec); // Reconvert division result to string and parse nDecPos = aStrFrac.indexOf('.'); @@ -701,7 +701,7 @@ void NumericFormatter::ImplNewFieldValue( sal_Int64 nNewValue ) aSelection.Justify(); OUString aText = GetField()->GetText(); // leave it as is if selected until end - if ( (sal_Int32)aSelection.Max() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Max()) == aText.getLength() ) { if ( !aSelection.Len() ) aSelection.Min() = SELECTION_MAX; @@ -1109,13 +1109,13 @@ sal_Int64 MetricField::ConvertValue( sal_Int64 nValue, sal_Int64 mnBaseValue, sa FieldUnit eInUnit, FieldUnit eOutUnit ) { double nDouble = nonValueDoubleToValueDouble( ConvertDoubleValue( - (double)nValue, mnBaseValue, nDecDigits, eInUnit, eOutUnit ) ); + static_cast<double>(nValue), mnBaseValue, nDecDigits, eInUnit, eOutUnit ) ); sal_Int64 nLong ; // caution: precision loss in double cast - if ( nDouble <= (double)SAL_MIN_INT64 ) + if ( nDouble <= double(SAL_MIN_INT64) ) nLong = SAL_MIN_INT64; - else if ( nDouble >= (double)SAL_MAX_INT64 ) + else if ( nDouble >= double(SAL_MAX_INT64) ) nLong = SAL_MAX_INT64; else nLong = static_cast<sal_Int64>( nDouble ); @@ -1299,7 +1299,7 @@ static bool ImplMetricGetValue( const OUString& rStr, double& rValue, sal_Int64 // Recalculate unit // caution: conversion to double loses precision - rValue = MetricField::ConvertDoubleValue( (double)nValue, nBaseValue, nDecDigits, eEntryUnit, eUnit ); + rValue = MetricField::ConvertDoubleValue( static_cast<double>(nValue), nBaseValue, nDecDigits, eEntryUnit, eUnit ); return true; } @@ -1313,11 +1313,11 @@ bool MetricFormatter::ImplMetricReformat( const OUString& rStr, double& rValue, double nTempVal = rValue; // caution: precision loss in double cast if ( nTempVal > GetMax() ) - nTempVal = (double)GetMax(); + nTempVal = static_cast<double>(GetMax()); else if ( nTempVal < GetMin()) - nTempVal = (double)GetMin(); + nTempVal = static_cast<double>(GetMin()); - rOutStr = CreateFieldText( (sal_Int64)nTempVal ); + rOutStr = CreateFieldText( static_cast<sal_Int64>(nTempVal) ); return true; } } @@ -1401,16 +1401,16 @@ sal_Int64 MetricFormatter::GetValue( FieldUnit eOutUnit ) const double nTempValue; // caution: precision loss in double cast if ( !ImplMetricGetValue( GetField()->GetText(), nTempValue, mnBaseValue, GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit ) ) - nTempValue = (double)mnLastValue; + nTempValue = static_cast<double>(mnLastValue); // caution: precision loss in double cast if ( nTempValue > mnMax ) - nTempValue = (double)mnMax; + nTempValue = static_cast<double>(mnMax); else if ( nTempValue < mnMin ) - nTempValue = (double)mnMin; + nTempValue = static_cast<double>(mnMin); // convert to requested units - return MetricField::ConvertValue( (sal_Int64)nTempValue, mnBaseValue, GetDecimalDigits(), meUnit, eOutUnit ); + return MetricField::ConvertValue( static_cast<sal_Int64>(nTempValue), mnBaseValue, GetDecimalDigits(), meUnit, eOutUnit ); } void MetricFormatter::SetValue( sal_Int64 nValue ) @@ -1477,9 +1477,9 @@ void MetricFormatter::Reformat() OUString aStr; // caution: precision loss in double cast - double nTemp = (double)mnLastValue; + double nTemp = static_cast<double>(mnLastValue); bool bOK = ImplMetricReformat( aText, nTemp, aStr ); - mnLastValue = (sal_Int64)nTemp; + mnLastValue = static_cast<sal_Int64>(nTemp); if ( !bOK ) return; @@ -1763,7 +1763,7 @@ sal_Int64 MetricBox::GetValue( sal_Int32 nPos ) const GetDecimalDigits(), ImplGetLocaleDataWrapper(), meUnit ); // convert to previously configured units - sal_Int64 nRetValue = MetricField::ConvertValue( (sal_Int64)nValue, mnBaseValue, GetDecimalDigits(), + sal_Int64 nRetValue = MetricField::ConvertValue( static_cast<sal_Int64>(nValue), mnBaseValue, GetDecimalDigits(), meUnit, FUNIT_NONE ); return nRetValue; diff --git a/vcl/source/control/field2.cxx b/vcl/source/control/field2.cxx index ce8aa460484d..015695df2c1f 100644 --- a/vcl/source/control/field2.cxx +++ b/vcl/source/control/field2.cxx @@ -83,7 +83,7 @@ static sal_Unicode* ImplAddNum( sal_Unicode* pBuf, sal_uLong nNumber, int nMinLe sal_Unicode* pTempBuf = aTempBuf; do { - *pTempBuf = (sal_Unicode)(nNumber % 10) + '0'; + *pTempBuf = static_cast<sal_Unicode>(nNumber % 10) + '0'; pTempBuf++; nNumber /= 10; if ( nMinLen ) @@ -1324,7 +1324,7 @@ void DateField::ImplDateSpinArea( bool bUp ) Selection aSelection = GetField()->GetSelection(); aSelection.Justify(); OUString aText( GetText() ); - if ( (sal_Int32)aSelection.Len() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Len()) == aText.getLength() ) ImplDateIncrementDay( aDate, bUp ); else { @@ -1344,7 +1344,7 @@ void DateField::ImplDateSpinArea( bool bUp ) for ( sal_Int8 i = 1; i <= 3; i++ ) { nPos = aText.indexOf( aDateSep, nPos ); - if (nPos < 0 || nPos >= (sal_Int32)aSelection.Max()) + if (nPos < 0 || nPos >= static_cast<sal_Int32>(aSelection.Max())) { nDateArea = i; break; @@ -1585,7 +1585,7 @@ void DateFormatter::ImplNewFieldValue( const Date& rDate ) OUString aText = GetField()->GetText(); // If selected until the end then keep it that way - if ( (sal_Int32)aSelection.Max() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Max()) == aText.getLength() ) { if ( !aSelection.Len() ) aSelection.Min() = SELECTION_MAX; @@ -1961,7 +1961,7 @@ static bool ImplCutTimePortion( OUStringBuffer& _rStr, sal_Int32 _nSepPos, bool if ( !ImplIsValidTimePortion( _bSkipInvalidCharacters, sPortion ) ) return false; - *_pPortion = (short)sPortion.toInt32(); + *_pPortion = static_cast<short>(sPortion.toInt32()); return true; } @@ -2030,14 +2030,14 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, nNanoSec = aStr.toString().toInt64(); } else - nSecond = (short)aStr.toString().toInt32(); + nSecond = static_cast<short>(aStr.toString().toInt32()); } else - nMinute = (short)aStr.toString().toInt32(); + nMinute = static_cast<short>(aStr.toString().toInt32()); } else if ( nSepPos < 0 ) { - nSecond = (short)aStr.toString().toInt32(); + nSecond = static_cast<short>(aStr.toString().toInt32()); nMinute += nSecond / 60; nSecond %= 60; nHour += nMinute / 60; @@ -2045,7 +2045,7 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, } else { - nSecond = (short)aStr.copy( 0, nSepPos ).toString().toInt32(); + nSecond = static_cast<short>(aStr.copy( 0, nSepPos ).toString().toInt32()); aStr.remove( 0, nSepPos+1 ); nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() ); @@ -2054,7 +2054,7 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, if ( nSepPos >= 0 ) { nMinute = nSecond; - nSecond = (short)aStr.copy( 0, nSepPos ).toString().toInt32(); + nSecond = static_cast<short>(aStr.copy( 0, nSepPos ).toString().toInt32()); aStr.remove( 0, nSepPos+1 ); nSepPos = aStr.indexOf( rLocaleDataWrapper.getTimeSep() ); @@ -2064,7 +2064,7 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, { nHour = nMinute; nMinute = nSecond; - nSecond = (short)aStr.copy( 0, nSepPos ).toString().toInt32(); + nSecond = static_cast<short>(aStr.copy( 0, nSepPos ).toString().toInt32()); aStr.remove( 0, nSepPos+1 ); } else @@ -2130,8 +2130,8 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, if ( (nHour == 12) && ( ( aUpperCaseStr.indexOf( "AM" ) >= 0 ) || ( aUpperCaseStr.indexOf( aAMlocalised ) >= 0 ) ) ) nHour = 0; - aTime = tools::Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond, - (sal_uInt32)nNanoSec ); + aTime = tools::Time( static_cast<sal_uInt16>(nHour), static_cast<sal_uInt16>(nMinute), static_cast<sal_uInt16>(nSecond), + static_cast<sal_uInt32>(nNanoSec) ); } else { @@ -2148,8 +2148,8 @@ static bool ImplTimeGetValue( const OUString& rStr, tools::Time& rTime, nNanoSec = nNanoSec < 0 ? -nNanoSec : nNanoSec; } - aTime = tools::Time( (sal_uInt16)nHour, (sal_uInt16)nMinute, (sal_uInt16)nSecond, - (sal_uInt32)nNanoSec ); + aTime = tools::Time( static_cast<sal_uInt16>(nHour), static_cast<sal_uInt16>(nMinute), static_cast<sal_uInt16>(nSecond), + static_cast<sal_uInt32>(nNanoSec) ); if ( bNegative ) aTime = -aTime; } @@ -2364,7 +2364,7 @@ void TimeFormatter::ImplNewFieldValue( const tools::Time& rTime ) OUString aText = GetField()->GetText(); // If selected until the end then keep it that way - if ( (sal_Int32)aSelection.Max() == aText.getLength() ) + if ( static_cast<sal_Int32>(aSelection.Max()) == aText.getLength() ) { if ( !aSelection.Len() ) aSelection.Min() = SELECTION_MAX; diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index 755d12cb22bb..98c88b674cd7 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -541,14 +541,14 @@ void ImplListBoxWindow::ImplCalcMetrics() mnMaxImgTxtWidth= 0; mnMaxImgHeight = 0; - mnTextHeight = (sal_uInt16)GetTextHeight(); + mnTextHeight = static_cast<sal_uInt16>(GetTextHeight()); mnMaxTxtHeight = mnTextHeight + mnBorder; mnMaxHeight = mnMaxTxtHeight; if ( maUserItemSize.Height() > mnMaxHeight ) - mnMaxHeight = (sal_uInt16) maUserItemSize.Height(); + mnMaxHeight = static_cast<sal_uInt16>(maUserItemSize.Height()); if ( maUserItemSize.Width() > mnMaxWidth ) - mnMaxWidth= (sal_uInt16) maUserItemSize.Width(); + mnMaxWidth= static_cast<sal_uInt16>(maUserItemSize.Width()); for ( sal_Int32 n = mpEntryList->GetEntryCount(); n; ) { @@ -637,7 +637,7 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) else { // normal single line case - aMetrics.nTextWidth = (sal_uInt16)GetTextWidth( rEntry.maStr ); + aMetrics.nTextWidth = static_cast<sal_uInt16>(GetTextWidth( rEntry.maStr )); if( aMetrics.nTextWidth > mnMaxTxtWidth ) mnMaxTxtWidth = aMetrics.nTextWidth; aMetrics.nEntryWidth = mnMaxTxtWidth; @@ -647,8 +647,8 @@ void ImplListBoxWindow::ImplUpdateEntryMetrics( ImplEntryType& rEntry ) if ( aMetrics.bImage ) { Size aImgSz = rEntry.maImage.GetSizePixel(); - aMetrics.nImgWidth = (sal_uInt16) CalcZoom( aImgSz.Width() ); - aMetrics.nImgHeight = (sal_uInt16) CalcZoom( aImgSz.Height() ); + aMetrics.nImgWidth = static_cast<sal_uInt16>(CalcZoom( aImgSz.Width() )); + aMetrics.nImgHeight = static_cast<sal_uInt16>(CalcZoom( aImgSz.Height() )); if( aMetrics.nImgWidth > mnMaxImgWidth ) mnMaxImgWidth = aMetrics.nImgWidth; @@ -897,7 +897,7 @@ void ImplListBoxWindow::MouseMove( const MouseEvent& rMEvt ) if( nSelect == LISTBOX_ENTRY_NOTFOUND ) nSelect = mpEntryList->GetEntryCount() - 1; nSelect = std::min( nSelect, GetLastVisibleEntry() ); - nSelect = std::min( nSelect, (sal_Int32) ( mpEntryList->GetEntryCount() - 1 ) ); + nSelect = std::min( nSelect, static_cast<sal_Int32>( mpEntryList->GetEntryCount() - 1 ) ); // Select only visible Entries with MouseMove, otherwise Tracking... if ( IsVisible( nSelect ) && mpEntryList->IsEntrySelectable( nSelect ) && @@ -1230,16 +1230,16 @@ void ImplListBoxWindow::Tracking( const TrackingEvent& rTEvt ) { if ( mnCurrentPos != LISTBOX_ENTRY_NOTFOUND ) { - nSelect = std::min( (sal_Int32)(mnCurrentPos+1), (sal_Int32)(mpEntryList->GetEntryCount()-1) ); + nSelect = std::min( static_cast<sal_Int32>(mnCurrentPos+1), static_cast<sal_Int32>(mpEntryList->GetEntryCount()-1) ); if( nSelect >= GetLastVisibleEntry() ) SetTopEntry( mnTop+1 ); } } else { - nSelect = (sal_Int32) ( ( aPt.Y() + mnBorder ) / mnMaxHeight ) + mnTop; + nSelect = static_cast<sal_Int32>( ( aPt.Y() + mnBorder ) / mnMaxHeight ) + mnTop; nSelect = std::min( nSelect, GetLastVisibleEntry() ); - nSelect = std::min( nSelect, (sal_Int32) ( mpEntryList->GetEntryCount() - 1 ) ); + nSelect = std::min( nSelect, static_cast<sal_Int32>( mpEntryList->GetEntryCount() - 1 ) ); } if ( bInside ) @@ -1450,10 +1450,10 @@ bool ImplListBoxWindow::ProcessKeyInput( const KeyEvent& rKEvt ) nTmp += mnTop - 1; if( mnCurrentPos == nTmp && mnCurrentPos != nCount - 1 ) { - long nTmp2 = std::min( (long)(nCount-nCurVis), (long)((long)mnTop+(long)nCurVis-1) ); - nTmp2 = std::max( (long)0 , nTmp2 ); - nTmp = (sal_Int32)(nTmp2+(nCurVis-1) ); - SetTopEntry( (sal_Int32)nTmp2 ); + long nTmp2 = std::min( static_cast<long>(nCount-nCurVis), static_cast<long>(static_cast<long>(mnTop)+static_cast<long>(nCurVis)-1) ); + nTmp2 = std::max( long(0) , nTmp2 ); + nTmp = static_cast<sal_Int32>(nTmp2+(nCurVis-1) ); + SetTopEntry( static_cast<sal_Int32>(nTmp2) ); } // find first selectable starting from nTmp looking backwards nSelect = mpEntryList->FindFirstSelectable( nTmp, false ); @@ -2237,7 +2237,7 @@ IMPL_LINK_NOARG(ImplListBox, LBWindowScrolled, ImplListBoxWindow*, void) IMPL_LINK( ImplListBox, ScrollBarHdl, ScrollBar*, pSB, void ) { - sal_uInt16 nPos = (sal_uInt16) pSB->GetThumbPos(); + sal_uInt16 nPos = static_cast<sal_uInt16>(pSB->GetThumbPos()); if( pSB == mpVScrollBar ) SetTopEntry( nPos ); else if( pSB == mpHScrollBar ) @@ -2250,7 +2250,7 @@ void ImplListBox::ImplCheckScrollBars() Size aOutSz = GetOutputSizePixel(); sal_Int32 nEntries = GetEntryList()->GetEntryCount(); - sal_uInt16 nMaxVisEntries = (sal_uInt16) (aOutSz.Height() / GetEntryHeight()); + sal_uInt16 nMaxVisEntries = static_cast<sal_uInt16>(aOutSz.Height() / GetEntryHeight()); // vertical ScrollBar if( nEntries > nMaxVisEntries ) @@ -2277,7 +2277,7 @@ void ImplListBox::ImplCheckScrollBars() // horizontal ScrollBar if( mbAutoHScroll ) { - long nWidth = (sal_uInt16) aOutSz.Width(); + long nWidth = static_cast<sal_uInt16>(aOutSz.Width()); if ( mbVScroll ) nWidth -= mpVScrollBar->GetSizePixel().Width(); @@ -2290,7 +2290,7 @@ void ImplListBox::ImplCheckScrollBars() if ( !mbVScroll ) // maybe we do need one now { - nMaxVisEntries = (sal_uInt16) ( ( aOutSz.Height() - mpHScrollBar->GetSizePixel().Height() ) / GetEntryHeight() ); + nMaxVisEntries = static_cast<sal_uInt16>( ( aOutSz.Height() - mpHScrollBar->GetSizePixel().Height() ) / GetEntryHeight() ); if( nEntries > nMaxVisEntries ) { bArrange = true; @@ -2306,7 +2306,7 @@ void ImplListBox::ImplCheckScrollBars() } // check of the scrolled-out region - sal_uInt16 nMaxLI = (sal_uInt16) (nMaxWidth - nWidth); + sal_uInt16 nMaxLI = static_cast<sal_uInt16>(nMaxWidth - nWidth); if ( nMaxLI < GetLeftIndent() ) SetLeftIndent( nMaxLI ); } @@ -2332,7 +2332,7 @@ void ImplListBox::ImplInitScrollBars() if ( mbVScroll ) { sal_Int32 nEntries = GetEntryList()->GetEntryCount(); - sal_uInt16 nVisEntries = (sal_uInt16) (aOutSz.Height() / GetEntryHeight()); + sal_uInt16 nVisEntries = static_cast<sal_uInt16>(aOutSz.Height() / GetEntryHeight()); mpVScrollBar->SetRangeMax( nEntries ); mpVScrollBar->SetVisibleSize( nVisEntries ); mpVScrollBar->SetPageSize( nVisEntries - 1 ); @@ -2341,7 +2341,7 @@ void ImplListBox::ImplInitScrollBars() if ( mbHScroll ) { mpHScrollBar->SetRangeMax( GetMaxEntryWidth() + HORZ_SCROLL ); - mpHScrollBar->SetVisibleSize( (sal_uInt16)aOutSz.Width() ); + mpHScrollBar->SetVisibleSize( static_cast<sal_uInt16>(aOutSz.Width()) ); mpHScrollBar->SetLineSize( HORZ_SCROLL ); mpHScrollBar->SetPageSize( aOutSz.Width() - HORZ_SCROLL ); } diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx index 7db757510534..df21ca2b1741 100644 --- a/vcl/source/control/listbox.cxx +++ b/vcl/source/control/listbox.cxx @@ -98,7 +98,7 @@ void ListBox::ImplInit( vcl::Window* pParent, WinBits nStyle ) { sal_Int32 nLeft, nTop, nRight, nBottom; GetBorder( nLeft, nTop, nRight, nBottom ); - mnDDHeight = (sal_uInt16)(GetTextHeight() + nTop + nBottom + 4); + mnDDHeight = static_cast<sal_uInt16>(GetTextHeight() + nTop + nBottom + 4); if( IsNativeWidgetEnabled() && IsNativeControlSupported( ControlType::Listbox, ControlPart::Entire ) ) @@ -413,7 +413,7 @@ void ListBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, Dr else { long nTextHeight = pDev->GetTextHeight(); - sal_uInt16 nLines = ( nTextHeight > 0 ) ? (sal_uInt16)(aSize.Height() / nTextHeight) : 1; + sal_uInt16 nLines = ( nTextHeight > 0 ) ? static_cast<sal_uInt16>(aSize.Height() / nTextHeight) : 1; tools::Rectangle aClip( aPos, aSize ); pDev->IntersectClipRegion( aClip ); @@ -1317,13 +1317,13 @@ void ListBox::GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines if ( !IsDropDownBox() ) { Size aOutSz = mpImplLB->GetMainWindow()->GetOutputSizePixel(); - rnCols = (sal_uInt16) (aOutSz.Width()/nCharWidth); - rnLines = (sal_uInt16) (aOutSz.Height()/mpImplLB->GetEntryHeight()); + rnCols = static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth); + rnLines = static_cast<sal_uInt16>(aOutSz.Height()/mpImplLB->GetEntryHeight()); } else { Size aOutSz = mpImplWin->GetOutputSizePixel(); - rnCols = (sal_uInt16) (aOutSz.Width()/nCharWidth); + rnCols = static_cast<sal_uInt16>(aOutSz.Width()/nCharWidth); rnLines = 1; } } diff --git a/vcl/source/control/longcurr.cxx b/vcl/source/control/longcurr.cxx index 0b538747f1c9..dc15721dc8fa 100644 --- a/vcl/source/control/longcurr.cxx +++ b/vcl/source/control/longcurr.cxx @@ -48,8 +48,8 @@ OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt { SAL_WARN_IF( nDigits >= 10, "vcl", "LongCurrency may only have 9 decimal places" ); - if ( rNumber.IsZero() || (long)rNumber ) - return rLocaleDataWrapper.getCurr( (long)rNumber, nDigits, rCurrSymbol, bShowThousandSep ); + if ( rNumber.IsZero() || static_cast<long>(rNumber) ) + return rLocaleDataWrapper.getCurr( static_cast<long>(rNumber), nDigits, rCurrSymbol, bShowThousandSep ); BigInt aTmp( ImplPower10( nDigits ) ); BigInt aInteger( rNumber ); @@ -66,7 +66,7 @@ OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt if ( rNumber.IsNeg() ) aFraction *= -1; - OUStringBuffer aTemplate = rLocaleDataWrapper.getCurr( (long)aFraction, nDigits, rCurrSymbol, bShowThousandSep ); + OUStringBuffer aTemplate = rLocaleDataWrapper.getCurr( static_cast<long>(aFraction), nDigits, rCurrSymbol, bShowThousandSep ); while( !aInteger.IsZero() ) { aFraction = aInteger; @@ -75,7 +75,7 @@ OUString ImplGetCurr( const LocaleDataWrapper& rLocaleDataWrapper, const BigInt if( !aInteger.IsZero() ) aFraction += aTmp; - OUString aFractionStr = rLocaleDataWrapper.getNum( (long)aFraction, 0 ); + OUString aFractionStr = rLocaleDataWrapper.getNum( static_cast<long>(aFraction), 0 ); sal_Int32 nSPos = aTemplate.indexOf( '1' ); if (nSPos == -1) diff --git a/vcl/source/control/prgsbar.cxx b/vcl/source/control/prgsbar.cxx index 837158350a36..519353a6a777 100644 --- a/vcl/source/control/prgsbar.cxx +++ b/vcl/source/control/prgsbar.cxx @@ -127,7 +127,7 @@ void ProgressBar::ImplDrawProgress(vcl::RenderContext& rRenderContext, sal_uInt1 mnPrgsWidth = (mnPrgsHeight * 2) / 3; maPos.Y() = PROGRESSBAR_WIN_OFFSET; long nMaxWidth = (aSize.Width() - (PROGRESSBAR_WIN_OFFSET * 2) + PROGRESSBAR_OFFSET); - sal_uInt16 nMaxCount = (sal_uInt16)(nMaxWidth / (mnPrgsWidth+PROGRESSBAR_OFFSET)); + sal_uInt16 nMaxCount = static_cast<sal_uInt16>(nMaxWidth / (mnPrgsWidth+PROGRESSBAR_OFFSET)); if (nMaxCount <= 1) { nMaxCount = 1; diff --git a/vcl/source/control/scrbar.cxx b/vcl/source/control/scrbar.cxx index ee937aa854d6..2695f6da714b 100644 --- a/vcl/source/control/scrbar.cxx +++ b/vcl/source/control/scrbar.cxx @@ -46,20 +46,20 @@ #include "thumbpos.hxx" -#define SCRBAR_DRAW_BTN1 ((sal_uInt16)0x0001) -#define SCRBAR_DRAW_BTN2 ((sal_uInt16)0x0002) -#define SCRBAR_DRAW_PAGE1 ((sal_uInt16)0x0004) -#define SCRBAR_DRAW_PAGE2 ((sal_uInt16)0x0008) -#define SCRBAR_DRAW_THUMB ((sal_uInt16)0x0010) -#define SCRBAR_DRAW_BACKGROUND ((sal_uInt16)0x0020) - -#define SCRBAR_STATE_BTN1_DOWN ((sal_uInt16)0x0001) -#define SCRBAR_STATE_BTN1_DISABLE ((sal_uInt16)0x0002) -#define SCRBAR_STATE_BTN2_DOWN ((sal_uInt16)0x0004) -#define SCRBAR_STATE_BTN2_DISABLE ((sal_uInt16)0x0008) -#define SCRBAR_STATE_PAGE1_DOWN ((sal_uInt16)0x0010) -#define SCRBAR_STATE_PAGE2_DOWN ((sal_uInt16)0x0020) -#define SCRBAR_STATE_THUMB_DOWN ((sal_uInt16)0x0040) +#define SCRBAR_DRAW_BTN1 (sal_uInt16(0x0001)) +#define SCRBAR_DRAW_BTN2 (sal_uInt16(0x0002)) +#define SCRBAR_DRAW_PAGE1 (sal_uInt16(0x0004)) +#define SCRBAR_DRAW_PAGE2 (sal_uInt16(0x0008)) +#define SCRBAR_DRAW_THUMB (sal_uInt16(0x0010)) +#define SCRBAR_DRAW_BACKGROUND (sal_uInt16(0x0020)) + +#define SCRBAR_STATE_BTN1_DOWN (sal_uInt16(0x0001)) +#define SCRBAR_STATE_BTN1_DISABLE (sal_uInt16(0x0002)) +#define SCRBAR_STATE_BTN2_DOWN (sal_uInt16(0x0004)) +#define SCRBAR_STATE_BTN2_DISABLE (sal_uInt16(0x0008)) +#define SCRBAR_STATE_PAGE1_DOWN (sal_uInt16(0x0010)) +#define SCRBAR_STATE_PAGE2_DOWN (sal_uInt16(0x0020)) +#define SCRBAR_STATE_THUMB_DOWN (sal_uInt16(0x0040)) #define SCRBAR_VIEW_STYLE (WB_3DLOOK | WB_HORZ | WB_VERT) diff --git a/vcl/source/control/slider.cxx b/vcl/source/control/slider.cxx index 61075e8b89e4..9bcc748fcd7a 100644 --- a/vcl/source/control/slider.cxx +++ b/vcl/source/control/slider.cxx @@ -24,9 +24,9 @@ #include "thumbpos.hxx" -#define SLIDER_STATE_CHANNEL1_DOWN ((sal_uInt16)0x0001) -#define SLIDER_STATE_CHANNEL2_DOWN ((sal_uInt16)0x0002) -#define SLIDER_STATE_THUMB_DOWN ((sal_uInt16)0x0004) +#define SLIDER_STATE_CHANNEL1_DOWN (sal_uInt16(0x0001)) +#define SLIDER_STATE_CHANNEL2_DOWN (sal_uInt16(0x0002)) +#define SLIDER_STATE_THUMB_DOWN (sal_uInt16(0x0004)) #define SLIDER_THUMB_SIZE 9 #define SLIDER_THUMB_HALFSIZE 4 diff --git a/vcl/source/control/tabctrl.cxx b/vcl/source/control/tabctrl.cxx index b94acb97f6dc..11d1bb0058ae 100644 --- a/vcl/source/control/tabctrl.cxx +++ b/vcl/source/control/tabctrl.cxx @@ -453,7 +453,7 @@ bool TabControl::ImplPlaceTabs( long nWidth ) nLineHeightAry[i] = nIH*(i-nCurLine-1) + GetItemsOffset().Y(); } - nLinePosAry[nLines+1] = (sal_uInt16)mpTabCtrlData->maItemList.size(); + nLinePosAry[nLines+1] = static_cast<sal_uInt16>(mpTabCtrlData->maItemList.size()); long nDX = 0; long nModDX = 0; @@ -1761,7 +1761,7 @@ void TabControl::EnablePage( sal_uInt16 i_nPageId, bool i_bEnable ) sal_uInt16 TabControl::GetPageCount() const { - return (sal_uInt16)mpTabCtrlData->maItemList.size(); + return static_cast<sal_uInt16>(mpTabCtrlData->maItemList.size()); } sal_uInt16 TabControl::GetPageId( sal_uInt16 nPos ) const @@ -1777,7 +1777,7 @@ sal_uInt16 TabControl::GetPagePos( sal_uInt16 nPageId ) const it != mpTabCtrlData->maItemList.end(); ++it ) { if ( it->mnId == nPageId ) - return (sal_uInt16)(it - mpTabCtrlData->maItemList.begin()); + return static_cast<sal_uInt16>(it - mpTabCtrlData->maItemList.begin()); } return TAB_PAGE_NOTFOUND; @@ -2030,7 +2030,7 @@ tools::Rectangle TabControl::GetCharacterBounds( sal_uInt16 nPageId, long nIndex if( HasLayoutData() ) { - std::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( (int)nPageId ); + std::unordered_map< int, int >::const_iterator it = mpTabCtrlData->maLayoutPageIdToLine.find( static_cast<int>(nPageId) ); if( it != mpTabCtrlData->maLayoutPageIdToLine.end() ) { Pair aPair = mpControlData->mpLayoutData->GetLineStartEnd( it->second ); @@ -2063,7 +2063,7 @@ long TabControl::GetIndexForPoint( const Point& rPoint, sal_uInt16& rPageId ) co if( aPair.A() <= nIndex && aPair.B() >= nIndex ) { nRet = nIndex - aPair.A(); - rPageId = (sal_uInt16)mpTabCtrlData->maLayoutLineToPageId[ nLine ]; + rPageId = static_cast<sal_uInt16>(mpTabCtrlData->maLayoutLineToPageId[ nLine ]); break; } } diff --git a/vcl/source/control/thumbpos.hxx b/vcl/source/control/thumbpos.hxx index 00e3d3c769eb..1992bd853745 100644 --- a/vcl/source/control/thumbpos.hxx +++ b/vcl/source/control/thumbpos.hxx @@ -14,8 +14,8 @@ inline long ImplMulDiv( long nNumber, long nNumerator, long nDenominator ) { if (!nDenominator) return 0; - double n = ((double)nNumber * (double)nNumerator) / (double)nDenominator; - return (long)n; + double n = (static_cast<double>(nNumber) * static_cast<double>(nNumerator)) / static_cast<double>(nDenominator); + return static_cast<long>(n); } #endif // INCLUDED_VCL_SOURCE_CONTROL_THUMBPOS_HXX |