diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-19 10:46:41 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-19 21:34:15 +0200 |
commit | 5afba3e12c8d4eb1ebb8e087134eb87593bb017a (patch) | |
tree | 065feaadfc8b8da456d0707358bb706c9f90e1e0 /svtools | |
parent | 73933ed0a207f1cf210cc4a7d329755bd885f871 (diff) |
use tools::Long in svtools
Change-Id: I2b26da23e625e643dc2bb5393abff3671c457884
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104518
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
26 files changed, 520 insertions, 519 deletions
diff --git a/svtools/inc/table/tablecontrol.hxx b/svtools/inc/table/tablecontrol.hxx index 1e780440a05a..7af537b9c19c 100644 --- a/svtools/inc/table/tablecontrol.hxx +++ b/svtools/inc/table/tablecontrol.hxx @@ -135,8 +135,8 @@ namespace svt::table virtual vcl::Window* GetWindowInstance() override; virtual sal_Int32 GetAccessibleControlCount() const override; virtual bool ConvertPointToControlIndex( sal_Int32& _rnIndex, const Point& _rPoint ) override; - virtual long GetRowCount() const override; - virtual long GetColumnCount() const override; + virtual tools::Long GetRowCount() const override; + virtual tools::Long GetColumnCount() const override; virtual bool ConvertPointToCellAddress( sal_Int32& _rnRow, sal_Int32& _rnColPos, const Point& _rPoint ) override; virtual tools::Rectangle calcHeaderRect( bool _bIsColumnBar ) override; virtual tools::Rectangle calcHeaderCellRect( bool _bIsColumnBar, sal_Int32 nPos) override; diff --git a/svtools/inc/table/tablecontrolinterface.hxx b/svtools/inc/table/tablecontrolinterface.hxx index 69670d2bdaa6..5314b2952381 100644 --- a/svtools/inc/table/tablecontrolinterface.hxx +++ b/svtools/inc/table/tablecontrolinterface.hxx @@ -107,7 +107,7 @@ namespace svt::table /** the start of the column, in pixels. Might be negative, in case the column is scrolled out of the visible area. Note: see below. */ - long nStartPixel; + tools::Long nStartPixel; /** the end of the column, in pixels, plus 1. Effectively, this is the accumulated width of all columns up to the current one. @@ -120,7 +120,7 @@ namespace svt::table gap. So these doc comments are inconsistent. How surprising. */ - long nEndPixel; + tools::Long nEndPixel; ColumnMetrics() :nStartPixel(0) @@ -128,7 +128,7 @@ namespace svt::table { } - ColumnMetrics( long const i_start, long const i_end ) + ColumnMetrics( tools::Long const i_start, tools::Long const i_end ) :nStartPixel( i_start ) ,nEndPixel( i_end ) { @@ -215,7 +215,7 @@ namespace svt::table virtual void invalidate( TableArea const i_what ) = 0; /// calculates a width, given in pixels, into an AppFont-based width - virtual long pixelWidthToAppFont( long const i_pixels ) const = 0; + virtual tools::Long pixelWidthToAppFont( tools::Long const i_pixels ) const = 0; /// shows a tracking rectangle virtual void showTracking( tools::Rectangle const & i_location, ShowTrackFlags const i_flags ) = 0; diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 943e888385e8..5eac20c1514e 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -141,7 +141,7 @@ public: } }; -long BrowseBox::GetBarHeight() const +tools::Long BrowseBox::GetBarHeight() const { // tdf#115941 because some platforms have things like overlay scrollbars, take a max // of a statusbar height and a scrollbar height as the control area height @@ -289,7 +289,7 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth ) void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const OUString& rText, - long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos ) + tools::Long nWidth, HeaderBarItemBits nBits, sal_uInt16 nPos ) { OSL_ENSURE( nItemId != HandleColumnId, "BrowseBox::InsertDataColumn: nItemId is HandleColumnId" ); @@ -332,8 +332,8 @@ sal_uInt16 BrowseBox::ToggleSelectedColumn() { DoHideCursor( "ToggleSelectedColumn" ); ToggleSelection(); - long nSelected = pColSel->FirstSelected(); - if (nSelected != static_cast<long>(SFX_ENDOFSELECTION)) + tools::Long nSelected = pColSel->FirstSelected(); + if (nSelected != static_cast<tools::Long>(SFX_ENDOFSELECTION)) nSelectedColId = mvCols[nSelected]->GetId(); pColSel->SelectAll(false); } @@ -444,11 +444,11 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos ) // do scroll, let redraw if( pDataWin->GetBackground().IsScrollable() ) { - long nScroll = -aFromRect.GetWidth(); + tools::Long nScroll = -aFromRect.GetWidth(); tools::Rectangle aScrollArea; if ( nOldPos > nPos ) { - long nFrozenWidth = GetFrozenWidth(); + tools::Long nFrozenWidth = GetFrozenWidth(); if ( aToRect.Left() < nFrozenWidth ) aToRect.SetLeft( nFrozenWidth ); aScrollArea = tools::Rectangle(Point(aToRect.Left(),0), @@ -565,12 +565,12 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) if ( nWidth < LONG_MAX && mvCols[ nItemPos ]->Width() == nWidth ) return; - long nOldWidth = mvCols[ nItemPos ]->Width(); + tools::Long nOldWidth = mvCols[ nItemPos ]->Width(); // adjust last column, if necessary if ( IsVisible() && nItemPos == mvCols.size() - 1 ) { - long nMaxWidth = pDataWin->GetSizePixel().Width(); + tools::Long nMaxWidth = pDataWin->GetSizePixel().Width(); nMaxWidth -= pDataWin->bAutoSizeLastCol ? GetFieldRect(nItemId).Left() : GetFrozenWidth(); @@ -606,7 +606,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth ) if ( bUpdate ) { // get X-Pos of the column changed - long nX = 0; + tools::Long nX = 0; for ( size_t nCol = 0; nCol < nItemPos; ++nCol ) { BrowserColumn *pCol = mvCols[ nCol ].get(); @@ -824,7 +824,7 @@ OUString BrowseBox::GetColumnTitle( sal_uInt16 nId ) const return mvCols[ nItemPos ]->Title(); } -long BrowseBox::GetRowCount() const +tools::Long BrowseBox::GetRowCount() const { return nRowCount; } @@ -834,7 +834,7 @@ sal_uInt16 BrowseBox::ColCount() const return static_cast<sal_uInt16>(mvCols.size()); } -long BrowseBox::ImpGetDataRowHeight() const +tools::Long BrowseBox::ImpGetDataRowHeight() const { BrowseBox *pThis = const_cast<BrowseBox*>(this); pThis->nDataRowHeight = pThis->CalcReverseZoom(pDataWin->GetTextHeight() + 4); @@ -843,7 +843,7 @@ long BrowseBox::ImpGetDataRowHeight() const return nDataRowHeight; } -void BrowseBox::SetDataRowHeight( long nPixel ) +void BrowseBox::SetDataRowHeight( tools::Long nPixel ) { nDataRowHeight = CalcReverseZoom(nPixel); @@ -857,11 +857,11 @@ void BrowseBox::SetTitleLines( sal_uInt16 nLines ) nTitleLines = nLines; } -long BrowseBox::ScrollColumns( long nCols ) +tools::Long BrowseBox::ScrollColumns( tools::Long nCols ) { if ( nFirstCol + nCols < 0 || - nFirstCol + nCols >= static_cast<long>(mvCols.size()) ) + nFirstCol + nCols >= static_cast<tools::Long>(mvCols.size()) ) return 0; // implicitly hides cursor while scrolling @@ -883,8 +883,8 @@ long BrowseBox::ScrollColumns( long nCols ) } else { - long nDelta = mvCols[ nFirstCol-1 ]->Width(); - long nFrozenWidth = GetFrozenWidth(); + tools::Long nDelta = mvCols[ nFirstCol-1 ]->Width(); + tools::Long nFrozenWidth = GetFrozenWidth(); tools::Rectangle aScrollRect( Point( nFrozenWidth + nDelta, 0 ), Size ( GetOutputSizePixel().Width() - nFrozenWidth - nDelta, @@ -929,8 +929,8 @@ long BrowseBox::ScrollColumns( long nCols ) } else { - long nDelta = mvCols[ nFirstCol ]->Width(); - long nFrozenWidth = GetFrozenWidth(); + tools::Long nDelta = mvCols[ nFirstCol ]->Width(); + tools::Long nFrozenWidth = GetFrozenWidth(); tools::Rectangle aScrollRect( Point( nFrozenWidth, 0 ), Size ( GetOutputSizePixel().Width() - nFrozenWidth, @@ -967,7 +967,7 @@ long BrowseBox::ScrollColumns( long nCols ) // adjust external headerbar, if necessary if ( pDataWin->pHeaderBar ) { - long nWidth = 0; + tools::Long nWidth = 0; for ( size_t nCol = 0; nCol < mvCols.size() && nCol < nFirstCol; ++nCol ) @@ -999,12 +999,12 @@ long BrowseBox::ScrollColumns( long nCols ) } -long BrowseBox::ScrollRows( long nRows ) +tools::Long BrowseBox::ScrollRows( tools::Long nRows ) { // compute new top row - long nTmpMin = std::min( static_cast<long>(nTopRow + nRows), static_cast<long>(nRowCount - 1) ); + tools::Long nTmpMin = std::min( static_cast<tools::Long>(nTopRow + nRows), static_cast<tools::Long>(nRowCount - 1) ); - long nNewTopRow = std::max<long>( nTmpMin, 0 ); + tools::Long nNewTopRow = std::max<long>( nTmpMin, 0 ); if ( nNewTopRow == nTopRow ) return 0; @@ -1015,15 +1015,15 @@ long BrowseBox::ScrollRows( long nRows ) VisibleRowsChanged(nNewTopRow, nVisibleRows); // compute new top row again (nTopRow might have changed!) - nTmpMin = std::min( static_cast<long>(nTopRow + nRows), static_cast<long>(nRowCount - 1) ); + nTmpMin = std::min( static_cast<tools::Long>(nTopRow + nRows), static_cast<tools::Long>(nRowCount - 1) ); nNewTopRow = std::max<long>( nTmpMin, 0 ); StartScroll(); // scroll area on screen and/or repaint - long nDeltaY = GetDataRowHeight() * ( nNewTopRow - nTopRow ); - long nOldTopRow = nTopRow; + tools::Long nDeltaY = GetDataRowHeight() * ( nNewTopRow - nTopRow ); + tools::Long nOldTopRow = nTopRow; nTopRow = nNewTopRow; if ( GetUpdateMode() ) @@ -1050,7 +1050,7 @@ long BrowseBox::ScrollRows( long nRows ) } -void BrowseBox::RowModified( long nRow, sal_uInt16 nColId ) +void BrowseBox::RowModified( tools::Long nRow, sal_uInt16 nColId ) { if ( !GetUpdateMode() ) @@ -1075,7 +1075,7 @@ void BrowseBox::Clear() // adjust the total number of rows DoHideCursor( "Clear" ); - long nOldRowCount = nRowCount; + tools::Long nOldRowCount = nRowCount; nRowCount = 0; if(bMultiSelection) { @@ -1134,7 +1134,7 @@ void BrowseBox::Clear() ); } -void BrowseBox::RowInserted( long nRow, long nNumRows, bool bDoPaint, bool bKeepSelection ) +void BrowseBox::RowInserted( tools::Long nRow, tools::Long nNumRows, bool bDoPaint, bool bKeepSelection ) { if (nRow < 0) @@ -1152,12 +1152,12 @@ void BrowseBox::RowInserted( long nRow, long nNumRows, bool bDoPaint, bool bKeep DoHideCursor( "RowInserted" ); // must we paint the new rows? - long nOldCurRow = nCurRow; + tools::Long nOldCurRow = nCurRow; Size aSz = pDataWin->GetOutputSizePixel(); if ( bDoPaint && nRow >= nTopRow && nRow <= nTopRow + aSz.Height() / GetDataRowHeight() ) { - long nY = (nRow-nTopRow) * GetDataRowHeight(); + tools::Long nY = (nRow-nTopRow) * GetDataRowHeight(); if ( !bLastRow ) { // scroll down the rows behind the new row @@ -1221,7 +1221,7 @@ void BrowseBox::RowInserted( long nRow, long nNumRows, bool bDoPaint, bool bKeep Any() ); - for (long i = nRow+1 ; i <= nRowCount ; ++i) + for (tools::Long i = nRow+1 ; i <= nRowCount ; ++i) { commitHeaderBarEvent( CHILD, @@ -1241,7 +1241,7 @@ void BrowseBox::RowInserted( long nRow, long nNumRows, bool bDoPaint, bool bKeep } -void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) +void BrowseBox::RowRemoved( tools::Long nRow, tools::Long nNumRows, bool bDoPaint ) { if ( nRow < 0 ) @@ -1266,12 +1266,12 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) // adjust total row count nRowCount -= nNumRows; if (nRowCount < 0) nRowCount = 0; - long nOldCurRow = nCurRow; + tools::Long nOldCurRow = nCurRow; // adjust the selection if ( bMultiSelection ) // uRow.pSel->Remove( nRow, nNumRows ); - for ( long i = 0; i < nNumRows; i++ ) + for ( tools::Long i = 0; i < nNumRows; i++ ) uRow.pSel->Remove( nRow ); else if ( nRow < uRow.nSel && uRow.nSel >= nNumRows ) uRow.nSel -= nNumRows; @@ -1306,7 +1306,7 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) // if there are Rows behind if (nRow < nRowCount) { - long nY = (nRow-nTopRow) * GetDataRowHeight(); + tools::Long nY = (nRow-nTopRow) * GetDataRowHeight(); pDataWin->SetClipRegion(); if( pDataWin->GetBackground().IsScrollable() ) { @@ -1391,7 +1391,7 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) Any() ); - for (long i = nRow+1 ; i <= (nRow+nNumRows) ; ++i) + for (tools::Long i = nRow+1 ; i <= (nRow+nNumRows) ; ++i) { commitHeaderBarEvent( CHILD, @@ -1412,16 +1412,16 @@ void BrowseBox::RowRemoved( long nRow, long nNumRows, bool bDoPaint ) } -bool BrowseBox::GoToRow( long nRow) +bool BrowseBox::GoToRow( tools::Long nRow) { return GoToRow(nRow, false); } -bool BrowseBox::GoToRow( long nRow, bool bRowColMove, bool bKeepSelection ) +bool BrowseBox::GoToRow( tools::Long nRow, bool bRowColMove, bool bKeepSelection ) { - long nOldCurRow = nCurRow; + tools::Long nOldCurRow = nCurRow; // nothing to do? if ( nRow == nCurRow && ( bMultiSelection || uRow.nSel == nRow ) ) @@ -1438,7 +1438,7 @@ bool BrowseBox::GoToRow( long nRow, bool bRowColMove, bool bKeepSelection ) // compute the last visible row Size aSz( pDataWin->GetSizePixel() ); sal_uInt16 nVisibleRows = sal_uInt16( aSz.Height() / GetDataRowHeight() - 1 ); - long nLastRow = nTopRow + nVisibleRows; + tools::Long nLastRow = nTopRow + nVisibleRows; // suspend Updates pDataWin->EnterUpdateLock(); @@ -1566,7 +1566,7 @@ bool BrowseBox::GoToColumnId( sal_uInt16 nColId, bool bMakeVisible, bool bRowCol } -bool BrowseBox::GoToRowColumnId( long nRow, sal_uInt16 nColId ) +bool BrowseBox::GoToRowColumnId( tools::Long nRow, sal_uInt16 nColId ) { // out of range? @@ -1651,7 +1651,7 @@ void BrowseBox::SelectAll() // don't highlight handle column BrowserColumn *pFirstCol = mvCols[ 0 ].get(); - long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); + tools::Long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); // highlight the row selection if ( !bHideSelect ) @@ -1659,7 +1659,7 @@ void BrowseBox::SelectAll() tools::Rectangle aHighlightRect; sal_uInt16 nVisibleRows = static_cast<sal_uInt16>(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); - for ( long nRow = std::max<long>( nTopRow, uRow.pSel->FirstSelected() ); + for ( tools::Long nRow = std::max<long>( nTopRow, uRow.pSel->FirstSelected() ); nRow != BROWSER_ENDOFSELECTION && nRow < nTopRow + nVisibleRows; nRow = uRow.pSel->NextSelected() ) aHighlightRect.Union( tools::Rectangle( @@ -1700,7 +1700,7 @@ void BrowseBox::SelectAll() } -void BrowseBox::SelectRow( long nRow, bool _bSelect, bool bExpand ) +void BrowseBox::SelectRow( tools::Long nRow, bool _bSelect, bool bExpand ) { if ( !bMultiSelection ) @@ -1738,7 +1738,7 @@ void BrowseBox::SelectRow( long nRow, bool _bSelect, bool bExpand ) { // don't highlight handle column BrowserColumn *pFirstCol = mvCols[ 0 ].get(); - long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); + tools::Long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); // highlight only newly selected part tools::Rectangle aRect( @@ -1772,7 +1772,7 @@ void BrowseBox::SelectRow( long nRow, bool _bSelect, bool bExpand ) } -long BrowseBox::GetSelectRowCount() const +tools::Long BrowseBox::GetSelectRowCount() const { return bMultiSelection ? uRow.pSel->GetSelectCount() : @@ -1853,34 +1853,34 @@ sal_uInt16 BrowseBox::GetSelectColumnCount() const } -long BrowseBox::FirstSelectedColumn( ) const +tools::Long BrowseBox::FirstSelectedColumn( ) const { return pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION; } -long BrowseBox::FirstSelectedRow() +tools::Long BrowseBox::FirstSelectedRow() { return bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel; } -long BrowseBox::NextSelectedRow() +tools::Long BrowseBox::NextSelectedRow() { return bMultiSelection ? uRow.pSel->NextSelected() : BROWSER_ENDOFSELECTION; } -long BrowseBox::LastSelectedRow() +tools::Long BrowseBox::LastSelectedRow() { return bMultiSelection ? uRow.pSel->LastSelected() : uRow.nSel; } -bool BrowseBox::IsRowSelected( long nRow ) const +bool BrowseBox::IsRowSelected( tools::Long nRow ) const { return bMultiSelection ? uRow.pSel->IsSelected(nRow) : nRow == uRow.nSel; @@ -1897,7 +1897,7 @@ bool BrowseBox::IsColumnSelected( sal_uInt16 nColumnId ) const void BrowseBox::MakeFieldVisible ( - long nRow, // line number of the field (starting with 0) + tools::Long nRow, // line number of the field (starting with 0) sal_uInt16 nColId // column ID of the field ) @@ -1948,7 +1948,7 @@ void BrowseBox::MakeFieldVisible ScrollRows( nRow - nTopRow ); // positioned outside below? - long nBottomRow = nTopRow + GetVisibleRows(); + tools::Long nBottomRow = nTopRow + GetVisibleRows(); // decrement nBottomRow to make it the number of the last visible line // (count starts with 0!). // Example: BrowseBox contains exactly one entry. nBottomRow := 0 + 1 - 1 @@ -1961,7 +1961,7 @@ void BrowseBox::MakeFieldVisible } -bool BrowseBox::IsFieldVisible( long nRow, sal_uInt16 nColumnId, +bool BrowseBox::IsFieldVisible( tools::Long nRow, sal_uInt16 nColumnId, bool bCompletely ) const { @@ -1986,7 +1986,7 @@ bool BrowseBox::IsFieldVisible( long nRow, sal_uInt16 nColumnId, } -tools::Rectangle BrowseBox::GetFieldRectPixel( long nRow, sal_uInt16 nColumnId, +tools::Rectangle BrowseBox::GetFieldRectPixel( tools::Long nRow, sal_uInt16 nColumnId, bool bRelToBrowser) const { @@ -2007,7 +2007,7 @@ tools::Rectangle BrowseBox::GetFieldRectPixel( long nRow, sal_uInt16 nColumnId, } -tools::Rectangle BrowseBox::GetRowRectPixel( long nRow ) const +tools::Rectangle BrowseBox::GetRowRectPixel( tools::Long nRow ) const { // get the rectangle relative to DataWin @@ -2031,11 +2031,11 @@ tools::Rectangle BrowseBox::GetRowRectPixel( long nRow ) const } -tools::Rectangle BrowseBox::ImplFieldRectPixel( long nRow, sal_uInt16 nColumnId ) const +tools::Rectangle BrowseBox::ImplFieldRectPixel( tools::Long nRow, sal_uInt16 nColumnId ) const { // compute the X-coordinate relative to DataWin by accumulation - long nColX = 0; + tools::Long nColX = 0; sal_uInt16 nFrozenCols = FrozenColCount(); size_t nCol; for ( nCol = 0; @@ -2048,7 +2048,7 @@ tools::Rectangle BrowseBox::ImplFieldRectPixel( long nRow, sal_uInt16 nColumnId return tools::Rectangle(); // compute the Y-coordinate relative to DataWin - long nRowY = GetDataRowHeight(); + tools::Long nRowY = GetDataRowHeight(); if ( nRow != BROWSER_ENDOFSELECTION ) // #105497# OJ nRowY = ( nRow - nTopRow ) * GetDataRowHeight(); @@ -2061,7 +2061,7 @@ tools::Rectangle BrowseBox::ImplFieldRectPixel( long nRow, sal_uInt16 nColumnId } -long BrowseBox::GetRowAtYPosPixel( long nY, bool bRelToBrowser ) const +tools::Long BrowseBox::GetRowAtYPosPixel( tools::Long nY, bool bRelToBrowser ) const { // compute the Y-coordinate @@ -2087,11 +2087,11 @@ tools::Rectangle BrowseBox::GetFieldRect( sal_uInt16 nColumnId ) const } -sal_uInt16 BrowseBox::GetColumnAtXPosPixel( long nX ) const +sal_uInt16 BrowseBox::GetColumnAtXPosPixel( tools::Long nX ) const { // accumulate the widths of the visible columns - long nColX = 0; + tools::Long nColX = 0; for ( size_t nCol = 0; nCol < mvCols.size(); ++nCol ) { BrowserColumn *pCol = mvCols[ nCol ].get(); @@ -2149,7 +2149,7 @@ void BrowseBox::SetMode( BrowserMode nMode ) nControlAreaWidth = USHRT_MAX; - long nOldRowSel = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel; + tools::Long nOldRowSel = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel; MultiSelection *pOldRowSel = bMultiSelection ? uRow.pSel : nullptr; pVScroll.disposeAndClear(); @@ -2238,7 +2238,7 @@ void BrowseBox::SetMode( BrowserMode nMode ) } -void BrowseBox::VisibleRowsChanged( long, sal_uInt16 ) +void BrowseBox::VisibleRowsChanged( tools::Long, sal_uInt16 ) { // old behavior: automatically correct NumRows: @@ -2253,7 +2253,7 @@ void BrowseBox::VisibleRowsChanged( long, sal_uInt16 ) } -bool BrowseBox::IsCursorMoveAllowed( long, sal_uInt16 ) const +bool BrowseBox::IsCursorMoveAllowed( tools::Long, sal_uInt16 ) const /* [Description] @@ -2272,7 +2272,7 @@ bool BrowseBox::IsCursorMoveAllowed( long, sal_uInt16 ) const } -long BrowseBox::GetDataRowHeight() const +tools::Long BrowseBox::GetDataRowHeight() const { return CalcZoom(nDataRowHeight ? nDataRowHeight : ImpGetDataRowHeight()); } @@ -2292,9 +2292,9 @@ void BrowseBox::SetHeaderBar( BrowserHeader* pHeaderBar ) pDataWin->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) ); } -long BrowseBox::GetTitleHeight() const +tools::Long BrowseBox::GetTitleHeight() const { - long nHeight; + tools::Long nHeight; // ask the header bar for the text height (if possible), as the header bar's font is adjusted with // our (and the header's) zoom factor HeaderBar* pHeaderBar = pDataWin->pHeaderBar; @@ -2306,7 +2306,7 @@ long BrowseBox::GetTitleHeight() const return nTitleLines ? nTitleLines * nHeight + 4 : 0; } -long BrowseBox::CalcReverseZoom(long nVal) +tools::Long BrowseBox::CalcReverseZoom(tools::Long nVal) { if (IsZoom()) { @@ -2316,7 +2316,7 @@ long BrowseBox::CalcReverseZoom(long nVal) if (!rZoom.GetNumerator()) throw o3tl::divide_by_zero(); n /= static_cast<double>(rZoom.GetNumerator()); - nVal = n>0 ? static_cast<long>(n + 0.5) : -static_cast<long>(-n + 0.5); + nVal = n>0 ? static_cast<tools::Long>(n + 0.5) : -static_cast<tools::Long>(-n + 0.5); } return nVal; diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx index 298a61a31c80..268bfb262ca3 100644 --- a/svtools/source/brwbox/brwbox2.cxx +++ b/svtools/source/brwbox/brwbox2.cxx @@ -183,7 +183,7 @@ void BrowseBox::DoubleClick( const BrowserMouseEvent & ) } -long BrowseBox::QueryMinimumRowHeight() +tools::Long BrowseBox::QueryMinimumRowHeight() { return CalcZoom( 5 ); } @@ -242,18 +242,18 @@ void BrowseBox::ToggleSelection() // accumulate areas of rows to highlight std::vector<tools::Rectangle> aHighlightList; - long nLastRowInRect = 0; // for the CFront + tools::Long nLastRowInRect = 0; // for the CFront // don't highlight handle column BrowserColumn *pFirstCol = mvCols.empty() ? nullptr : mvCols[ 0 ].get(); - long nOfsX = (!pFirstCol || pFirstCol->GetId()) ? 0 : pFirstCol->Width(); + tools::Long nOfsX = (!pFirstCol || pFirstCol->GetId()) ? 0 : pFirstCol->Width(); // accumulate old row selection - long nBottomRow = nTopRow + + tools::Long nBottomRow = nTopRow + pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight(); if ( nBottomRow > GetRowCount() && GetRowCount() ) nBottomRow = GetRowCount(); - for ( long nRow = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel; + for ( tools::Long nRow = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel; nRow != BROWSER_ENDOFSELECTION && nRow <= nBottomRow; nRow = bMultiSelection ? uRow.pSel->NextSelected() : BROWSER_ENDOFSELECTION ) { @@ -278,7 +278,7 @@ void BrowseBox::ToggleSelection() } // unhighlight old column selection (if any) - for ( long nColId = pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION; + for ( tools::Long nColId = pColSel ? pColSel->FirstSelected() : BROWSER_ENDOFSELECTION; nColId != BROWSER_ENDOFSELECTION; nColId = pColSel->NextSelected() ) { @@ -496,11 +496,11 @@ void BrowseBox::Resize() aHScroll->Hide(); // calculate the size of the data window - long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight(); + tools::Long nDataHeight = GetOutputSizePixel().Height() - GetTitleHeight(); if ( aHScroll->IsVisible() || ( nControlAreaWidth != USHRT_MAX ) ) nDataHeight -= nSBSize; - long nDataWidth = GetOutputSizePixel().Width(); + tools::Long nDataWidth = GetOutputSizePixel().Width(); if ( pVScroll->IsVisible() ) nDataWidth -= nSBSize; @@ -532,7 +532,7 @@ void BrowseBox::Resize() { // take the handle column into account BrowserColumn *pFirstCol = mvCols[ 0 ].get(); - long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); + tools::Long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width(); pHeaderBar->SetPosSizePixel( Point( nOfsX, 0 ), Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) ); } @@ -581,7 +581,7 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle return; // iterate through columns to redraw - long nX = 0; + tools::Long nX = 0; size_t nCol; for (nCol = 0; nCol < mvCols.size() && nX < rRect.Right(); ++nCol) { @@ -668,10 +668,10 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) // (as it is based on the settings of our data window, not the foreign device) if (!nDataRowHeight) ImpGetDataRowHeight(); - long nHeightLogic = PixelToLogic(Size(0, nDataRowHeight), MapMode(MapUnit::Map10thMM)).Height(); - long nForeignHeightPixel = pDev->LogicToPixel(Size(0, nHeightLogic), MapMode(MapUnit::Map10thMM)).Height(); + tools::Long nHeightLogic = PixelToLogic(Size(0, nDataRowHeight), MapMode(MapUnit::Map10thMM)).Height(); + tools::Long nForeignHeightPixel = pDev->LogicToPixel(Size(0, nHeightLogic), MapMode(MapUnit::Map10thMM)).Height(); - long nOriginalHeight = nDataRowHeight; + tools::Long nOriginalHeight = nDataRowHeight; nDataRowHeight = nForeignHeightPixel; // this counts for the column widths, too @@ -680,8 +680,8 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) { BrowserColumn* pCurrent = mvCols[ nPos ].get(); - long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MapMode(MapUnit::Map10thMM)).Width(); - long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MapMode(MapUnit::Map10thMM)).Width(); + tools::Long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MapMode(MapUnit::Map10thMM)).Width(); + tools::Long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MapMode(MapUnit::Map10thMM)).Width(); pCurrent->SetWidth(nForeignWidthPixel, GetZoom()); if ( pBar ) @@ -698,7 +698,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) if ( pBar ) { // the title height with respect to the font set for the given device - long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MapMode(MapUnit::Map10thMM)).Height(); + tools::Long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MapMode(MapUnit::Map10thMM)).Height(); nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MapMode(MapUnit::Map10thMM)).Height(); BrowserColumn* pFirstCol = !mvCols.empty() ? mvCols[ 0 ].get() : nullptr; @@ -761,8 +761,8 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) { BrowserColumn* pCurrent = mvCols[ nPos ].get(); - long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MapMode(MapUnit::Map10thMM)).Width(); - long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MapMode(MapUnit::Map10thMM)).Width(); + tools::Long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MapMode(MapUnit::Map10thMM)).Width(); + tools::Long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MapMode(MapUnit::Map10thMM)).Width(); pCurrent->SetWidth(nWidthPixel, GetZoom()); if ( pBar ) @@ -778,7 +778,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec Size aOverallAreaSize = _bForeignDevice ? _rRect.GetSize() : pDataWin->GetOutputSizePixel(); Point aOverallAreaBRPos = _bForeignDevice ? _rRect.BottomRight() : Point( aOverallAreaSize.Width(), aOverallAreaSize.Height() ); - long nDataRowHeigt = GetDataRowHeight(); + tools::Long nDataRowHeigt = GetDataRowHeight(); // compute relative rows to redraw sal_uLong nRelTopRow = 0; @@ -799,7 +799,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec Color aOldTextColor = _rOut.GetTextColor(); Color aOldFillColor = _rOut.GetFillColor(); Color aOldLineColor = _rOut.GetLineColor(); - long nHLineX = 0 == mvCols[ 0 ]->GetId() ? mvCols[ 0 ]->Width() : 0; + tools::Long nHLineX = 0 == mvCols[ 0 ]->GetId() ? mvCols[ 0 ]->Width() : 0; nHLineX += aOverallAreaPos.X(); Color aDelimiterLineColor( ::svtools::ColorConfig().GetColorValue( ::svtools::CALCGRID ).nColor ); @@ -812,7 +812,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec // get row // check valid area, to be on the safe side: 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 ) + if ( (nTopRow+tools::Long(nRelRow)) < 0 || static_cast<sal_uInt16>(nTopRow+nRelRow) >= nRowCount ) continue; // prepare row @@ -935,11 +935,11 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec _rOut.SetClipRegion(); _rOut.Push( PushFlags::LINECOLOR ); _rOut.SetLineColor( aDelimiterLineColor ); - long nY = aPos.Y() + nDataRowHeigt - 1; + tools::Long nY = aPos.Y() + nDataRowHeigt - 1; if (nY <= aOverallAreaBRPos.Y()) _rOut.DrawLine( Point( nHLineX, nY ), Point( bVLines - ? std::min(long(aPos.X() - 1), aOverallAreaBRPos.X()) + ? std::min(tools::Long(aPos.X() - 1), aOverallAreaBRPos.X()) : aOverallAreaBRPos.X(), nY ) ); _rOut.Pop(); @@ -969,7 +969,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec // draw vertical delimitational line between frozen and scrollable cols _rOut.SetLineColor( COL_BLACK ); - long nFrozenWidth = GetFrozenWidth()-1; + tools::Long nFrozenWidth = GetFrozenWidth()-1; _rOut.DrawLine( Point( aOverallAreaPos.X() + nFrozenWidth, aPos.Y() ), Point( aOverallAreaPos.X() + nFrozenWidth, bHLines ? aPos.Y() - 1 @@ -980,7 +980,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec { _rOut.SetLineColor( aDelimiterLineColor ); Point aVertPos( aOverallAreaPos.X() - 1, aOverallAreaPos.Y() ); - long nDeltaY = aOverallAreaBRPos.Y(); + tools::Long nDeltaY = aOverallAreaBRPos.Y(); for ( size_t nCol = 0; nCol < mvCols.size(); ++nCol ) { // get column @@ -1049,7 +1049,7 @@ void BrowseBox::UpdateScrollbars() nCornerSize = static_cast<sal_uLong>(nCornerSize * static_cast<double>(GetZoom())); bool bNeedsVScroll = false; - long nMaxRows = 0; + tools::Long nMaxRows = 0; if (GetDataRowHeight()) { // needs VScroll? @@ -1134,14 +1134,14 @@ void BrowseBox::UpdateScrollbars() if ( pVScroll->GetThumbPos() != nTopRow ) pVScroll->SetThumbPos( nTopRow ); - long nVisibleSize = std::min( std::min( nRowCount, nMaxRows ), long(nRowCount-nTopRow) ); + tools::Long nVisibleSize = std::min( std::min( nRowCount, nMaxRows ), tools::Long(nRowCount-nTopRow) ); pVScroll->SetVisibleSize( nVisibleSize ? nVisibleSize : 1 ); pVScroll->SetRange( Range( 0, nRowCount ) ); pVScroll->SetPosSizePixel( Point( aDataWinSize.Width(), GetTitleHeight() ), Size( nCornerSize, aDataWinSize.Height()) ); - long nLclDataRowHeight = GetDataRowHeight(); - if ( nLclDataRowHeight > 0 && nRowCount < long( aDataWinSize.Height() / nLclDataRowHeight ) ) + tools::Long nLclDataRowHeight = GetDataRowHeight(); + if ( nLclDataRowHeight > 0 && nRowCount < tools::Long( aDataWinSize.Height() / nLclDataRowHeight ) ) ScrollRows( -nTopRow ); if ( bNeedsVScroll && !pVScroll->IsVisible() ) pVScroll->Show(); @@ -1179,7 +1179,7 @@ void BrowseBox::UpdateScrollbars() // scroll headerbar, if necessary if ( pDataWin->pHeaderBar ) { - long nWidth = 0; + tools::Long nWidth = 0; for ( size_t nCol = 0; nCol < mvCols.size() && nCol < nFirstCol; ++nCol ) @@ -1237,10 +1237,10 @@ bool BrowseBox::GetUpdateMode() const } -long BrowseBox::GetFrozenWidth() const +tools::Long BrowseBox::GetFrozenWidth() const { - long nWidth = 0; + tools::Long nWidth = 0; for ( size_t nCol = 0; nCol < mvCols.size() && mvCols[ nCol ]->IsFrozen(); ++nCol ) @@ -1298,8 +1298,8 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt ) if ( rEvtPos.Y() >= GetTitleHeight() ) return; - long nX = 0; - long nWidth = GetOutputSizePixel().Width(); + tools::Long nX = 0; + tools::Long nWidth = GetOutputSizePixel().Width(); for ( size_t nCol = 0; nCol < mvCols.size() && nX < nWidth; ++nCol ) { // is this column visible? @@ -1307,7 +1307,7 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt ) if ( pCol->IsFrozen() || nCol >= nFirstCol ) { // compute right end of column - long nR = nX + pCol->Width() - 1; + tools::Long nR = nX + pCol->Width() - 1; // at the end of a column (and not handle column)? if ( pCol->GetId() && std::abs( nR - rEvtPos.X() ) < 2 ) @@ -1362,7 +1362,7 @@ void BrowseBox::MouseMove( const MouseEvent& rEvt ) // show resize-pointer? if ( bResizing || ( pCol->GetId() && - std::abs( static_cast<long>(nR) - rEvt.GetPosPixel().X() ) < MIN_COLUMNWIDTH ) ) + std::abs( static_cast<tools::Long>(nR) - rEvt.GetPosPixel().X() ) < MIN_COLUMNWIDTH ) ) { aNewPointer = PointerStyle::HSplit; if ( bResizing ) @@ -1372,7 +1372,7 @@ void BrowseBox::MouseMove( const MouseEvent& rEvt ) // check allowed width and new delta nDragX = std::max( rEvt.GetPosPixel().X(), nMinResizeX ); - long nDeltaX = nDragX - nResizeX; + tools::Long nDeltaX = nDragX - nResizeX; sal_uInt16 nId = GetColumnId(nResizeCol); sal_uLong nOldWidth = GetColumnWidth(nId); nDragX = nOldWidth + nDeltaX + nResizeX - nOldWidth; @@ -1402,12 +1402,12 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt ) // width changed? nDragX = std::max( rEvt.GetPosPixel().X(), nMinResizeX ); - if ( (nDragX - nResizeX) != static_cast<long>(mvCols[ nResizeCol ]->Width()) ) + if ( (nDragX - nResizeX) != static_cast<tools::Long>(mvCols[ nResizeCol ]->Width()) ) { // resize column - long nMaxX = pDataWin->GetSizePixel().Width(); + tools::Long nMaxX = pDataWin->GetSizePixel().Width(); nDragX = std::min( nDragX, nMaxX ); - long nDeltaX = nDragX - nResizeX; + tools::Long nDeltaX = nDragX - nResizeX; sal_uInt16 nId = GetColumnId(nResizeCol); SetColumnWidth( GetColumnId(nResizeCol), GetColumnWidth(nId) + nDeltaX ); ColumnResized( nId ); @@ -1691,7 +1691,7 @@ bool BrowseBox::ProcessKey( const KeyEvent& rEvt ) void BrowseBox::Dispatch( sal_uInt16 nId ) { - long nRowsOnPage = pDataWin->GetSizePixel().Height() / GetDataRowHeight(); + tools::Long nRowsOnPage = pDataWin->GetSizePixel().Height() / GetDataRowHeight(); switch ( nId ) { @@ -1712,7 +1712,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId ) if ( GetRowCount() ) { DoHideCursor( "BROWSER_SELECTHOME" ); - for ( long nRow = GetCurRow(); nRow >= 0; --nRow ) + for ( tools::Long nRow = GetCurRow(); nRow >= 0; --nRow ) SelectRow( nRow ); GoToRow( 0, true ); DoShowCursor( "BROWSER_SELECTHOME" ); @@ -1722,8 +1722,8 @@ void BrowseBox::Dispatch( sal_uInt16 nId ) if ( GetRowCount() ) { DoHideCursor( "BROWSER_SELECTEND" ); - long nRows = GetRowCount(); - for ( long nRow = GetCurRow(); nRow < nRows; ++nRow ) + tools::Long nRows = GetRowCount(); + for ( tools::Long nRow = GetCurRow(); nRow < nRows; ++nRow ) SelectRow( nRow ); GoToRow( GetRowCount() - 1, true ); DoShowCursor( "BROWSER_SELECTEND" ); @@ -1735,7 +1735,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId ) { // deselect the current row, if it isn't the first // and there is no other selected row above - long nRow = GetCurRow(); + tools::Long nRow = GetCurRow(); bool bLocalSelect = ( !IsRowSelected( nRow ) || GetSelectRowCount() == 1 || IsRowSelected( nRow - 1 ) ); SelectRow( nRow, bLocalSelect ); @@ -1752,7 +1752,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId ) { // deselect the current row, if it isn't the first // and there is no other selected row under - long nRow = GetCurRow(); + tools::Long nRow = GetCurRow(); bool bLocalSelect = ( !IsRowSelected( nRow ) || GetSelectRowCount() == 1 || IsRowSelected( nRow + 1 ) ); SelectRow( nCurRow, bLocalSelect ); @@ -1909,8 +1909,8 @@ tools::Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen) pParent = GetAccessibleParentWindow(); Point aTopLeft; - long nWidth; - long nHeight; + tools::Long nWidth; + tools::Long nHeight; if ( _bIsColumnBar ) { nWidth = pDataWin->GetOutputSizePixel().Width(); @@ -1935,8 +1935,8 @@ tools::Rectangle BrowseBox::calcTableRect(bool _bOnScreen) tools::Rectangle aRect( GetWindowExtentsRelative( pParent ) ); tools::Rectangle aRowBar = calcHeaderRect(false, pParent == nullptr); - long nX = aRowBar.Right() - aRect.Left(); - long nY = aRowBar.Top() - aRect.Top(); + tools::Long nX = aRowBar.Right() - aRect.Left(); + tools::Long nY = aRowBar.Top() - aRect.Top(); Size aSize(aRect.GetSize()); return tools::Rectangle(aRowBar.TopRight(), Size(aSize.Width() - nX, aSize.Height() - nY - GetBarHeight()) ); diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index e6148aa217ce..9227c0f8570a 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -395,7 +395,7 @@ void BrowseBox::GrabTableFocus() GrabFocus(); } -OUString BrowseBox::GetCellText(long, sal_uInt16 ) const +OUString BrowseBox::GetCellText(tools::Long, sal_uInt16 ) const { SAL_WARN("svtools", "This method has to be implemented by the derived classes! BUG!!"); return OUString(); @@ -459,7 +459,7 @@ void BrowseBox::SelectColumn( sal_uInt16 _nColumn, bool _bSelect ) SelectColumnPos( _nColumn, _bSelect ); } -bool BrowseBox::IsColumnSelected( long _nColumn ) const +bool BrowseBox::IsColumnSelected( tools::Long _nColumn ) const { return ( pColSel && (0 <= _nColumn) && (_nColumn <= 0xFFF) ) && pColSel->IsSelected( static_cast< sal_uInt16 >( _nColumn ) ); @@ -520,7 +520,7 @@ bool BrowseBox::IsCellVisible( sal_Int32 _nRow, sal_uInt16 _nColumnPos ) const return IsFieldVisible( _nRow, GetColumnId( _nColumnPos ) ); } -OUString BrowseBox::GetAccessibleCellText(long _nRow, sal_uInt16 _nColPos) const +OUString BrowseBox::GetAccessibleCellText(tools::Long _nRow, sal_uInt16 _nColPos) const { return GetCellText( _nRow, GetColumnId( _nColPos ) ); } diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx index fa42bfe293c3..86ed55d0dfce 100644 --- a/svtools/source/brwbox/brwhead.cxx +++ b/svtools/source/brwbox/brwhead.cxx @@ -27,7 +27,7 @@ BrowserHeader::BrowserHeader( BrowseBox* pParent, WinBits nWinBits ) :HeaderBar( pParent, nWinBits ) ,_pBrowseBox( pParent ) { - long nHeight = pParent->IsZoom() ? pParent->CalcZoom(pParent->GetTitleHeight()) : pParent->GetTitleHeight(); + tools::Long nHeight = pParent->IsZoom() ? pParent->CalcZoom(pParent->GetTitleHeight()) : pParent->GetTitleHeight(); SetPosSizePixel( Point( 0, 0), Size( pParent->GetOutputSizePixel().Width(), diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx index 80350e4a31cb..f4cc3a7ce65c 100644 --- a/svtools/source/brwbox/datwin.cxx +++ b/svtools/source/brwbox/datwin.cxx @@ -99,7 +99,7 @@ BrowserColumn::BrowserColumn( sal_uInt16 nItemId, if (!rCurrentZoom.GetNumerator()) throw o3tl::divide_by_zero(); n /= static_cast<double>(rCurrentZoom.GetNumerator()); - _nOriginalWidth = n>0 ? static_cast<long>(n+0.5) : -static_cast<long>(-n+0.5); + _nOriginalWidth = n>0 ? static_cast<tools::Long>(n+0.5) : -static_cast<tools::Long>(-n+0.5); } BrowserColumn::~BrowserColumn() @@ -122,7 +122,7 @@ void BrowserColumn::SetWidth(sal_uLong nNewWidthPixel, const Fraction& rCurrentZ if (!rCurrentZoom.GetNumerator()) throw o3tl::divide_by_zero(); n /= static_cast<double>(rCurrentZoom.GetNumerator()); - _nOriginalWidth = n>0 ? static_cast<long>(n+0.5) : -static_cast<long>(-n+0.5); + _nOriginalWidth = n>0 ? static_cast<tools::Long>(n+0.5) : -static_cast<tools::Long>(-n+0.5); } } @@ -153,7 +153,7 @@ void BrowserColumn::Draw( BrowseBox const & rBox, OutputDevice& rDev, const Poin else { // paint data column - long nWidth = Width() == LONG_MAX ? rBox.GetDataWindow().GetSizePixel().Width() : Width(); + tools::Long nWidth = Width() == LONG_MAX ? rBox.GetDataWindow().GetSizePixel().Width() : Width(); rBox.DoPaintField( rDev, tools::Rectangle( @@ -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 ? static_cast<long>(n+0.5) : -static_cast<long>(-n+0.5); + _nWidth = n>0 ? static_cast<tools::Long>(n+0.5) : -static_cast<tools::Long>(-n+0.5); } @@ -298,14 +298,14 @@ BrowseEvent BrowserDataWin::CreateBrowseEvent( const Point& rPosPixel ) BrowseBox *pBox = GetParent(); // seek to row under mouse - long nRelRow = rPosPixel.Y() < 0 + tools::Long nRelRow = rPosPixel.Y() < 0 ? -1 : rPosPixel.Y() / pBox->GetDataRowHeight(); - long nRow = nRelRow < 0 ? -1 : nRelRow + pBox->nTopRow; + tools::Long nRow = nRelRow < 0 ? -1 : nRelRow + pBox->nTopRow; // find column under mouse - long nMouseX = rPosPixel.X(); - long nColX = 0; + tools::Long nMouseX = rPosPixel.X(); + tools::Long nColX = 0; size_t nCol; for ( nCol = 0; nCol < pBox->mvCols.size() && nColX < GetSizePixel().Width(); @@ -376,7 +376,7 @@ void BrowserDataWin::Command( const CommandEvent& rEvt ) return; Point aEventPos( rEvt.GetMousePosPixel() ); - long nRow = pBox->GetRowAtYPosPixel( aEventPos.Y(), false); + tools::Long nRow = pBox->GetRowAtYPosPixel( aEventPos.Y(), false); MouseEvent aMouseEvt( aEventPos, 1, MouseEventModifiers::SELECT, MOUSE_LEFT ); if ( CommandEventId::ContextMenu == rEvt.GetCommand() && rEvt.IsMouseEvent() && nRow < pBox->GetRowCount() && !pBox->IsRowSelected(nRow) ) @@ -417,7 +417,7 @@ bool BrowserDataWin::ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent ) ) return false; - long nDividerDistance = GetParent()->GetDataRowHeight() - ( _rEvent.GetPosPixel().Y() % GetParent()->GetDataRowHeight() ); + tools::Long nDividerDistance = GetParent()->GetDataRowHeight() - ( _rEvent.GetPosPixel().Y() % GetParent()->GetDataRowHeight() ); return ( nDividerDistance <= 4 ); } @@ -495,9 +495,9 @@ void BrowserDataWin::MouseButtonUp( const MouseEvent& rEvt ) void BrowserDataWin::StartRowDividerDrag( const Point& _rStartPos ) { - long nDataRowHeight = GetParent()->GetDataRowHeight(); + tools::Long nDataRowHeight = GetParent()->GetDataRowHeight(); // the exact separation pos of the two rows - long nDragRowDividerCurrentPos = _rStartPos.Y(); + tools::Long nDragRowDividerCurrentPos = _rStartPos.Y(); if ( ( nDragRowDividerCurrentPos % nDataRowHeight ) > nDataRowHeight / 2 ) nDragRowDividerCurrentPos += nDataRowHeight; nDragRowDividerCurrentPos /= nDataRowHeight; @@ -535,7 +535,7 @@ void BrowserDataWin::Tracking( const TrackingEvent& rTEvt ) if ( !rTEvt.IsTrackingCanceled() ) { - long nNewRowHeight = aMousePos.Y() + m_nDragRowDividerOffset - m_nDragRowDividerLimit; + tools::Long nNewRowHeight = aMousePos.Y() + m_nDragRowDividerOffset - m_nDragRowDividerLimit; // care for minimum row height if ( nNewRowHeight < GetParent()->QueryMinimumRowHeight() ) @@ -547,7 +547,7 @@ void BrowserDataWin::Tracking( const TrackingEvent& rTEvt ) } else { - long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset; + tools::Long nDragRowDividerCurrentPos = aMousePos.Y() + m_nDragRowDividerOffset; // care for minimum row height if ( nDragRowDividerCurrentPos < m_nDragRowDividerLimit + GetParent()->QueryMinimumRowHeight() ) @@ -574,7 +574,7 @@ void BrowserDataWin::RequestHelp( const HelpEvent& rHEvt ) BrowseEvent::BrowseEvent( vcl::Window* pWindow, - long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, + tools::Long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, const tools::Rectangle& rRect ): pWin(pWindow), nRow(nAbsRow), @@ -594,7 +594,7 @@ BrowserMouseEvent::BrowserMouseEvent( BrowserDataWin *pWindow, BrowserMouseEvent::BrowserMouseEvent( vcl::Window *pWindow, const MouseEvent& rEvt, - long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, + tools::Long nAbsRow, sal_uInt16 nColumn, sal_uInt16 nColumnId, const tools::Rectangle& rRect ): MouseEvent(rEvt), BrowseEvent( pWindow, nAbsRow, nColumn, nColumnId, rRect ) diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index 996b68b4b194..1c451fa95943 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -196,7 +196,7 @@ namespace svt } - bool EditBrowseBox::SeekRow(long nRow) + bool EditBrowseBox::SeekRow(tools::Long nRow) { nPaintRow = nRow; return true; @@ -364,7 +364,7 @@ namespace svt } - EditBrowseBox::RowStatus EditBrowseBox::GetRowStatus(long) const + EditBrowseBox::RowStatus EditBrowseBox::GetRowStatus(tools::Long) const { return CLEAN; } @@ -770,7 +770,7 @@ namespace svt } - bool EditBrowseBox::IsCursorMoveAllowed(long nNewRow, sal_uInt16 nNewColId) const + bool EditBrowseBox::IsCursorMoveAllowed(tools::Long nNewRow, sal_uInt16 nNewColId) const { sal_uInt16 nInfo = 0; @@ -874,7 +874,7 @@ namespace svt } - bool EditBrowseBox::CursorMoving(long, sal_uInt16) + bool EditBrowseBox::CursorMoving(tools::Long, sal_uInt16) { DeactivateCell(false); return true; @@ -883,7 +883,7 @@ namespace svt void EditBrowseBox::CursorMoved() { - long nNewRow = GetCurRow(); + tools::Long nNewRow = GetCurRow(); if (nEditRow != nNewRow) { if (!(GetBrowserFlags() & EditBrowseBoxFlags::NO_HANDLE_COLUMN_CONTENT)) @@ -909,7 +909,7 @@ namespace svt } - void EditBrowseBox::ActivateCell(long nRow, sal_uInt16 nCol, bool bCellFocus) + void EditBrowseBox::ActivateCell(tools::Long nRow, sal_uInt16 nCol, bool bCellFocus) { if (IsEditing()) return; @@ -992,7 +992,7 @@ namespace svt } - tools::Rectangle EditBrowseBox::GetCellRect(long nRow, sal_uInt16 nColId, bool bRel) const + tools::Rectangle EditBrowseBox::GetCellRect(tools::Long nRow, sal_uInt16 nColId, bool bRel) const { tools::Rectangle aRect( GetFieldRectPixel(nRow, nColId, bRel)); if ((GetMode() & BrowserMode::CURSOR_WO_FOCUS) == BrowserMode::CURSOR_WO_FOCUS) @@ -1060,7 +1060,7 @@ namespace svt DBG_ASSERT(nId, "EditBrowseBox::AppendColumn: invalid id!"); - long w = nWidth; + tools::Long w = nWidth; if (!w) w = GetDefaultColumnWidth(rName); @@ -1102,7 +1102,7 @@ namespace svt { } - CellController* EditBrowseBox::GetController(long, sal_uInt16) + CellController* EditBrowseBox::GetController(tools::Long, sal_uInt16) { return nullptr; } @@ -1122,7 +1122,7 @@ namespace svt rControl.SetPosSizePixel(aPoint, aSize); } - void EditBrowseBox::InitController(CellControllerRef&, long, sal_uInt16) + void EditBrowseBox::InitController(CellControllerRef&, tools::Long, sal_uInt16) { } @@ -1152,12 +1152,12 @@ namespace svt sal_uInt32 nCurColWidth = GetColumnWidth(nColId); sal_uInt32 nMinColWidth = CalcZoom(20); // minimum sal_uInt32 nNewColWidth = nMinColWidth; - long nMaxRows = std::min(long(GetVisibleRows()), GetRowCount()); - long nLastVisRow = GetTopRow() + nMaxRows - 1; + tools::Long nMaxRows = std::min(tools::Long(GetVisibleRows()), GetRowCount()); + tools::Long nLastVisRow = GetTopRow() + nMaxRows - 1; if (GetTopRow() <= nLastVisRow) // calc the column with using the cell contents { - for (long i = GetTopRow(); i <= nLastVisRow; ++i) + for (tools::Long i = GetTopRow(); i <= nLastVisRow; ++i) nNewColWidth = std::max(nNewColWidth,GetTotalCellWidth(i,nColId) + 12); if (nNewColWidth == nCurColWidth) // size has not changed @@ -1168,7 +1168,7 @@ namespace svt return nNewColWidth; } - sal_uInt32 EditBrowseBox::GetTotalCellWidth(long, sal_uInt16) + sal_uInt32 EditBrowseBox::GetTotalCellWidth(tools::Long, sal_uInt16) { return 0; } diff --git a/svtools/source/brwbox/editbrowsebox2.cxx b/svtools/source/brwbox/editbrowsebox2.cxx index 51f58e320703..fece6c6dc0a0 100644 --- a/svtools/source/brwbox/editbrowsebox2.cxx +++ b/svtools/source/brwbox/editbrowsebox2.cxx @@ -35,7 +35,7 @@ namespace svt using namespace ::com::sun::star::accessibility::AccessibleEventId; -Reference< XAccessible > EditBrowseBox::CreateAccessibleCheckBoxCell(long _nRow, sal_uInt16 _nColumnPos,const TriState& eState) +Reference< XAccessible > EditBrowseBox::CreateAccessibleCheckBoxCell(tools::Long _nRow, sal_uInt16 _nColumnPos,const TriState& eState) { Reference< XAccessible > xAccessible( GetAccessible() ); Reference< XAccessibleContext > xAccContext; @@ -143,7 +143,7 @@ void EditBrowseBox::DetermineFocus( const GetFocusFlags _nGetFocusFlags ) ) return; - long nRows = GetRowCount(); + tools::Long nRows = GetRowCount(); sal_uInt16 nCols = ColCount(); if (( nRows <= 0 ) || ( nCols <= 0 )) diff --git a/svtools/source/config/printoptions.cxx b/svtools/source/config/printoptions.cxx index afcd07108e6c..e7d7ce991429 100644 --- a/svtools/source/config/printoptions.cxx +++ b/svtools/source/config/printoptions.cxx @@ -424,7 +424,7 @@ void SvtBasePrintOptions::SetPrinterOptions( const PrinterOptions& rOptions ) SetReducedBitmapResolution( 0 ); else { - for( long i = DPI_COUNT - 1; i >= 0; i-- ) + for( tools::Long i = DPI_COUNT - 1; i >= 0; i-- ) { if( nDPI >= aDPIArray[ i ] ) { diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 7a5d73e3135c..180fe6a9661b 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -84,15 +84,15 @@ bool BorderWidthImpl::operator== ( const BorderWidthImpl& r ) const ( m_nRateGap == r.m_nRateGap ); } -long BorderWidthImpl::GetLine1( long nWidth ) const +tools::Long BorderWidthImpl::GetLine1( tools::Long nWidth ) const { - long result = static_cast<long>(m_nRate1); + tools::Long result = static_cast<tools::Long>(m_nRate1); if ( m_nFlags & BorderWidthImplFlags::CHANGE_LINE1 ) { - long const nConstant2 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE2) ? 0 : m_nRate2; - long const nConstantD = (m_nFlags & BorderWidthImplFlags::CHANGE_DIST ) ? 0 : m_nRateGap; + tools::Long const nConstant2 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE2) ? 0 : m_nRate2; + tools::Long const nConstantD = (m_nFlags & BorderWidthImplFlags::CHANGE_DIST ) ? 0 : m_nRateGap; result = std::max<long>(0, - static_cast<long>((m_nRate1 * nWidth) + 0.5) + static_cast<tools::Long>((m_nRate1 * nWidth) + 0.5) - (nConstant2 + nConstantD)); if (result == 0 && m_nRate1 > 0.0 && nWidth > 0) { // fdo#51777: hack to essentially treat 1 twip DOUBLE border @@ -102,29 +102,29 @@ long BorderWidthImpl::GetLine1( long nWidth ) const return result; } -long BorderWidthImpl::GetLine2( long nWidth ) const +tools::Long BorderWidthImpl::GetLine2( tools::Long nWidth ) const { - long result = static_cast<long>(m_nRate2); + tools::Long result = static_cast<tools::Long>(m_nRate2); if ( m_nFlags & BorderWidthImplFlags::CHANGE_LINE2) { - long const nConstant1 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE1) ? 0 : m_nRate1; - long const nConstantD = (m_nFlags & BorderWidthImplFlags::CHANGE_DIST ) ? 0 : m_nRateGap; + tools::Long const nConstant1 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE1) ? 0 : m_nRate1; + tools::Long const nConstantD = (m_nFlags & BorderWidthImplFlags::CHANGE_DIST ) ? 0 : m_nRateGap; result = std::max<long>(0, - static_cast<long>((m_nRate2 * nWidth) + 0.5) + static_cast<tools::Long>((m_nRate2 * nWidth) + 0.5) - (nConstant1 + nConstantD)); } return result; } -long BorderWidthImpl::GetGap( long nWidth ) const +tools::Long BorderWidthImpl::GetGap( tools::Long nWidth ) const { - long result = static_cast<long>(m_nRateGap); + tools::Long result = static_cast<tools::Long>(m_nRateGap); if ( m_nFlags & BorderWidthImplFlags::CHANGE_DIST ) { - long const nConstant1 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE1) ? 0 : m_nRate1; - long const nConstant2 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE2) ? 0 : m_nRate2; + tools::Long const nConstant1 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE1) ? 0 : m_nRate1; + tools::Long const nConstant2 = (m_nFlags & BorderWidthImplFlags::CHANGE_LINE2) ? 0 : m_nRate2; result = std::max<long>(0, - static_cast<long>((m_nRateGap * nWidth) + 0.5) + static_cast<tools::Long>((m_nRateGap * nWidth) + 0.5) - (nConstant1 + nConstant2)); } @@ -135,7 +135,7 @@ long BorderWidthImpl::GetGap( long nWidth ) const return result; } -static double lcl_getGuessedWidth( long nTested, double nRate, bool bChanging ) +static double lcl_getGuessedWidth( tools::Long nTested, double nRate, bool bChanging ) { double nWidth = -1.0; if ( bChanging ) @@ -149,7 +149,7 @@ static double lcl_getGuessedWidth( long nTested, double nRate, bool bChanging ) return nWidth; } -long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap ) +tools::Long BorderWidthImpl::GuessWidth( tools::Long nLine1, tools::Long nLine2, tools::Long nGap ) { std::vector< double > aToCompare; bool bInvalid = false; @@ -196,12 +196,12 @@ long BorderWidthImpl::GuessWidth( long nLine1, long nLine2, long nGap ) return nWidth; } -static void lclDrawPolygon( OutputDevice& rDev, const basegfx::B2DPolygon& rPolygon, long nWidth, SvxBorderLineStyle nDashing ) +static void lclDrawPolygon( OutputDevice& rDev, const basegfx::B2DPolygon& rPolygon, tools::Long nWidth, SvxBorderLineStyle nDashing ) { AntialiasingFlags nOldAA = rDev.GetAntialiasing(); rDev.SetAntialiasing( nOldAA & ~AntialiasingFlags::Enable ); - long nPix = rDev.PixelToLogic(Size(1, 1)).Width(); + tools::Long nPix = rDev.PixelToLogic(Size(1, 1)).Width(); basegfx::B2DPolyPolygon aPolygons = svtools::ApplyLineDashing(rPolygon, nDashing, nPix); // Handle problems of width 1px in Pixel mode: 0.5px gives a 1px line @@ -527,9 +527,9 @@ IMPL_LINK_NOARG(FontNameBox, CustomGetSizeHdl, OutputDevice&, Size) namespace { - long shrinkFontToFit(OUString const &rSampleText, long nH, vcl::Font &rFont, OutputDevice &rDevice, tools::Rectangle &rTextRect) + tools::Long shrinkFontToFit(OUString const &rSampleText, tools::Long nH, vcl::Font &rFont, OutputDevice &rDevice, tools::Rectangle &rTextRect) { - long nWidth = 0; + tools::Long nWidth = 0; Size aSize( rFont.GetFontSize() ); @@ -575,8 +575,8 @@ static void DrawPreview(const FontMetric& rFontMetric, const Point& rTopLeft, Ou else rDevice.SetTextColor(rStyleSettings.GetDialogTextColor()); - long nX = rTopLeft.X(); - long nH = gUserItemSz.Height(); + tools::Long nX = rTopLeft.X(); + tools::Long nH = gUserItemSz.Height(); nX += IMGOUTERTEXTSPACE; @@ -610,12 +610,12 @@ static void DrawPreview(const FontMetric& rFontMetric, const Point& rTopLeft, Ou rDevice.GetTextBoundRect(aTextRect, sFontName); } - long nTextHeight = aTextRect.GetHeight(); - long nDesiredGap = (nH-nTextHeight)/2; - long nVertAdjust = nDesiredGap - aTextRect.Top(); + tools::Long nTextHeight = aTextRect.GetHeight(); + tools::Long nDesiredGap = (nH-nTextHeight)/2; + tools::Long nVertAdjust = nDesiredGap - aTextRect.Top(); Point aPos( nX, rTopLeft.Y() + nVertAdjust ); rDevice.DrawText(aPos, sFontName); - long nTextX = aPos.X() + aTextRect.GetWidth() + GAPTOEXTRAPREVIEW; + tools::Long nTextX = aPos.X() + aTextRect.GetWidth() + GAPTOEXTRAPREVIEW; if (!bUsingCorrectFont) rDevice.SetFont(aFont); @@ -716,11 +716,11 @@ static void DrawPreview(const FontMetric& rFontMetric, const Point& rTopLeft, Ou const Size &rItemSize = gUserItemSz; //leave a little border at the edge - long nSpace = rItemSize.Width() - nTextX - IMGOUTERTEXTSPACE; + tools::Long nSpace = rItemSize.Width() - nTextX - IMGOUTERTEXTSPACE; if (nSpace >= 0) { //Make sure it fits in the available height, and get how wide that would be - long nWidth = shrinkFontToFit(sSampleText, nH, aFont, rDevice, aTextRect); + tools::Long nWidth = shrinkFontToFit(sSampleText, nH, aFont, rDevice, aTextRect); //Chop letters off until it fits in the available width while (nWidth > nSpace || nWidth > gUserItemSz.Width()) { @@ -1349,7 +1349,7 @@ namespace } } -void SvtLineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, +void SvtLineListBox::ImpGetLine( tools::Long nLine1, tools::Long nLine2, tools::Long nDistance, Color aColor1, Color aColor2, Color aColorDist, SvxBorderLineStyle nStyle, BitmapEx& rBmp ) { @@ -1365,10 +1365,10 @@ void SvtLineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, // Paint the lines aSize = aVirDev->PixelToLogic( aSize ); - long nPix = aVirDev->PixelToLogic( Size( 0, 1 ) ).Height(); + tools::Long nPix = aVirDev->PixelToLogic( Size( 0, 1 ) ).Height(); sal_uInt32 n1 = nLine1; sal_uInt32 n2 = nLine2; - long nDist = nDistance; + tools::Long nDist = nDistance; n1 += nPix-1; n1 -= n1%nPix; if ( n2 ) @@ -1378,7 +1378,7 @@ void SvtLineListBox::ImpGetLine( long nLine1, long nLine2, long nDistance, n2 += nPix-1; n2 -= n2%nPix; } - long nVirHeight = n1+nDist+n2; + tools::Long nVirHeight = n1+nDist+n2; if ( nVirHeight > aSize.Height() ) aSize.setHeight( nVirHeight ); // negative width should not be drawn @@ -1517,7 +1517,7 @@ void SvtLineListBox::SelectEntry(SvxBorderLineStyle nStyle) } void SvtLineListBox::InsertEntry( - const BorderWidthImpl& rWidthImpl, SvxBorderLineStyle nStyle, long nMinWidth, + const BorderWidthImpl& rWidthImpl, SvxBorderLineStyle nStyle, tools::Long nMinWidth, ColorFunc pColor1Fn, ColorFunc pColor2Fn, ColorDistFunc pColorDistFn ) { m_vLineList.emplace_back(new ImpLineListData( diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 9dbd922ef186..8f07a60091c3 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -768,7 +768,7 @@ const int* FontList::GetSizeAry( const FontMetric& rInfo ) const pDevice->SetMapMode( aMap ); int nRealCount = 0; - long nOldHeight = 0; + tools::Long nOldHeight = 0; mpSizeAry.reset(new int[nDevSizeCount+1] ); for (int i = 0; i < nDevSizeCount; ++i) { @@ -840,7 +840,7 @@ sal_Int32 FontSizeNames::Name2Size( const OUString& rName ) const RTL_TEXTENCODING_UTF8)); // linear search is sufficient for this rare case - for( long i = mnElem; --i >= 0; ) + for( tools::Long i = mnElem; --i >= 0; ) if ( aName == mpArray[i].mszUtf8Name ) return mpArray[i].mnSize; } @@ -853,9 +853,9 @@ OUString FontSizeNames::Size2Name( sal_Int32 nValue ) const OUString aStr; // binary search - for( long lower = 0, upper = mnElem - 1; lower <= upper; ) + for( tools::Long lower = 0, upper = mnElem - 1; lower <= upper; ) { - long mid = (upper + lower) >> 1; + tools::Long mid = (upper + lower) >> 1; if ( nValue == mpArray[mid].mnSize ) { aStr = OUString( mpArray[mid].mszUtf8Name, strlen(mpArray[mid].mszUtf8Name), RTL_TEXTENCODING_UTF8 ); diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx index d23264972ce8..20d40364f0a3 100644 --- a/svtools/source/control/ruler.cxx +++ b/svtools/source/control/ruler.cxx @@ -105,17 +105,17 @@ private: vector<RulerIndent> pIndents; vector<RulerTab> pTabs; - long nNullVirOff; - long nRulVirOff; - long nRulWidth; - long nPageOff; - long nPageWidth; - long nNullOff; - long nMargin1; - long nMargin2; + tools::Long nNullVirOff; + tools::Long nRulVirOff; + tools::Long nRulWidth; + tools::Long nPageOff; + tools::Long nPageWidth; + tools::Long nNullOff; + tools::Long nMargin1; + tools::Long nMargin2; // In this context, "frame margin" means paragraph margins (indents) - long nLeftFrameMargin; - long nRightFrameMargin; + tools::Long nLeftFrameMargin; + tools::Long nRightFrameMargin; RulerMarginStyle nMargin1Style; RulerMarginStyle nMargin2Style; bool bAutoPageWidth; @@ -236,7 +236,7 @@ void Ruler::ImplInit( WinBits nWinBits ) // Setup the default size tools::Rectangle aRect; GetTextBoundRect( aRect, "0123456789" ); - long nDefHeight = aRect.GetHeight() + RULER_OFF * 2 + ruler_tab.textoff * 2 + mnBorderWidth; + tools::Long nDefHeight = aRect.GetHeight() + RULER_OFF * 2 + ruler_tab.textoff * 2 + mnBorderWidth; Size aDefSize; if ( nWinBits & WB_HORZ ) @@ -295,7 +295,7 @@ void Ruler::dispose() Window::dispose(); } -void Ruler::ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2) +void Ruler::ImplVDrawLine(vcl::RenderContext& rRenderContext, tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) { if ( nX1 < -RULER_CLIP ) { @@ -303,7 +303,7 @@ void Ruler::ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1 if ( nX2 < -RULER_CLIP ) return; } - long nClip = mnVirWidth + RULER_CLIP; + tools::Long nClip = mnVirWidth + RULER_CLIP; if ( nX2 > nClip ) { nX2 = nClip; @@ -317,7 +317,7 @@ void Ruler::ImplVDrawLine(vcl::RenderContext& rRenderContext, long nX1, long nY1 rRenderContext.DrawLine( Point( nY1, nX1 ), Point( nY2, nX2 ) ); } -void Ruler::ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1, long nX2, long nY2) +void Ruler::ImplVDrawRect(vcl::RenderContext& rRenderContext, tools::Long nX1, tools::Long nY1, tools::Long nX2, tools::Long nY2) { if ( nX1 < -RULER_CLIP ) { @@ -325,7 +325,7 @@ void Ruler::ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1 if ( nX2 < -RULER_CLIP ) return; } - long nClip = mnVirWidth + RULER_CLIP; + tools::Long nClip = mnVirWidth + RULER_CLIP; if ( nX2 > nClip ) { nX2 = nClip; @@ -339,15 +339,15 @@ void Ruler::ImplVDrawRect(vcl::RenderContext& rRenderContext, long nX1, long nY1 rRenderContext.DrawRect(tools::Rectangle(nY1, nX1, nY2, nX2)); } -void Ruler::ImplVDrawText(vcl::RenderContext& rRenderContext, long nX, long nY, const OUString& rText, long nMin, long nMax) +void Ruler::ImplVDrawText(vcl::RenderContext& rRenderContext, tools::Long nX, tools::Long nY, const OUString& rText, tools::Long nMin, tools::Long nMax) { tools::Rectangle aRect; SalLayoutGlyphs* pTextLayout = lcl_GetRulerTextGlyphs(rRenderContext, rText, maTextGlyphs[rText]); rRenderContext.GetTextBoundRect(aRect, rText, 0, 0, -1, 0, nullptr, pTextLayout); - long nShiftX = ( aRect.GetWidth() / 2 ) + aRect.Left(); - long nShiftY = ( aRect.GetHeight() / 2 ) + aRect.Top(); + tools::Long nShiftX = ( aRect.GetWidth() / 2 ) + aRect.Left(); + tools::Long nShiftY = ( aRect.GetHeight() / 2 ) + aRect.Top(); if ( (nX > -RULER_CLIP) && (nX < mnVirWidth + RULER_CLIP) && ( nX < nMax - nShiftX ) && ( nX > nMin + nShiftX ) ) { @@ -366,10 +366,10 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext) if (mpData->pLines.empty() || !mbActive || mbDrag || mbFormat || (mnUpdateFlags & RULER_UPDATE_LINES) ) return; - long nNullWinOff = mpData->nNullVirOff + mnVirOff; - long nRulX1 = mpData->nRulVirOff + mnVirOff; - long nRulX2 = nRulX1 + mpData->nRulWidth; - long nY = (RULER_OFF * 2) + mnVirHeight - 1; + tools::Long nNullWinOff = mpData->nNullVirOff + mnVirOff; + tools::Long nRulX1 = mpData->nRulVirOff + mnVirOff; + tools::Long nRulX2 = nRulX1 + mpData->nRulWidth; + tools::Long nY = (RULER_OFF * 2) + mnVirHeight - 1; // Calculate rectangle tools::Rectangle aRect; @@ -381,7 +381,7 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext) // Draw lines for (const RulerLine & rLine : mpData->pLines) { - const long n = rLine.nPos + nNullWinOff; + const tools::Long n = rLine.nPos + nNullWinOff; if ((n >= nRulX1) && (n < nRulX2)) { if (mnWinStyle & WB_HORZ ) @@ -420,22 +420,22 @@ void Ruler::ImplInvertLines(vcl::RenderContext& rRenderContext) mnUpdateFlags = 0; } -void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nStart, long nTop, long nBottom) +void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, tools::Long nMin, tools::Long nMax, tools::Long nStart, tools::Long nTop, tools::Long nBottom) { double nCenter = nTop + ((nBottom - nTop) / 2); - long nTickLength3 = (nBottom - nTop) * 0.5; - long nTickLength2 = nTickLength3 * 0.66; - long nTickLength1 = nTickLength2 * 0.66; + tools::Long nTickLength3 = (nBottom - nTop) * 0.5; + tools::Long nTickLength2 = nTickLength3 * 0.66; + tools::Long nTickLength1 = nTickLength2 * 0.66; - long nScale = ruler_tab.DPIScaleFactor; - long DPIOffset = nScale - 1; + tools::Long nScale = ruler_tab.DPIScaleFactor; + tools::Long DPIOffset = nScale - 1; double nTick4 = aImplRulerUnitTab[mnUnitIndex].nTick4; double nTick2 = 0; double nTickCount = aImplRulerUnitTab[mnUnitIndex].nTick1 / nScale; double nTickUnit = 0; - long nTickWidth; + tools::Long nTickWidth; bool bNoTicks = false; Size aPixSize = rRenderContext.LogicToPixel(Size(nTick4, nTick4), maMapMode); @@ -474,7 +474,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM nTickWidth = aPixSize.Height(); } - long nMaxWidth = rRenderContext.PixelToLogic(Size(mpData->nPageWidth, 0), maMapMode).Width(); + tools::Long nMaxWidth = rRenderContext.PixelToLogic(Size(mpData->nPageWidth, 0), maMapMode).Width(); if (nMaxWidth < 0) nMaxWidth = -nMaxWidth; @@ -484,8 +484,8 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM nMaxWidth /= aImplRulerUnitTab[mnUnitIndex].nTickUnit; OUString aNumString = OUString::number(nMaxWidth); - long nTxtWidth = rRenderContext.GetTextWidth( aNumString ); - const long nTextOff = 4; + tools::Long nTxtWidth = rRenderContext.GetTextWidth( aNumString ); + const tools::Long nTextOff = 4; // Determine the number divider for ruler drawn numbers - means which numbers // should be shown on the ruler and which should be skipped because the ruler @@ -493,12 +493,12 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM if (nTickWidth < nTxtWidth + nTextOff) { // Calculate the scale of the ruler - long nMulti = 1; - long nOrgTick4 = nTick4; + tools::Long nMulti = 1; + tools::Long nOrgTick4 = nTick4; while (nTickWidth < nTxtWidth + nTextOff) { - long nOldMulti = nMulti; + tools::Long nOldMulti = nMulti; if (nTickWidth == 0) nMulti *= 10; else if (nMulti < 10) @@ -534,7 +534,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM if (bNoTicks) return; - long n = 0; + tools::Long n = 0; double nTick = 0.0; double nTick3 = 0; @@ -547,11 +547,11 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM Size nTickGapSize; nTickGapSize = rRenderContext.LogicToPixel(Size(nTickCount, nTickCount), maMapMode); - long nTickGap1 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height(); + tools::Long nTickGap1 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height(); nTickGapSize = rRenderContext.LogicToPixel(Size(nTick2, nTick2), maMapMode); - long nTickGap2 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height(); + tools::Long nTickGap2 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height(); nTickGapSize = rRenderContext.LogicToPixel(Size(nTick3, nTick3), maMapMode); - long nTickGap3 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height(); + tools::Long nTickGap3 = mnWinStyle & WB_HORZ ? nTickGapSize.Width() : nTickGapSize.Height(); while (((nStart - n) >= nMin) || ((nStart + n) <= nMax)) { @@ -589,7 +589,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM else aNumString = OUString::number(nTick / aImplRulerUnitTab[mnUnitIndex].nTickUnit); - long nHorizontalLocation = nStart + n; + tools::Long nHorizontalLocation = nStart + n; ImplVDrawText(rRenderContext, nHorizontalLocation, nCenter, aNumString, nMin, nMax); if (nMin < nHorizontalLocation && nHorizontalLocation < nMax) @@ -612,7 +612,7 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM // Tick/Tick2 - Output (Strokes) else { - long nTickLength = nTickLength1; + tools::Long nTickLength = nTickLength1; aStep = (nTick / nTick2); aRest = std::abs(aStep - std::floor(aStep)); @@ -628,9 +628,9 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM (nTickLength == nTickLength2 && nTickGap2 > 6) || (nTickLength == nTickLength3 && nTickGap3 > 6)) { - long nT1 = nCenter - (nTickLength / 2.0); - long nT2 = nT1 + nTickLength - 1; - long nT; + tools::Long nT1 = nCenter - (nTickLength / 2.0); + tools::Long nT2 = nT1 + nTickLength - 1; + tools::Long nT; nT = nStart + n; @@ -646,14 +646,14 @@ void Ruler::ImplDrawTicks(vcl::RenderContext& rRenderContext, long nMin, long nM } } -void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nVirTop, long nVirBottom) +void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, tools::Long nMin, tools::Long nMax, tools::Long nVirTop, tools::Long nVirBottom) { const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - long n; - long n1; - long n2; - long nTemp1; - long nTemp2; + tools::Long n; + tools::Long n1; + tools::Long n2; + tools::Long nTemp1; + tools::Long nTemp2; for (std::vector<RulerBorder>::size_type i = 0; i < mpData->pBorders.size(); i++) { @@ -689,9 +689,9 @@ void Ruler::ImplDrawBorders(vcl::RenderContext& rRenderContext, long nMin, long { nTemp1 = n1 + (((n2 - n1 + 1) - RULER_VAR_SIZE) / 2); nTemp2 = nVirTop + (((nVirBottom - nVirTop + 1) - RULER_VAR_SIZE) / 2); - long nTemp3 = nTemp1 + RULER_VAR_SIZE - 1; - long nTemp4 = nTemp2 + RULER_VAR_SIZE - 1; - long nTempY = nTemp2; + tools::Long nTemp3 = nTemp1 + RULER_VAR_SIZE - 1; + tools::Long nTemp4 = nTemp2 + RULER_VAR_SIZE - 1; + tools::Long nTempY = nTemp2; rRenderContext.SetLineColor(rStyleSettings.GetLightColor()); while (nTempY <= nTemp4) @@ -749,11 +749,11 @@ void Ruler::ImplDrawIndent(vcl::RenderContext& rRenderContext, const tools::Poly rRenderContext.DrawPolygon(aPolygon); } -void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nVirTop, long nVirBottom) +void Ruler::ImplDrawIndents(vcl::RenderContext& rRenderContext, tools::Long nMin, tools::Long nMax, tools::Long nVirTop, tools::Long nVirBottom) { - long n; - long nIndentHeight = (mnVirHeight / 2) - 1; - long nIndentWidth2 = nIndentHeight-3; + tools::Long n; + tools::Long nIndentHeight = (mnVirHeight / 2) - 1; + tools::Long nIndentWidth2 = nIndentHeight-3; tools::Polygon aPoly(5); @@ -827,7 +827,7 @@ static void ImplCenterTabPos(Point& rPos, sal_uInt16 nTabStyle) } } -static void lcl_RotateRect_Impl(tools::Rectangle& rRect, const long nReference, bool bRightAligned) +static void lcl_RotateRect_Impl(tools::Rectangle& rRect, const tools::Long nReference, bool bRightAligned) { if (rRect.IsEmpty()) return; @@ -840,7 +840,7 @@ static void lcl_RotateRect_Impl(tools::Rectangle& rRect, const long nReference, if (bRightAligned) { - long nRef = 2 * nReference; + tools::Long nRef = 2 * nReference; rRect.SetLeft( nRef - rRect.Left() ); rRect.SetRight( nRef - rRect.Right() ); } @@ -955,17 +955,17 @@ void Ruler::ImplDrawTab(vcl::RenderContext& rRenderContext, const Point& rPos, s ImplDrawRulerTab(rRenderContext, rPos, nStyle, GetStyle()); } -void Ruler::ImplDrawTabs(vcl::RenderContext& rRenderContext, long nMin, long nMax, long nVirTop, long nVirBottom) +void Ruler::ImplDrawTabs(vcl::RenderContext& rRenderContext, tools::Long nMin, tools::Long nMax, tools::Long nVirTop, tools::Long nVirBottom) { for (const RulerTab & rTab : mpData->pTabs) { if (rTab.nStyle & RULER_STYLE_INVISIBLE) continue; - long aPosition; + tools::Long aPosition; aPosition = rTab.nPos; aPosition += +mpData->nNullVirOff; - long nTopBottom = (GetStyle() & WB_RIGHT_ALIGNED) ? nVirTop : nVirBottom; + tools::Long nTopBottom = (GetStyle() & WB_RIGHT_ALIGNED) ? nVirTop : nVirBottom; if (nMin <= aPosition && aPosition <= nMax) ImplDrawTab(rRenderContext, Point( aPosition, nTopBottom ), rTab.nStyle); } @@ -1048,10 +1048,10 @@ void Ruler::ImplCalc() mpData->nRulVirOff -= mnVirOff; else mpData->nRulVirOff = 0; - long nRulWinOff = mpData->nRulVirOff+mnVirOff; + tools::Long nRulWinOff = mpData->nRulVirOff+mnVirOff; // calculate non-visual part of the page - long nNotVisPageWidth; + tools::Long nNotVisPageWidth; if ( mpData->nPageOff < 0 ) { nNotVisPageWidth = -(mpData->nPageOff); @@ -1097,15 +1097,15 @@ void Ruler::ImplFormat(vcl::RenderContext const & rRenderContext) return; const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); - long nP1; // pixel position of Page1 - long nP2; // pixel position of Page2 - long nM1; // pixel position of Margin1 - long nM2; // pixel position of Margin2 - long nVirTop; // top/left corner - long nVirBottom; // bottom/right corner - long nVirLeft; // left/top corner - long nVirRight; // right/bottom corner - long nNullVirOff; // for faster calculation + tools::Long nP1; // pixel position of Page1 + tools::Long nP2; // pixel position of Page2 + tools::Long nM1; // pixel position of Margin1 + tools::Long nM2; // pixel position of Margin2 + tools::Long nVirTop; // top/left corner + tools::Long nVirBottom; // bottom/right corner + tools::Long nVirLeft; // left/top corner + tools::Long nVirRight; // right/bottom corner + tools::Long nNullVirOff; // for faster calculation // calculate values if (mbCalc) @@ -1217,9 +1217,9 @@ void Ruler::ImplFormat(vcl::RenderContext const & rRenderContext) ImplVDrawLine(*maVirDev, nP2 - 1, nVirTop + 1, nP2 - 1, nVirBottom); //right line of the right rectangle } - long nMin = nVirLeft; - long nMax = nP2; - long nStart = 0; + tools::Long nMin = nVirLeft; + tools::Long nMax = nP2; + tools::Long nStart = 0; if (mpData->bTextRTL) nStart = mpData->nRightFrameMargin + nNullVirOff; @@ -1381,7 +1381,7 @@ void Ruler::ImplDrawExtra(vcl::RenderContext& rRenderContext) if (mpData->bTextRTL) { - long nTemp = aDraw.X(); + tools::Long nTemp = aDraw.X(); aDraw.setX( aDraw.Y() ); aDraw.setY( nTemp ); } @@ -1417,10 +1417,10 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, { sal_Int32 i; sal_uInt16 nStyle; - long nHitBottom; - long nX; - long nY; - long n1; + tools::Long nHitBottom; + tools::Long nX; + tools::Long nY; + tools::Long n1; if ( !mbActive ) return false; @@ -1446,7 +1446,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, pHitTest->bSizeBar = false; // so that leftover tabs and indents are taken into account - long nXExtraOff; + tools::Long nXExtraOff; if ( !mpData->pTabs.empty() || !mpData->pIndents.empty() ) nXExtraOff = (mnVirHeight / 2) - 4; else @@ -1517,8 +1517,8 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, // Indents if ( !mpData->pIndents.empty() ) { - long nIndentHeight = (mnVirHeight / 2) - 1; - long nIndentWidth2 = nIndentHeight - 3; + tools::Long nIndentHeight = (mnVirHeight / 2) - 1; + tools::Long nIndentWidth2 = nIndentHeight - 3; for ( i = mpData->pIndents.size(); i; i-- ) { @@ -1563,7 +1563,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, for ( i = mpData->pBorders.size(); i; i-- ) { n1 = mpData->pBorders[i-1].nPos; - long n2 = n1 + mpData->pBorders[i-1].nWidth; + tools::Long n2 = n1 + mpData->pBorders[i-1].nWidth; // borders have at least 3 pixel padding if ( !mpData->pBorders[i-1].nWidth ) @@ -1591,7 +1591,7 @@ bool Ruler::ImplHitTest( const Point& rPos, RulerSelection* pHitTest, } else { - long nMOff = RULER_MOUSE_BORDERWIDTH; + tools::Long nMOff = RULER_MOUSE_BORDERWIDTH; while ( nMOff*2 >= (n2-n1-RULER_MOUSE_BORDERMOVE) ) { if ( nMOff < 2 ) @@ -1813,9 +1813,9 @@ bool Ruler::ImplStartDrag( RulerSelection const * pHitTest, sal_uInt16 nModifier void Ruler::ImplDrag( const Point& rPos ) { - long nX; - long nY; - long nOutHeight; + tools::Long nX; + tools::Long nY; + tools::Long nOutHeight; if ( mnWinStyle & WB_HORZ ) { @@ -2063,7 +2063,7 @@ void Ruler::Resize() { Size aWinSize = GetOutputSizePixel(); - long nNewHeight; + tools::Long nNewHeight; if ( mnWinStyle & WB_HORZ ) { if ( aWinSize.Height() != mnHeight ) @@ -2327,7 +2327,7 @@ RulerType Ruler::GetType( const Point& rPos, sal_uInt16* pAryPos ) return aHitTest.eType; } -void Ruler::SetWinPos( long nNewOff, long nNewWidth ) +void Ruler::SetWinPos( tools::Long nNewOff, tools::Long nNewWidth ) { // should widths be automatically calculated if ( !nNewWidth ) @@ -2340,7 +2340,7 @@ void Ruler::SetWinPos( long nNewOff, long nNewWidth ) ImplUpdate( true ); } -void Ruler::SetPagePos( long nNewOff, long nNewWidth ) +void Ruler::SetPagePos( tools::Long nNewOff, tools::Long nNewWidth ) { // should we do anything? if ( (mpData->nPageOff == nNewOff) && (mpData->nPageWidth == nNewWidth) ) @@ -2357,7 +2357,7 @@ void Ruler::SetPagePos( long nNewOff, long nNewWidth ) ImplUpdate( true ); } -void Ruler::SetBorderPos( long nOff ) +void Ruler::SetBorderPos( tools::Long nOff ) { if ( mnWinStyle & WB_BORDER ) { @@ -2445,7 +2445,7 @@ void Ruler::SetExtraType( RulerExtra eNewExtraType, sal_uInt16 nStyle ) } } -void Ruler::SetNullOffset( long nPos ) +void Ruler::SetNullOffset( tools::Long nPos ) { if ( mpData->nNullOff != nPos ) { @@ -2455,7 +2455,7 @@ void Ruler::SetNullOffset( long nPos ) } } -void Ruler::SetLeftFrameMargin( long nPos ) +void Ruler::SetLeftFrameMargin( tools::Long nPos ) { if ( mpData->nLeftFrameMargin != nPos ) { @@ -2464,7 +2464,7 @@ void Ruler::SetLeftFrameMargin( long nPos ) } } -void Ruler::SetRightFrameMargin( long nPos ) +void Ruler::SetRightFrameMargin( tools::Long nPos ) { if ( mpData->nRightFrameMargin != nPos ) { @@ -2473,7 +2473,7 @@ void Ruler::SetRightFrameMargin( long nPos ) } } -void Ruler::SetMargin1( long nPos, RulerMarginStyle nMarginStyle ) +void Ruler::SetMargin1( tools::Long nPos, RulerMarginStyle nMarginStyle ) { if ( (mpData->nMargin1 != nPos) || (mpData->nMargin1Style != nMarginStyle) ) { @@ -2483,7 +2483,7 @@ void Ruler::SetMargin1( long nPos, RulerMarginStyle nMarginStyle ) } } -void Ruler::SetMargin2( long nPos, RulerMarginStyle nMarginStyle ) +void Ruler::SetMargin2( tools::Long nPos, RulerMarginStyle nMarginStyle ) { DBG_ASSERT( (nPos >= mpData->nMargin1) || (mpData->nMargin1Style & RulerMarginStyle::Invisible) || @@ -2708,22 +2708,22 @@ void Ruler::SetTextRTL(bool bRTL) } -long Ruler::GetPageOffset() const +tools::Long Ruler::GetPageOffset() const { return mpData->nPageOff; } -long Ruler::GetNullOffset() const +tools::Long Ruler::GetNullOffset() const { return mpData->nNullOff; } -long Ruler::GetMargin1() const +tools::Long Ruler::GetMargin1() const { return mpData->nMargin1; } -long Ruler::GetMargin2() const +tools::Long Ruler::GetMargin2() const { return mpData->nMargin2; } diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 14a8e05251f0..e41696c0b56d 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -102,8 +102,8 @@ public: void drawText(const OUString& aText) { tools::Rectangle aRect = maRect; - long nTextWidth = mrRenderContext.GetTextWidth(aText); - long nTextHeight = mrRenderContext.GetTextHeight(); + tools::Long nTextWidth = mrRenderContext.GetTextWidth(aText); + tools::Long nTextHeight = mrRenderContext.GetTextHeight(); Point aPos = aRect.TopLeft(); aPos.AdjustX((aRect.getWidth() - nTextWidth) / 2 ); aPos.AdjustY((aRect.getHeight() - nTextHeight) / 2 ); @@ -196,7 +196,7 @@ struct ImplTabBarItem OUString maHelpText; OUString maAuxiliaryText; // used in LayerTabBar for real layer name tools::Rectangle maRect; - long mnWidth; + tools::Long mnWidth; OString maHelpId; bool mbShort : 1; bool mbSelect : 1; @@ -310,7 +310,7 @@ private: virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override; Point maStartPos; - long mnStartWidth; + tools::Long mnStartWidth; }; ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle ) @@ -324,7 +324,7 @@ ImplTabSizer::ImplTabSizer( TabBar* pParent, WinBits nWinStyle ) void ImplTabSizer::ImplTrack( const Point& rScreenPos ) { TabBar* pParent = GetParent(); - long nDiff = rScreenPos.X() - maStartPos.X(); + tools::Long nDiff = rScreenPos.X() - maStartPos.X(); pParent->mnSplitSize = mnStartWidth + (pParent->IsMirrored() ? -nDiff : nDiff); if ( pParent->mnSplitSize < TABBAR_MINSIZE ) pParent->mnSplitSize = TABBAR_MINSIZE; @@ -656,7 +656,7 @@ bool TabBar::ImplCalcWidth() bool bChanged = false; for (auto& pItem : mpImpl->mpItemList) { - long nNewWidth = GetTextWidth(pItem->GetRenderText()); + tools::Long nNewWidth = GetTextWidth(pItem->GetRenderText()); if (mnCurMaxWidth && (nNewWidth > mnCurMaxWidth)) { pItem->mbShort = true; @@ -668,7 +668,7 @@ bool TabBar::ImplCalcWidth() } // Padding is dependent on font height - bigger font = bigger padding - long nFontWidth = aFont.GetFontHeight(); + tools::Long nFontWidth = aFont.GetFontHeight(); if (pItem->mbProtect) nNewWidth += 24; nNewWidth += nFontWidth * 2; @@ -693,7 +693,7 @@ void TabBar::ImplFormat() return; sal_uInt16 nItemIndex = 0; - long x = mnOffX; + tools::Long x = mnOffX; for (auto & pItem : mpImpl->mpItemList) { // At all non-visible tabs an empty rectangle is set @@ -717,8 +717,8 @@ void TabBar::ImplFormat() if (mbMirrored) { - long nNewLeft = mnOffX + mnLastOffX - pItem->maRect.Right(); - long nNewRight = mnOffX + mnLastOffX - pItem->maRect.Left(); + tools::Long nNewLeft = mnOffX + mnLastOffX - pItem->maRect.Right(); + tools::Long nNewRight = mnOffX + mnLastOffX - pItem->maRect.Left(); pItem->maRect.SetRight(nNewRight); pItem->maRect.SetLeft(nNewLeft); } @@ -740,8 +740,8 @@ sal_uInt16 TabBar::ImplGetLastFirstPos() return 0; sal_uInt16 nLastFirstPos = nCount - 1; - long nWinWidth = mnLastOffX - mnOffX - ADDNEWPAGE_AREAWIDTH; - long nWidth = mpImpl->mpItemList[nLastFirstPos]->mnWidth; + tools::Long nWinWidth = mnLastOffX - mnOffX - ADDNEWPAGE_AREAWIDTH; + tools::Long nWidth = mpImpl->mpItemList[nLastFirstPos]->mnWidth; while (nLastFirstPos && (nWidth < nWinWidth)) { @@ -860,7 +860,7 @@ void TabBar::ImplShowPage( sal_uInt16 nPos ) return; // calculate width - long nWidth = GetOutputSizePixel().Width(); + tools::Long nWidth = GetOutputSizePixel().Width(); auto& pItem = mpImpl->mpItemList[nPos]; if (nPos < mnFirstPos) @@ -1241,8 +1241,8 @@ void TabBar::Resize() { Size aNewSize = GetOutputSizePixel(); - long nSizerWidth = 0; - long nButtonWidth = 0; + tools::Long nSizerWidth = 0; + tools::Long nButtonWidth = 0; // order the Sizer if ( mpImpl->mpSizer ) @@ -1255,14 +1255,14 @@ void TabBar::Resize() } // order the scroll buttons - long const nHeight = aNewSize.Height(); + tools::Long const nHeight = aNewSize.Height(); // adapt font height? ImplInitSettings( true, false ); - long nButtonMargin = BUTTON_MARGIN * GetDPIScaleFactor(); + tools::Long nButtonMargin = BUTTON_MARGIN * GetDPIScaleFactor(); - long nX = mbMirrored ? (aNewSize.Width() - nHeight - nButtonMargin) : nButtonMargin; - long const nXDiff = mbMirrored ? -nHeight : nHeight; + tools::Long nX = mbMirrored ? (aNewSize.Width() - nHeight - nButtonMargin) : nButtonMargin; + tools::Long const nXDiff = mbMirrored ? -nHeight : nHeight; nButtonWidth += nButtonMargin; @@ -1865,7 +1865,7 @@ void TabBar::SetCurPageId(sal_uInt16 nPageId) else { // calculate visible width - long nWidth = mnLastOffX; + tools::Long nWidth = mnLastOffX; if (nWidth > ADDNEWPAGE_AREAWIDTH) nWidth -= ADDNEWPAGE_AREAWIDTH; @@ -1919,7 +1919,7 @@ void TabBar::MakeVisible(sal_uInt16 nPageId) auto& pItem = mpImpl->mpItemList[nPos]; // calculate visible area - long nWidth = mnLastOffX; + tools::Long nWidth = mnLastOffX; if (mbFormat || pItem->maRect.IsEmpty()) { @@ -2051,8 +2051,8 @@ bool TabBar::StartEditMode(sal_uInt16 nPageId) mpImpl->mxEdit.disposeAndReset(VclPtr<TabBarEdit>::Create(this)); tools::Rectangle aRect = GetPageRect( mnEditId ); - long nX = aRect.Left(); - long nWidth = aRect.GetWidth(); + tools::Long nX = aRect.Left(); + tools::Long nWidth = aRect.GetWidth(); if (mnEditId != GetCurPageId()) nX += 1; if (nX + nWidth > mnLastOffX) @@ -2178,7 +2178,7 @@ bool TabBar::IsEffectiveRTL() const return IsMirrored() != AllSettings::GetLayoutRTL(); } -void TabBar::SetMaxPageWidth(long nMaxWidth) +void TabBar::SetMaxPageWidth(tools::Long nMaxWidth) { if (mnMaxPageWidth != nMaxWidth) { @@ -2360,8 +2360,8 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos) // draw drop position arrows Color aBlackColor(COL_BLACK); - long nX; - long nY = (maWinSize.Height() / 2) - 1; + tools::Long nX; + tools::Long nY = (maWinSize.Height() / 2) - 1; sal_uInt16 nCurPos = GetPagePos(mnCurPageId); sal_Int32 nTriangleWidth = 3 * GetDPIScaleFactor(); @@ -2419,9 +2419,9 @@ void TabBar::HideDropPos() if (!mbDropPos) return; - long nX; - long nY1 = (maWinSize.Height() / 2) - 3; - long nY2 = nY1 + 5; + tools::Long nX; + tools::Long nY1 = (maWinSize.Height() / 2) - 3; + tools::Long nY2 = nY1 + 5; sal_uInt16 nItemCount = mpImpl->getItemSize(); if (mnDropPos < nItemCount) @@ -2500,7 +2500,7 @@ void TabBar::SetStyle(WinBits nStyle) Size TabBar::CalcWindowSizePixel() const { - long nWidth = 0; + tools::Long nWidth = 0; if (!mpImpl->mpItemList.empty()) { diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx index 25e0c79e6c0e..e81aeb2745bd 100644 --- a/svtools/source/control/valueset.cxx +++ b/svtools/source/control/valueset.cxx @@ -266,7 +266,7 @@ void ValueSet::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& const StyleSettings& rStyleSettings = rRenderContext.GetSettings().GetStyleSettings(); rRenderContext.SetLineColor(); rRenderContext.SetFillColor(rStyleSettings.GetFaceColor()); - long nOffY = maVirDev->GetOutputSizePixel().Height(); + tools::Long nOffY = maVirDev->GetOutputSizePixel().Height(); Size aWinSize(GetOutputSizePixel()); rRenderContext.DrawRect(tools::Rectangle(Point(0, nOffY ), Point( aWinSize.Width(), aWinSize.Height()))); } @@ -649,8 +649,8 @@ tools::Rectangle ValueSet::ImplGetItemRect( size_t nPos ) const const size_t row = mnCols ? nPos/mnCols : 0; const size_t col = mnCols ? nPos%mnCols : 0; - const long x = maItemListRect.Left()+col*(mnItemWidth+mnSpacing); - const long y = maItemListRect.Top()+row*(mnItemHeight+mnSpacing); + const tools::Long x = maItemListRect.Left()+col*(mnItemWidth+mnSpacing); + const tools::Long y = maItemListRect.Top()+row*(mnItemHeight+mnSpacing); return tools::Rectangle( Point(x, y), Size(mnItemWidth, mnItemHeight) ); } @@ -865,10 +865,10 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) Size aWinSize(GetOutputSizePixel()); size_t nItemCount = mItemList.size(); WinBits nStyle = GetStyle(); - long nTxtHeight = rRenderContext.GetTextHeight(); - long nOff; - long nNoneHeight; - long nNoneSpace; + tools::Long nTxtHeight = rRenderContext.GetTextHeight(); + tools::Long nOff; + tools::Long nNoneHeight; + tools::Long nNoneSpace; if (mxScrolledWindow && !(nStyle & WB_VSCROLL) && mxScrolledWindow->get_vpolicy() != VclPolicyType::NEVER) TurnOffScrollBar(); @@ -936,7 +936,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) auto nOldLines = mnLines; // Floor( (M+N-1)/N )==Ceiling( M/N ) - mnLines = (static_cast<long>(nItemCount) + mnCols - 1) / mnCols; + mnLines = (static_cast<tools::Long>(nItemCount) + mnCols - 1) / mnCols; if (mnLines <= 0) mnLines = 1; @@ -944,7 +944,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) auto nOldVisLines = mnVisLines; - long nCalcHeight = aWinSize.Height() - nNoneHeight; + tools::Long nCalcHeight = aWinSize.Height() - nNoneHeight; if (mnUserVisLines) { mnVisLines = mnUserVisLines; @@ -976,8 +976,8 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) } // calculate item size - const long nColSpace = (mnCols - 1) * static_cast<long>(mnSpacing); - const long nLineSpace = ((mnVisLines - 1) * mnSpacing) + nNoneSpace; + const tools::Long nColSpace = (mnCols - 1) * static_cast<tools::Long>(mnSpacing); + const tools::Long nLineSpace = ((mnVisLines - 1) * mnSpacing) + nNoneSpace; if (mnUserItemWidth && !mnUserCols) { mnItemWidth = mnUserItemWidth; @@ -1061,12 +1061,12 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) } // calculate offsets - long nStartX; - long nStartY; + tools::Long nStartX; + tools::Long nStartY; if (mbFullMode) { - long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace; - long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace; + tools::Long nAllItemWidth = (mnItemWidth * mnCols) + nColSpace; + tools::Long nAllItemHeight = (mnItemHeight * mnVisLines) + nNoneHeight + nLineSpace; nStartX = (aWinSize.Width() - nAllItemWidth) / 2; nStartY = (aWinSize.Height() - nAllItemHeight) / 2; } @@ -1078,8 +1078,8 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) // calculate and draw items maVirDev->SetLineColor(); - long x = nStartX; - long y = nStartY; + tools::Long x = nStartX; + tools::Long y = nStartY; // create NoSelection field and show it if (nStyle & WB_NONEFIELD) @@ -1165,7 +1165,7 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext) bool bTurnScrollbarOn = mxScrolledWindow->get_vpolicy() != VclPolicyType::ALWAYS; if (bAdjustmentOutOfDate || bTurnScrollbarOn) { - long nPageSize = mnVisLines; + tools::Long nPageSize = mnVisLines; if (nPageSize < 1) nPageSize = 1; mxScrolledWindow->vadjustment_configure(mnFirstLine, 0, mnLines, 1, @@ -1364,7 +1364,7 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, ValueSe maVirDev->SetFillColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuColor() : rStyleSettings.GetWindowColor()); maVirDev->DrawRect(aRect); Point aTxtPos(aRect.Left() + 2, aRect.Top()); - long nTxtWidth = rRenderContext.GetTextWidth(pItem->maText); + tools::Long nTxtWidth = rRenderContext.GetTextWidth(pItem->maText); if ((aTxtPos.X() + nTxtWidth) > aRect.Right()) { maVirDev->SetClipRegion(vcl::Region(aRect)); @@ -1426,7 +1426,7 @@ void ValueSet::ImplFormatItem(vcl::RenderContext const & rRenderContext, ValueSe maVirDev->SetTextColor((nStyle & WB_MENUSTYLEVALUESET) ? rStyleSettings.GetMenuTextColor() : rStyleSettings.GetWindowTextColor()); maVirDev->SetTextFillColor(); - long nTxtWidth = maVirDev->GetTextWidth(pItem->maText); + tools::Long nTxtWidth = maVirDev->GetTextWidth(pItem->maText); if (nTxtWidth > aRect.GetWidth()) maVirDev->SetClipRegion(vcl::Region(aRect)); @@ -1464,8 +1464,8 @@ void ValueSet::ImplDrawItemText(vcl::RenderContext& rRenderContext, const OUStri return; Size aWinSize(GetOutputSizePixel()); - long nTxtWidth = rRenderContext.GetTextWidth(rText); - long nTxtOffset = mnTextOffset; + tools::Long nTxtWidth = rRenderContext.GetTextWidth(rText); + tools::Long nTxtOffset = mnTextOffset; // delete rectangle and show text if (GetStyle() & WB_FLATVALUESET) @@ -1589,8 +1589,8 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol Size aSize( rItemSize.Width() * nCalcCols, rItemSize.Height() * nCalcLines ); WinBits nStyle = GetStyle(); - long nTxtHeight = GetTextHeight(); - long n; + tools::Long nTxtHeight = GetTextHeight(); + tools::Long n; if ( nStyle & WB_ITEMBORDER ) { @@ -1709,7 +1709,7 @@ Size ValueSet::CalcItemSizePixel( const Size& rItemSize) const WinBits nStyle = GetStyle(); if ( nStyle & WB_ITEMBORDER ) { - long n; + tools::Long n; if ( nStyle & WB_DOUBLEBORDER ) n = ITEM_OFFSET_DOUBLE; @@ -1732,7 +1732,7 @@ void ValueSet::SetLineCount( sal_uInt16 nNewLines ) } } -void ValueSet::SetItemWidth( long nNewItemWidth ) +void ValueSet::SetItemWidth( tools::Long nNewItemWidth ) { if ( mnUserItemWidth != nNewItemWidth ) { @@ -1754,7 +1754,7 @@ void ValueSet::InsertItem( sal_uInt16 nItemId, const OUString& rText, size_t nPo ImplInsertItem( std::move(pItem), nPos ); } -void ValueSet::SetItemHeight( long nNewItemHeight ) +void ValueSet::SetItemHeight( tools::Long nNewItemHeight ) { if ( mnUserItemHeight != nNewItemHeight ) { diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index eb8480d7dbeb..e36cae84ab20 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -550,8 +550,8 @@ void AssignmentPersistentData::ImplCommit() m_pImpl->aFieldLabels.push_back( SvtResId( STR_FIELD_USER3)); m_pImpl->aFieldLabels.push_back( SvtResId( STR_FIELD_USER4)); - long nLabelWidth = 0; - long nListBoxWidth = m_pImpl->pFields[0]->get_approximate_digit_width() * 18; + tools::Long nLabelWidth = 0; + tools::Long nListBoxWidth = m_pImpl->pFields[0]->get_approximate_digit_width() * 18; for (auto const& fieldLabel : m_pImpl->aFieldLabels) { m_pImpl->pFieldLabels[0]->set_label(fieldLabel); diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 2319485a65bd..27a9703fdc7f 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -675,8 +675,8 @@ void EmbeddedObjectRef::DrawPaintReplacement( const tools::Rectangle &rRect, con } BitmapEx aBmp(BMP_PLUGIN); - long nHeight = rRect.GetHeight() - pOut->GetTextHeight(); - long nWidth = rRect.GetWidth(); + tools::Long nHeight = rRect.GetHeight() - pOut->GetTextHeight(); + tools::Long nWidth = rRect.GetWidth(); if(nHeight > 0 && nWidth > 0 && aBmp.GetSizePixel().Width() > 0) { aPt.setY( nHeight ); @@ -688,7 +688,7 @@ void EmbeddedObjectRef::DrawPaintReplacement( const tools::Rectangle &rRect, con { // adjust to the width // keep proportions - long nH = nWidth * aBmpSize.Height() / aBmpSize.Width(); + tools::Long nH = nWidth * aBmpSize.Height() / aBmpSize.Width(); // center aP.AdjustY((nHeight - nH) / 2 ); nHeight = nH; @@ -697,7 +697,7 @@ void EmbeddedObjectRef::DrawPaintReplacement( const tools::Rectangle &rRect, con { // adjust to the height // keep proportions - long nW = nHeight * aBmpSize.Width() / aBmpSize.Height(); + tools::Long nW = nHeight * aBmpSize.Width() / aBmpSize.Height(); // center aP.AdjustX((nWidth - nW) / 2 ); nWidth = nW; diff --git a/svtools/source/misc/unitconv.cxx b/svtools/source/misc/unitconv.cxx index 93dab6ada967..361570163063 100644 --- a/svtools/source/misc/unitconv.cxx +++ b/svtools/source/misc/unitconv.cxx @@ -115,7 +115,7 @@ int GetCoreValue(const weld::MetricSpinButton& rField, MapUnit eUnit) return nUnitVal; } -long CalcToUnit( float nIn, MapUnit eUnit ) +tools::Long CalcToUnit( float nIn, MapUnit eUnit ) { // nIn is in Points @@ -140,15 +140,15 @@ long CalcToUnit( float nIn, MapUnit eUnit ) } nTmp *= 20; - long nRet = static_cast<long>(nTmp); + tools::Long nRet = static_cast<tools::Long>(nTmp); return nRet; //! return (long)(nTmp * 20); } -long ItemToControl( long nIn, MapUnit eItem, FieldUnit eCtrl ) +tools::Long ItemToControl( tools::Long nIn, MapUnit eItem, FieldUnit eCtrl ) { - long nOut = 0; + tools::Long nOut = 0; switch ( eItem ) { @@ -202,7 +202,7 @@ long ItemToControl( long nIn, MapUnit eItem, FieldUnit eCtrl ) } -long ControlToItem( long nIn, FieldUnit eCtrl, MapUnit eItem ) +tools::Long ControlToItem( tools::Long nIn, FieldUnit eCtrl, MapUnit eItem ) { return ItemToControl( nIn, eItem, eCtrl ); } @@ -237,7 +237,7 @@ FieldUnit MapToFieldUnit( const MapUnit eUnit ) } -long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor ) +tools::Long CalcToPoint( tools::Long nIn, MapUnit eUnit, sal_uInt16 nFactor ) { DBG_ASSERT( eUnit == MapUnit::MapTwip || eUnit == MapUnit::Map100thMM || @@ -245,7 +245,7 @@ long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor ) eUnit == MapUnit::MapMM || eUnit == MapUnit::MapCM, "this unit is not implemented" ); - long nRet = 0; + tools::Long nRet = 0; if ( MapUnit::MapTwip == eUnit ) nRet = nIn; @@ -264,7 +264,7 @@ long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor ) // round up if necessary if ( MapUnit::MapTwip != eUnit ) { - long nTmp = nRet % 10; + tools::Long nTmp = nRet % 10; if ( nTmp >= 4 ) nRet += 10 - nTmp; @@ -274,9 +274,9 @@ long CalcToPoint( long nIn, MapUnit eUnit, sal_uInt16 nFactor ) } -static long CMToTwips( long nIn ) +static tools::Long CMToTwips( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) nRet = nIn * 567; @@ -284,9 +284,9 @@ static long CMToTwips( long nIn ) } -static long MMToTwips( long nIn ) +static tools::Long MMToTwips( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) nRet = nIn * 567 / 10; @@ -294,9 +294,9 @@ static long MMToTwips( long nIn ) } -static long InchToTwips( long nIn ) +static tools::Long InchToTwips( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 1440 ) && nIn >= ( LONG_MIN / 1440 ) ) nRet = nIn * 1440; @@ -304,9 +304,9 @@ static long InchToTwips( long nIn ) } -long PointToTwips( long nIn ) +tools::Long PointToTwips( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 20 ) && nIn >= ( LONG_MIN / 20 ) ) nRet = nIn * 20; @@ -314,9 +314,9 @@ long PointToTwips( long nIn ) } -static long PicaToTwips( long nIn ) +static tools::Long PicaToTwips( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 240 ) && nIn >= ( LONG_MIN / 240 ) ) nRet = nIn * 240; @@ -324,16 +324,16 @@ static long PicaToTwips( long nIn ) } -static long TwipsToCM( long nIn ) +static tools::Long TwipsToCM( tools::Long nIn ) { - long nRet = nIn / 567; + tools::Long nRet = nIn / 567; return nRet; } -static long InchToCM( long nIn ) +static tools::Long InchToCM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 254 ) && nIn >= ( LONG_MIN / 254 ) ) nRet = nIn * 254 / 100; @@ -341,16 +341,16 @@ static long InchToCM( long nIn ) } -static long MMToCM( long nIn ) +static tools::Long MMToCM( tools::Long nIn ) { - long nRet = nIn / 10; + tools::Long nRet = nIn / 10; return nRet; } -static long PointToCM( long nIn ) +static tools::Long PointToCM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 20 ) && nIn >= ( LONG_MIN / 20 ) ) nRet = nIn * 20 / 567; @@ -358,9 +358,9 @@ static long PointToCM( long nIn ) } -static long PicaToCM( long nIn) +static tools::Long PicaToCM( tools::Long nIn) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 12 / 20 ) && nIn >= ( LONG_MIN / 12 / 20 ) ) nRet = nIn * 12 * 20 / 567; @@ -368,9 +368,9 @@ static long PicaToCM( long nIn) } -static long TwipsToMM( long nIn ) +static tools::Long TwipsToMM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 10 ) && nIn >= ( LONG_MIN / 10 ) ) nRet = nIn * 10 / 566; @@ -378,9 +378,9 @@ static long TwipsToMM( long nIn ) } -static long CMToMM( long nIn ) +static tools::Long CMToMM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 10 ) && nIn >= ( LONG_MIN / 10 ) ) nRet = nIn * 10; @@ -388,9 +388,9 @@ static long CMToMM( long nIn ) } -static long InchToMM( long nIn ) +static tools::Long InchToMM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 254 ) && nIn >= ( LONG_MIN / 254 ) ) nRet = nIn * 254 / 10; @@ -398,9 +398,9 @@ static long InchToMM( long nIn ) } -static long PointToMM( long nIn ) +static tools::Long PointToMM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 200 ) && nIn >= ( LONG_MIN / 200 ) ) nRet = nIn * 200 / 567; @@ -408,9 +408,9 @@ static long PointToMM( long nIn ) } -static long PicaToMM( long nIn ) +static tools::Long PicaToMM( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 12 / 200 ) && nIn >= ( LONG_MIN / 12 / 200 ) ) nRet = nIn * 12 * 200 / 567; @@ -418,16 +418,16 @@ static long PicaToMM( long nIn ) } -static long TwipsToInch( long nIn ) +static tools::Long TwipsToInch( tools::Long nIn ) { - long nRet = nIn / 1440; + tools::Long nRet = nIn / 1440; return nRet; } -static long CMToInch( long nIn ) +static tools::Long CMToInch( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 100 ) && nIn >= ( LONG_MIN / 100 ) ) nRet = nIn * 100 / 254; @@ -435,9 +435,9 @@ static long CMToInch( long nIn ) } -static long MMToInch( long nIn ) +static tools::Long MMToInch( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 10 ) && nIn >= ( LONG_MIN / 10 ) ) nRet = nIn * 10 / 254; @@ -445,30 +445,30 @@ static long MMToInch( long nIn ) } -static long PointToInch( long nIn ) +static tools::Long PointToInch( tools::Long nIn ) { - long nRet = nIn / 72; + tools::Long nRet = nIn / 72; return nRet; } -static long PicaToInch( long nIn ) +static tools::Long PicaToInch( tools::Long nIn ) { - long nRet = nIn / 6; + tools::Long nRet = nIn / 6; return nRet; } -static long TwipsToPoint( long nIn ) +static tools::Long TwipsToPoint( tools::Long nIn ) { - long nRet = nIn / 20; + tools::Long nRet = nIn / 20; return nRet; } -static long InchToPoint( long nIn ) +static tools::Long InchToPoint( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 72 ) && nIn >= ( LONG_MIN / 72 ) ) nRet = nIn * 72; @@ -476,9 +476,9 @@ static long InchToPoint( long nIn ) } -static long CMToPoint( long nIn ) +static tools::Long CMToPoint( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) nRet = nIn * 567 / 20; @@ -486,9 +486,9 @@ static long CMToPoint( long nIn ) } -static long MMToPoint( long nIn ) +static tools::Long MMToPoint( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) nRet = nIn * 567 / 200; @@ -496,23 +496,23 @@ static long MMToPoint( long nIn ) } -static long PicaToPoint( long nIn ) +static tools::Long PicaToPoint( tools::Long nIn ) { - long nRet = nIn / 12; + tools::Long nRet = nIn / 12; return nRet; } -static long TwipsToPica( long nIn ) +static tools::Long TwipsToPica( tools::Long nIn ) { - long nRet = nIn / 240; + tools::Long nRet = nIn / 240; return nRet; } -static long InchToPica( long nIn ) +static tools::Long InchToPica( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 6 ) && nIn >= ( LONG_MIN / 6 ) ) nRet = nIn * 6; @@ -520,9 +520,9 @@ static long InchToPica( long nIn ) } -static long PointToPica( long nIn ) +static tools::Long PointToPica( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 12 ) && nIn >= ( LONG_MIN / 12 ) ) nRet = nIn * 12; @@ -530,9 +530,9 @@ static long PointToPica( long nIn ) } -static long CMToPica( long nIn ) +static tools::Long CMToPica( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) nRet = nIn * 567 / 20 / 12; @@ -540,9 +540,9 @@ static long CMToPica( long nIn ) } -static long MMToPica( long nIn ) +static tools::Long MMToPica( tools::Long nIn ) { - long nRet = 0; + tools::Long nRet = 0; if ( nIn <= ( LONG_MAX / 567 ) && nIn >= ( LONG_MIN / 567 ) ) nRet = nIn * 567 / 200 / 12; @@ -550,9 +550,9 @@ static long MMToPica( long nIn ) } -static long Nothing( long nIn ) +static tools::Long Nothing( tools::Long nIn ) { - long nRet = nIn; + tools::Long nRet = nIn; return nRet; } @@ -568,7 +568,7 @@ FUNC_CONVERT const ConvertTable[6][6] = }; -long TransformMetric( long nVal, FieldUnit aOld, FieldUnit aNew ) +tools::Long TransformMetric( tools::Long nVal, FieldUnit aOld, FieldUnit aNew ) { if ( aOld == FieldUnit::NONE || aNew == FieldUnit::NONE || aOld == FieldUnit::CUSTOM || aNew == FieldUnit::CUSTOM ) diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 300818e665ad..24ce5b50b98e 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -669,7 +669,7 @@ SvStream& HTMLOutFuncs::Out_ImageMap( SvStream& rStream, static_cast<const IMapCircleObject *>(pObj); pShape= OOO_STRING_SVTOOLS_HTML_SH_circ; Point aCenter( pCirc->GetCenter() ); - long nOff = pCirc->GetRadius(); + tools::Long nOff = pCirc->GetRadius(); aCoords = OStringBuffer() .append(static_cast<sal_Int32>(aCenter.X())) diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index b3aea78145a0..c24e60f71209 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -37,7 +37,7 @@ struct SvParser_Impl sal_uInt64 nFilePos; // actual position in stream sal_uLong nlLineNr; // actual line number sal_uLong nlLinePos; // actual column number - long nTokenValue; // extra value (RTF) + tools::Long nTokenValue; // extra value (RTF) bool bTokenHasValue; // indicates whether nTokenValue is valid T nToken; // actual Token sal_uInt32 nNextCh; // actual character diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx index 2ca15c7ca514..e209fe953104 100644 --- a/svtools/source/table/cellvalueconversion.cxx +++ b/svtools/source/table/cellvalueconversion.cxx @@ -32,6 +32,7 @@ #include <tools/date.hxx> #include <tools/time.hxx> #include <tools/diagnose_ex.h> +#include <tools/long.hxx> #include <unotools/syslocale.hxx> #include <i18nlangtag/languagetag.hxx> #include <comphelper/processfactory.hxx> @@ -63,14 +64,14 @@ namespace svt double lcl_convertDateToDays( sal_uInt16 const i_day, sal_uInt16 const i_month, sal_Int16 const i_year ) { - long const nNullDateDays = ::Date::DateToDays( 1, 1, 1900 ); - long const nValueDateDays = ::Date::DateToDays( i_day, i_month, i_year ); + tools::Long const nNullDateDays = ::Date::DateToDays( 1, 1, 1900 ); + tools::Long const nValueDateDays = ::Date::DateToDays( i_day, i_month, i_year ); return nValueDateDays - nNullDateDays; } - double lcl_convertTimeToDays( long const i_hours, long const i_minutes, long const i_seconds, long const i_100thSeconds ) + double lcl_convertTimeToDays( tools::Long const i_hours, tools::Long const i_minutes, tools::Long const i_seconds, tools::Long const i_100thSeconds ) { return tools::Time( i_hours, i_minutes, i_seconds, i_100thSeconds ).GetTimeInDays(); } diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index 8ab7ae182d48..08de04b177e9 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -62,11 +62,11 @@ namespace svt::table { } - BitmapEx const & getBitmapFor(vcl::RenderContext const & i_device, long const i_headerHeight, + BitmapEx const & getBitmapFor(vcl::RenderContext const & i_device, tools::Long const i_headerHeight, StyleSettings const & i_style, bool const i_sortAscending); private: - long m_lastHeaderHeight; + tools::Long m_lastHeaderHeight; Color m_lastArrowColor; BitmapEx m_sortAscending; BitmapEx m_sortDescending; @@ -74,14 +74,14 @@ namespace svt::table } - BitmapEx const & CachedSortIndicator::getBitmapFor(vcl::RenderContext const& i_device, long const i_headerHeight, + BitmapEx const & CachedSortIndicator::getBitmapFor(vcl::RenderContext const& i_device, tools::Long const i_headerHeight, StyleSettings const & i_style, bool const i_sortAscending ) { BitmapEx& rBitmap(i_sortAscending ? m_sortAscending : m_sortDescending); if (!rBitmap || (i_headerHeight != m_lastHeaderHeight) || (i_style.GetActiveColor() != m_lastArrowColor)) { - long const nSortIndicatorWidth = 2 * i_headerHeight / 3; - long const nSortIndicatorHeight = 2 * nSortIndicatorWidth / 3; + tools::Long const nSortIndicatorWidth = 2 * i_headerHeight / 3; + tools::Long const nSortIndicatorHeight = 2 * nSortIndicatorWidth / 3; Point const aBitmapPos( 0, 0 ); Size const aBitmapSize( nSortIndicatorWidth, nSortIndicatorHeight ); @@ -274,12 +274,12 @@ namespace svt::table aCurrentSortOrder = pSortAdapter->getCurrentSortOrder(); if ( aCurrentSortOrder.nColumnPos == _nCol ) { - long const nHeaderHeight( _rArea.GetHeight() ); + tools::Long const nHeaderHeight( _rArea.GetHeight() ); BitmapEx const aIndicatorBitmap = m_pImpl->aSortIndicator.getBitmapFor(rRenderContext, nHeaderHeight, _rStyle, aCurrentSortOrder.eSortDirection == ColumnSortAscending); Size const aBitmapSize( aIndicatorBitmap.GetSizePixel() ); - long const nSortIndicatorPaddingX = 2; - long const nSortIndicatorPaddingY = ( nHeaderHeight - aBitmapSize.Height() ) / 2; + tools::Long const nSortIndicatorPaddingX = 2; + tools::Long const nSortIndicatorPaddingY = ( nHeaderHeight - aBitmapSize.Height() ) / 2; if ( nDrawTextFlags & DrawTextFlags::Right ) { @@ -580,11 +580,11 @@ namespace svt::table tools::Rectangle const aTargetArea( lcl_getTextRenderingArea( lcl_getContentArea( *m_pImpl, i_targetArea ) ) ); - long const nTextHeight = i_targetDevice.GetTextHeight(); + tools::Long const nTextHeight = i_targetDevice.GetTextHeight(); if ( nTextHeight > aTargetArea.GetHeight() ) return false; - long const nTextWidth = i_targetDevice.GetTextWidth( sText ); + tools::Long const nTextWidth = i_targetDevice.GetTextWidth( sText ); return nTextWidth <= aTargetArea.GetWidth(); } diff --git a/svtools/source/table/mousefunction.cxx b/svtools/source/table/mousefunction.cxx index 3d2986f1091f..6675e67e8cd3 100644 --- a/svtools/source/table/mousefunction.cxx +++ b/svtools/source/table/mousefunction.cxx @@ -117,24 +117,24 @@ namespace svt::table i_tableControl.hideTracking(); PColumnModel const pColumn = i_tableControl.getModel()->getColumnModel( m_nResizingColumn ); - long const maxWidthLogical = pColumn->getMaxWidth(); - long const minWidthLogical = pColumn->getMinWidth(); + tools::Long const maxWidthLogical = pColumn->getMaxWidth(); + tools::Long const minWidthLogical = pColumn->getMinWidth(); // new position of mouse - long const requestedEnd = aPoint.X(); + tools::Long const requestedEnd = aPoint.X(); // old position of right border - long const oldEnd = i_tableControl.getColumnMetrics( m_nResizingColumn ).nEndPixel; + tools::Long const oldEnd = i_tableControl.getColumnMetrics( m_nResizingColumn ).nEndPixel; // position of left border if cursor in the to-be-resized column - long const columnStart = i_tableControl.getColumnMetrics( m_nResizingColumn ).nStartPixel; - long const requestedWidth = requestedEnd - columnStart; + tools::Long const columnStart = i_tableControl.getColumnMetrics( m_nResizingColumn ).nStartPixel; + tools::Long const requestedWidth = requestedEnd - columnStart; // TODO: this is not correct, strictly: It assumes that the mouse was pressed exactly on the "end" pos, // but for a while now, we have relaxed this, and allow clicking a few pixels aside, too if ( requestedEnd >= columnStart ) { - long requestedWidthLogical = i_tableControl.pixelWidthToAppFont( requestedWidth ); + tools::Long requestedWidthLogical = i_tableControl.pixelWidthToAppFont( requestedWidth ); // respect column width limits if ( oldEnd > requestedEnd ) { diff --git a/svtools/source/table/tablecontrol.cxx b/svtools/source/table/tablecontrol.cxx index e2310b798bcd..2655843b3339 100644 --- a/svtools/source/table/tablecontrol.cxx +++ b/svtools/source/table/tablecontrol.cxx @@ -540,13 +540,13 @@ namespace svt::table } - long TableControl::GetRowCount() const + tools::Long TableControl::GetRowCount() const { return GetModel()->getRowCount(); } - long TableControl::GetColumnCount() const + tools::Long TableControl::GetColumnCount() const { return GetModel()->getColumnCount(); } diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index b4cf5591761f..26e96c063325 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -511,7 +511,7 @@ namespace svt::table { // the number of pixels which are scrolled out of the left hand // side of the window - const long nScrolledOutLeft = m_nLeftColumn == 0 ? 0 : m_aColumnWidths[ m_nLeftColumn - 1 ].getEnd(); + const tools::Long nScrolledOutLeft = m_nLeftColumn == 0 ? 0 : m_aColumnWidths[ m_nLeftColumn - 1 ].getEnd(); ColumnPositions::const_reverse_iterator loop = m_aColumnWidths.rbegin(); do @@ -581,8 +581,8 @@ namespace svt::table { /// determines whether a scrollbar is needed for the given values - bool lcl_determineScrollbarNeed( long const i_position, ScrollbarVisibility const i_visibility, - long const i_availableSpace, long const i_neededSpace ) + bool lcl_determineScrollbarNeed( tools::Long const i_position, ScrollbarVisibility const i_visibility, + tools::Long const i_availableSpace, tools::Long const i_neededSpace ) { if ( i_visibility == ScrollbarShowNever ) return false; @@ -609,8 +609,8 @@ namespace svt::table bool lcl_updateScrollbar( vcl::Window& _rParent, VclPtr<ScrollBar>& _rpBar, - bool const i_needBar, long _nVisibleUnits, - long _nPosition, long _nRange, + bool const i_needBar, tools::Long _nVisibleUnits, + tools::Long _nPosition, tools::Long _nRange, bool _bHorizontal, const Link<ScrollBar*,void>& _rScrollHandler ) { // do we currently have the scrollbar? @@ -653,7 +653,7 @@ namespace svt::table for the given row height. Partially fitting rows are counted, too, if the respective parameter says so. */ - TableSize lcl_getRowsFittingInto( long _nOverallHeight, long _nRowHeightPixel, bool _bAcceptPartialRow ) + TableSize lcl_getRowsFittingInto( tools::Long _nOverallHeight, tools::Long _nRowHeightPixel, bool _bAcceptPartialRow ) { return _bAcceptPartialRow ? ( _nOverallHeight + ( _nRowHeightPixel - 1 ) ) / _nRowHeightPixel @@ -686,11 +686,11 @@ namespace svt::table } - long TableControl_Impl::impl_ni_calculateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding, + tools::Long TableControl_Impl::impl_ni_calculateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding, bool const i_assumeVerticalScrollbar, ::std::vector< long >& o_newColWidthsPixel ) const { // the available horizontal space - long gridWidthPixel = m_rAntiImpl.GetOutputSizePixel().Width(); + tools::Long gridWidthPixel = m_rAntiImpl.GetOutputSizePixel().Width(); ENSURE_OR_RETURN( !!m_pModel, "TableControl_Impl::impl_ni_calculateColumnWidths: not allowed without a model!", gridWidthPixel ); if ( m_pModel->hasRowHeaders() && ( gridWidthPixel != 0 ) ) { @@ -699,7 +699,7 @@ namespace svt::table if ( i_assumeVerticalScrollbar && ( m_pModel->getVerticalScrollbarVisibility() != ScrollbarShowNever ) ) { - long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + tools::Long nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); gridWidthPixel -= nScrollbarMetrics; } @@ -710,18 +710,18 @@ namespace svt::table // collect some meta data for our columns: // - their current (pixel) metrics - long accumulatedCurrentWidth = 0; + tools::Long accumulatedCurrentWidth = 0; ::std::vector< long > currentColWidths; currentColWidths.reserve( colCount ); typedef ::std::vector< ::std::pair< long, long > > ColumnLimits; ColumnLimits effectiveColumnLimits; effectiveColumnLimits.reserve( colCount ); - long accumulatedMinWidth = 0; - long accumulatedMaxWidth = 0; + tools::Long accumulatedMinWidth = 0; + tools::Long accumulatedMaxWidth = 0; // - their relative flexibility ::std::vector< ::sal_Int32 > columnFlexibilities; columnFlexibilities.reserve( colCount ); - long flexibilityDenominator = 0; + tools::Long flexibilityDenominator = 0; size_t flexibleColumnCount = 0; for ( ColPos col = 0; col < colCount; ++col ) { @@ -729,7 +729,7 @@ namespace svt::table ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" ); // current width - long const currentWidth = appFontWidthToPixel( pColumn->getWidth() ); + tools::Long const currentWidth = appFontWidthToPixel( pColumn->getWidth() ); currentColWidths.push_back( currentWidth ); // accumulated width @@ -745,17 +745,17 @@ namespace svt::table flexibility = 0; // min/max width - long effectiveMin = currentWidth, effectiveMax = currentWidth; + tools::Long effectiveMin = currentWidth, effectiveMax = currentWidth; // if the column is not flexible, it will not be asked for min/max, but we assume the current width as limit then if ( flexibility > 0 ) { - long const minWidth = appFontWidthToPixel( pColumn->getMinWidth() ); + tools::Long const minWidth = appFontWidthToPixel( pColumn->getMinWidth() ); if ( minWidth > 0 ) effectiveMin = minWidth; else effectiveMin = MIN_COLUMN_WIDTH_PIXEL; - long const maxWidth = appFontWidthToPixel( pColumn->getMaxWidth() ); + tools::Long const maxWidth = appFontWidthToPixel( pColumn->getMaxWidth() ); OSL_ENSURE( minWidth <= maxWidth, "TableControl_Impl::impl_ni_calculateColumnWidths: pretty undecided 'bout its width limits, this column!" ); if ( ( maxWidth > 0 ) && ( maxWidth >= minWidth ) ) effectiveMax = maxWidth; @@ -784,7 +784,7 @@ namespace svt::table } else if ( gridWidthPixel > accumulatedCurrentWidth ) { // we have space to give away ... - long distributePixel = gridWidthPixel - accumulatedCurrentWidth; + tools::Long distributePixel = gridWidthPixel - accumulatedCurrentWidth; if ( gridWidthPixel > accumulatedMaxWidth ) { // ... but the column's maximal widths are still less than we have @@ -803,11 +803,11 @@ namespace svt::table // distribute the remaining space amongst all columns with a positive flexibility for ( size_t i=0; i<o_newColWidthsPixel.size() && !startOver; ++i ) { - long const columnFlexibility = columnFlexibilities[i]; + tools::Long const columnFlexibility = columnFlexibilities[i]; if ( columnFlexibility == 0 ) continue; - long newColWidth = currentColWidths[i] + columnFlexibility * distributePixel / flexibilityDenominator; + tools::Long newColWidth = currentColWidths[i] + columnFlexibility * distributePixel / flexibilityDenominator; if ( newColWidth > effectiveColumnLimits[i].second ) { // that was too much, we hit the col's maximum @@ -818,7 +818,7 @@ namespace svt::table columnFlexibilities[i] = 0; --flexibleColumnCount; // ... and the remaining width ... - long const difference = newColWidth - currentColWidths[i]; + tools::Long const difference = newColWidth - currentColWidths[i]; distributePixel -= difference; // ... this way, we ensure that the width not taken up by this column is consumed by the other // flexible ones (if there are some) @@ -861,7 +861,7 @@ namespace svt::table } else if ( gridWidthPixel < accumulatedCurrentWidth ) { // we need to take away some space from the columns which allow it ... - long takeAwayPixel = accumulatedCurrentWidth - gridWidthPixel; + tools::Long takeAwayPixel = accumulatedCurrentWidth - gridWidthPixel; if ( gridWidthPixel < accumulatedMinWidth ) { // ... but the column's minimal widths are still more than we have @@ -880,11 +880,11 @@ namespace svt::table // take away the space we need from the columns with a positive flexibility for ( size_t i=0; i<o_newColWidthsPixel.size() && !startOver; ++i ) { - long const columnFlexibility = columnFlexibilities[i]; + tools::Long const columnFlexibility = columnFlexibilities[i]; if ( columnFlexibility == 0 ) continue; - long newColWidth = currentColWidths[i] - columnFlexibility * takeAwayPixel / flexibilityDenominator; + tools::Long newColWidth = currentColWidths[i] - columnFlexibility * takeAwayPixel / flexibilityDenominator; if ( newColWidth < effectiveColumnLimits[i].first ) { // that was too much, we hit the col's minimum @@ -895,7 +895,7 @@ namespace svt::table columnFlexibilities[i] = 0; --flexibleColumnCount; // ... and the remaining width ... - long const difference = currentColWidths[i] - newColWidth; + tools::Long const difference = currentColWidths[i] - newColWidth; takeAwayPixel -= difference; // and start over with the first column, since there might be earlier columns which need @@ -964,10 +964,10 @@ namespace svt::table // - V-NO: redistribute the remaining space (if any) amongst all columns which allow it ::std::vector< long > newWidthsPixel; - long gridWidthPixel = impl_ni_calculateColumnWidths( i_assumeInflexibleColumnsUpToIncluding, true, newWidthsPixel ); + tools::Long gridWidthPixel = impl_ni_calculateColumnWidths( i_assumeInflexibleColumnsUpToIncluding, true, newWidthsPixel ); // the width/height of a scrollbar, needed several times below - long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + tools::Long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); // determine the playground for the data cells (excluding headers) // TODO: what if the control is smaller than needed for the headers/scrollbars? @@ -977,7 +977,7 @@ namespace svt::table OSL_ENSURE( ( m_nRowCount == m_pModel->getRowCount() ) && ( m_nColumnCount == m_pModel->getColumnCount() ), "TableControl_Impl::impl_ni_relayout: how is this expected to work with invalid data?" ); - long const nAllColumnsWidth = ::std::accumulate( newWidthsPixel.begin(), newWidthsPixel.end(), 0 ); + tools::Long const nAllColumnsWidth = ::std::accumulate( newWidthsPixel.begin(), newWidthsPixel.end(), 0 ); ScrollbarVisibility const eVertScrollbar = m_pModel->getVerticalScrollbarVisibility(); ScrollbarVisibility const eHorzScrollbar = m_pModel->getHorizontalScrollbarVisibility(); @@ -1022,12 +1022,12 @@ namespace svt::table // update the column objects with the new widths we finally calculated TableSize const colCount = m_pModel->getColumnCount(); m_aColumnWidths.reserve( colCount ); - long accumulatedWidthPixel = m_nRowHeaderWidthPixel; + tools::Long accumulatedWidthPixel = m_nRowHeaderWidthPixel; bool anyColumnWidthChanged = false; for ( ColPos col = 0; col < colCount; ++col ) { - const long columnStart = accumulatedWidthPixel; - const long columnEnd = columnStart + newWidthsPixel[col]; + const tools::Long columnStart = accumulatedWidthPixel; + const tools::Long columnEnd = columnStart + newWidthsPixel[col]; m_aColumnWidths.emplace_back( columnStart, columnEnd ); accumulatedWidthPixel = columnEnd; @@ -1035,8 +1035,8 @@ namespace svt::table PColumnModel const pColumn = m_pModel->getColumnModel( col ); ENSURE_OR_THROW( !!pColumn, "invalid column returned by the model!" ); - long const oldColumnWidthAppFont = pColumn->getWidth(); - long const newColumnWidthAppFont = pixelWidthToAppFont( newWidthsPixel[col] ); + tools::Long const oldColumnWidthAppFont = pColumn->getWidth(); + tools::Long const newColumnWidthAppFont = pixelWidthToAppFont( newWidthsPixel[col] ); pColumn->setWidth( newColumnWidthAppFont ); anyColumnWidthChanged |= ( oldColumnWidthAppFont != newColumnWidthAppFont ); @@ -1058,7 +1058,7 @@ namespace svt::table // now adjust the column metrics, since they currently ignore the horizontal scroll position if ( m_nLeftColumn > 0 ) { - const long offsetPixel = m_aColumnWidths[ 0 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart(); + const tools::Long offsetPixel = m_aColumnWidths[ 0 ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart(); for (auto & columnWidth : m_aColumnWidths) { columnWidth.move( offsetPixel ); @@ -1073,7 +1073,7 @@ namespace svt::table void TableControl_Impl::impl_ni_positionChildWindows( tools::Rectangle const & i_dataCellPlayground, bool const i_verticalScrollbar, bool const i_horizontalScrollbar ) { - long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); + tools::Long const nScrollbarMetrics = m_rAntiImpl.GetSettings().GetStyleSettings().GetScrollBarSize(); // create or destroy the vertical scrollbar, as needed lcl_updateScrollbar( @@ -1785,13 +1785,13 @@ namespace svt::table } - long TableControl_Impl::pixelWidthToAppFont( long const i_pixels ) const + tools::Long TableControl_Impl::pixelWidthToAppFont( tools::Long const i_pixels ) const { return m_pDataWindow->PixelToLogic(Size(i_pixels, 0), MapMode(MapUnit::MapAppFont)).Width(); } - long TableControl_Impl::appFontWidthToPixel( long const i_appFontUnits ) const + tools::Long TableControl_Impl::appFontWidthToPixel( tools::Long const i_appFontUnits ) const { return m_pDataWindow->LogicToPixel(Size(i_appFontUnits, 0), MapMode(MapUnit::MapAppFont)).Width(); } @@ -2035,7 +2035,7 @@ namespace svt::table // Same for onEndScroll // scroll the view port, if possible - long nPixelDelta = m_nRowHeightPixel * ( m_nTopRow - nOldTopRow ); + tools::Long nPixelDelta = m_nRowHeightPixel * ( m_nTopRow - nOldTopRow ); tools::Rectangle aDataArea( Point( 0, m_nColHeaderHeightPixel ), m_pDataWindow->GetOutputSizePixel() ); @@ -2043,7 +2043,7 @@ namespace svt::table && std::abs( nPixelDelta ) < aDataArea.GetHeight() ) { - m_pDataWindow->Scroll( 0, static_cast<long>(-nPixelDelta), aDataArea, ScrollFlags::Clip | ScrollFlags::Update | ScrollFlags::Children); + m_pDataWindow->Scroll( 0, static_cast<tools::Long>(-nPixelDelta), aDataArea, ScrollFlags::Clip | ScrollFlags::Update | ScrollFlags::Children); } else { @@ -2101,7 +2101,7 @@ namespace svt::table // scroll the view port, if possible const tools::Rectangle aDataArea( Point( m_nRowHeaderWidthPixel, 0 ), m_pDataWindow->GetOutputSizePixel() ); - long nPixelDelta = + tools::Long nPixelDelta = m_aColumnWidths[ nOldLeftColumn ].getStart() - m_aColumnWidths[ m_nLeftColumn ].getStart(); @@ -2177,7 +2177,7 @@ namespace svt::table } - ColPos TableControl_Impl::impl_getColumnForOrdinate( long const i_ordinate ) const + ColPos TableControl_Impl::impl_getColumnForOrdinate( tools::Long const i_ordinate ) const { if ( ( m_aColumnWidths.empty() ) || ( i_ordinate < 0 ) ) return COL_INVALID; @@ -2203,7 +2203,7 @@ namespace svt::table } - RowPos TableControl_Impl::impl_getRowForAbscissa( long const i_abscissa ) const + RowPos TableControl_Impl::impl_getRowForAbscissa( tools::Long const i_abscissa ) const { if ( i_abscissa < 0 ) return ROW_INVALID; @@ -2211,8 +2211,8 @@ namespace svt::table if ( i_abscissa < m_nColHeaderHeightPixel ) return ROW_COL_HEADERS; - long const abscissa = i_abscissa - m_nColHeaderHeightPixel; - long const row = m_nTopRow + abscissa / m_nRowHeightPixel; + tools::Long const abscissa = i_abscissa - m_nColHeaderHeightPixel; + tools::Long const row = m_nTopRow + abscissa / m_nRowHeightPixel; return row < m_pModel->getRowCount() ? row : ROW_INVALID; } diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx index 9e512e99a1e7..998558ece08b 100644 --- a/svtools/source/table/tablecontrol_impl.hxx +++ b/svtools/source/table/tablecontrol_impl.hxx @@ -41,17 +41,17 @@ namespace svt::table { } - MutableColumnMetrics( long const i_startPixel, long const i_endPixel ) + MutableColumnMetrics( tools::Long const i_startPixel, tools::Long const i_endPixel ) :ColumnMetrics( i_startPixel, i_endPixel ) { } - long getStart() const { return nStartPixel; } - long getEnd() const { return nEndPixel; } + tools::Long getStart() const { return nStartPixel; } + tools::Long getEnd() const { return nEndPixel; } - void move( long const i_offset ) { nStartPixel += i_offset; nEndPixel += i_offset; } + void move( tools::Long const i_offset ) { nStartPixel += i_offset; nEndPixel += i_offset; } - long getWidth() const { return nEndPixel - nStartPixel; } + tools::Long getWidth() const { return nEndPixel - nStartPixel; } }; struct ColumnInfoPositionLess @@ -90,11 +90,11 @@ namespace svt::table ColumnPositions m_aColumnWidths; /// the height of a single row in the table, measured in pixels - long m_nRowHeightPixel; + tools::Long m_nRowHeightPixel; /// the height of the column header row in the table, measured in pixels - long m_nColHeaderHeightPixel; + tools::Long m_nColHeaderHeightPixel; /// the width of the row header column in the table, measured in pixels - long m_nRowHeaderWidthPixel; + tools::Long m_nRowHeaderWidthPixel; /// the number of columns in the table control. Cached model value. TableSize m_nColumnCount; @@ -256,7 +256,7 @@ namespace svt::table virtual void captureMouse() override; virtual void releaseMouse() override; virtual void invalidate( TableArea const i_what ) override; - virtual long pixelWidthToAppFont( long const i_pixels ) const override; + virtual tools::Long pixelWidthToAppFont( tools::Long const i_pixels ) const override; virtual void hideTracking() override; virtual void showTracking( tools::Rectangle const & i_location, ShowTrackFlags const i_flags ) override; RowPos getRowAtPoint( const Point& rPoint ) const; @@ -266,7 +266,7 @@ namespace svt::table virtual bool isRowSelected( RowPos i_row ) const override; - long appFontWidthToPixel( long const i_appFontUnits ) const; + tools::Long appFontWidthToPixel( tools::Long const i_appFontUnits ) const; TableDataWindow& getDataWindow() { return *m_pDataWindow; } const TableDataWindow& getDataWindow() const { return *m_pDataWindow; } @@ -372,7 +372,7 @@ namespace svt::table @return the overall width of the grid, which is available for columns */ - long impl_ni_calculateColumnWidths( + tools::Long impl_ni_calculateColumnWidths( ColPos const i_assumeInflexibleColumnsUpToIncluding, bool const i_assumeVerticalScrollbar, ::std::vector< long >& o_newColWidthsPixel @@ -438,11 +438,11 @@ namespace svt::table /** retrieves the column which covers the given ordinate */ - ColPos impl_getColumnForOrdinate( long const i_ordinate ) const; + ColPos impl_getColumnForOrdinate( tools::Long const i_ordinate ) const; /** retrieves the row which covers the given abscissa */ - RowPos impl_getRowForAbscissa( long const i_abscissa ) const; + RowPos impl_getRowForAbscissa( tools::Long const i_abscissa ) const; /// invalidates the window area occupied by the given column void impl_invalidateColumn( ColPos const i_column ); |