summaryrefslogtreecommitdiff
path: root/svtools/source/brwbox/brwbox2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'svtools/source/brwbox/brwbox2.cxx')
-rw-r--r--svtools/source/brwbox/brwbox2.cxx113
1 files changed, 55 insertions, 58 deletions
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 89c3babea3c7..0963e067a1da 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -138,7 +138,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
pHeaderBar->SetZoom(GetZoom());
// let the columns calculate their new widths and adjust the header bar
- for (BrowserColumn* pCol : pCols)
+ for (auto & pCol : mvCols)
{
pCol->ZoomChanged(GetZoom());
if ( pHeaderBar )
@@ -151,7 +151,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
else if (StateChangedType::Enable == nStateChange)
{
// do we have a handle column?
- bool bHandleCol = !pCols.empty() && (0 == pCols[ 0 ]->GetId());
+ bool bHandleCol = !mvCols.empty() && (0 == mvCols[ 0 ]->GetId());
// do we have a header bar?
bool bHeaderBar = (nullptr != pDataWin->pHeaderBar.get());
@@ -239,7 +239,7 @@ void BrowseBox::ToggleSelection()
long nLastRowInRect = 0; // for the CFront
// don't highlight handle column
- BrowserColumn *pFirstCol = pCols.empty() ? nullptr : pCols[ 0 ];
+ BrowserColumn *pFirstCol = mvCols.empty() ? nullptr : mvCols[ 0 ].get();
long nOfsX = (!pFirstCol || pFirstCol->GetId()) ? 0 : pFirstCol->Width();
// accumulate old row selection
@@ -277,7 +277,7 @@ void BrowseBox::ToggleSelection()
nColId = pColSel->NextSelected() )
{
tools::Rectangle aRect( GetFieldRectPixel(nCurRow,
- pCols[ nColId ]->GetId(),
+ mvCols[ nColId ]->GetId(),
false ) );
aRect.AdjustLeft( -(MIN_COLUMNWIDTH) );
aRect.AdjustRight(MIN_COLUMNWIDTH );
@@ -325,8 +325,8 @@ void BrowseBox::DrawCursor()
}
else
aCursor = tools::Rectangle(
- Point( ( !pCols.empty() && pCols[ 0 ]->GetId() == 0 ) ?
- pCols[ 0 ]->Width() : 0,
+ Point( ( !mvCols.empty() && mvCols[ 0 ]->GetId() == 0 ) ?
+ mvCols[ 0 ]->Width() : 0,
(nCurRow - nTopRow) * GetDataRowHeight() + 1 ),
Size( pDataWin->GetOutputSizePixel().Width() + 1,
GetDataRowHeight() - 2 ) );
@@ -363,26 +363,25 @@ sal_uLong BrowseBox::GetColumnWidth( sal_uInt16 nId ) const
{
sal_uInt16 nItemPos = GetColumnPos( nId );
- if ( nItemPos >= pCols.size() )
+ if ( nItemPos >= mvCols.size() )
return 0;
- return pCols[ nItemPos ]->Width();
+ return mvCols[ nItemPos ]->Width();
}
sal_uInt16 BrowseBox::GetColumnId( sal_uInt16 nPos ) const
{
- if ( nPos >= pCols.size() )
+ if ( nPos >= mvCols.size() )
return BROWSER_INVALIDID;
- return pCols[ nPos ]->GetId();
+ return mvCols[ nPos ]->GetId();
}
sal_uInt16 BrowseBox::GetColumnPos( sal_uInt16 nId ) const
{
-
- for ( size_t nPos = 0; nPos < pCols.size(); ++nPos )
- if ( pCols[ nPos ]->GetId() == nId )
+ for ( size_t nPos = 0; nPos < mvCols.size(); ++nPos )
+ if ( mvCols[ nPos ]->GetId() == nId )
return nPos;
return BROWSER_INVALIDID;
}
@@ -390,8 +389,7 @@ sal_uInt16 BrowseBox::GetColumnPos( sal_uInt16 nId ) const
bool BrowseBox::IsFrozen( sal_uInt16 nColumnId ) const
{
-
- for (BrowserColumn* pCol : pCols)
+ for (auto const & pCol : mvCols)
if ( pCol->GetId() == nColumnId )
return pCol->IsFrozen();
return false;
@@ -466,7 +464,7 @@ void BrowseBox::Resize()
{
if ( !bBootstrapped && IsReallyVisible() )
BrowseBox::StateChanged( StateChangedType::InitShow );
- if ( pCols.empty() )
+ if ( mvCols.empty() )
{
pDataWin->bResizeOnPaint = true;
return;
@@ -488,7 +486,7 @@ void BrowseBox::Resize()
// did we need a horizontal scroll bar or is there a Control Area?
if ( !pDataWin->bNoHScroll &&
- ( ( pCols.size() - FrozenColCount() ) > 1 ) )
+ ( ( mvCols.size() - FrozenColCount() ) > 1 ) )
aHScroll->Show();
else
aHScroll->Hide();
@@ -529,7 +527,7 @@ void BrowseBox::Resize()
if ( pHeaderBar )
{
// take the handle column into account
- BrowserColumn *pFirstCol = pCols[ 0 ];
+ BrowserColumn *pFirstCol = mvCols[ 0 ].get();
long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
pHeaderBar->SetPosSizePixel( Point( nOfsX, 0 ), Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) );
}
@@ -545,10 +543,10 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
// initializations
if (!bBootstrapped && IsReallyVisible())
BrowseBox::StateChanged(StateChangedType::InitShow);
- if (pCols.empty())
+ if (mvCols.empty())
return;
- BrowserColumn *pFirstCol = pCols[ 0 ];
+ BrowserColumn *pFirstCol = mvCols[ 0 ].get();
bool bHandleCol = pFirstCol && pFirstCol->GetId() == 0;
bool bHeaderBar = pDataWin->pHeaderBar.get() != nullptr;
@@ -581,17 +579,17 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
// iterate through columns to redraw
long nX = 0;
size_t nCol;
- for (nCol = 0; nCol < pCols.size() && nX < rRect.Right(); ++nCol)
+ for (nCol = 0; nCol < mvCols.size() && nX < rRect.Right(); ++nCol)
{
// skip invisible columns between frozen and scrollable area
- if (nCol < nFirstCol && !pCols[nCol]->IsFrozen())
+ if (nCol < nFirstCol && !mvCols[nCol]->IsFrozen())
nCol = nFirstCol;
// only the handle column?
if (bHeaderBar && bHandleCol && nCol > 0)
break;
- BrowserColumn* pCol = pCols[nCol];
+ BrowserColumn* pCol = mvCols[nCol].get();
// draw the column and increment position
if ( pCol->Width() > 4 )
@@ -616,7 +614,7 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle
}
// retouching
- if ( !bHeaderBar && nCol == pCols.size() )
+ if ( !bHeaderBar && nCol == mvCols.size() )
{
const StyleSettings &rSettings = rRenderContext.GetSettings().GetStyleSettings();
Color aColFace(rSettings.GetFaceColor());
@@ -677,9 +675,9 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
// this counts for the column widths, too
size_t nPos;
- for ( nPos = 0; nPos < pCols.size(); ++nPos )
+ for ( nPos = 0; nPos < mvCols.size(); ++nPos )
{
- BrowserColumn* pCurrent = pCols[ nPos ];
+ 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();
@@ -702,7 +700,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MapMode(MapUnit::Map10thMM)).Height();
nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MapMode(MapUnit::Map10thMM)).Height();
- BrowserColumn* pFirstCol = !pCols.empty() ? pCols[ 0 ] : nullptr;
+ BrowserColumn* pFirstCol = !mvCols.empty() ? mvCols[ 0 ].get() : nullptr;
Point aHeaderPos(pFirstCol && (pFirstCol->GetId() == 0) ? pFirstCol->Width() : 0, 0);
Size aHeaderSize(aRealSize.Width() - aHeaderPos.X(), nTitleHeight);
@@ -756,9 +754,9 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
// restore the column widths/data row height
nDataRowHeight = nOriginalHeight;
- for ( nPos = 0; nPos < pCols.size(); ++nPos )
+ for ( nPos = 0; nPos < mvCols.size(); ++nPos )
{
- BrowserColumn* pCurrent = pCols[ nPos ];
+ 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();
@@ -799,7 +797,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 == pCols[ 0 ]->GetId() ? pCols[ 0 ]->Width() : 0;
+ long nHLineX = 0 == mvCols[ 0 ]->GetId() ? mvCols[ 0 ]->Width() : 0;
nHLineX += aOverallAreaPos.X();
Color aDelimiterLineColor( ::svtools::ColorConfig().GetColorValue( ::svtools::CALCGRID ).nColor );
@@ -842,10 +840,10 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec
// iterate through columns to redraw
size_t nCol;
- for ( nCol = 0; nCol < pCols.size(); ++nCol )
+ for ( nCol = 0; nCol < mvCols.size(); ++nCol )
{
// get column
- BrowserColumn *pCol = pCols[ nCol ];
+ BrowserColumn *pCol = mvCols[ nCol ].get();
// at end of invalid area
if ( aPos.X() >= _rRect.Right() )
@@ -855,7 +853,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec
if ( nCol < nFirstCol && !pCol->IsFrozen() )
{
nCol = nFirstCol;
- pCol = (nCol < pCols.size() ) ? pCols[ nCol ] : nullptr;
+ pCol = (nCol < mvCols.size() ) ? mvCols[ nCol ].get() : nullptr;
if (!pCol)
{ // FS - 21.05.99 - 66325
// actually this has been fixed elsewhere (in the right place),
@@ -957,14 +955,14 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec
aOldLineColor = _rOut.GetLineColor();
aOldFillColor = _rOut.GetFillColor();
_rOut.SetFillColor( rSettings.GetFaceColor() );
- if ( !pCols.empty() && ( pCols[ 0 ]->GetId() == 0 ) && ( aPos.Y() <= _rRect.Bottom() ) )
+ if ( !mvCols.empty() && ( mvCols[ 0 ]->GetId() == 0 ) && ( aPos.Y() <= _rRect.Bottom() ) )
{
// fill rectangle gray below handle column
// DG: fill it only until the end of the drawing rect and not to the end, as this may overpaint handle columns
_rOut.SetLineColor( COL_BLACK );
_rOut.DrawRect( tools::Rectangle(
Point( aOverallAreaPos.X() - 1, aPos.Y() - 1 ),
- Point( aOverallAreaPos.X() + pCols[ 0 ]->Width() - 1,
+ Point( aOverallAreaPos.X() + mvCols[ 0 ]->Width() - 1,
_rRect.Bottom() + 1) ) );
}
_rOut.SetFillColor( aOldFillColor );
@@ -983,16 +981,16 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const tools::Rectangle& _rRec
_rOut.SetLineColor( aDelimiterLineColor );
Point aVertPos( aOverallAreaPos.X() - 1, aOverallAreaPos.Y() );
long nDeltaY = aOverallAreaBRPos.Y();
- for ( size_t nCol = 0; nCol < pCols.size(); ++nCol )
+ for ( size_t nCol = 0; nCol < mvCols.size(); ++nCol )
{
// get column
- BrowserColumn *pCol = pCols[ nCol ];
+ BrowserColumn *pCol = mvCols[ nCol ].get();
// skip invisible columns between frozen and scrollable area
if ( nCol < nFirstCol && !pCol->IsFrozen() )
{
nCol = nFirstCol;
- pCol = pCols[ nCol ];
+ pCol = mvCols[ nCol ].get();
}
// skip column
@@ -1022,7 +1020,7 @@ void BrowseBox::PaintData( vcl::Window const & rWin, vcl::RenderContext& rRender
BrowseBox::StateChanged(StateChangedType::InitShow);
// initializations
- if (pCols.empty() || !rWin.IsUpdateMode())
+ if (mvCols.empty() || !rWin.IsUpdateMode())
return;
if (pDataWin->bResizeOnPaint)
Resize();
@@ -1083,7 +1081,7 @@ void BrowseBox::UpdateScrollbars()
sal_uInt16 nFrozenCols = FrozenColCount();
bool bNeedsHScroll = pDataWin->bAutoHScroll
- ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols.size() )
+ ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= mvCols.size() )
: !pDataWin->bNoHScroll;
if ( !bNeedsHScroll )
{
@@ -1112,11 +1110,11 @@ void BrowseBox::UpdateScrollbars()
Size( aDataWinSize.Width() - nHScrX, nCornerSize ) );
// total scrollable columns
- short nScrollCols = short(pCols.size()) - static_cast<short>(nFrozenCols);
+ short nScrollCols = short(mvCols.size()) - static_cast<short>(nFrozenCols);
// visible columns
short nVisibleHSize = nLastCol == BROWSER_INVALIDID
- ? static_cast<short>( pCols.size() - nFirstCol )
+ ? static_cast<short>( mvCols.size() - nFirstCol )
: static_cast<short>( nLastCol - nFirstCol );
short nRange = std::max( nScrollCols, short(0) );
@@ -1183,12 +1181,12 @@ void BrowseBox::UpdateScrollbars()
{
long nWidth = 0;
for ( size_t nCol = 0;
- nCol < pCols.size() && nCol < nFirstCol;
+ nCol < mvCols.size() && nCol < nFirstCol;
++nCol )
{
// not the handle column
- if ( pCols[ nCol ]->GetId() )
- nWidth += pCols[ nCol ]->Width();
+ if ( mvCols[ nCol ]->GetId() )
+ nWidth += mvCols[ nCol ]->Width();
}
pDataWin->pHeaderBar->SetOffset( nWidth );
@@ -1244,16 +1242,15 @@ long BrowseBox::GetFrozenWidth() const
long nWidth = 0;
for ( size_t nCol = 0;
- nCol < pCols.size() && pCols[ nCol ]->IsFrozen();
+ nCol < mvCols.size() && mvCols[ nCol ]->IsFrozen();
++nCol )
- nWidth += pCols[ nCol ]->Width();
+ nWidth += mvCols[ nCol ]->Width();
return nWidth;
}
void BrowseBox::ColumnInserted( sal_uInt16 nPos )
{
-
if ( pColSel )
pColSel->Insert( nPos );
UpdateScrollbars();
@@ -1262,9 +1259,9 @@ void BrowseBox::ColumnInserted( sal_uInt16 nPos )
sal_uInt16 BrowseBox::FrozenColCount() const
{
- BrowserColumns::size_type nCol;
+ std::size_t nCol;
for ( nCol = 0;
- nCol < pCols.size() && pCols[ nCol ]->IsFrozen();
+ nCol < mvCols.size() && mvCols[ nCol ]->IsFrozen();
++nCol )
/* empty loop */;
return nCol; //TODO: BrowserColumns::size_type -> sal_uInt16!
@@ -1321,10 +1318,10 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt )
long nX = 0;
long nWidth = GetOutputSizePixel().Width();
- for ( size_t nCol = 0; nCol < pCols.size() && nX < nWidth; ++nCol )
+ for ( size_t nCol = 0; nCol < mvCols.size() && nX < nWidth; ++nCol )
{
// is this column visible?
- BrowserColumn *pCol = pCols[ nCol ];
+ BrowserColumn *pCol = mvCols[ nCol ].get();
if ( pCol->IsFrozen() || nCol >= nFirstCol )
{
// compute right end of column
@@ -1371,14 +1368,14 @@ void BrowseBox::MouseMove( const MouseEvent& rEvt )
sal_uInt16 nX = 0;
for ( size_t nCol = 0;
- nCol < pCols.size() &&
- ( nX + pCols[ nCol ]->Width() ) < sal_uInt16(GetOutputSizePixel().Width());
+ nCol < mvCols.size() &&
+ ( nX + mvCols[ nCol ]->Width() ) < sal_uInt16(GetOutputSizePixel().Width());
++nCol )
// is this column visible?
- if ( pCols[ nCol ]->IsFrozen() || nCol >= nFirstCol )
+ if ( mvCols[ nCol ]->IsFrozen() || nCol >= nFirstCol )
{
// compute right end of column
- BrowserColumn *pCol = pCols[ nCol ];
+ BrowserColumn *pCol = mvCols[ nCol ].get();
sal_uInt16 nR = static_cast<sal_uInt16>(nX + pCol->Width() - 1);
// show resize-pointer?
@@ -1423,7 +1420,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
// width changed?
nDragX = std::max( rEvt.GetPosPixel().X(), nMinResizeX );
- if ( (nDragX - nResizeX) != static_cast<long>(pCols[ nResizeCol ]->Width()) )
+ if ( (nDragX - nResizeX) != static_cast<long>(mvCols[ nResizeCol ]->Width()) )
{
// resize column
long nMaxX = pDataWin->GetSizePixel().Width();
@@ -1469,7 +1466,7 @@ void BrowseBox::MouseButtonDown( const BrowserMouseEvent& rEvt )
{
if ( bColumnCursor && rEvt.GetColumn() != 0 )
{
- if ( rEvt.GetColumn() < pCols.size() )
+ if ( rEvt.GetColumn() < mvCols.size() )
SelectColumnPos( rEvt.GetColumn(), true, false);
}
}