diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:14:18 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:14:18 +0100 |
commit | 43b137e1404acbd16649813e9d493ba97b8f509c (patch) | |
tree | 2e5827c0d60185c56603e66b1ea74a72230b9476 | |
parent | c049c76fc521f2b55b39a6e9eb0f0092bcf6ef77 (diff) |
More loplugin:cstylecast: svtools
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: Ide9e7c53b554f0a36e2078a8823f5ef6fb5cc8fa
62 files changed, 357 insertions, 357 deletions
diff --git a/include/svtools/accessibletableprovider.hxx b/include/svtools/accessibletableprovider.hxx index d3ca495b3b9a..094c4a16fb27 100644 --- a/include/svtools/accessibletableprovider.hxx +++ b/include/svtools/accessibletableprovider.hxx @@ -29,8 +29,8 @@ namespace svt { -#define OFFSET_DEFAULT ((sal_Int32)-1) -#define OFFSET_NONE ((sal_Int32)0) +#define OFFSET_DEFAULT (sal_Int32(-1)) +#define OFFSET_NONE (sal_Int32(0)) enum AccessibleTableChildIndex { diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index 1f5ab12dc3cc..5d76e28e46f6 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -570,7 +570,7 @@ namespace svt // inserting columns // if you don't set a width, this will be calculated automatically // if the id isn't set the smallest unused will do it ... - virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1); + virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1)); // called whenever (Shift)Tab or Enter is pressed. If true is returned, these keys // result in traveling to the next or to th previous cell diff --git a/include/svtools/headbar.hxx b/include/svtools/headbar.hxx index a575bd7c3fb5..08203a2c611a 100644 --- a/include/svtools/headbar.hxx +++ b/include/svtools/headbar.hxx @@ -174,8 +174,8 @@ HeaderBarItemBits::CLICKABLE, but HeaderBarItemBits::FIXEDPOS. class Accelerator; class ImplHeadItem; -#define WB_BOTTOMBORDER ((WinBits)0x0400) -#define WB_BUTTONSTYLE ((WinBits)0x0800) +#define WB_BOTTOMBORDER (WinBits(0x0400)) +#define WB_BUTTONSTYLE (WinBits(0x0800)) #define WB_STDHEADERBAR (WB_BUTTONSTYLE | WB_BOTTOMBORDER) enum class HeaderBarItemBits @@ -203,9 +203,9 @@ namespace o3tl template<> struct typed_flags<HeaderBarItemBits> : is_typed_flags<HeaderBarItemBits, 0x3fff> {}; } -#define HEADERBAR_APPEND ((sal_uInt16)0xFFFF) -#define HEADERBAR_ITEM_NOTFOUND ((sal_uInt16)0xFFFF) -#define HEADERBAR_FULLSIZE ((long)1000000000) +#define HEADERBAR_APPEND (sal_uInt16(0xFFFF)) +#define HEADERBAR_ITEM_NOTFOUND (sal_uInt16(0xFFFF)) +#define HEADERBAR_FULLSIZE (long(1000000000)) #define HEADERBAR_TEXTOFF 2 diff --git a/include/svtools/imapobj.hxx b/include/svtools/imapobj.hxx index 9c79dbc0152c..04da290dda0d 100644 --- a/include/svtools/imapobj.hxx +++ b/include/svtools/imapobj.hxx @@ -29,12 +29,12 @@ namespace tools { class Rectangle; } class SvStream; #define IMAP_OBJ_NONE ((sal_uInt16)0x0000) -#define IMAP_OBJ_RECTANGLE ((sal_uInt16)0x0001) -#define IMAP_OBJ_CIRCLE ((sal_uInt16)0x0002) -#define IMAP_OBJ_POLYGON ((sal_uInt16)0x0003) -#define IMAP_OBJ_VERSION ((sal_uInt16)0x0005) +#define IMAP_OBJ_RECTANGLE (sal_uInt16(0x0001)) +#define IMAP_OBJ_CIRCLE (sal_uInt16(0x0002)) +#define IMAP_OBJ_POLYGON (sal_uInt16(0x0003)) +#define IMAP_OBJ_VERSION (sal_uInt16(0x0005)) -#define IMAGE_MAP_VERSION ((sal_uInt16)0x0001) +#define IMAGE_MAP_VERSION (sal_uInt16(0x0001)) #define IMAPMAGIC "SDIMAP" diff --git a/include/svtools/ruler.hxx b/include/svtools/ruler.hxx index 23aac6fc2fcc..2da312a6b244 100644 --- a/include/svtools/ruler.hxx +++ b/include/svtools/ruler.hxx @@ -459,8 +459,8 @@ Tips for the use of the ruler: *************************************************************************/ -#define WB_EXTRAFIELD ((WinBits)0x00004000) -#define WB_RIGHT_ALIGNED ((WinBits)0x00008000) +#define WB_EXTRAFIELD (WinBits(0x00004000)) +#define WB_RIGHT_ALIGNED (WinBits(0x00008000)) #define WB_STDRULER WB_HORZ @@ -470,9 +470,9 @@ enum class RulerType { DontKnow, Outside, enum class RulerExtra { DontKnow, NullOffset, Tab }; -#define RULER_STYLE_HIGHLIGHT ((sal_uInt16)0x8000) -#define RULER_STYLE_DONTKNOW ((sal_uInt16)0x4000) -#define RULER_STYLE_INVISIBLE ((sal_uInt16)0x2000) +#define RULER_STYLE_HIGHLIGHT (sal_uInt16(0x8000)) +#define RULER_STYLE_DONTKNOW (sal_uInt16(0x4000)) +#define RULER_STYLE_INVISIBLE (sal_uInt16(0x2000)) enum class RulerDragSize { Move, @@ -529,13 +529,13 @@ struct RulerIndent }; -#define RULER_TAB_LEFT ((sal_uInt16)0x0000) -#define RULER_TAB_RIGHT ((sal_uInt16)0x0001) -#define RULER_TAB_CENTER ((sal_uInt16)0x0002) -#define RULER_TAB_DECIMAL ((sal_uInt16)0x0003) -#define RULER_TAB_DEFAULT ((sal_uInt16)0x0004) -#define RULER_TAB_STYLE ((sal_uInt16)0x000F) -#define RULER_TAB_RTL ((sal_uInt16)0x0010) +#define RULER_TAB_LEFT (sal_uInt16(0x0000)) +#define RULER_TAB_RIGHT (sal_uInt16(0x0001)) +#define RULER_TAB_CENTER (sal_uInt16(0x0002)) +#define RULER_TAB_DECIMAL (sal_uInt16(0x0003)) +#define RULER_TAB_DEFAULT (sal_uInt16(0x0004)) +#define RULER_TAB_STYLE (sal_uInt16(0x000F)) +#define RULER_TAB_RTL (sal_uInt16(0x0010)) struct RulerTab { diff --git a/include/svtools/tabbar.hxx b/include/svtools/tabbar.hxx index 8996cb0f60bf..0e5b93a5e861 100644 --- a/include/svtools/tabbar.hxx +++ b/include/svtools/tabbar.hxx @@ -268,10 +268,10 @@ been carried out. class Button; -#define WB_RANGESELECT ((WinBits)0x00200000) -#define WB_MULTISELECT ((WinBits)0x00400000) -#define WB_MINSCROLL ((WinBits)0x20000000) -#define WB_INSERTTAB ((WinBits)0x40000000) +#define WB_RANGESELECT (WinBits(0x00200000)) +#define WB_MULTISELECT (WinBits(0x00400000)) +#define WB_MINSCROLL (WinBits(0x20000000)) +#define WB_INSERTTAB (WinBits(0x40000000)) #define WB_STDTABBAR WB_BORDER // Page bits diff --git a/include/svtools/table/tabletypes.hxx b/include/svtools/table/tabletypes.hxx index b10d1a411d0b..36765757a921 100644 --- a/include/svtools/table/tabletypes.hxx +++ b/include/svtools/table/tabletypes.hxx @@ -37,14 +37,14 @@ namespace svt { namespace table typedef sal_Int32 TableMetrics; /// denotes the column containing the row headers -#define COL_ROW_HEADERS ((::svt::table::ColPos)-1) +#define COL_ROW_HEADERS (::svt::table::ColPos(-1)) /// denotes the row containing the column headers -#define ROW_COL_HEADERS ((::svt::table::RowPos)-1) +#define ROW_COL_HEADERS (::svt::table::RowPos(-1)) /// denotes an invalid column index -#define COL_INVALID ((::svt::table::ColPos)-2) +#define COL_INVALID (::svt::table::ColPos(-2)) /// denotes an invalid row index -#define ROW_INVALID ((::svt::table::RowPos)-2) +#define ROW_INVALID (::svt::table::RowPos(-2)) } } // namespace svt::table diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx index 0f70c177ee1b..83f5e7d075f8 100644 --- a/include/svtools/valueset.hxx +++ b/include/svtools/valueset.hxx @@ -179,16 +179,16 @@ to be set (before Show) with SetStyle(). typedef std::vector<ValueSetItem*> ValueItemList; -#define WB_ITEMBORDER ((WinBits)0x00010000) -#define WB_DOUBLEBORDER ((WinBits)0x00020000) -#define WB_NAMEFIELD ((WinBits)0x00040000) -#define WB_NONEFIELD ((WinBits)0x00080000) -#define WB_FLATVALUESET ((WinBits)0x02000000) -#define WB_NO_DIRECTSELECT ((WinBits)0x04000000) -#define WB_MENUSTYLEVALUESET ((WinBits)0x08000000) - -#define VALUESET_APPEND ((size_t)-1) -#define VALUESET_ITEM_NOTFOUND ((size_t)-1) +#define WB_ITEMBORDER (WinBits(0x00010000)) +#define WB_DOUBLEBORDER (WinBits(0x00020000)) +#define WB_NAMEFIELD (WinBits(0x00040000)) +#define WB_NONEFIELD (WinBits(0x00080000)) +#define WB_FLATVALUESET (WinBits(0x02000000)) +#define WB_NO_DIRECTSELECT (WinBits(0x04000000)) +#define WB_MENUSTYLEVALUESET (WinBits(0x08000000)) + +#define VALUESET_APPEND (size_t(-1)) +#define VALUESET_ITEM_NOTFOUND (size_t(-1)) class SVT_DLLPUBLIC ValueSet : public Control diff --git a/include/svtools/wizardmachine.hxx b/include/svtools/wizardmachine.hxx index 6a354a39fe80..2bb25bba8a13 100644 --- a/include/svtools/wizardmachine.hxx +++ b/include/svtools/wizardmachine.hxx @@ -47,7 +47,7 @@ namespace svt // wizard states -#define WZS_INVALID_STATE ((WizardState)-1) +#define WZS_INVALID_STATE (WizardState(-1)) //= WizardTypes diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index effe4eecf379..fd773ff62638 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -541,7 +541,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) nMaxWidth -= pDataWin->bAutoSizeLastCol ? GetFieldRect(nItemId).Left() : GetFrozenWidth(); - if ( pDataWin->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth ) + if ( pDataWin->bAutoSizeLastCol || nWidth > static_cast<sal_uLong>(nMaxWidth) ) { nWidth = nMaxWidth > 16 ? nMaxWidth : nOldWidth; } @@ -550,7 +550,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) // OV // In AutoSizeLastColumn(), we call SetColumnWidth with nWidth==0xffff. // Thus, check here, if the width has actually changed. - if( (sal_uLong)nOldWidth == nWidth ) + if( static_cast<sal_uLong>(nOldWidth) == nWidth ) return; // do we want to display the change immediately? @@ -588,13 +588,13 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) if( GetBackground().IsScrollable() ) { - tools::Rectangle aScrRect( nX + std::min( (sal_uLong)nOldWidth, nWidth ), 0, + tools::Rectangle aScrRect( nX + std::min( static_cast<sal_uLong>(nOldWidth), nWidth ), 0, GetSizePixel().Width() , // the header is longer than the datawin pDataWin->GetPosPixel().Y() - 1 ); Control::Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS ); aScrRect.Bottom() = pDataWin->GetSizePixel().Height(); pDataWin->Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS ); - tools::Rectangle aInvRect( nX, 0, nX + std::max( nWidth, (sal_uLong)nOldWidth ), USHRT_MAX ); + tools::Rectangle aInvRect( nX, 0, nX + std::max( nWidth, static_cast<sal_uLong>(nOldWidth) ), USHRT_MAX ); Control::Invalidate( aInvRect, InvalidateFlags::NoChildren ); pDataWin->Invalidate( aInvRect ); } @@ -629,7 +629,7 @@ void BrowseBox::AutoSizeLastColumn() if ( pDataWin->bAutoSizeLastCol && pDataWin->GetUpdateMode() ) { - sal_uInt16 nId = GetColumnId( (sal_uInt16)pCols.size() - 1 ); + sal_uInt16 nId = GetColumnId( static_cast<sal_uInt16>(pCols.size()) - 1 ); SetColumnWidth( nId, LONG_MAX ); ColumnResized( nId ); } @@ -806,7 +806,7 @@ long BrowseBox::GetRowCount() const sal_uInt16 BrowseBox::ColCount() const { - return (sal_uInt16) pCols.size(); + return static_cast<sal_uInt16>(pCols.size()); } @@ -841,7 +841,7 @@ long BrowseBox::ScrollColumns( long nCols ) { if ( nFirstCol + nCols < 0 || - nFirstCol + nCols >= (long)pCols.size() ) + nFirstCol + nCols >= static_cast<long>(pCols.size()) ) return 0; // implicitly hides cursor while scrolling @@ -940,7 +940,7 @@ long BrowseBox::ScrollColumns( long nCols ) pDataWin->GetSizePixel() ) ); } - nFirstCol = nFirstCol + (sal_uInt16)nCols; + nFirstCol = nFirstCol + static_cast<sal_uInt16>(nCols); aHScroll->SetThumbPos( nFirstCol - FrozenColCount() ); } @@ -987,7 +987,7 @@ long BrowseBox::ScrollRows( long nRows ) return 0; // compute new top row - long nTmpMin = std::min( (long)(nTopRow + nRows), (long)(nRowCount - 1) ); + long nTmpMin = std::min( static_cast<long>(nTopRow + nRows), static_cast<long>(nRowCount - 1) ); long nNewTopRow = std::max<long>( nTmpMin, 0 ); @@ -995,12 +995,12 @@ long BrowseBox::ScrollRows( long nRows ) return 0; sal_uInt16 nVisibleRows = - (sal_uInt16)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); + static_cast<sal_uInt16>(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); VisibleRowsChanged(nNewTopRow, nVisibleRows); // compute new top row again (nTopRow might have changed!) - nTmpMin = std::min( (long)(nTopRow + nRows), (long)(nRowCount - 1) ); + nTmpMin = std::min( static_cast<long>(nTopRow + nRows), static_cast<long>(nRowCount - 1) ); nNewTopRow = std::max<long>( nTmpMin, 0 ); @@ -1020,7 +1020,7 @@ long BrowseBox::ScrollRows( long nRows ) std::abs( nDeltaY ) > 0 && std::abs( nDeltaY ) < pDataWin->GetSizePixel().Height() ) { - pDataWin->Scroll( 0, (short)-nDeltaY, SCROLL_FLAGS ); + pDataWin->Scroll( 0, static_cast<short>(-nDeltaY), SCROLL_FLAGS ); } else pDataWin->Invalidate(); @@ -1292,7 +1292,7 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) pDataWin->SetClipRegion(); if( pDataWin->GetBackground().IsScrollable() ) { - pDataWin->Scroll( 0, - (short) GetDataRowHeight() * nNumRows, + pDataWin->Scroll( 0, - static_cast<short>(GetDataRowHeight()) * nNumRows, tools::Rectangle( Point( 0, nY ), Size( aSz.Width(), aSz.Height() - nY + nNumRows*GetDataRowHeight() ) ), SCROLL_FLAGS ); @@ -1515,7 +1515,7 @@ bool BrowseBox::GoToColumnId( sal_uInt16 nColId, bool bMakeVisible, bool bRowCol bool bScrolled = false; sal_uInt16 nFirstPos = nFirstCol; - sal_uInt16 nWidth = (sal_uInt16)pColumn->Width(); + sal_uInt16 nWidth = static_cast<sal_uInt16>(pColumn->Width()); sal_uInt16 nLastPos = GetColumnAtXPosPixel( pDataWin->GetSizePixel().Width()-nWidth ); sal_uInt16 nFrozen = FrozenColCount(); @@ -1643,7 +1643,7 @@ void BrowseBox::SelectAll() { tools::Rectangle aHighlightRect; sal_uInt16 nVisibleRows = - (sal_uInt16)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); + static_cast<sal_uInt16>(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); for ( long nRow = std::max<long>( nTopRow, uRow.pSel->FirstSelected() ); nRow != BROWSER_ENDOFSELECTION && nRow < nTopRow + nVisibleRows; nRow = uRow.pSel->NextSelected() ) @@ -1833,7 +1833,7 @@ sal_uInt16 BrowseBox::GetSelectColumnCount() const { // while bAutoSelect (==!pColSel), 1 if any rows (yes rows!) else none - return pColSel ? (sal_uInt16) pColSel->GetSelectCount() : + return pColSel ? static_cast<sal_uInt16>(pColSel->GetSelectCount()) : nCurRow >= 0 ? 1 : 0; } @@ -2305,12 +2305,12 @@ long BrowseBox::CalcReverseZoom(long nVal) if (IsZoom()) { const Fraction& rZoom = GetZoom(); - double n = (double)nVal; - n *= (double)rZoom.GetDenominator(); + double n = static_cast<double>(nVal); + n *= static_cast<double>(rZoom.GetDenominator()); if (!rZoom.GetNumerator()) throw o3tl::divide_by_zero(); - n /= (double)rZoom.GetNumerator(); - nVal = n>0 ? (long)(n + 0.5) : -(long)(-n + 0.5); + n /= static_cast<double>(rZoom.GetNumerator()); + nVal = n>0 ? static_cast<long>(n + 0.5) : -static_cast<long>(-n + 0.5); } return nVal; @@ -2371,7 +2371,7 @@ void BrowseBox::GetFocus() sal_uInt16 BrowseBox::GetVisibleRows() { - return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); + return static_cast<sal_uInt16>((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); } vcl::Window& BrowseBox::GetDataWindow() const diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 8ff0f3e860e5..99040fcb7e75 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -478,13 +478,13 @@ void BrowseBox::Resize() // resized - which is done in UpdateScrollbars) sal_uLong nSBSize = GetSettings().GetStyleSettings().GetScrollBarSize(); if (IsZoom()) - nSBSize = (sal_uLong)(nSBSize * (double)GetZoom()); + nSBSize = static_cast<sal_uLong>(nSBSize * static_cast<double>(GetZoom())); DoHideCursor( "Resize" ); sal_uInt16 nOldVisibleRows = 0; //fdo#42694, post #i111125# GetDataRowHeight() can be 0 if (GetDataRowHeight()) - nOldVisibleRows = (sal_uInt16)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); + nOldVisibleRows = static_cast<sal_uInt16>(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); // did we need a horizontal scroll bar or is there a Control Area? if ( !pDataWin->bNoHScroll && @@ -510,7 +510,7 @@ void BrowseBox::Resize() sal_uInt16 nVisibleRows = 0; if (GetDataRowHeight()) - nVisibleRows = (sal_uInt16)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); + nVisibleRows = static_cast<sal_uInt16>(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); // TopRow is unchanged, but the number of visible lines has changed. if ( nVisibleRows != nOldVisibleRows ) @@ -785,8 +785,8 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec sal_uLong nRelBottomRow = aOverallAreaSize.Height(); if (!_bForeignDevice && nDataRowHeigt) { - nRelTopRow = ((sal_uLong)_rRect.Top() / nDataRowHeigt); - nRelBottomRow = (sal_uLong)(_rRect.Bottom()) / nDataRowHeigt; + nRelTopRow = (static_cast<sal_uLong>(_rRect.Top()) / nDataRowHeigt); + nRelBottomRow = static_cast<sal_uLong>(_rRect.Bottom()) / nDataRowHeigt; } // cache frequently used values @@ -806,13 +806,13 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec // redraw the invalid fields for ( sal_uLong nRelRow = nRelTopRow; - nRelRow <= nRelBottomRow && (sal_uLong)nTopRow+nRelRow < (sal_uLong)nRowCount; + nRelRow <= nRelBottomRow && static_cast<sal_uLong>(nTopRow)+nRelRow < static_cast<sal_uLong>(nRowCount); ++nRelRow, aPos.Y() += nDataRowHeigt ) { // get row // check valid area, to be on the safe side: - DBG_ASSERT( (sal_uInt16)(nTopRow+nRelRow) < nRowCount, "BrowseBox::ImplPaintData: invalid seek" ); - if ( (nTopRow+long(nRelRow)) < 0 || (sal_uInt16)(nTopRow+nRelRow) >= nRowCount ) + DBG_ASSERT( static_cast<sal_uInt16>(nTopRow+nRelRow) < nRowCount, "BrowseBox::ImplPaintData: invalid seek" ); + if ( (nTopRow+long(nRelRow)) < 0 || static_cast<sal_uInt16>(nTopRow+nRelRow) >= nRowCount ) continue; // prepare row @@ -880,7 +880,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec _rOut.DrawRect( aFieldRect ); } - if (!m_bFocusOnlyCursor && (pCol->GetId() == GetCurColumnId()) && (nRow == (sal_uLong)GetCurRow())) + if (!m_bFocusOnlyCursor && (pCol->GetId() == GetCurColumnId()) && (nRow == static_cast<sal_uLong>(GetCurRow()))) DrawCursor(); // draw a single field. @@ -1048,7 +1048,7 @@ void BrowseBox::UpdateScrollbars() // the size of the corner window (and the width of the VSB/height of the HSB) sal_uLong nCornerSize = GetSettings().GetStyleSettings().GetScrollBarSize(); if (IsZoom()) - nCornerSize = (sal_uLong)(nCornerSize * (double)GetZoom()); + nCornerSize = static_cast<sal_uLong>(nCornerSize * static_cast<double>(GetZoom())); bool bNeedsVScroll = false; long nMaxRows = 0; @@ -1112,14 +1112,14 @@ void BrowseBox::UpdateScrollbars() Size( aDataWinSize.Width() - nHScrX, nCornerSize ) ); // total scrollable columns - short nScrollCols = short(pCols.size()) - (short)nFrozenCols; + short nScrollCols = short(pCols.size()) - static_cast<short>(nFrozenCols); // visible columns short nVisibleHSize = nLastCol == BROWSER_INVALIDID - ? (short)( pCols.size() - nFirstCol ) - : (short)( nLastCol - nFirstCol ); + ? static_cast<short>( pCols.size() - nFirstCol ) + : static_cast<short>( nLastCol - nFirstCol ); - short nRange = std::max( nScrollCols, (short)0 ); + short nRange = std::max( nScrollCols, short(0) ); aHScroll->SetVisibleSize( nVisibleHSize ); aHScroll->SetRange( Range( 0, nRange )); if ( bNeedsHScroll && !aHScroll->IsVisible() ) @@ -1379,11 +1379,11 @@ void BrowseBox::MouseMove( const MouseEvent& rEvt ) { // compute right end of column BrowserColumn *pCol = pCols[ nCol ]; - sal_uInt16 nR = (sal_uInt16)(nX + pCol->Width() - 1); + sal_uInt16 nR = static_cast<sal_uInt16>(nX + pCol->Width() - 1); // show resize-pointer? if ( bResizing || ( pCol->GetId() && - std::abs( ((long) nR ) - rEvt.GetPosPixel().X() ) < MIN_COLUMNWIDTH ) ) + std::abs( static_cast<long>(nR) - rEvt.GetPosPixel().X() ) < MIN_COLUMNWIDTH ) ) { aNewPointer = Pointer( PointerStyle::HSplit ); if ( bResizing ) @@ -1423,7 +1423,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt ) // width changed? nDragX = std::max( rEvt.GetPosPixel().X(), nMinResizeX ); - if ( (nDragX - nResizeX) != (long)pCols[ nResizeCol ]->Width() ) + if ( (nDragX - nResizeX) != static_cast<long>(pCols[ nResizeCol ]->Width()) ) { // resize column long nMaxX = pDataWin->GetSizePixel().Width(); diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index 073277734c89..7e69688c814c 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -508,7 +508,7 @@ void BrowseBox::GetAllSelectedColumns( css::uno::Sequence< sal_Int32 >& _rColumn { const Range& rRange = pColumnSel->GetRange( nRange ); // loop has to include aRange.Max() - for( sal_Int32 nCol = rRange.Min(); nCol <= (sal_Int32)rRange.Max(); ++nCol ) + for( sal_Int32 nCol = rRange.Min(); nCol <= static_cast<sal_Int32>(rRange.Max()); ++nCol ) { DBG_ASSERT( nIndex < nCount, "GetAllSelectedColumns - range overflow" ); diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index 69d6501a24da..2ca807be8276 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -94,12 +94,12 @@ BrowserColumn::BrowserColumn( sal_uInt16 nItemId, _aTitle( rTitle ), _bFrozen( false ) { - double n = (double)_nWidth; - n *= (double)rCurrentZoom.GetDenominator(); + double n = static_cast<double>(_nWidth); + n *= static_cast<double>(rCurrentZoom.GetDenominator()); if (!rCurrentZoom.GetNumerator()) throw o3tl::divide_by_zero(); - n /= (double)rCurrentZoom.GetNumerator(); - _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); + n /= static_cast<double>(rCurrentZoom.GetNumerator()); + _nOriginalWidth = n>0 ? static_cast<long>(n+0.5) : -static_cast<long>(-n+0.5); } BrowserColumn::~BrowserColumn() @@ -117,12 +117,12 @@ void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZ } else { - double n = (double)_nWidth; - n *= (double)rCurrentZoom.GetDenominator(); + double n = static_cast<double>(_nWidth); + n *= static_cast<double>(rCurrentZoom.GetDenominator()); if (!rCurrentZoom.GetNumerator()) throw o3tl::divide_by_zero(); - n /= (double)rCurrentZoom.GetNumerator(); - _nOriginalWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); + n /= static_cast<double>(rCurrentZoom.GetNumerator()); + _nOriginalWidth = n>0 ? static_cast<long>(n+0.5) : -static_cast<long>(-n+0.5); } } @@ -168,7 +168,7 @@ void BrowserColumn::Draw( BrowseBox const & rBox, OutputDevice& rDev, const Poin void BrowserColumn::ZoomChanged(const Fraction& rNewZoom) { double n(_nOriginalWidth * rNewZoom); - _nWidth = n>0 ? (long)(n+0.5) : -(long)(-n+0.5); + _nWidth = n>0 ? static_cast<long>(n+0.5) : -static_cast<long>(-n+0.5); } diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index eb092d16c51f..02f2cb83cdda 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -1102,9 +1102,9 @@ return; // the size of the control area Point aPoint(GetControlArea().TopLeft()); - sal_uInt16 nX = (sal_uInt16)aPoint.X(); + sal_uInt16 nX = static_cast<sal_uInt16>(aPoint.X()); - ArrangeControls(nX, (sal_uInt16)aPoint.Y()); + ArrangeControls(nX, static_cast<sal_uInt16>(aPoint.Y())); if (!nX) nX = USHRT_MAX; @@ -1115,8 +1115,8 @@ return; //chance to adapt to the new size if (bChanged) { - nX = (sal_uInt16)aPoint.X(); - ArrangeControls(nX, (sal_uInt16)aPoint.Y()); + nX = static_cast<sal_uInt16>(aPoint.X()); + ArrangeControls(nX, static_cast<sal_uInt16>(aPoint.Y())); } } diff --git a/svtools/source/config/htmlcfg.cxx b/svtools/source/config/htmlcfg.cxx index cbf6cff6282e..b84e79243485 100644 --- a/svtools/source/config/htmlcfg.cxx +++ b/svtools/source/config/htmlcfg.cxx @@ -255,7 +255,7 @@ void SvxHtmlOptions::Notify( const css::uno::Sequence< OUString >& ) sal_uInt16 SvxHtmlOptions::GetFontSize(sal_uInt16 nPos) const { if(nPos < HTML_FONT_COUNT) - return (sal_uInt16)pImpl->aFontSizeArr[nPos]; + return static_cast<sal_uInt16>(pImpl->aFontSizeArr[nPos]); return 0; } @@ -287,7 +287,7 @@ void SvxHtmlOptions::SetImportUnknown(bool bSet) sal_uInt16 SvxHtmlOptions::GetExportMode() const { - return (sal_uInt16)pImpl->nExportMode; + return static_cast<sal_uInt16>(pImpl->nExportMode); } @@ -378,7 +378,7 @@ rtl_TextEncoding SvxHtmlOptions::GetTextEncoding() const if(pImpl->bIsEncodingDefault) eRet = SvtSysLocale::GetBestMimeEncoding(); else - eRet = (rtl_TextEncoding)pImpl->eEncoding; + eRet = static_cast<rtl_TextEncoding>(pImpl->eEncoding); return eRet; } diff --git a/svtools/source/config/miscopt.cxx b/svtools/source/config/miscopt.cxx index 4a06f66b2526..c5b029d4c8bd 100644 --- a/svtools/source/config/miscopt.cxx +++ b/svtools/source/config/miscopt.cxx @@ -68,7 +68,7 @@ using namespace ::com::sun::star; #define PROPERTYNAME_NOTEBOOKBARICONSIZE "NotebookbarIconSize" #define PROPERTYHANDLE_NOTEBOOKBARICONSIZE 11 -#define VCL_TOOLBOX_STYLE_FLAT ((sal_uInt16)0x0004) // from <vcl/toolbox.hxx> +#define VCL_TOOLBOX_STYLE_FLAT (sal_uInt16(0x0004)) // from <vcl/toolbox.hxx> class SvtMiscOptions_Impl : public ConfigItem { diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index 81d7c7a275d3..b11458694d40 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -654,7 +654,7 @@ void SvtBasePrintOptions::GetPrinterOptions( PrinterOptions& rOptions ) const rOptions.SetReducedGradientStepCount( GetReducedGradientStepCount() ); rOptions.SetReduceBitmaps( IsReduceBitmaps() ); rOptions.SetReducedBitmapMode( (PrinterBitmapMode) GetReducedBitmapMode() ); - rOptions.SetReducedBitmapResolution( aDPIArray[ std::min( (sal_uInt16) GetReducedBitmapResolution(), (sal_uInt16)( DPI_COUNT - 1 ) ) ] ); + rOptions.SetReducedBitmapResolution( aDPIArray[ std::min( static_cast<sal_uInt16>(GetReducedBitmapResolution()), sal_uInt16( DPI_COUNT - 1 ) ) ] ); rOptions.SetReducedBitmapIncludesTransparency( IsReducedBitmapIncludesTransparency() ); rOptions.SetConvertToGreyscales( IsConvertToGreyscales() ); rOptions.SetPDFAsStandardPrintJobFormat( IsPDFAsStandardPrintJobFormat() ); @@ -687,7 +687,7 @@ void SvtBasePrintOptions::SetPrinterOptions( const PrinterOptions& rOptions ) { if( nDPI >= aDPIArray[ i ] ) { - SetReducedBitmapResolution( (sal_Int16) i ); + SetReducedBitmapResolution( static_cast<sal_Int16>(i) ); i = -1; } } diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index 749a16efd2da..02565a04ef84 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -422,7 +422,7 @@ inline void SvtFileView_Impl::EndEditing() OUString CreateExactSizeText( sal_Int64 nSize ) { - double fSize( ( double ) nSize ); + double fSize( static_cast<double>(nSize) ); int nDec; long nMega = 1024 * 1024; @@ -1352,8 +1352,8 @@ void SvtFileView::SetConfigString( const OUString& rCfgStr ) DBG_ASSERT( pBar, "invalid headerbar" ); sal_Int32 nIdx = 0; - mpImpl->mnSortColumn = (sal_uInt16)rCfgStr.getToken( 0, ';', nIdx ).toInt32(); - bool bUp = (bool)(sal_uInt16)rCfgStr.getToken( 0, ';', nIdx ).toInt32(); + mpImpl->mnSortColumn = static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32()); + bool bUp = static_cast<bool>(static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32())); HeaderBarItemBits nBits = pBar->GetItemBits( mpImpl->mnSortColumn ); if ( bUp ) @@ -1370,7 +1370,7 @@ void SvtFileView::SetConfigString( const OUString& rCfgStr ) while ( nIdx != -1 ) { - sal_uInt16 nItemId = (sal_uInt16)rCfgStr.getToken( 0, ';', nIdx ).toInt32(); + sal_uInt16 nItemId = static_cast<sal_uInt16>(rCfgStr.getToken( 0, ';', nIdx ).toInt32()); pBar->SetItemSize( nItemId, rCfgStr.getToken( 0, ';', nIdx ).toInt32() ); } diff --git a/svtools/source/contnr/iconviewimpl.cxx b/svtools/source/contnr/iconviewimpl.cxx index 87a8ceb09827..3b3380a7d972 100644 --- a/svtools/source/contnr/iconviewimpl.cxx +++ b/svtools/source/contnr/iconviewimpl.cxx @@ -172,7 +172,7 @@ void IconViewImpl::KeyDown( bool bPageDown ) aVerSBar->SetThumbPos( nThumbPos+nDelta ); if( bPageDown ) - PageDown( (short)nDelta ); + PageDown( static_cast<short>(nDelta) ); else CursorDown(); @@ -203,7 +203,7 @@ void IconViewImpl::KeyUp( bool bPageUp ) aVerSBar->SetThumbPos( nThumbPos - nDelta ); if( bPageUp ) - PageUp( (short)nDelta ); + PageUp( static_cast<short>(nDelta) ); else CursorUp(); @@ -238,8 +238,8 @@ SvTreeListEntry* IconViewImpl::GetClickedEntry( const Point& rPoint ) const if( pView->GetEntryCount() == 0 || !pStartEntry || !pView->GetEntryHeight() || !pView->GetEntryWidth()) return nullptr; - sal_uInt16 nY = (sal_uInt16)(rPoint.Y() / pView->GetEntryHeight() ); - sal_uInt16 nX = (sal_uInt16)(rPoint.X() / pView->GetEntryWidth() ); + sal_uInt16 nY = static_cast<sal_uInt16>(rPoint.Y() / pView->GetEntryHeight() ); + sal_uInt16 nX = static_cast<sal_uInt16>(rPoint.X() / pView->GetEntryWidth() ); sal_uInt16 nTemp = nY * pView->GetColumnsCount() + nX; SvTreeListEntry* pEntry = pView->NextVisible(pStartEntry, nTemp); @@ -329,7 +329,7 @@ SvTreeListEntry* IconViewImpl::GetEntry( const Point& rPoint ) const || !pView->GetEntryWidth()) return nullptr; - sal_uInt16 nClickedEntry = (sal_uInt16)(rPoint.Y() / pView->GetEntryHeight() * pView->GetColumnsCount() + rPoint.X() / pView->GetEntryWidth() ); + sal_uInt16 nClickedEntry = static_cast<sal_uInt16>(rPoint.Y() / pView->GetEntryHeight() * pView->GetColumnsCount() + rPoint.X() / pView->GetEntryWidth() ); sal_uInt16 nTemp = nClickedEntry; SvTreeListEntry* pEntry = pView->NextVisible(pStartEntry, nTemp); if( nTemp != nClickedEntry ) diff --git a/svtools/source/contnr/imivctl.hxx b/svtools/source/contnr/imivctl.hxx index 1f9efb0ce1b2..5ba8627ed6e8 100644 --- a/svtools/source/contnr/imivctl.hxx +++ b/svtools/source/contnr/imivctl.hxx @@ -552,8 +552,8 @@ public: void OccupyGrids( const SvxIconChoiceCtrlEntry* ); void OccupyGrid( GridId nId ) { - DBG_ASSERT(!_pGridMap || nId<(sal_uLong)(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId"); - if(_pGridMap && nId < (sal_uLong)(_nGridCols *_nGridRows) ) + DBG_ASSERT(!_pGridMap || nId<static_cast<sal_uLong>(_nGridCols*_nGridRows),"OccupyGrid: Bad GridId"); + if(_pGridMap && nId < static_cast<sal_uLong>(_nGridCols *_nGridRows) ) _pGridMap[ nId ] = true; } diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index e789d1524a7d..3686ac96bba0 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -453,7 +453,7 @@ void SvxIconChoiceCtrl_Impl::ResetVirtSize() aVirtOutputSize.Height() < aRealOutputSize.Height() ) { sal_uLong nGridCount = IcnGridMap_Impl::GetGridCount( - aRealOutputSize, (sal_uInt16)nGridDX, (sal_uInt16)nGridDY ); + aRealOutputSize, static_cast<sal_uInt16>(nGridDX), static_cast<sal_uInt16>(nGridDY) ); if( nGridCount < nCount ) { if( nWinBits & WB_ALIGN_TOP ) @@ -991,7 +991,7 @@ bool SvxIconChoiceCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) bool bMod2 = rKEvt.GetKeyCode().IsMod2(); sal_Unicode cChar = rKEvt.GetCharCode(); - sal_uLong nPos = (sal_uLong)-1; + sal_uLong nPos = sal_uLong(-1); if ( bMod2 && cChar && IsMnemonicChar( cChar, nPos ) ) { // shortcut is clicked @@ -2075,7 +2075,7 @@ bool SvxIconChoiceCtrl_Impl::HandleScrollCommand( const CommandEvent& rCmd ) } else { - nScrollDY = pData->GetNotchDelta() * (long)nScrollLines; + nScrollDY = pData->GetNotchDelta() * static_cast<long>(nScrollLines); nScrollDY *= GetScrollBarLineSize(); } } diff --git a/svtools/source/contnr/imivctl2.cxx b/svtools/source/contnr/imivctl2.cxx index 6521751e5a86..9d88972b64a0 100644 --- a/svtools/source/contnr/imivctl2.cxx +++ b/svtools/source/contnr/imivctl2.cxx @@ -75,8 +75,8 @@ void IcnCursor_Impl::ImplCreate() SvxIconChoiceCtrlEntry* pEntry = pView->aEntries[ nCur ]; // const Rectangle& rRect = pView->GetEntryBoundRect( pEntry ); tools::Rectangle rRect( pView->CalcBmpRect( pEntry ) ); - short nY = (short)( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); - short nX = (short)( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth ); + short nY = static_cast<short>( ((rRect.Top()+rRect.Bottom())/2) / nDeltaHeight ); + short nX = static_cast<short>( ((rRect.Left()+rRect.Right())/2) / nDeltaWidth ); // capture rounding errors if( nY >= nRows ) @@ -316,7 +316,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoLeftRight( SvxIconChoiceCtrlEntry* pCt sal_uInt16 nRowMax = nY; do { - SvxIconChoiceCtrlEntry* pEntry = SearchCol((sal_uInt16)nCurCol, nRowMin, nRowMax, true, false); + SvxIconChoiceCtrlEntry* pEntry = SearchCol(static_cast<sal_uInt16>(nCurCol), nRowMin, nRowMax, true, false); if( pEntry ) return pEntry; if( nRowMin ) @@ -332,7 +332,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS { if( pView->IsAutoArrange() && !(pView->nWinBits & WB_ALIGN_TOP) ) { - const long nPos = (long)pView->GetEntryListPos( pStart ); + const long nPos = static_cast<long>(pView->GetEntryListPos( pStart )); long nEntriesInView = (pView->aOutputSize.Height() / pView->nGridDY); nEntriesInView *= ((pView->aOutputSize.Width()+(pView->nGridDX/2)) / pView->nGridDX ); @@ -340,7 +340,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS if( bDown ) { nNewPos += nEntriesInView; - if( nNewPos >= (long)pView->aEntries.size() ) + if( nNewPos >= static_cast<long>(pView->aEntries.size()) ) nNewPos = pView->aEntries.size() - 1; } else @@ -350,7 +350,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoPageUpDown( SvxIconChoiceCtrlEntry* pS nNewPos = 0; } if( nPos != nNewPos ) - return pView->aEntries[ (size_t)nNewPos ]; + return pView->aEntries[ static_cast<size_t>(nNewPos) ]; return nullptr; } long nOpt = pView->GetEntryBoundRect( pStart ).Top(); @@ -435,7 +435,7 @@ SvxIconChoiceCtrlEntry* IcnCursor_Impl::GoUpDown( SvxIconChoiceCtrlEntry* pCtrlE sal_uInt16 nColMax = nX; do { - SvxIconChoiceCtrlEntry* pEntry = SearchRow((sal_uInt16)nCurRow, nColMin, nColMax, true, false); + SvxIconChoiceCtrlEntry* pEntry = SearchRow(static_cast<sal_uInt16>(nCurRow), nColMin, nColMax, true, false); if( pEntry ) return pEntry; if( nColMin ) @@ -459,8 +459,8 @@ void IcnCursor_Impl::SetDeltas() if( !nRows ) nRows = 1; - nDeltaWidth = (short)(rSize.Width() / nCols); - nDeltaHeight = (short)(rSize.Height() / nRows); + nDeltaWidth = static_cast<short>(rSize.Width() / nCols); + nDeltaHeight = static_cast<short>(rSize.Height() / nRows); if( !nDeltaHeight ) { nDeltaHeight = 1; @@ -567,8 +567,8 @@ void IcnGridMap_Impl::GetMinMapSize( sal_uInt16& rDX, sal_uInt16& rDY ) const if( !nDY ) nDY++; - rDX = (sal_uInt16)nDX; - rDY = (sal_uInt16)nDY; + rDX = static_cast<sal_uInt16>(nDX); + rDY = static_cast<sal_uInt16>(nDY); } GridId IcnGridMap_Impl::GetGrid( sal_uInt16 nGridX, sal_uInt16 nGridY ) @@ -598,8 +598,8 @@ GridId IcnGridMap_Impl::GetGrid( const Point& rDocPos ) { nY = _nGridRows - 1; } - GridId nId = GetGrid( (sal_uInt16)nX, (sal_uInt16)nY ); - DBG_ASSERT(nId <(sal_uLong)(_nGridCols*_nGridRows),"GetGrid failed"); + GridId nId = GetGrid( static_cast<sal_uInt16>(nX), static_cast<sal_uInt16>(nY) ); + DBG_ASSERT(nId <static_cast<sal_uLong>(_nGridCols*_nGridRows),"GetGrid failed"); return nId; } @@ -624,13 +624,13 @@ GridId IcnGridMap_Impl::GetUnoccupiedGrid() while( true ) { - const sal_uLong nCount = (sal_uInt16)(_nGridCols * _nGridRows); + const sal_uLong nCount = static_cast<sal_uInt16>(_nGridCols * _nGridRows); for( sal_uLong nCur = nStart; nCur < nCount; nCur++ ) { if( !_pGridMap[ nCur ] ) { _pGridMap[ nCur ] = true; - return (GridId)nCur; + return static_cast<GridId>(nCur); } } DBG_ASSERT(!bExpanded,"ExpandGrid failed"); @@ -669,7 +669,7 @@ sal_uLong IcnGridMap_Impl::GetGridCount( const Size& rSizePixel, sal_uInt16 nDX, if( ndx < 0 ) ndx *= -1; long ndy = (rSizePixel.Height() - TBOFFS_WINBORDER) / nDY; if( ndy < 0 ) ndy *= -1; - return (sal_uLong)(ndx * ndy); + return static_cast<sal_uLong>(ndx * ndy); } void IcnGridMap_Impl::OutputSizeChanged() @@ -703,13 +703,13 @@ void IcnGridMap_Impl::GetGridCoord( GridId nId, sal_uInt16& rGridX, sal_uInt16& Create(); if( _pView->nWinBits & WB_ALIGN_TOP ) { - rGridX = (sal_uInt16)(nId % _nGridCols); - rGridY = (sal_uInt16)(nId / _nGridCols); + rGridX = static_cast<sal_uInt16>(nId % _nGridCols); + rGridY = static_cast<sal_uInt16>(nId / _nGridCols); } else { - rGridX = (sal_uInt16)(nId / _nGridRows); - rGridY = (sal_uInt16)(nId % _nGridRows); + rGridX = static_cast<sal_uInt16>(nId / _nGridRows); + rGridY = static_cast<sal_uInt16>(nId % _nGridRows); } } diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx index 2e4e989054e5..bb78c42851d9 100644 --- a/svtools/source/contnr/simptabl.cxx +++ b/svtools/source/contnr/simptabl.cxx @@ -186,7 +186,7 @@ void SvSimpleTable::SetTabs() { sal_uInt16 nNewSize = static_cast< sal_uInt16 >( GetTab(i) ) - nPos; aHeaderBar->SetItemSize( i, nNewSize ); - nPos = (sal_uInt16)GetTab(i); + nPos = static_cast<sal_uInt16>(GetTab(i)); } aHeaderBar->SetItemSize( i, HEADERBAR_FULLSIZE ); // because no tab for last entry diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index 1b0e4ac4f509..61cb5e274436 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -78,8 +78,8 @@ SvImpLBox::SvImpLBox( SvTreeListBox* pLBView, SvTreeList* pLBTree, WinBits nWinS aHorSBar->SetPageSize( 24 ); // pixels aHorSBar->SetLineSize( 8 ); // pixels - nHorSBarHeight = (short)aHorSBar->GetSizePixel().Height(); - nVerSBarWidth = (short)aVerSBar->GetSizePixel().Width(); + nHorSBarHeight = static_cast<short>(aHorSBar->GetSizePixel().Height()); + nVerSBarWidth = static_cast<short>(aVerSBar->GetSizePixel().Width()); pStartEntry = nullptr; pCursor = nullptr; @@ -183,8 +183,8 @@ void SvImpLBox::UpdateContextBmpWidthVectorFromMovedEntry( SvTreeListEntry* pEnt DBG_ASSERT( pEntry, "Moved Entry is invalid!" ); SvLBoxContextBmp* pBmpItem = static_cast< SvLBoxContextBmp* >( pEntry->GetFirstItem(SvLBoxItemType::ContextBmp) ); - short nExpWidth = (short)pBmpItem->GetBitmap1().GetSizePixel().Width(); - short nColWidth = (short)pBmpItem->GetBitmap2().GetSizePixel().Width(); + short nExpWidth = static_cast<short>(pBmpItem->GetBitmap1().GetSizePixel().Width()); + short nColWidth = static_cast<short>(pBmpItem->GetBitmap2().GetSizePixel().Width()); short nMax = std::max(nExpWidth, nColWidth); UpdateContextBmpWidthVector( pEntry, nMax ); @@ -329,7 +329,7 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void ) if( nDelta == 1 ) CursorDown(); else - PageDown( (sal_uInt16) nDelta ); + PageDown( static_cast<sal_uInt16>(nDelta) ); } else { @@ -337,7 +337,7 @@ IMPL_LINK( SvImpLBox, ScrollUpDownHdl, ScrollBar *, pScrollBar, void ) if( nDelta == 1 ) CursorUp(); else - PageUp( (sal_uInt16) nDelta ); + PageUp( static_cast<sal_uInt16>(nDelta) ); } bInVScrollHdl = false; } @@ -484,7 +484,7 @@ void SvImpLBox::KeyUp( bool bPageUp ) aVerSBar->SetThumbPos( nThumbPos - nDelta ); if( bPageUp ) - PageUp( (short)nDelta ); + PageUp( static_cast<short>(nDelta) ); else CursorUp(); @@ -519,7 +519,7 @@ void SvImpLBox::KeyDown( bool bPageDown ) aVerSBar->SetThumbPos( nThumbPos+nDelta ); if( bPageDown ) - PageDown( (short)nDelta ); + PageDown( static_cast<short>(nDelta) ); else CursorDown(); @@ -763,7 +763,7 @@ SvTreeListEntry* SvImpLBox::GetClickedEntry( const Point& rPoint ) const if( pView->GetEntryCount() == 0 || !pStartEntry || !pView->GetEntryHeight()) return nullptr; - sal_uInt16 nClickedEntry = (sal_uInt16)(rPoint.Y() / pView->GetEntryHeight() ); + sal_uInt16 nClickedEntry = static_cast<sal_uInt16>(rPoint.Y() / pView->GetEntryHeight() ); sal_uInt16 nTemp = nClickedEntry; SvTreeListEntry* pEntry = pView->NextVisible(pStartEntry, nTemp); return pEntry; @@ -803,7 +803,7 @@ SvTreeListEntry* SvImpLBox::GetEntry( const Point& rPoint ) const || !pView->GetEntryHeight()) return nullptr; - sal_uInt16 nClickedEntry = (sal_uInt16)(rPoint.Y() / pView->GetEntryHeight() ); + sal_uInt16 nClickedEntry = static_cast<sal_uInt16>(rPoint.Y() / pView->GetEntryHeight() ); sal_uInt16 nTemp = nClickedEntry; SvTreeListEntry* pEntry = pView->NextVisible(pStartEntry, nTemp); if( nTemp != nClickedEntry ) @@ -975,7 +975,7 @@ void SvImpLBox::MakeVisible( SvTreeListEntry* pEntry, bool bMoveToTop ) pStartEntry = pEntry; ShowCursor( false ); FillView(); - aVerSBar->SetThumbPos( (long)(pView->GetVisiblePos( pStartEntry )) ); + aVerSBar->SetThumbPos( static_cast<long>(pView->GetVisiblePos( pStartEntry )) ); ShowCursor( true ); pView->Invalidate(); } @@ -1226,7 +1226,7 @@ void SvImpLBox::AdjustScrollBars( Size& rSize ) aSelEng.SetVisibleArea( aRect ); // vertical scrollbar - long nTemp = (long)nVisibleCount; + long nTemp = static_cast<long>(nVisibleCount); nTemp--; if( nTemp != aVerSBar->GetVisibleSize() ) { @@ -1312,8 +1312,8 @@ void SvImpLBox::FillView() { if( !pStartEntry ) { - sal_uInt16 nVisibleViewCount = (sal_uInt16)(pView->GetVisibleCount()); - sal_uInt16 nTempThumb = (sal_uInt16)aVerSBar->GetThumbPos(); + sal_uInt16 nVisibleViewCount = static_cast<sal_uInt16>(pView->GetVisibleCount()); + sal_uInt16 nTempThumb = static_cast<sal_uInt16>(aVerSBar->GetThumbPos()); if( nTempThumb >= nVisibleViewCount ) nTempThumb = nVisibleViewCount - 1; pStartEntry = pView->GetEntryAtVisPos(nTempThumb); @@ -1321,8 +1321,8 @@ void SvImpLBox::FillView() if( !pStartEntry ) return; - sal_uInt16 nLast = (sal_uInt16)(pView->GetVisiblePos(pView->LastVisible())); - sal_uInt16 nThumb = (sal_uInt16)(pView->GetVisiblePos( pStartEntry )); + sal_uInt16 nLast = static_cast<sal_uInt16>(pView->GetVisiblePos(pView->LastVisible())); + sal_uInt16 nThumb = static_cast<sal_uInt16>(pView->GetVisiblePos( pStartEntry )); sal_uLong nCurDispEntries = nLast-nThumb+1; if( nCurDispEntries >= nVisibleCount ) return; @@ -1357,7 +1357,7 @@ void SvImpLBox::ShowVerSBar() sal_uLong nVis = 0; if( !bVerBar ) nVis = pView->GetVisibleCount(); - if( bVerBar || (nVisibleCount && nVis > (sal_uLong)(nVisibleCount-1)) ) + if( bVerBar || (nVisibleCount && nVis > static_cast<sal_uLong>(nVisibleCount-1)) ) { if( !aVerSBar->IsVisible() ) { @@ -1515,7 +1515,7 @@ void SvImpLBox::EntryCollapsed( SvTreeListEntry* pEntry ) if( nNewThumbPos != nOldThumbPos ) { pStartEntry = pView->First(); - sal_uInt16 nDistance = (sal_uInt16)nNewThumbPos; + sal_uInt16 nDistance = static_cast<sal_uInt16>(nNewThumbPos); if( nDistance ) pStartEntry = pView->NextVisible(pStartEntry, nDistance); if( GetUpdateMode() ) @@ -1767,8 +1767,8 @@ void SvImpLBox::EntryMoved( SvTreeListEntry* pEntry ) pStartEntry = pView->First(); aVerSBar->SetRange( Range(0, pView->GetVisibleCount()-1)); - sal_uInt16 nFirstPos = (sal_uInt16)pTree->GetAbsPos( pStartEntry ); - sal_uInt16 nNewPos = (sal_uInt16)pTree->GetAbsPos( pEntry ); + sal_uInt16 nFirstPos = static_cast<sal_uInt16>(pTree->GetAbsPos( pStartEntry )); + sal_uInt16 nNewPos = static_cast<sal_uInt16>(pTree->GetAbsPos( pEntry )); FindMostRight(nullptr); if( nNewPos < nFirstPos ) // HACK! pStartEntry = pEntry; @@ -1823,8 +1823,8 @@ void SvImpLBox::EntryInserted( SvTreeListEntry* pEntry ) { // Check if the view is filled completely. If not, then adjust // pStartEntry and the Cursor (automatic scrolling). - sal_uInt16 nLast = (sal_uInt16)(pView->GetVisiblePos(pView->LastVisible())); - sal_uInt16 nThumb = (sal_uInt16)(pView->GetVisiblePos( pStartEntry )); + sal_uInt16 nLast = static_cast<sal_uInt16>(pView->GetVisiblePos(pView->LastVisible())); + sal_uInt16 nThumb = static_cast<sal_uInt16>(pView->GetVisiblePos( pStartEntry )); sal_uInt16 nCurDispEntries = nLast-nThumb+1; if( nCurDispEntries < nVisibleCount ) { @@ -2099,7 +2099,7 @@ bool SvImpLBox::KeyInput( const KeyEvent& rKEvt) bool bKeyUsed = true; - sal_uInt16 nDelta = (sal_uInt16)aVerSBar->GetPageSize(); + sal_uInt16 nDelta = static_cast<sal_uInt16>(aVerSBar->GetPageSize()); sal_uInt16 aCode = rKeyCode.GetCode(); bool bShift = rKeyCode.IsShift(); diff --git a/svtools/source/contnr/svtabbx.cxx b/svtools/source/contnr/svtabbx.cxx index e5559a96814e..8f871e41ea8a 100644 --- a/svtools/source/contnr/svtabbx.cxx +++ b/svtools/source/contnr/svtabbx.cxx @@ -120,7 +120,7 @@ void SvTabListBox::SetTabs(const long* pTabs, MapUnit eMapUnit) return; delete [] pTabList; - sal_uInt16 nCount = (sal_uInt16)(*pTabs); + sal_uInt16 nCount = static_cast<sal_uInt16>(*pTabs); pTabList = new SvLBoxTab[ nCount ]; nTabCount = nCount; @@ -965,7 +965,7 @@ OUString SvHeaderTabListBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBox } case ::svt::BBTYPE_COLUMNHEADERCELL: { - aRetText = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( (sal_uInt16)_nPos ) ); + aRetText = m_pImpl->m_pHeaderBar->GetItemText( m_pImpl->m_pHeaderBar->GetItemId( static_cast<sal_uInt16>(_nPos) ) ); break; } diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index ff6e9b8adf6a..e227891dd572 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -770,7 +770,7 @@ SvTreeListEntry* SvTreeList::PrevVisible( const SvListView* pView, SvTreeListEnt // example: 0,1,2,3,4,5,6,7,8,9 nVisPos=8 nDelta=20 // nNewDelta = nNewVisPos if ( nDelta > nVisPos ) - nDelta = (sal_uInt16)nVisPos; + nDelta = static_cast<sal_uInt16>(nVisPos); sal_uInt16 nDeltaTmp = nDelta; while( nDeltaTmp ) { diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index c3da96e85bf5..39ba9d6c611f 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -753,7 +753,7 @@ void SvTreeListBox::FillEntryPath( SvTreeListEntry* pEntry, ::std::deque< sal_In DBG_ASSERT( pEntry, "invalid entry" ); if ( pEntry == pTemp ) { - _rPath.push_front( (sal_Int32)i ); + _rPath.push_front( static_cast<sal_Int32>(i) ); break; } } @@ -1709,7 +1709,7 @@ void SvTreeListBox::SetExpandedEntryBmp( SvTreeListEntry* pEntry, const Image& a GetModel()->InvalidateEntry( pEntry ); SetEntryHeight( pEntry ); Size aSize = aBmp.GetSizePixel(); - short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, (short)aSize.Width() ); + short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, static_cast<short>(aSize.Width()) ); if( nWidth > nContextBmpWidthMax ) { nContextBmpWidthMax = nWidth; @@ -1727,7 +1727,7 @@ void SvTreeListBox::SetCollapsedEntryBmp(SvTreeListEntry* pEntry,const Image& aB GetModel()->InvalidateEntry( pEntry ); SetEntryHeight( pEntry ); Size aSize = aBmp.GetSizePixel(); - short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, (short)aSize.Width() ); + short nWidth = pImpl->UpdateContextBmpWidthVector( pEntry, static_cast<short>(aSize.Width()) ); if( nWidth > nContextBmpWidthMax ) { nContextBmpWidthMax = nWidth; @@ -1753,13 +1753,13 @@ void SvTreeListBox::ImpEntryInserted( SvTreeListEntry* pEntry ) Size aSize = GetCollapsedEntryBmp( pEntry ).GetSizePixel(); if( aSize.Width() > nContextBmpWidthMax ) { - nContextBmpWidthMax = (short)aSize.Width(); + nContextBmpWidthMax = static_cast<short>(aSize.Width()); nTreeFlags |= SvTreeFlags::RECALCTABS; } aSize = GetExpandedEntryBmp( pEntry ).GetSizePixel(); if( aSize.Width() > nContextBmpWidthMax ) { - nContextBmpWidthMax = (short)aSize.Width(); + nContextBmpWidthMax = static_cast<short>(aSize.Width()); nTreeFlags |= SvTreeFlags::RECALCTABS; } } @@ -1897,7 +1897,7 @@ void SvTreeListBox::SetDefaultExpandedEntryBmp( const Image& aBmp ) { Size aSize = aBmp.GetSizePixel(); if( aSize.Width() > nContextBmpWidthMax ) - nContextBmpWidthMax = (short)aSize.Width(); + nContextBmpWidthMax = static_cast<short>(aSize.Width()); SetTabs(); pImpl->SetDefaultEntryExpBmp( aBmp ); @@ -1907,7 +1907,7 @@ void SvTreeListBox::SetDefaultCollapsedEntryBmp( const Image& aBmp ) { Size aSize = aBmp.GetSizePixel(); if( aSize.Width() > nContextBmpWidthMax ) - nContextBmpWidthMax = (short)aSize.Width(); + nContextBmpWidthMax = static_cast<short>(aSize.Width()); SetTabs(); pImpl->SetDefaultEntryColBmp( aBmp ); @@ -2066,14 +2066,14 @@ void SvTreeListBox::ScrollOutputArea( short nDeltaEntries ) long nVis = pImpl->aVerSBar->GetVisibleSize(); long nTemp = nThumb + nVis; if( nDeltaEntries > (nMax - nTemp) ) - nDeltaEntries = (short)(nMax - nTemp); - pImpl->PageDown( (sal_uInt16)nDeltaEntries ); + nDeltaEntries = static_cast<short>(nMax - nTemp); + pImpl->PageDown( static_cast<sal_uInt16>(nDeltaEntries) ); } else { if( nDeltaEntries > nThumb ) - nDeltaEntries = (short)nThumb; - pImpl->PageUp( (sal_uInt16)nDeltaEntries ); + nDeltaEntries = static_cast<short>(nThumb); + pImpl->PageUp( static_cast<sal_uInt16>(nDeltaEntries) ); } pImpl->SyncVerThumb(); NotifyEndScroll(); @@ -2104,7 +2104,7 @@ void SvTreeListBox::SetEntryHeight( SvTreeListEntry const * pEntry ) SvViewDataEntry* pViewData = GetViewDataEntry( pEntry ); while( nCur < nCount ) { - short nHeight = (short)(SvLBoxItem::GetSize( pViewData, nCur ).Height()); + short nHeight = static_cast<short>(SvLBoxItem::GetSize( pViewData, nCur ).Height()); if( nHeight > nHeightMax ) nHeightMax = nHeight; nCur++; @@ -2142,7 +2142,7 @@ void SvTreeListBox::AdjustEntryHeight( const Image& rBmp ) const Size aSize( rBmp.GetSizePixel() ); if( aSize.Height() > nEntryHeight ) { - nEntryHeight = (short)aSize.Height() + nEntryHeightOffs; + nEntryHeight = static_cast<short>(aSize.Height()) + nEntryHeightOffs; pImpl->SetEntryHeight(); } } @@ -2152,7 +2152,7 @@ void SvTreeListBox::AdjustEntryHeight() Size aSize( GetTextWidth(OUString('X')), GetTextHeight() ); if( aSize.Height() > nEntryHeight ) { - nEntryHeight = (short)aSize.Height() + nEntryHeightOffs; + nEntryHeight = static_cast<short>(aSize.Height()) + nEntryHeightOffs; pImpl->SetEntryHeight(); } } @@ -2484,7 +2484,7 @@ void SvTreeListBox::EditItemText(SvTreeListEntry* pEntry, SvLBoxString* pItem, c long nOutputWidth = pImpl->GetOutputSize().Width(); Size aSize( nOutputWidth - aPos.X(), aItemSize.Height() ); sal_uInt16 nPos = std::find( aTabs.begin(), aTabs.end(), pTab ) - aTabs.begin(); - if( nPos+1 < (sal_uInt16)aTabs.size() ) + if( nPos+1 < static_cast<sal_uInt16>(aTabs.size()) ) { SvLBoxTab* pRightTab = aTabs[ nPos + 1 ]; long nRight = GetTabPos( pEntry, pRightTab ); @@ -3016,9 +3016,9 @@ tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLin pLastTab = aTabs[ nLastTab ]; aSize.Width() = pLastTab ? pLastTab->GetPos() : 0x0fffffff; - nFocusWidth = (short)aSize.Width(); + nFocusWidth = static_cast<short>(aSize.Width()); if( pTab ) - nFocusWidth = nFocusWidth - (short)nTabPos; //pTab->GetPos(); + nFocusWidth = nFocusWidth - static_cast<short>(nTabPos); //pTab->GetPos(); } else { @@ -3043,7 +3043,7 @@ tools::Rectangle SvTreeListBox::GetFocusRect( SvTreeListEntry* pEntry, long nLin if( aRect.Right() >= nRealWidth ) { aRect.Right() = nRealWidth-1; - nFocusWidth = (short)aRect.GetWidth(); + nFocusWidth = static_cast<short>(aRect.GetWidth()); } return aRect; } @@ -3056,8 +3056,8 @@ sal_IntPtr SvTreeListBox::GetTabPos( SvTreeListEntry* pEntry, SvLBoxTab* pTab) if( pTab->IsDynamic() ) { sal_uInt16 nDepth = pModel->GetDepth( pEntry ); - nDepth = nDepth * (sal_uInt16)nIndent; - nPos += (sal_IntPtr)nDepth; + nDepth = nDepth * static_cast<sal_uInt16>(nIndent); + nPos += static_cast<sal_IntPtr>(nDepth); } return nPos; } @@ -3371,7 +3371,7 @@ SvLBoxTab* SvTreeListBox::GetFirstTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rPo void SvTreeListBox::GetLastTab( SvLBoxTabFlags nFlagMask, sal_uInt16& rTabPos ) { - sal_uInt16 nPos = (sal_uInt16)aTabs.size(); + sal_uInt16 nPos = static_cast<sal_uInt16>(aTabs.size()); while( nPos ) { --nPos; @@ -3645,7 +3645,7 @@ void SvTreeListBox::FillAccessibleEntryStateSet( SvTreeListEntry* pEntry, ::utl: { rStateSet.AddState( AccessibleStateType::EXPANDABLE ); if ( IsExpanded( pEntry ) ) - rStateSet.AddState( (sal_Int16)AccessibleStateType::EXPANDED ); + rStateSet.AddState( sal_Int16(AccessibleStateType::EXPANDED) ); } if ( GetCheckButtonState( pEntry ) == SvButtonState::Checked ) diff --git a/svtools/source/contnr/treelistentry.cxx b/svtools/source/contnr/treelistentry.cxx index aab1f37597c2..b96a2c8e479e 100644 --- a/svtools/source/contnr/treelistentry.cxx +++ b/svtools/source/contnr/treelistentry.cxx @@ -200,12 +200,12 @@ void SvTreeListEntry::SetUserData( void* pPtr ) bool SvTreeListEntry::HasChildrenOnDemand() const { - return (bool)(nEntryFlags & SvTLEntryFlags::CHILDREN_ON_DEMAND); + return static_cast<bool>(nEntryFlags & SvTLEntryFlags::CHILDREN_ON_DEMAND); } bool SvTreeListEntry::HasInUseEmphasis() const { - return (bool)(nEntryFlags & SvTLEntryFlags::IN_USE); + return static_cast<bool>(nEntryFlags & SvTLEntryFlags::IN_USE); } diff --git a/svtools/source/control/autocmpledit.cxx b/svtools/source/control/autocmpledit.cxx index 262c7341d81c..d008ee41bc69 100644 --- a/svtools/source/control/autocmpledit.cxx +++ b/svtools/source/control/autocmpledit.cxx @@ -39,7 +39,7 @@ IMPL_LINK_NOARG(AutocompleteEdit, AutoCompleteHdl_Impl, Edit&, void) if( aSelection.Max() != aCurText.getLength() ) return; - sal_uInt16 nLen = ( sal_uInt16 )aSelection.Min(); + sal_uInt16 nLen = static_cast<sal_uInt16>(aSelection.Min()); aCurText = aCurText.copy( 0, nLen ); if( aCurText.isEmpty() ) return; @@ -87,7 +87,7 @@ bool AutocompleteEdit::PreNotify( NotifyEvent& rNEvt ) if( ( aCode == KEY_UP || aCode == KEY_DOWN ) && !rKey.IsMod2() ) { Selection aSelection( GetSelection() ); - sal_uInt16 nLen = ( sal_uInt16 )aSelection.Min(); + sal_uInt16 nLen = static_cast<sal_uInt16>(aSelection.Min()); if( m_aMatching.size() && ( ( aCode == KEY_DOWN && m_nCurrent + 1 < m_aMatching.size() ) diff --git a/svtools/source/control/breadcrumb.cxx b/svtools/source/control/breadcrumb.cxx index 3bb9fa390263..cbaa8ccf655c 100644 --- a/svtools/source/control/breadcrumb.cxx +++ b/svtools/source/control/breadcrumb.cxx @@ -135,7 +135,7 @@ void Breadcrumb::SetURL( const OUString& rURL ) // fill the other fields - for( unsigned int i = 1; i < (unsigned int)nSegments + 1; i++ ) + for( unsigned int i = 1; i < static_cast<unsigned int>(nSegments) + 1; i++ ) { if( i >= m_aLinks.size() ) appendField(); @@ -210,7 +210,7 @@ void Breadcrumb::SetURL( const OUString& rURL ) } } - if( nSegments + i == (int)m_aLinks.size() ) + if( nSegments + i == static_cast<int>(m_aLinks.size()) ) bRight = false; if( i != 0 && bRight ) diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index e4bfa6e58cf4..b558629551c8 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -48,10 +48,10 @@ #define SPIN_OFFX 4 #define SPIN_OFFY TITLE_BORDERY -#define CALENDAR_HITTEST_DAY ((sal_uInt16)0x0001) -#define CALENDAR_HITTEST_MONTHTITLE ((sal_uInt16)0x0004) -#define CALENDAR_HITTEST_PREV ((sal_uInt16)0x0008) -#define CALENDAR_HITTEST_NEXT ((sal_uInt16)0x0010) +#define CALENDAR_HITTEST_DAY (sal_uInt16(0x0001)) +#define CALENDAR_HITTEST_MONTHTITLE (sal_uInt16(0x0004)) +#define CALENDAR_HITTEST_PREV (sal_uInt16(0x0008)) +#define CALENDAR_HITTEST_NEXT (sal_uInt16(0x0010)) #define MENU_YEAR_COUNT 3 @@ -292,12 +292,12 @@ void Calendar::ImplFormat() sal_uInt16 nWeekDay; Date aTempDate = GetFirstMonth(); maFirstDate = aTempDate; - nWeekDay = (sal_uInt16)aTempDate.GetDayOfWeek(); - nWeekDay = (nWeekDay+(7-(sal_uInt16)eStartDay)) % 7; + nWeekDay = static_cast<sal_uInt16>(aTempDate.GetDayOfWeek()); + nWeekDay = (nWeekDay+(7-static_cast<sal_uInt16>(eStartDay))) % 7; maFirstDate.AddDays( -nWeekDay ); mnDayCount = nWeekDay; sal_uInt16 nDaysInMonth; - sal_uInt16 nMonthCount = (sal_uInt16)(mnMonthPerLine*mnLines); + sal_uInt16 nMonthCount = static_cast<sal_uInt16>(mnMonthPerLine*mnLines); for ( sal_uInt16 i = 0; i < nMonthCount; i++ ) { nDaysInMonth = aTempDate.GetDaysInMonth(); @@ -308,8 +308,8 @@ void Calendar::ImplFormat() --aTempDate2; nDaysInMonth = aTempDate2.GetDaysInMonth(); aTempDate2.AddDays( -(nDaysInMonth-1) ); - nWeekDay = (sal_uInt16)aTempDate2.GetDayOfWeek(); - nWeekDay = (nWeekDay+(7-(sal_uInt16)eStartDay)) % 7; + nWeekDay = static_cast<sal_uInt16>(aTempDate2.GetDayOfWeek()); + nWeekDay = (nWeekDay+(7-static_cast<sal_uInt16>(eStartDay))) % 7; mnDayCount += 42-nDaysInMonth-nWeekDay; // determine colours @@ -391,8 +391,8 @@ sal_uInt16 Calendar::ImplHitTest( const Point& rPos, Date& rDate ) const long nDayY = nY+mnDaysOffY; if ( rPos.Y() < nDayY ) return 0; - sal_Int32 nDayIndex = (sal_Int32)rDate.GetDayOfWeek(); - nDayIndex = (nDayIndex+(7-(sal_Int32)eStartDay)) % 7; + sal_Int32 nDayIndex = static_cast<sal_Int32>(rDate.GetDayOfWeek()); + nDayIndex = (nDayIndex+(7-static_cast<sal_Int32>(eStartDay))) % 7; if ( (i == 0) && (j == 0) ) { Date aTempDate = rDate; @@ -433,8 +433,8 @@ sal_uInt16 Calendar::ImplHitTest( const Point& rPos, Date& rDate ) const } if ( (i == mnLines-1) && (j == mnMonthPerLine-1) ) { - sal_uInt16 nWeekDay = (sal_uInt16)rDate.GetDayOfWeek(); - nWeekDay = (nWeekDay+(7-(sal_uInt16)eStartDay)) % 7; + sal_uInt16 nWeekDay = static_cast<sal_uInt16>(rDate.GetDayOfWeek()); + nWeekDay = (nWeekDay+(7-static_cast<sal_uInt16>(eStartDay))) % 7; sal_Int32 nDayCount = 42-nDaysInMonth-nWeekDay; Date aTempDate = rDate; aTempDate.AddDays( nDaysInMonth ); @@ -745,8 +745,8 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) sal_uInt16 nDaysInMonth = aDate.GetDaysInMonth(); nDayX = nX + mnDaysOffX; nDayY = nY + mnDaysOffY; - sal_uInt16 nDayIndex = (sal_uInt16) aDate.GetDayOfWeek(); - nDayIndex = (nDayIndex + (7 - (sal_uInt16)eStartDay)) % 7; + sal_uInt16 nDayIndex = static_cast<sal_uInt16>(aDate.GetDayOfWeek()); + nDayIndex = (nDayIndex + (7 - static_cast<sal_uInt16>(eStartDay))) % 7; if (i == 0 && j == 0) { Date aTempDate = aDate; @@ -756,14 +756,14 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) nDeltaX = nDayX + (nDay * mnDayWidth); ImplDrawDate(rRenderContext, nDeltaX, nDayY, nDay + aTempDate.GetDay(), aTempDate.GetMonth(), aTempDate.GetYear(), - (DayOfWeek)((nDay + (sal_uInt16)eStartDay) % 7), true, nToday); + (DayOfWeek)((nDay + static_cast<sal_uInt16>(eStartDay)) % 7), true, nToday); } } for (nDay = 1; nDay <= nDaysInMonth; nDay++) { nDeltaX = nDayX + (nDayIndex * mnDayWidth); ImplDrawDate(rRenderContext, nDeltaX, nDayY, nDay, nMonth, nYear, - (DayOfWeek)((nDayIndex + (sal_uInt16)eStartDay) % 7), + (DayOfWeek)((nDayIndex + static_cast<sal_uInt16>(eStartDay)) % 7), false, nToday); if (nDayIndex == 6) { @@ -775,8 +775,8 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) } if ((i == mnLines - 1) && (j == mnMonthPerLine - 1)) { - sal_uInt16 nWeekDay = (sal_uInt16)aDate.GetDayOfWeek(); - nWeekDay = (nWeekDay + (7 - (sal_uInt16)eStartDay)) % 7; + sal_uInt16 nWeekDay = static_cast<sal_uInt16>(aDate.GetDayOfWeek()); + nWeekDay = (nWeekDay + (7 - static_cast<sal_uInt16>(eStartDay))) % 7; sal_uInt16 nDayCount = 42 - nDaysInMonth - nWeekDay; Date aTempDate = aDate; aTempDate.AddDays( nDaysInMonth ); @@ -785,7 +785,7 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) nDeltaX = nDayX + (nDayIndex * mnDayWidth); ImplDrawDate(rRenderContext, nDeltaX, nDayY, nDay, aTempDate.GetMonth(), aTempDate.GetYear(), - (DayOfWeek)((nDayIndex + (sal_uInt16)eStartDay) % 7), + (DayOfWeek)((nDayIndex + static_cast<sal_uInt16>(eStartDay)) % 7), true, nToday); if (nDayIndex == 6) { @@ -1238,7 +1238,7 @@ void Calendar::RequestHelp( const HelpEvent& rHEvt ) if ( rHEvt.GetMode() & HelpEventMode::QUICK ) { maCalendarWrapper.setGregorianDateTime( aDate); - sal_uInt16 nWeek = (sal_uInt16) maCalendarWrapper.getValue( i18n::CalendarFieldIndex::WEEK_OF_YEAR); + sal_uInt16 nWeek = static_cast<sal_uInt16>(maCalendarWrapper.getValue( i18n::CalendarFieldIndex::WEEK_OF_YEAR)); sal_uInt16 nMonth = aDate.GetMonth(); OUString aStr = maDayText + ": " @@ -1437,7 +1437,7 @@ sal_uInt16 Calendar::GetMonthCount() const if ( mbFormat ) return 1; else - return (sal_uInt16)(mnMonthPerLine*mnLines); + return static_cast<sal_uInt16>(mnMonthPerLine*mnLines); } bool Calendar::GetDate( const Point& rPos, Date& rDate ) const @@ -1480,7 +1480,7 @@ tools::Rectangle Calendar::GetDateRect( const Date& rDate ) const Date aLastDate = GetLastMonth(); if ( rDate > aLastDate ) { - sal_Int32 nWeekDay = (sal_Int32)aLastDate.GetDayOfWeek(); + sal_Int32 nWeekDay = static_cast<sal_Int32>(aLastDate.GetDayOfWeek()); nWeekDay = (nWeekDay+(7-ImplGetWeekStart())) % 7; aLastDate.AddDays( -nWeekDay ); aRect = GetDateRect( aLastDate ); @@ -1521,8 +1521,8 @@ tools::Rectangle Calendar::GetDateRect( const Date& rDate ) const { long nDayX = nX+mnDaysOffX; long nDayY = nY+mnDaysOffY; - nDayIndex = (sal_uInt16)aDate.GetDayOfWeek(); - nDayIndex = (nDayIndex+(7-(sal_uInt16)ImplGetWeekStart())) % 7; + nDayIndex = static_cast<sal_uInt16>(aDate.GetDayOfWeek()); + nDayIndex = (nDayIndex+(7-static_cast<sal_uInt16>(ImplGetWeekStart()))) % 7; for ( sal_uInt16 nDay = 1; nDay <= nDaysInMonth; nDay++ ) { if ( nDay == rDate.GetDay() ) diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 16c6fdcb7310..de28bb513ae5 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -561,7 +561,7 @@ sal_Int32 LineListBox::GetEntryPos( SvxBorderLineStyle nStyle ) const size_t nPos = i; if (!m_sNone.isEmpty()) nPos ++; - return (sal_Int32)nPos; + return static_cast<sal_Int32>(nPos); } } return LISTBOX_ENTRY_NOTFOUND; diff --git a/svtools/source/control/headbar.cxx b/svtools/source/control/headbar.cxx index 42c0f9cd092c..db32b5009191 100644 --- a/svtools/source/control/headbar.cxx +++ b/svtools/source/control/headbar.cxx @@ -51,8 +51,8 @@ public: #define HEADERBAR_DRAGOUTOFF 15 -#define HEAD_HITTEST_ITEM ((sal_uInt16)0x0001) -#define HEAD_HITTEST_DIVIDER ((sal_uInt16)0x0002) +#define HEAD_HITTEST_ITEM (sal_uInt16(0x0001)) +#define HEAD_HITTEST_DIVIDER (sal_uInt16(0x0002)) void HeaderBar::ImplInit( WinBits nWinStyle ) { @@ -154,7 +154,7 @@ tools::Rectangle HeaderBar::ImplGetItemRect( sal_uInt16 nPos ) const sal_uInt16 HeaderBar::ImplHitTest( const Point& rPos, long& nMouseOff, sal_uInt16& nPos ) const { - size_t nCount = (sal_uInt16)mvItemList.size(); + size_t nCount = static_cast<sal_uInt16>(mvItemList.size()); bool bLastFixed = true; long nX = -mnOffset; @@ -1169,7 +1169,7 @@ void HeaderBar::SetOffset( long nNewOffset ) sal_uInt16 HeaderBar::GetItemCount() const { - return (sal_uInt16)mvItemList.size(); + return static_cast<sal_uInt16>(mvItemList.size()); } sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const @@ -1177,7 +1177,7 @@ sal_uInt16 HeaderBar::GetItemPos( sal_uInt16 nItemId ) const for ( size_t i = 0, n = mvItemList.size(); i < n; ++i ) { auto& pItem = mvItemList[ i ]; if ( pItem->mnId == nItemId ) - return (sal_uInt16)i; + return static_cast<sal_uInt16>(i); } return HEADERBAR_ITEM_NOTFOUND; } diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 5ddcf6f05806..b922c4905104 100644 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -415,7 +415,7 @@ void SvtMatchContext_Impl::ReadFolder( const OUString& rURL, sal_Unicode aDelimiter = '/'; if ( bSmart ) // when parsing is done "smart", the delimiter must be "guessed" - aObj.getFSysPath( (FSysStyle)(FSysStyle::Detect & ~FSysStyle::Vos), &aDelimiter ); + aObj.getFSysPath( static_cast<FSysStyle>(FSysStyle::Detect & ~FSysStyle::Vos), &aDelimiter ); if ( bIsFolder ) aObj.setFinalSlash(); @@ -791,7 +791,7 @@ void SvtURLBox::TryAutoComplete() Selection aSelection( GetSelection() ); if( aSelection.Max() != aCurText.getLength() ) return; - sal_uInt16 nLen = (sal_uInt16)aSelection.Min(); + sal_uInt16 nLen = static_cast<sal_uInt16>(aSelection.Min()); aCurText = aCurText.copy( 0, nLen ); if( !aCurText.isEmpty() && bIsAutoCompleteEnabled ) { @@ -1062,7 +1062,7 @@ bool SvtURLBox::PreNotify( NotifyEvent& rNEvt ) else if( ( aCode == KEY_UP || aCode == KEY_DOWN ) && !rKey.IsMod2() ) { Selection aSelection( GetSelection() ); - sal_uInt16 nLen = (sal_uInt16)aSelection.Min(); + sal_uInt16 nLen = static_cast<sal_uInt16>(aSelection.Min()); GetSubEdit()->KeyInput( rEvent ); SetSelection( Selection( nLen, GetText().getLength() ) ); return true; diff --git a/svtools/source/control/roadmap.cxx b/svtools/source/control/roadmap.cxx index 539f4ec2e46e..e53bf7b70799 100644 --- a/svtools/source/control/roadmap.cxx +++ b/svtools/source/control/roadmap.cxx @@ -328,7 +328,7 @@ void ORoadmap::SetRoadmapComplete(bool _bComplete) void ORoadmap::UpdatefollowingHyperLabels(ItemIndex _nIndex) { const HL_Vector& rItems = m_pImpl->getHyperLabels(); - if ( _nIndex < (ItemIndex)rItems.size() ) + if ( _nIndex < static_cast<ItemIndex>(rItems.size()) ) { for ( HL_Vector::const_iterator i = rItems.begin() + _nIndex; i != rItems.end(); @@ -450,7 +450,7 @@ const RoadmapItem* ORoadmap::GetByID(ItemId _nID) const RoadmapItem* ORoadmap::GetByIndex(ItemIndex _nItemIndex) { const HL_Vector& rItems = m_pImpl->getHyperLabels(); - if ( ( _nItemIndex > -1 ) && ( _nItemIndex < (ItemIndex)rItems.size() ) ) + if ( ( _nItemIndex > -1 ) && ( _nItemIndex < static_cast<ItemIndex>(rItems.size()) ) ) { return rItems.at( _nItemIndex ); } diff --git a/svtools/source/control/scrwin.cxx b/svtools/source/control/scrwin.cxx index cf6b83fb624a..e105f0b5fb1a 100644 --- a/svtools/source/control/scrwin.cxx +++ b/svtools/source/control/scrwin.cxx @@ -336,8 +336,8 @@ void ScrollableWindow::Scroll( long nDeltaX, long nDeltaY, ScrollFlags ) Update(); // does the new area overlap the old one? - if ( std::abs( (int)aDeltaPix.Height() ) < aOutPixSz.Height() || - std::abs( (int)aDeltaPix.Width() ) < aOutPixSz.Width() ) + if ( std::abs( static_cast<int>(aDeltaPix.Height()) ) < aOutPixSz.Height() || + std::abs( static_cast<int>(aDeltaPix.Width()) ) < aOutPixSz.Width() ) { // scroll the overlapping area SetMapMode( aMap ); diff --git a/svtools/source/control/toolbarmenu.cxx b/svtools/source/control/toolbarmenu.cxx index 92cb4b88e83f..eb0c3dcc9b03 100644 --- a/svtools/source/control/toolbarmenu.cxx +++ b/svtools/source/control/toolbarmenu.cxx @@ -387,7 +387,7 @@ void ToolbarMenu_Impl::notifyHighlightedEntry() ToolbarMenuEntry* ToolbarMenu_Impl::implGetEntry( int nEntry ) const { - if( (nEntry < 0) || (nEntry >= (int)maEntryVector.size() ) ) + if( (nEntry < 0) || (nEntry >= static_cast<int>(maEntryVector.size()) ) ) return nullptr; return maEntryVector[nEntry].get(); @@ -1005,7 +1005,7 @@ ToolbarMenuEntry* ToolbarMenu::implCursorUpDown( bool bUp, bool bHomeEnd ) } else { - if( n < ((int)mpImpl->maEntryVector.size()-1) ) + if( n < (static_cast<int>(mpImpl->maEntryVector.size())-1) ) n++; else if( mpImpl->mnHighlightedEntry == -1 ) diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index e57152021cbb..76a4dc89465e 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -666,7 +666,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) mxScrollBar->SetPosSizePixel(aPos, aSize); mxScrollBar->SetRangeMax(mnLines); mxScrollBar->SetVisibleSize(mnVisLines); - mxScrollBar->SetThumbPos((long)mnFirstLine); + mxScrollBar->SetThumbPos(static_cast<long>(mnFirstLine)); long nPageSize = mnVisLines; if (nPageSize < 1) nPageSize = 1; @@ -1065,7 +1065,7 @@ bool ValueSet::ImplHasAccessibleListeners() IMPL_LINK( ValueSet,ImplScrollHdl, ScrollBar*, pScrollBar, void ) { - sal_uInt16 nNewFirstLine = (sal_uInt16)pScrollBar->GetThumbPos(); + sal_uInt16 nNewFirstLine = static_cast<sal_uInt16>(pScrollBar->GetThumbPos()); if ( nNewFirstLine != mnFirstLine ) { mnFirstLine = nNewFirstLine; @@ -1794,15 +1794,15 @@ void ValueSet::SelectItem( sal_uInt16 nItemId ) // if necessary scroll to the visible area if (mbScroll && nItemId && mnCols) { - sal_uInt16 nNewLine = (sal_uInt16)(nItemPos / mnCols); + sal_uInt16 nNewLine = static_cast<sal_uInt16>(nItemPos / mnCols); if ( nNewLine < mnFirstLine ) { mnFirstLine = nNewLine; bNewLine = true; } - else if ( nNewLine > (sal_uInt16)(mnFirstLine+mnVisLines-1) ) + else if ( nNewLine > static_cast<sal_uInt16>(mnFirstLine+mnVisLines-1) ) { - mnFirstLine = (sal_uInt16)(nNewLine-mnVisLines+1); + mnFirstLine = static_cast<sal_uInt16>(nNewLine-mnVisLines+1); bNewLine = true; } } diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index fd1c4a548285..b1df44bdf245 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -617,7 +617,7 @@ void AssignmentPersistentData::ImplCommit() // the logical names OUString sLogicalFieldNames(STR_LOGICAL_FIELD_NAMES); sal_Int32 nAdjustedTokenCount = comphelper::string::getTokenCount(sLogicalFieldNames, ';') + (m_pImpl->bOddFieldNumber ? 1 : 0); - DBG_ASSERT(nAdjustedTokenCount == (sal_Int32)m_pImpl->aFieldLabels.size(), + DBG_ASSERT(nAdjustedTokenCount == static_cast<sal_Int32>(m_pImpl->aFieldLabels.size()), "AddressBookSourceDialog::AddressBookSourceDialog: inconsistence between logical and UI field names!"); m_pImpl->aLogicalFieldNames.reserve(nAdjustedTokenCount); for (sal_Int32 i = 0; i<nAdjustedTokenCount; ++i) @@ -1049,8 +1049,8 @@ void AssignmentPersistentData::ImplCommit() // the new row for the focus sal_Int32 nNewFocusRow = nOldFocusRow + nDelta; // normalize - nNewFocusRow = std::min(nNewFocusRow, (sal_Int32)(FIELD_PAIRS_VISIBLE - 1), ::std::less< sal_Int32 >()); - nNewFocusRow = std::max(nNewFocusRow, (sal_Int32)0, ::std::less< sal_Int32 >()); + nNewFocusRow = std::min(nNewFocusRow, sal_Int32(FIELD_PAIRS_VISIBLE - 1), ::std::less< sal_Int32 >()); + nNewFocusRow = std::max(nNewFocusRow, sal_Int32(0), ::std::less< sal_Int32 >()); // set the new focus (in the same column) m_pImpl->pFields[nNewFocusRow * 2 + nOldFocusColumn]->GrabFocus(); } diff --git a/svtools/source/dialogs/colrdlg.cxx b/svtools/source/dialogs/colrdlg.cxx index a0d4af23f78f..941f9bbaa779 100644 --- a/svtools/source/dialogs/colrdlg.cxx +++ b/svtools/source/dialogs/colrdlg.cxx @@ -74,7 +74,7 @@ short SvColorDialog::Execute() Sequence< PropertyValue > props( 2 ); props[0].Name = sColor; - props[0].Value <<= (sal_Int32) maColor.GetColor(); + props[0].Value <<= static_cast<sal_Int32>(maColor.GetColor()); props[1].Name = "Mode"; props[1].Value <<= static_cast<sal_Int16>(meMode); diff --git a/svtools/source/dialogs/roadmapwizard.cxx b/svtools/source/dialogs/roadmapwizard.cxx index 97c808a53f64..dae6e40897bb 100644 --- a/svtools/source/dialogs/roadmapwizard.cxx +++ b/svtools/source/dialogs/roadmapwizard.cxx @@ -205,12 +205,12 @@ namespace svt if ( m_pImpl->nActivePath != -1 ) nCurrentStatePathIndex = m_pImpl->getStateIndexInPath( getCurrentState(), m_pImpl->nActivePath ); - DBG_ASSERT( (sal_Int32)aNewPathPos->second.size() > nCurrentStatePathIndex, + DBG_ASSERT( static_cast<sal_Int32>(aNewPathPos->second.size()) > nCurrentStatePathIndex, "RoadmapWizard::activate: you cannot activate a path which has less states than we've already advanced!" ); // If this asserts, this for instance means that we are already in state number, say, 5 // of our current path, and the caller tries to activate a path which has less than 5 // states - if ( (sal_Int32)aNewPathPos->second.size() <= nCurrentStatePathIndex ) + if ( static_cast<sal_Int32>(aNewPathPos->second.size()) <= nCurrentStatePathIndex ) return; // assert that the current and the new path are equal, up to nCurrentStatePathIndex @@ -243,7 +243,7 @@ namespace svt return; // determine up to which index (in the new path) we have to display the items - RoadmapTypes::ItemIndex nUpperStepBoundary = (RoadmapTypes::ItemIndex)rActivePath.size(); + RoadmapTypes::ItemIndex nUpperStepBoundary = static_cast<RoadmapTypes::ItemIndex>(rActivePath.size()); bool bIncompletePath = false; if ( !m_pImpl->bActivePathIsDefinite ) { @@ -355,14 +355,14 @@ namespace svt sal_Int32 nNextStateIndex = nCurrentStatePathIndex + 1; - while ( ( nNextStateIndex < (sal_Int32)aActivePathPos->second.size() ) + while ( ( nNextStateIndex < static_cast<sal_Int32>(aActivePathPos->second.size()) ) && ( m_pImpl->aDisabledStates.find( aActivePathPos->second[ nNextStateIndex ] ) != m_pImpl->aDisabledStates.end() ) ) { ++nNextStateIndex; } - if ( nNextStateIndex >= (sal_Int32)aActivePathPos->second.size() ) + if ( nNextStateIndex >= static_cast<sal_Int32>(aActivePathPos->second.size()) ) // there is no next state in the current path (at least none which is enabled) return WZS_INVALID_STATE; @@ -453,8 +453,8 @@ namespace svt bool bResult = true; if ( nNewIndex > nCurrentIndex ) { - bResult = skipUntil( (WizardState)nCurItemId ); - WizardState nTemp = (WizardState)nCurItemId; + bResult = skipUntil( static_cast<WizardState>(nCurItemId) ); + WizardState nTemp = static_cast<WizardState>(nCurItemId); while( nTemp ) { if( m_pImpl->aDisabledStates.find( --nTemp ) != m_pImpl->aDisabledStates.end() ) @@ -462,7 +462,7 @@ namespace svt } } else - bResult = skipBackwardUntil( (WizardState)nCurItemId ); + bResult = skipBackwardUntil( static_cast<WizardState>(nCurItemId) ); if ( !bResult ) m_pImpl->pRoadmap->SelectRoadmapItemByID( getCurrentState() ); @@ -524,7 +524,7 @@ namespace svt } // if the state is currently in the roadmap, reflect it's new status - m_pImpl->pRoadmap->EnableRoadmapItem( (RoadmapTypes::ItemId)_nState, _bEnable ); + m_pImpl->pRoadmap->EnableRoadmapItem( static_cast<RoadmapTypes::ItemId>(_nState), _bEnable ); } @@ -555,7 +555,7 @@ namespace svt void RoadmapWizard::updateRoadmapItemLabel( WizardState _nState ) { const WizardPath& rActivePath( m_pImpl->aPaths[ m_pImpl->nActivePath ] ); - RoadmapTypes::ItemIndex nUpperStepBoundary = (RoadmapTypes::ItemIndex)rActivePath.size(); + RoadmapTypes::ItemIndex nUpperStepBoundary = static_cast<RoadmapTypes::ItemIndex>(rActivePath.size()); RoadmapTypes::ItemIndex nLoopUntil = ::std::max( nUpperStepBoundary, m_pImpl->pRoadmap->GetItemCount() ); sal_Int32 nCurrentStatePathIndex = -1; if ( m_pImpl->nActivePath != -1 ) diff --git a/svtools/source/edit/editsyntaxhighlighter.cxx b/svtools/source/edit/editsyntaxhighlighter.cxx index 6c081b4f11db..bb4ad8838b3e 100644 --- a/svtools/source/edit/editsyntaxhighlighter.cxx +++ b/svtools/source/edit/editsyntaxhighlighter.cxx @@ -124,13 +124,13 @@ Color MultiLineEditSyntaxHighlight::GetColorValue(TokenType aToken) { switch (aToken) { - case TokenType::Identifier: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor; break; - case TokenType::Number: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLNUMBER).nColor; break; - case TokenType::String: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLSTRING).nColor; break; - case TokenType::Operator: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor; break; - case TokenType::Keywords: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor; break; - case TokenType::Parameter: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor; break; - case TokenType::Comment: aColor = (ColorData)m_aColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor; break; + case TokenType::Identifier: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLIDENTIFIER).nColor); break; + case TokenType::Number: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLNUMBER).nColor); break; + case TokenType::String: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLSTRING).nColor); break; + case TokenType::Operator: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLOPERATOR).nColor); break; + case TokenType::Keywords: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLKEYWORD).nColor); break; + case TokenType::Parameter: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLPARAMETER).nColor); break; + case TokenType::Comment: aColor = static_cast<ColorData>(m_aColorConfig.GetColorValue(svtools::SQLCOMMENT).nColor); break; default: aColor = Color(0,0,0); } break; diff --git a/svtools/source/filter/DocumentToGraphicRenderer.cxx b/svtools/source/filter/DocumentToGraphicRenderer.cxx index 812fea51d701..74275afa5c79 100644 --- a/svtools/source/filter/DocumentToGraphicRenderer.cxx +++ b/svtools/source/filter/DocumentToGraphicRenderer.cxx @@ -167,8 +167,8 @@ Graphic DocumentToGraphicRenderer::renderToGraphic( assert( aDocumentSizePixel.Width() > 0 && aDocumentSizePixel.Height() > 0 && aTargetSizePixel.Width() > 0 && aTargetSizePixel.Height() > 0); - double fScaleX = aTargetSizePixel.Width() / (double) aDocumentSizePixel.Width(); - double fScaleY = aTargetSizePixel.Height() / (double) aDocumentSizePixel.Height(); + double fScaleX = aTargetSizePixel.Width() / static_cast<double>(aDocumentSizePixel.Width()); + double fScaleY = aTargetSizePixel.Height() / static_cast<double>(aDocumentSizePixel.Height()); PropertyValues renderProps; renderProps.realloc( 4 ); diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index cd42a0aa289a..5a420941e187 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -125,16 +125,16 @@ OString GraphicID::GetIDString() const aHexStr.setLength(24 + (2 * BITMAP_CHECKSUM_SIZE)); for( nShift = 28; nShift >= 0; nShift -= 4 ) - aHexStr[nIndex++] = aHexData[ ( mnID1 >> (sal_uInt32) nShift ) & 0xf ]; + aHexStr[nIndex++] = aHexData[ ( mnID1 >> static_cast<sal_uInt32>(nShift) ) & 0xf ]; for( nShift = 28; nShift >= 0; nShift -= 4 ) - aHexStr[nIndex++] = aHexData[ ( mnID2 >> (sal_uInt32) nShift ) & 0xf ]; + aHexStr[nIndex++] = aHexData[ ( mnID2 >> static_cast<sal_uInt32>(nShift) ) & 0xf ]; for( nShift = 28; nShift >= 0; nShift -= 4 ) - aHexStr[nIndex++] = aHexData[ ( mnID3 >> (sal_uInt32) nShift ) & 0xf ]; + aHexStr[nIndex++] = aHexData[ ( mnID3 >> static_cast<sal_uInt32>(nShift) ) & 0xf ]; for( nShift = ( 8 * BITMAP_CHECKSUM_SIZE ) - 4; nShift >= 0; nShift -= 4 ) - aHexStr[nIndex++] = aHexData[ ( mnID4 >> (sal_uInt32) nShift ) & 0xf ]; + aHexStr[nIndex++] = aHexData[ ( mnID4 >> static_cast<sal_uInt32>(nShift) ) & 0xf ]; return aHexStr.makeStringAndClear(); } diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 210206d52553..51f474d2b563 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -269,19 +269,19 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 ) { - double fScale = (double) aSize100.Width() / nTotalWidth; + double fScale = static_cast<double>(aSize100.Width()) / nTotalWidth; const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Horizontal ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); const long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; - fScale = (double) rSz.Width() / aSize100.Width(); + fScale = static_cast<double>(rSz.Width()) / aSize100.Width(); rPt.X() += FRound( nNewLeft * fScale ); rSz.Width() = FRound( ( nNewRight - nNewLeft + 1 ) * fScale ); - fScale = (double) aSize100.Height() / nTotalHeight; + fScale = static_cast<double>(aSize100.Height()) / nTotalHeight; const long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BmpMirrorFlags::Vertical ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); const long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; - fScale = (double) rSz.Height() / aSize100.Height(); + fScale = static_cast<double>(rSz.Height()) / aSize100.Height(); rPt.Y() += FRound( nNewTop * fScale ); rSz.Height() = FRound( ( nNewBottom - nNewTop + 1 ) * fScale ); @@ -535,9 +535,9 @@ void GraphicObject::DrawTiled( OutputDevice* pOut, const tools::Rectangle& rArea ::std::max( 1L, pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) ); //#i69780 clip final tile size to a sane max size - while (((sal_Int64)rSize.Width() * nTileCacheSize1D) > SAL_MAX_UINT16) + while ((static_cast<sal_Int64>(rSize.Width()) * nTileCacheSize1D) > SAL_MAX_UINT16) nTileCacheSize1D /= 2; - while (((sal_Int64)rSize.Height() * nTileCacheSize1D) > SAL_MAX_UINT16) + while ((static_cast<sal_Int64>(rSize.Height()) * nTileCacheSize1D) > SAL_MAX_UINT16) nTileCacheSize1D /= 2; ImplDrawTiled( pOut, rArea, aOutTileSize, rOffset, nullptr, nFlags, nTileCacheSize1D ); @@ -710,19 +710,19 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo aMtf.AddAction( new MetaISectRectClipRegionAction( aClipRect ), 0 ); // #104115# To crop the metafile, scale larger than the output rectangle - aMtf.Scale( (double)rDestSize.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()), - (double)rDestSize.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) ); + aMtf.Scale( static_cast<double>(rDestSize.Width()) / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()), + static_cast<double>(rDestSize.Height()) / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) ); // #104115# Adapt the pref size by hand (scale changes it // proportionally, but we want it to be smaller than the // former size, to crop the excess out) - aMtf.SetPrefSize( Size( (long)((double)rDestSize.Width() * (1.0 + (aCropLeftTop.Width() + aCropRightBottom.Width()) / aSrcSize.Width()) + .5), - (long)((double)rDestSize.Height() * (1.0 + (aCropLeftTop.Height() + aCropRightBottom.Height()) / aSrcSize.Height()) + .5) ) ); + aMtf.SetPrefSize( Size( static_cast<long>(static_cast<double>(rDestSize.Width()) * (1.0 + (aCropLeftTop.Width() + aCropRightBottom.Width()) / aSrcSize.Width()) + .5), + static_cast<long>(static_cast<double>(rDestSize.Height()) * (1.0 + (aCropLeftTop.Height() + aCropRightBottom.Height()) / aSrcSize.Height()) + .5) ) ); // #104115# Adapt the origin of the new mapmode, such that it // is shifted to the place where the cropped output starts - Point aNewOrigin( (long)((double)aMtfMapMode.GetOrigin().X() + rDestSize.Width() * aCropLeftTop.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()) + .5), - (long)((double)aMtfMapMode.GetOrigin().Y() + rDestSize.Height() * aCropLeftTop.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) + .5) ); + Point aNewOrigin( static_cast<long>(static_cast<double>(aMtfMapMode.GetOrigin().X()) + rDestSize.Width() * aCropLeftTop.Width() / (aSrcSize.Width() - aCropLeftTop.Width() - aCropRightBottom.Width()) + .5), + static_cast<long>(static_cast<double>(aMtfMapMode.GetOrigin().Y()) + rDestSize.Height() * aCropLeftTop.Height() / (aSrcSize.Height() - aCropLeftTop.Height() - aCropRightBottom.Height()) + .5) ); MapMode aNewMap( rDestMap ); aNewMap.SetOrigin( OutputDevice::LogicToLogic(aNewOrigin, aMtfMapMode, rDestMap) ); aMtf.SetPrefMapMode( aNewMap ); @@ -783,8 +783,8 @@ Graphic GraphicObject::GetTransformedGraphic( const Size& rDestSize, const MapMo // another possibility is to adapt the values created so far with a factor; this // will keep the original Bitmap untouched and thus quality will not change // caution: convert to double first, else pretty big errors may occur - const double fFactorX((double)aBitmapEx.GetSizePixel().Width() / aSrcSizePixel.Width()); - const double fFactorY((double)aBitmapEx.GetSizePixel().Height() / aSrcSizePixel.Height()); + const double fFactorX(static_cast<double>(aBitmapEx.GetSizePixel().Width()) / aSrcSizePixel.Width()); + const double fFactorY(static_cast<double>(aBitmapEx.GetSizePixel().Height()) / aSrcSizePixel.Height()); aCropLeftTop.Width() = basegfx::fround(aCropLeftTop.Width() * fFactorX); aCropLeftTop.Height() = basegfx::fround(aCropLeftTop.Height() * fFactorY); diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index 268d008ce4f6..0fc929a76610 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -42,7 +42,7 @@ namespace { constexpr sal_uInt8 MAP(long cVal0, long cVal1, long nFrac) { - return (sal_uInt8)(((cVal0<<20)+nFrac*(cVal1-cVal0))>>20); + return static_cast<sal_uInt8>(((cVal0<<20)+nFrac*(cVal1-cVal0))>>20); } } @@ -336,7 +336,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib if(aBitmapWidth > 1 && aUnrotatedWidth > 1) { - fRevScaleX = (double) ( aBitmapWidth - 1 ) / (double)( aUnrotatedWidth - 1 ); + fRevScaleX = static_cast<double>( aBitmapWidth - 1 ) / static_cast<double>( aUnrotatedWidth - 1 ); // create horizontal mapping table long x; for( x = 0, nTmpX = aBitmapWidth - 1, nTmp = aBitmapWidth - 2 >= 0 ? aBitmapWidth -2 : 0L; x < aUnrotatedWidth; x++ ) @@ -347,7 +347,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib fTmp = nTmpX - fTmp; pMapIX[ x ] = MinMax( fTmp, 0, nTmp ); - pMapFX[ x ] = (long) ( ( fTmp - pMapIX[ x ] ) * 1048576.0 ); + pMapFX[ x ] = static_cast<long>( ( fTmp - pMapIX[ x ] ) * 1048576.0 ); } scaleByAveraging |= fRevScaleX > 5.0/3.0; } @@ -355,7 +355,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib { if(aBitmapWidth == 1) { - fRevScaleX = 1.0 / (double) aUnrotatedWidth; + fRevScaleX = 1.0 / static_cast<double>(aUnrotatedWidth); for ( long x = 0; x < aUnrotatedWidth ; x++) { pMapIX[x] = 0; @@ -365,17 +365,17 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib } else { - fRevScaleX = (double) aBitmapWidth / (double)aUnrotatedWidth; - fTmp = (double)aBitmapWidth / 2.0; + fRevScaleX = static_cast<double>(aBitmapWidth) / static_cast<double>(aUnrotatedWidth); + fTmp = static_cast<double>(aBitmapWidth) / 2.0; - pMapIX[ 0 ] = (long)fTmp; - pMapFX[ 0 ] = (long)( ( fTmp - pMapIX[ 0 ] ) * 1048576.0 ); + pMapIX[ 0 ] = static_cast<long>(fTmp); + pMapFX[ 0 ] = static_cast<long>( ( fTmp - pMapIX[ 0 ] ) * 1048576.0 ); scaleByAveraging = true; } } if(aBitmapHeight > 1 && aUnrotatedHeight > 1) { - fRevScaleY = (double) ( aBitmapHeight - 1 ) / (double)( aUnrotatedHeight - 1 ); + fRevScaleY = static_cast<double>( aBitmapHeight - 1 ) / static_cast<double>( aUnrotatedHeight - 1 ); // create vertical mapping table long y; for( y = 0, nTmpY = aBitmapHeight - 1, nTmp = aBitmapHeight - 2 >= 0 ? aBitmapHeight - 2 : 0L; y < aUnrotatedHeight; y++ ) @@ -386,7 +386,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib fTmp = nTmpY - fTmp; pMapIY[ y ] = MinMax( fTmp, 0, nTmp ); - pMapFY[ y ] = (long) ( ( fTmp - pMapIY[ y ] ) * 1048576.0 ); + pMapFY[ y ] = static_cast<long>( ( fTmp - pMapIY[ y ] ) * 1048576.0 ); } scaleByAveraging |= fRevScaleY > 5.0/3.0; } @@ -394,7 +394,7 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib { if(aBitmapHeight == 1) { - fRevScaleY = 1.0 / (double)aUnrotatedHeight; + fRevScaleY = 1.0 / static_cast<double>(aUnrotatedHeight); for (long y = 0; y < aUnrotatedHeight; ++y) { pMapIY[y] = 0; @@ -404,11 +404,11 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib } else { - fRevScaleY = (double) aBitmapHeight / (double)aUnrotatedHeight; - fTmp = (double)aBitmapHeight / 2.0; + fRevScaleY = static_cast<double>(aBitmapHeight) / static_cast<double>(aUnrotatedHeight); + fTmp = static_cast<double>(aBitmapHeight) / 2.0; - pMapIY[ 0 ] = (long)fTmp; - pMapFY[ 0 ] = (long)( ( fTmp - pMapIY[ 0 ] ) * 1048576.0 ); + pMapIY[ 0 ] = static_cast<long>(fTmp); + pMapFY[ 0 ] = static_cast<long>( ( fTmp - pMapIY[ 0 ] ) * 1048576.0 ); scaleByAveraging = true; } } @@ -810,11 +810,11 @@ bool ImplCreateRotatedScaled( const BitmapEx& rBmpEx, const GraphicAttr& rAttrib // create new horizontal mapping table for( long nX = 0; nX < aUnrotatedWidth; nX++ ) - pMapLX[ nX ] = FRound( (double) pMapIX[ nX ] + pMapFX[ nX ] / 1048576.0 ); + pMapLX[ nX ] = FRound( static_cast<double>(pMapIX[ nX ]) + pMapFX[ nX ] / 1048576.0 ); // create new vertical mapping table for( long nY = 0; nY < aUnrotatedHeight; nY++ ) - pMapLY[ nY ] = FRound( (double) pMapIY[ nY ] + pMapFY[ nY ] / 1048576.0 ); + pMapLY[ nY ] = FRound( static_cast<double>(pMapIY[ nY ]) + pMapFY[ nY ] / 1048576.0 ); // do mask rotation for( long nY = 0; nY < aTargetHeight; nY++ ) @@ -1102,8 +1102,8 @@ bool GraphicManager::ImplCreateOutput( OutputDevice* pOut, bool bNonBitmapActionEncountered(false); if( aNewSize.Width() && aNewSize.Height() && rSz.Width() && rSz.Height() ) { - const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height(); - const double fOutWH = (double) rSz.Width() / rSz.Height(); + const double fGrfWH = static_cast<double>(aNewSize.Width()) / aNewSize.Height(); + const double fOutWH = static_cast<double>(rSz.Width()) / rSz.Height(); const double fScaleX = fOutWH / fGrfWH; const double fScaleY = 1.0; @@ -1476,7 +1476,7 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, Gra for( long nX = 0; nX < nWidth; nX++ ) { nNewTrans = nTrans + *pAScan; - *pAScan++ = (sal_uInt8) ( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ); + *pAScan++ = static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ); } } } @@ -1489,7 +1489,7 @@ void GraphicManager::ImplAdjust( BitmapEx& rBmpEx, const GraphicAttr& rAttr, Gra for( long nX = 0; nX < nWidth; nX++ ) { nNewTrans = nTrans + pA->GetPixel( nY, nX ).GetIndex(); - aAlphaValue.SetIndex( (sal_uInt8) ( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ) ); + aAlphaValue.SetIndex( static_cast<sal_uInt8>( ( nNewTrans & 0xffffff00 ) ? 255 : nNewTrans ) ); pA->SetPixel( nY, nX, aAlphaValue ); } } @@ -2095,8 +2095,8 @@ void GraphicObject::ImplTransformBitmap( BitmapEx& rBmpEx, if( !(aSizePixel.Width() && aSizePixel.Height() && rDstSize.Width() && rDstSize.Height()) ) return; - double fSrcWH = (double) aSizePixel.Width() / aSizePixel.Height(); - double fDstWH = (double) rDstSize.Width() / rDstSize.Height(); + double fSrcWH = static_cast<double>(aSizePixel.Width()) / aSizePixel.Height(); + double fDstWH = static_cast<double>(rDstSize.Width()) / rDstSize.Height(); double fScaleX = 1.0, fScaleY = 1.0; // always choose scaling to shrink bitmap diff --git a/svtools/source/graphic/transformer.cxx b/svtools/source/graphic/transformer.cxx index dbb6bfc0160a..775dfb1b0239 100644 --- a/svtools/source/graphic/transformer.cxx +++ b/svtools/source/graphic/transformer.cxx @@ -139,7 +139,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL GraphicTransformer::applyDuotone( BitmapEx aBitmapEx( aGraphic.GetBitmapEx() ); AlphaMask aMask( aBitmapEx.GetAlpha() ); Bitmap aBitmap( aBitmapEx.GetBitmap() ); - BmpFilterParam aFilter( (sal_uLong) nColorOne, (sal_uLong) nColorTwo ); + BmpFilterParam aFilter( static_cast<sal_uLong>(nColorOne), static_cast<sal_uLong>(nColorTwo) ); aBitmap.Filter( BmpFilter::DuoTone, &aFilter ); aGraphic = ::Graphic( BitmapEx( aBitmap, aMask ) ); diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index f7b71d090c41..9840cab38cdc 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -117,7 +117,7 @@ IMPL_STATIC_LINK( MainThreadFrameCloserRequest, worker, void*, p, void ) xWindow->setVisible( false ); // reparent the window - xWinPeer->setProperty( "PluginParent", uno::makeAny( (sal_Int64) 0 ) ); + xWinPeer->setProperty( "PluginParent", uno::makeAny( sal_Int64(0) ) ); VclPtr<vcl::Window> pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow ) diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index d30e2393032d..b96a4171a75e 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -215,7 +215,7 @@ css::awt::KeyEvent AcceleratorExecute::st_VCLKey2AWTKey(const vcl::KeyCode& aVCL { css::awt::KeyEvent aAWTKey; aAWTKey.Modifiers = 0; - aAWTKey.KeyCode = (sal_Int16)aVCLKey.GetCode(); + aAWTKey.KeyCode = static_cast<sal_Int16>(aVCLKey.GetCode()); if (aVCLKey.IsShift()) aAWTKey.Modifiers |= css::awt::KeyModifier::SHIFT; @@ -235,7 +235,7 @@ vcl::KeyCode AcceleratorExecute::st_AWTKey2VCLKey(const css::awt::KeyEvent& aAWT bool bMod1 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD1 ) == css::awt::KeyModifier::MOD1 ); bool bMod2 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD2 ) == css::awt::KeyModifier::MOD2 ); bool bMod3 = ((aAWTKey.Modifiers & css::awt::KeyModifier::MOD3 ) == css::awt::KeyModifier::MOD3 ); - sal_uInt16 nKey = (sal_uInt16)aAWTKey.KeyCode; + sal_uInt16 nKey = static_cast<sal_uInt16>(aAWTKey.KeyCode); return vcl::KeyCode(nKey, bShift, bMod1, bMod2, bMod3); } diff --git a/svtools/source/misc/imap.cxx b/svtools/source/misc/imap.cxx index b06fd21042db..d304298b26af 100644 --- a/svtools/source/misc/imap.cxx +++ b/svtools/source/misc/imap.cxx @@ -42,7 +42,7 @@ /******************************************************************************/ -sal_uInt16 IMapObject::nActualTextEncoding = (sal_uInt16) RTL_TEXTENCODING_DONTKNOW; +sal_uInt16 IMapObject::nActualTextEncoding = sal_uInt16(RTL_TEXTENCODING_DONTKNOW); /******************************************************************************/ @@ -320,8 +320,8 @@ bool IMapCircleObject::IsHit( const Point& rPoint ) const const Point aPoint( aCenter - rPoint ); bool bRet = false; - if ( (sal_Int32) sqrt( (double) aPoint.X() * aPoint.X() + - aPoint.Y() * aPoint.Y() ) <= nRadius ) + if ( static_cast<sal_Int32>(sqrt( static_cast<double>(aPoint.X()) * aPoint.X() + + aPoint.Y() * aPoint.Y() )) <= nRadius ) { bRet = true; } @@ -911,7 +911,7 @@ void ImageMap::Write( SvStream& rOStm ) const IMapCompat* pCompat; OUString aImageName( GetName() ); SvStreamEndian nOldFormat = rOStm.GetEndian(); - sal_uInt16 nCount = (sal_uInt16) GetIMapObjectCount(); + sal_uInt16 nCount = static_cast<sal_uInt16>(GetIMapObjectCount()); const rtl_TextEncoding eEncoding = osl_getThreadTextEncoding(); //vomit! rOStm.SetEndian( SvStreamEndian::LITTLE ); diff --git a/svtools/source/misc/imap2.cxx b/svtools/source/misc/imap2.cxx index a51bce522f27..c1fdd20e6d20 100644 --- a/svtools/source/misc/imap2.cxx +++ b/svtools/source/misc/imap2.cxx @@ -130,7 +130,7 @@ void IMapPolygonObject::WriteCERN( SvStream& rOStm ) const void IMapPolygonObject::WriteNCSA( SvStream& rOStm ) const { OStringBuffer aStrBuf("poly "); - const sal_uInt16 nCount = std::min( aPoly.GetSize(), (sal_uInt16) 100 ); + const sal_uInt16 nCount = std::min( aPoly.GetSize(), sal_uInt16(100) ); AppendNCSAURL(aStrBuf); @@ -418,8 +418,8 @@ void ImageMap::ImpReadNCSALine( const OString& rLine ) const OUString aURL( ImpReadNCSAURL( &pStr, "" ) ); const Point aCenter( ImpReadNCSACoords( &pStr ) ); const Point aDX( aCenter - ImpReadNCSACoords( &pStr ) ); - long nRadius = (long) sqrt( (double) aDX.X() * aDX.X() + - (double) aDX.Y() * aDX.Y() ); + long nRadius = static_cast<long>(sqrt( static_cast<double>(aDX.X()) * aDX.X() + + static_cast<double>(aDX.Y()) * aDX.Y() )); maList.emplace_back( new IMapCircleObject( aCenter, nRadius, aURL, OUString(), OUString(), OUString(), OUString() ) ); } diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 01b7ddc6b024..94762f656e3f 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -439,10 +439,10 @@ namespace svt sal_Int32 TemplateFolderCacheImpl::getMagicNumber() { sal_Int32 nMagic = 0; - ( nMagic += (sal_Int8)'T' ) <<= 4; - ( nMagic += (sal_Int8)'D' ) <<= 4; - ( nMagic += (sal_Int8)'S' ) <<= 4; - ( nMagic += (sal_Int8)'C' ) <<= 0; + ( nMagic += sal_Int8('T') ) <<= 4; + ( nMagic += sal_Int8('D') ) <<= 4; + ( nMagic += sal_Int8('S') ) <<= 4; + ( nMagic += sal_Int8('C') ) <<= 0; return nMagic; } diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index d950a8e25b22..88845fe9794b 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -168,7 +168,7 @@ long CalcToUnit( float nIn, MapUnit eUnit ) } nTmp *= 20; - long nRet = (long)nTmp; + long nRet = static_cast<long>(nTmp); return nRet; //! return (long)(nTmp * 20); } diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index a4d030631398..6147e8cf2595 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -571,7 +571,7 @@ SvStream& HTMLOutFuncs::Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nL sal_Char *pStr = aNToABuf + (sizeof(aNToABuf)-1); for( sal_uInt8 n = 0; n < nLen; ++n ) { - *(--pStr) = (sal_Char)(nHex & 0xf ) + 48; + *(--pStr) = static_cast<sal_Char>(nHex & 0xf ) + 48; if( *pStr > '9' ) *pStr += 39; nHex >>= 4; @@ -953,8 +953,8 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum( aStrTD.append(' '). append(OOO_STRING_SVTOOLS_HTML_O_SDnum). append("=\""). - append((sal_Int32)static_cast<sal_uInt16>( - Application::GetSettings().GetLanguageTag().getLanguageType())). + append(static_cast<sal_Int32>(static_cast<sal_uInt16>( + Application::GetSettings().GetLanguageTag().getLanguageType()))). append(';'); // Language for Format 0 if ( nFormat ) { @@ -969,7 +969,7 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum( } else nLang = LANGUAGE_SYSTEM; - aStrTD.append((sal_Int32)static_cast<sal_uInt16>(nLang)).append(';'). + aStrTD.append(static_cast<sal_Int32>(static_cast<sal_uInt16>(nLang))).append(';'). append(aNumStr); } aStrTD.append('\"'); diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx index 7ea1750974be..290bfaab0aac 100644 --- a/svtools/source/svhtml/parhtml.cxx +++ b/svtools/source/svhtml/parhtml.cxx @@ -114,7 +114,7 @@ sal_uInt32 HTMLOption::GetNumber() const "GetNumber: Option not numerical" ); OUString aTmp(comphelper::string::stripStart(aValue, ' ')); sal_Int32 nTmp = aTmp.toInt32(); - return nTmp >= 0 ? (sal_uInt32)nTmp : 0; + return nTmp >= 0 ? static_cast<sal_uInt32>(nTmp) : 0; } sal_Int32 HTMLOption::GetSNumber() const @@ -189,9 +189,9 @@ void HTMLOption::GetColor( Color& rColor ) const } } - rColor.SetRed( (sal_uInt8)((nColor & 0x00ff0000) >> 16) ); - rColor.SetGreen( (sal_uInt8)((nColor & 0x0000ff00) >> 8)); - rColor.SetBlue( (sal_uInt8)(nColor & 0x000000ff) ); + rColor.SetRed( static_cast<sal_uInt8>((nColor & 0x00ff0000) >> 16) ); + rColor.SetGreen( static_cast<sal_uInt8>((nColor & 0x0000ff00) >> 8)); + rColor.SetBlue( static_cast<sal_uInt8>(nColor & 0x000000ff) ); } HTMLInputType HTMLOption::GetInputType() const @@ -504,7 +504,7 @@ HtmlTokenId HTMLParser::ScanText( const sal_Unicode cBreak ) static_cast<sal_uInt64>(nPos+1)*GetCharSize(), "Wrong stream position" ); DBG_ASSERT( nlLinePos-nLinePos == - (sal_uLong)(nPos+1), + static_cast<sal_uLong>(nPos+1), "Wrong line position" ); rInput.Seek( nStreamPos ); nlLinePos = nLinePos; @@ -541,7 +541,7 @@ HtmlTokenId HTMLParser::ScanText( const sal_Unicode cBreak ) static_cast<sal_uInt64>(nPos+1)*GetCharSize(), "Wrong stream position" ); DBG_ASSERT( nlLinePos-nLinePos == - (sal_uLong)(nPos+1), + static_cast<sal_uLong>(nPos+1), "Wrong line position" ); rInput.Seek( nStreamPos ); nlLinePos = nLinePos; diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx index 04c59e1b0c52..1ac63c32c342 100644 --- a/svtools/source/svrtf/parrtf.cxx +++ b/svtools/source/svrtf/parrtf.cxx @@ -158,7 +158,7 @@ int SvRTFParser::GetNextToken_() case RTF_UC: if( 0 <= nTokenValue ) { - nUCharOverread = (sal_uInt8)nTokenValue; + nUCharOverread = static_cast<sal_uInt8>(nTokenValue); if (!aParserStates.empty()) { //cmc: other ifdef breaks #i3584 @@ -186,7 +186,7 @@ int SvRTFParser::GetNextToken_() if( !bRTF_InTextRead ) { nRet = RTF_TEXTTOKEN; - aToken = OUString( (sal_Unicode)nTokenValue ); + aToken = OUString( static_cast<sal_Unicode>(nTokenValue) ); // overread the next n "RTF" characters. This // can be also \{, \}, \'88 @@ -326,7 +326,7 @@ void SvRTFParser::ScanText() OStringBuffer aByteString; while (true) { - char c = (char)GetHexValue(); + char c = static_cast<char>(GetHexValue()); /* * Note: \'00 is a valid internal character in a * string in RTF. OStringBuffer supports @@ -349,13 +349,13 @@ void SvRTFParser::ScanText() { if (!aByteString.isEmpty()) aStrBuffer.append( OStringToOUString(aByteString.makeStringAndClear(), GetSrcEncoding()) ); - aStrBuffer.append((sal_Unicode)next); + aStrBuffer.append(static_cast<sal_Unicode>(next)); continue; } - nSlash = (sal_Char)next; + nSlash = static_cast<sal_Char>(next); while (nSlash == 0xD || nSlash == 0xA) - nSlash = (sal_Char)GetNextChar(); + nSlash = static_cast<sal_Char>(GetNextChar()); switch (nSlash) { diff --git a/svtools/source/svrtf/rtfout.cxx b/svtools/source/svrtf/rtfout.cxx index 0b9ba46eb426..ad97ac630215 100644 --- a/svtools/source/svrtf/rtfout.cxx +++ b/svtools/source/svrtf/rtfout.cxx @@ -38,7 +38,7 @@ SvStream& Out_Hex( SvStream& rStream, sal_uLong nHex, sal_uInt8 nLen ) sal_Char* pStr = aNToABuf + (sizeof(aNToABuf)-1); for( sal_uInt8 n = 0; n < nLen; ++n ) { - *(--pStr) = (sal_Char)(nHex & 0xf ) + 48; + *(--pStr) = static_cast<sal_Char>(nHex & 0xf ) + 48; if( *pStr > '9' ) *pStr += 39; nHex >>= 4; diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index d74de8e2a9df..837e3f61aec9 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -1383,7 +1383,7 @@ namespace svt { namespace table case cursorPageUp: { - RowPos nNewRow = ::std::max( (RowPos)0, m_nCurRow - impl_getVisibleRows( false ) ); + RowPos nNewRow = ::std::max( RowPos(0), m_nCurRow - impl_getVisibleRows( false ) ); bSuccess = goTo( m_nCurColumn, nNewRow ); } break; @@ -2026,8 +2026,8 @@ namespace svt { namespace table // compute new top row RowPos nNewTopRow = ::std::max( - ::std::min( (RowPos)( m_nTopRow + _nRowDelta ), (RowPos)( m_nRowCount - 1 ) ), - (RowPos)0 + ::std::min( static_cast<RowPos>( m_nTopRow + _nRowDelta ), static_cast<RowPos>( m_nRowCount - 1 ) ), + RowPos(0) ); RowPos nOldTopRow = m_nTopRow; @@ -2050,7 +2050,7 @@ namespace svt { namespace table && std::abs( nPixelDelta ) < aDataArea.GetHeight() ) { - m_pDataWindow->Scroll( 0, (long)-nPixelDelta, aDataArea, ScrollFlags::Clip | ScrollFlags::Update | ScrollFlags::Children); + m_pDataWindow->Scroll( 0, static_cast<long>(-nPixelDelta), aDataArea, ScrollFlags::Clip | ScrollFlags::Update | ScrollFlags::Children); } else { @@ -2075,7 +2075,7 @@ namespace svt { namespace table if ( m_nTopRow == 0 ) m_rAntiImpl.PostUserEvent( LINK( this, TableControl_Impl, OnUpdateScrollbars ) ); - return (TableSize)( m_nTopRow - nOldTopRow ); + return static_cast<TableSize>( m_nTopRow - nOldTopRow ); } @@ -2090,8 +2090,8 @@ namespace svt { namespace table // compute new left column const ColPos nNewLeftColumn = ::std::max( - ::std::min( (ColPos)( m_nLeftColumn + _nColumnDelta ), (ColPos)( m_nColumnCount - 1 ) ), - (ColPos)0 + ::std::min( static_cast<ColPos>( m_nLeftColumn + _nColumnDelta ), static_cast<ColPos>( m_nColumnCount - 1 ) ), + ColPos(0) ); const ColPos nOldLeftColumn = m_nLeftColumn; @@ -2147,7 +2147,7 @@ namespace svt { namespace table if ( m_nLeftColumn == 0 ) m_rAntiImpl.PostUserEvent( LINK( this, TableControl_Impl, OnUpdateScrollbars ) ); - return (TableSize)( m_nLeftColumn - nOldLeftColumn ); + return static_cast<TableSize>( m_nLeftColumn - nOldLeftColumn ); } diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index e2c9f2b4edf6..6bca0137bc19 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -1258,7 +1258,7 @@ void TreeControlPeer::setProperty( const OUString& PropertyName, const Any& aVal { sal_Int32 nHeight = 0; if( aValue >>= nHeight ) - rTree.SetEntryHeight( (short)nHeight ); + rTree.SetEntryHeight( static_cast<short>(nHeight) ); break; } case BASEPROPERTY_TREE_EDITABLE: @@ -1337,7 +1337,7 @@ Any TreeControlPeer::getProperty( const OUString& PropertyName ) return Any( eSelectionType ); } case BASEPROPERTY_ROW_HEIGHT: - return Any( (sal_Int32)rTree.GetEntryHeight() ); + return Any( static_cast<sal_Int32>(rTree.GetEntryHeight()) ); case BASEPROPERTY_TREE_DATAMODEL: return Any( mxDataModel ); case BASEPROPERTY_TREE_EDITABLE: diff --git a/svtools/source/uno/unocontroltablemodel.cxx b/svtools/source/uno/unocontroltablemodel.cxx index 4b7ada56e8e3..c69e89f9b1fc 100644 --- a/svtools/source/uno/unocontroltablemodel.cxx +++ b/svtools/source/uno/unocontroltablemodel.cxx @@ -137,7 +137,7 @@ namespace svt { namespace table TableSize UnoControlTableModel::getColumnCount() const { DBG_CHECK_ME(); - return (TableSize)m_pImpl->aColumns.size(); + return static_cast<TableSize>(m_pImpl->aColumns.size()); } diff --git a/svtools/source/uno/unoiface.cxx b/svtools/source/uno/unoiface.cxx index 1c3725a751a5..948fe4d00e60 100644 --- a/svtools/source/uno/unoiface.cxx +++ b/svtools/source/uno/unoiface.cxx @@ -320,7 +320,7 @@ sal_Int16 VCLXMultiLineEdit::getMaxTextLen() SolarMutexGuard aGuard; VclPtr< MultiLineEdit > pMultiLineEdit = GetAs< MultiLineEdit >(); - return pMultiLineEdit ? (sal_Int16)pMultiLineEdit->GetMaxTextLen() : (sal_Int16)0; + return pMultiLineEdit ? static_cast<sal_Int16>(pMultiLineEdit->GetMaxTextLen()) : sal_Int16(0); } OUString VCLXMultiLineEdit::getTextLines() @@ -497,7 +497,7 @@ css::uno::Any VCLXMultiLineEdit::getProperty( const OUString& PropertyName ) break; case BASEPROPERTY_MAXTEXTLEN: { - aProp <<= (sal_Int16) pMultiLineEdit->GetMaxTextLen(); + aProp <<= static_cast<sal_Int16>(pMultiLineEdit->GetMaxTextLen()); } break; default: @@ -903,7 +903,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u sal_Int32 nValue = 0; if (!(Value >>= nValue)) throw css::lang::IllegalArgumentException(); - SetValue(css::uno::makeAny((double)nValue)); + SetValue(css::uno::makeAny(static_cast<double>(nValue))); break; } @@ -927,7 +927,7 @@ void SVTXFormattedField::setProperty( const OUString& PropertyName, const css::u { sal_Int32 n = 0; if ( Value >>= n ) - pField->SetDecimalDigits( (sal_uInt16)n ); + pField->SetDecimalDigits( static_cast<sal_uInt16>(n) ); } break; case BASEPROPERTY_NUMSHOWTHOUSANDSEP: @@ -1440,20 +1440,20 @@ void SVTXRoadmap::propertyChange( const css::beans::PropertyChangeEvent& evt ) { bool bEnable = false; evt.NewValue >>= bEnable; - pField->EnableRoadmapItem( (RoadmapTypes::ItemId)nID , bEnable ); + pField->EnableRoadmapItem( static_cast<RoadmapTypes::ItemId>(nID) , bEnable ); } else if ( sPropertyName == "Label" ) { OUString sLabel; evt.NewValue >>= sLabel; - pField->ChangeRoadmapItemLabel( (RoadmapTypes::ItemId)nID , sLabel ); + pField->ChangeRoadmapItemLabel( static_cast<RoadmapTypes::ItemId>(nID) , sLabel ); } else if ( sPropertyName == "ID" ) { sal_Int32 nNewID = 0; evt.NewValue >>= nNewID; evt.OldValue >>= nID; - pField->ChangeRoadmapItemID( (RoadmapTypes::ItemId)nID, (RoadmapTypes::ItemId)nNewID ); + pField->ChangeRoadmapItemID( static_cast<RoadmapTypes::ItemId>(nID), static_cast<RoadmapTypes::ItemId>(nNewID) ); } // else // TODO handle Interactive appropriately @@ -1502,7 +1502,7 @@ void SVTXRoadmap::elementInserted( const css::container::ContainerEvent& _rEvent RMItemData CurItemData = GetRMItemData( _rEvent ); sal_Int32 InsertIndex = 0; _rEvent.Accessor >>= InsertIndex; - pField->InsertRoadmapItem( InsertIndex, CurItemData.Label, (RoadmapTypes::ItemId)CurItemData.n_ID, CurItemData.b_Enabled ); + pField->InsertRoadmapItem( InsertIndex, CurItemData.Label, static_cast<RoadmapTypes::ItemId>(CurItemData.n_ID), CurItemData.b_Enabled ); } } @@ -1527,7 +1527,7 @@ void SVTXRoadmap::elementReplaced( const css::container::ContainerEvent& _rEvent RMItemData CurItemData = GetRMItemData( _rEvent ); sal_Int32 ReplaceIndex = 0; _rEvent.Accessor >>= ReplaceIndex; - pField->ReplaceRoadmapItem( ReplaceIndex, CurItemData.Label, (RoadmapTypes::ItemId)CurItemData.n_ID, CurItemData.b_Enabled ); + pField->ReplaceRoadmapItem( ReplaceIndex, CurItemData.Label, static_cast<RoadmapTypes::ItemId>(CurItemData.n_ID), CurItemData.b_Enabled ); } } @@ -1562,7 +1562,7 @@ void SVTXRoadmap::setProperty( const OUString& PropertyName, const css::uno::Any { sal_Int32 nId = 0; Value >>= nId; - pField->SelectRoadmapItemByID( (RoadmapTypes::ItemId)nId ); + pField->SelectRoadmapItemByID( static_cast<RoadmapTypes::ItemId>(nId) ); } break; @@ -2096,7 +2096,7 @@ void VCLXProgressBar::ImplUpdateValue() } // set progressbar value - pProgressBar->SetValue( (sal_uInt16) nPercent ); + pProgressBar->SetValue( static_cast<sal_uInt16>(nPercent) ); } // css::uno::XInterface diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 2cf167626ab5..6a0fafaa93d8 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -216,7 +216,7 @@ SvUnoImageMapObject::SvUnoImageMapObject( const IMapObject& rMapObject, const Sv break; case IMAP_OBJ_CIRCLE: { - mnRadius = (sal_Int32)static_cast<const IMapCircleObject*>(&rMapObject)->GetRadius(false); + mnRadius = static_cast<sal_Int32>(static_cast<const IMapCircleObject*>(&rMapObject)->GetRadius(false)); const Point aPoint( static_cast<const IMapCircleObject*>(&rMapObject)->GetCenter(false) ); maCenter.X = aPoint.X(); @@ -275,7 +275,7 @@ IMapObject* SvUnoImageMapObject::createIMapObject() const case IMAP_OBJ_POLYGON: default: { - const sal_uInt16 nCount = (sal_uInt16)maPolygon.getLength(); + const sal_uInt16 nCount = static_cast<sal_uInt16>(maPolygon.getLength()); tools::Polygon aPoly( nCount ); for( sal_uInt16 nPoint = 0; nPoint < nCount; nPoint++ ) |