remove unnecessary casting in BrowseBox::pDataWin member

Change-Id: I1187691c19808c53ff3839cfd8892ab06d36053e
Reviewed-on: https://gerrit.libreoffice.org/32381
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2016-12-23 13:15:43 +02:00
parent 0c267bbc2c
commit cfcbbfaeb4
3 changed files with 149 additions and 145 deletions

View File

@ -197,9 +197,9 @@ public:
static const sal_uInt16 HandleColumnId = 0; static const sal_uInt16 HandleColumnId = 0;
private: private:
VclPtr<vcl::Window> pDataWin; // window to display data rows VclPtr<BrowserDataWin> pDataWin; // window to display data rows
VclPtr<ScrollBar> pVScroll; // vertical scrollbar VclPtr<ScrollBar> pVScroll; // vertical scrollbar
VclPtr<ScrollBar> aHScroll; // horizontal scrollbar VclPtr<ScrollBar> aHScroll; // horizontal scrollbar
long nDataRowHeight; // height of a single data-row long nDataRowHeight; // height of a single data-row
sal_uInt16 nTitleLines; // number of lines in title row sal_uInt16 nTitleLines; // number of lines in title row
@ -356,8 +356,7 @@ protected:
virtual void VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows); virtual void VisibleRowsChanged( long nNewTopRow, sal_uInt16 nNumRows);
// number of visible rows in the window (incl. "truncated" rows) // number of visible rows in the window (incl. "truncated" rows)
sal_uInt16 GetVisibleRows() sal_uInt16 GetVisibleRows();
{ return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1); }
long GetTopRow() { return nTopRow; } long GetTopRow() { return nTopRow; }
sal_uInt16 GetFirstVisibleColNumber() const { return nFirstCol; } sal_uInt16 GetFirstVisibleColNumber() const { return nFirstCol; }
@ -436,7 +435,7 @@ public:
// map-mode and font control // map-mode and font control
void SetFont( const vcl::Font& rNewFont ); void SetFont( const vcl::Font& rNewFont );
const vcl::Font& GetFont() const { return pDataWin->GetFont(); } const vcl::Font& GetFont() const;
void SetTitleFont( const vcl::Font& rNewFont ) void SetTitleFont( const vcl::Font& rNewFont )
{ Control::SetFont( rNewFont ); } { Control::SetFont( rNewFont ); }
@ -505,7 +504,7 @@ public:
bool IsResizing() const { return bResizing; } bool IsResizing() const { return bResizing; }
// access to positions of fields, column and rows // access to positions of fields, column and rows
vcl::Window& GetDataWindow() const { return *pDataWin; } vcl::Window& GetDataWindow() const;
Rectangle GetRowRectPixel( long nRow ) const; Rectangle GetRowRectPixel( long nRow ) const;
Rectangle GetFieldRectPixel( long nRow, sal_uInt16 nColId, Rectangle GetFieldRectPixel( long nRow, sal_uInt16 nColId,
bool bRelToBrowser = true) const; bool bRelToBrowser = true) const;

View File

@ -36,7 +36,6 @@
#define SCROLL_FLAGS (ScrollFlags::Clip | ScrollFlags::NoChildren) #define SCROLL_FLAGS (ScrollFlags::Clip | ScrollFlags::NoChildren)
#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin.get()))
using namespace com::sun::star::accessibility::AccessibleEventId; using namespace com::sun::star::accessibility::AccessibleEventId;
using namespace com::sun::star::accessibility::AccessibleTableModelChangeType; using namespace com::sun::star::accessibility::AccessibleTableModelChangeType;
@ -62,9 +61,7 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
SAL_INFO("svtools", "BrowseBox:ConstructImpl " << this ); SAL_INFO("svtools", "BrowseBox:ConstructImpl " << this );
bMultiSelection = false; bMultiSelection = false;
pColSel = nullptr; pColSel = nullptr;
pDataWin = nullptr;
pVScroll = nullptr; pVScroll = nullptr;
pDataWin = VclPtr<BrowserDataWin>::Create( this ).get(); pDataWin = VclPtr<BrowserDataWin>::Create( this ).get();
pCols = new BrowserColumns; pCols = new BrowserColumns;
m_pImpl.reset( new ::svt::BrowseBoxImpl() ); m_pImpl.reset( new ::svt::BrowseBoxImpl() );
@ -106,7 +103,7 @@ void BrowseBox::ConstructImpl( BrowserMode nMode )
SetMode( nMode ); SetMode( nMode );
bSelectionIsVisible = bKeepHighlight; bSelectionIsVisible = bKeepHighlight;
bHasFocus = HasChildPathFocus(); bHasFocus = HasChildPathFocus();
getDataWindow()->nCursorHidden = pDataWin->nCursorHidden =
( bHasFocus ? 0 : 1 ) + ( GetUpdateMode() ? 0 : 1 ); ( bHasFocus ? 0 : 1 ) + ( GetUpdateMode() ? 0 : 1 );
} }
@ -136,8 +133,8 @@ void BrowseBox::dispose()
} }
Hide(); Hide();
getDataWindow()->pHeaderBar.disposeAndClear(); pDataWin->pHeaderBar.disposeAndClear();
getDataWindow()->pCornerWin.disposeAndClear(); pDataWin->pCornerWin.disposeAndClear();
pDataWin.disposeAndClear(); pDataWin.disposeAndClear();
pVScroll.disposeAndClear(); pVScroll.disposeAndClear();
aHScroll.disposeAndClear(); aHScroll.disposeAndClear();
@ -158,15 +155,15 @@ void BrowseBox::dispose()
short BrowseBox::GetCursorHideCount() const short BrowseBox::GetCursorHideCount() const
{ {
return getDataWindow()->nCursorHidden; return pDataWin->nCursorHidden;
} }
void BrowseBox::DoShowCursor( const char * ) void BrowseBox::DoShowCursor( const char * )
{ {
if (!getDataWindow()) if (!pDataWin)
return; return;
short nHiddenCount = --getDataWindow()->nCursorHidden; short nHiddenCount = --pDataWin->nCursorHidden;
if (PaintCursorIfHiddenOnce()) if (PaintCursorIfHiddenOnce())
{ {
if (1 == nHiddenCount) if (1 == nHiddenCount)
@ -182,7 +179,7 @@ void BrowseBox::DoShowCursor( const char * )
void BrowseBox::DoHideCursor( const char * ) void BrowseBox::DoHideCursor( const char * )
{ {
short nHiddenCount = ++getDataWindow()->nCursorHidden; short nHiddenCount = ++pDataWin->nCursorHidden;
if (PaintCursorIfHiddenOnce()) if (PaintCursorIfHiddenOnce())
{ {
if (2 == nHiddenCount) if (2 == nHiddenCount)
@ -198,7 +195,7 @@ void BrowseBox::DoHideCursor( const char * )
void BrowseBox::SetRealRowCount( const OUString &rRealRowCount ) void BrowseBox::SetRealRowCount( const OUString &rRealRowCount )
{ {
getDataWindow()->aRealRowCount = rRealRowCount; pDataWin->aRealRowCount = rRealRowCount;
} }
@ -208,10 +205,14 @@ void BrowseBox::SetFont( const vcl::Font& rNewFont )
ImpGetDataRowHeight(); ImpGetDataRowHeight();
} }
const vcl::Font& BrowseBox::GetFont() const
{
return pDataWin->GetFont();
}
sal_uLong BrowseBox::GetDefaultColumnWidth( const OUString& _rText ) const sal_uLong BrowseBox::GetDefaultColumnWidth( const OUString& _rText ) const
{ {
return GetDataWindow().GetTextWidth( _rText ) + GetDataWindow().GetTextWidth(OUString('0')) * 4; return pDataWin->GetTextWidth( _rText ) + pDataWin->GetTextWidth(OUString('0')) * 4;
} }
@ -233,9 +234,9 @@ void BrowseBox::InsertHandleColumn( sal_uLong nWidth )
FreezeColumn( 0 ); FreezeColumn( 0 );
// adjust headerbar // adjust headerbar
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
{ {
getDataWindow()->pHeaderBar->SetPosSizePixel( pDataWin->pHeaderBar->SetPosSizePixel(
Point(nWidth, 0), Point(nWidth, 0),
Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() ) Size( GetOutputSizePixel().Width() - nWidth, GetTitleHeight() )
); );
@ -273,13 +274,13 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const OUString& rText,
if ( nCurColId == 0 ) if ( nCurColId == 0 )
nCurColId = nItemId; nCurColId = nItemId;
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
{ {
// Handle column not in the header bar // Handle column not in the header bar
sal_uInt16 nHeaderPos = nPos; sal_uInt16 nHeaderPos = nPos;
if (nHeaderPos != HEADERBAR_APPEND && GetColumnId(0) == HandleColumnId ) if (nHeaderPos != HEADERBAR_APPEND && GetColumnId(0) == HandleColumnId )
nHeaderPos--; nHeaderPos--;
getDataWindow()->pHeaderBar->InsertItem( pDataWin->pHeaderBar->InsertItem(
nItemId, rText, nWidth, nBits, nHeaderPos ); nItemId, rText, nWidth, nBits, nHeaderPos );
} }
ColumnInserted( nPos ); ColumnInserted( nPos );
@ -353,7 +354,7 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId )
// repaint // repaint
Control::Invalidate(); Control::Invalidate();
getDataWindow()->Invalidate(); pDataWin->Invalidate();
// remember the column selection // remember the column selection
SetToggledSelectedColumn(nSelectedColId); SetToggledSelectedColumn(nSelectedColId);
@ -380,8 +381,8 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos )
// determine old column area // determine old column area
Size aDataWinSize( pDataWin->GetSizePixel() ); Size aDataWinSize( pDataWin->GetSizePixel() );
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
aDataWinSize.Height() += getDataWindow()->pHeaderBar->GetSizePixel().Height(); aDataWinSize.Height() += pDataWin->pHeaderBar->GetSizePixel().Height();
Rectangle aFromRect( GetFieldRect( nColumnId) ); Rectangle aFromRect( GetFieldRect( nColumnId) );
aFromRect.Right() += 2*MIN_COLUMNWIDTH; aFromRect.Right() += 2*MIN_COLUMNWIDTH;
@ -435,12 +436,12 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos )
pDataWin->Window::Invalidate( InvalidateFlags::NoChildren ); pDataWin->Window::Invalidate( InvalidateFlags::NoChildren );
// adjust header bar positions // adjust header bar positions
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
{ {
sal_uInt16 nNewPos = nPos; sal_uInt16 nNewPos = nPos;
if ( GetColumnId(0) == HandleColumnId ) if ( GetColumnId(0) == HandleColumnId )
--nNewPos; --nNewPos;
getDataWindow()->pHeaderBar->MoveItem(nColumnId,nNewPos); pDataWin->pHeaderBar->MoveItem(nColumnId,nNewPos);
} }
// remember the column selection // remember the column selection
SetToggledSelectedColumn(nSelectedColId); SetToggledSelectedColumn(nSelectedColId);
@ -500,8 +501,8 @@ void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const OUString& rTitle )
pCol->Title() = rTitle; pCol->Title() = rTitle;
// adjust headerbar column // adjust headerbar column
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
getDataWindow()->pHeaderBar->SetItemText( nItemId, rTitle ); pDataWin->pHeaderBar->SetItemText( nItemId, rTitle );
else else
{ {
// redraw visible columns // redraw visible columns
@ -539,10 +540,10 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
if ( IsVisible() && nItemPos == pCols->size() - 1 ) if ( IsVisible() && nItemPos == pCols->size() - 1 )
{ {
long nMaxWidth = pDataWin->GetSizePixel().Width(); long nMaxWidth = pDataWin->GetSizePixel().Width();
nMaxWidth -= getDataWindow()->bAutoSizeLastCol nMaxWidth -= pDataWin->bAutoSizeLastCol
? GetFieldRect(nItemId).Left() ? GetFieldRect(nItemId).Left()
: GetFrozenWidth(); : GetFrozenWidth();
if ( static_cast<BrowserDataWin*>( pDataWin.get() )->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth ) if ( pDataWin->bAutoSizeLastCol || nWidth > (sal_uLong)nMaxWidth )
{ {
nWidth = nMaxWidth > 16 ? nMaxWidth : nOldWidth; nWidth = nMaxWidth > 16 ? nMaxWidth : nOldWidth;
nWidth = QueryColumnResize( nItemId, nWidth ); nWidth = QueryColumnResize( nItemId, nWidth );
@ -564,7 +565,7 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
// Selection hidden // Selection hidden
DoHideCursor( "SetColumnWidth" ); DoHideCursor( "SetColumnWidth" );
ToggleSelection(); ToggleSelection();
//!getDataWindow()->Update(); //!pDataWin->Update();
//!Control::Update(); //!Control::Update();
} }
@ -595,19 +596,19 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
pDataWin->GetPosPixel().Y() - 1 ); pDataWin->GetPosPixel().Y() - 1 );
Control::Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS ); Control::Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS );
aScrRect.Bottom() = pDataWin->GetSizePixel().Height(); aScrRect.Bottom() = pDataWin->GetSizePixel().Height();
getDataWindow()->Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS ); pDataWin->Scroll( nWidth-nOldWidth, 0, aScrRect, SCROLL_FLAGS );
Rectangle aInvRect( nX, 0, nX + std::max( nWidth, (sal_uLong)nOldWidth ), USHRT_MAX ); Rectangle aInvRect( nX, 0, nX + std::max( nWidth, (sal_uLong)nOldWidth ), USHRT_MAX );
Control::Invalidate( aInvRect, InvalidateFlags::NoChildren ); Control::Invalidate( aInvRect, InvalidateFlags::NoChildren );
static_cast<BrowserDataWin*>( pDataWin.get() )->Invalidate( aInvRect ); pDataWin->Invalidate( aInvRect );
} }
else else
{ {
Control::Invalidate( InvalidateFlags::NoChildren ); Control::Invalidate( InvalidateFlags::NoChildren );
getDataWindow()->Window::Invalidate( InvalidateFlags::NoChildren ); pDataWin->Window::Invalidate( InvalidateFlags::NoChildren );
} }
//!getDataWindow()->Update(); //!pDataWin->Update();
//!Control::Update(); //!Control::Update();
bSelectionIsVisible = bSelVis; bSelectionIsVisible = bSelVis;
ToggleSelection(); ToggleSelection();
@ -616,8 +617,8 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
UpdateScrollbars(); UpdateScrollbars();
// adjust headerbar column // adjust headerbar column
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
getDataWindow()->pHeaderBar->SetItemSize( pDataWin->pHeaderBar->SetItemSize(
nItemId ? nItemId : USHRT_MAX - 1, nWidth ); nItemId ? nItemId : USHRT_MAX - 1, nWidth );
// adjust last column // adjust last column
@ -630,8 +631,8 @@ void BrowseBox::SetColumnWidth( sal_uInt16 nItemId, sal_uLong nWidth )
void BrowseBox::AutoSizeLastColumn() void BrowseBox::AutoSizeLastColumn()
{ {
if ( getDataWindow()->bAutoSizeLastCol && if ( pDataWin->bAutoSizeLastCol &&
getDataWindow()->GetUpdateMode() ) pDataWin->GetUpdateMode() )
{ {
sal_uInt16 nId = GetColumnId( (sal_uInt16)pCols->size() - 1 ); sal_uInt16 nId = GetColumnId( (sal_uInt16)pCols->size() - 1 );
SetColumnWidth( nId, LONG_MAX ); SetColumnWidth( nId, LONG_MAX );
@ -671,15 +672,15 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId )
// handlecolumn not in headerbar // handlecolumn not in headerbar
if (nItemId) if (nItemId)
{ {
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
getDataWindow()->pHeaderBar->RemoveItem( nItemId ); pDataWin->pHeaderBar->RemoveItem( nItemId );
} }
else else
{ {
// adjust headerbar // adjust headerbar
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
{ {
getDataWindow()->pHeaderBar->SetPosSizePixel( pDataWin->pHeaderBar->SetPosSizePixel(
Point(0, 0), Point(0, 0),
Size( GetOutputSizePixel().Width(), GetTitleHeight() ) Size( GetOutputSizePixel().Width(), GetTitleHeight() )
); );
@ -692,9 +693,9 @@ void BrowseBox::RemoveColumn( sal_uInt16 nItemId )
// trigger repaint, if necessary // trigger repaint, if necessary
if ( GetUpdateMode() ) if ( GetUpdateMode() )
{ {
getDataWindow()->Invalidate(); pDataWin->Invalidate();
Control::Invalidate(); Control::Invalidate();
if ( getDataWindow()->bAutoSizeLastCol && nPos ==ColCount() ) if ( pDataWin->bAutoSizeLastCol && nPos ==ColCount() )
SetColumnWidth( GetColumnId( nPos - 1 ), LONG_MAX ); SetColumnWidth( GetColumnId( nPos - 1 ), LONG_MAX );
} }
@ -742,8 +743,8 @@ void BrowseBox::RemoveColumns()
nCurColId = 0; nCurColId = 0;
nFirstCol = 0; nFirstCol = 0;
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
getDataWindow()->pHeaderBar->Clear( ); pDataWin->pHeaderBar->Clear( );
// correct vertical scrollbar // correct vertical scrollbar
UpdateScrollbars(); UpdateScrollbars();
@ -751,7 +752,7 @@ void BrowseBox::RemoveColumns()
// trigger repaint if necessary // trigger repaint if necessary
if ( GetUpdateMode() ) if ( GetUpdateMode() )
{ {
getDataWindow()->Invalidate(); pDataWin->Invalidate();
Control::Invalidate(); Control::Invalidate();
} }
@ -820,7 +821,7 @@ long BrowseBox::ImpGetDataRowHeight() const
BrowseBox *pThis = const_cast<BrowseBox*>(this); BrowseBox *pThis = const_cast<BrowseBox*>(this);
pThis->nDataRowHeight = pThis->CalcReverseZoom(pDataWin->GetTextHeight() + 2); pThis->nDataRowHeight = pThis->CalcReverseZoom(pDataWin->GetTextHeight() + 2);
pThis->Resize(); pThis->Resize();
getDataWindow()->Invalidate(); pDataWin->Invalidate();
return nDataRowHeight; return nDataRowHeight;
} }
@ -830,7 +831,7 @@ void BrowseBox::SetDataRowHeight( long nPixel )
nDataRowHeight = CalcReverseZoom(nPixel); nDataRowHeight = CalcReverseZoom(nPixel);
Resize(); Resize();
getDataWindow()->Invalidate(); pDataWin->Invalidate();
} }
@ -876,7 +877,7 @@ long BrowseBox::ScrollColumns( long nCols )
) ); ) );
// scroll the header bar area (if there is no dedicated HeaderBar control) // scroll the header bar area (if there is no dedicated HeaderBar control)
if ( !getDataWindow()->pHeaderBar && nTitleLines ) if ( !pDataWin->pHeaderBar && nTitleLines )
{ {
// actually scroll // actually scroll
Scroll( -nDelta, 0, aScrollRect, SCROLL_FLAGS ); Scroll( -nDelta, 0, aScrollRect, SCROLL_FLAGS );
@ -897,7 +898,7 @@ long BrowseBox::ScrollColumns( long nCols )
// invalidate the area of the column which was scrolled out to the left hand side // invalidate the area of the column which was scrolled out to the left hand side
aScrollRect.Left() = nFrozenWidth; aScrollRect.Left() = nFrozenWidth;
aScrollRect.Right() = nFrozenWidth + nDelta - 1; aScrollRect.Right() = nFrozenWidth + nDelta - 1;
getDataWindow()->Invalidate( aScrollRect ); pDataWin->Invalidate( aScrollRect );
} }
} }
@ -922,7 +923,7 @@ long BrowseBox::ScrollColumns( long nCols )
) ); ) );
// scroll the header bar area (if there is no dedicated HeaderBar control) // scroll the header bar area (if there is no dedicated HeaderBar control)
if ( !getDataWindow()->pHeaderBar && nTitleLines ) if ( !pDataWin->pHeaderBar && nTitleLines )
{ {
Scroll( nDelta, 0, aScrollRect, SCROLL_FLAGS ); Scroll( nDelta, 0, aScrollRect, SCROLL_FLAGS );
} }
@ -939,7 +940,7 @@ long BrowseBox::ScrollColumns( long nCols )
Invalidate( Rectangle( Invalidate( Rectangle(
Point( GetFrozenWidth(), 0 ), Point( GetFrozenWidth(), 0 ),
Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) ); Size( GetOutputSizePixel().Width(), GetTitleHeight() ) ) );
getDataWindow()->Invalidate( Rectangle( pDataWin->Invalidate( Rectangle(
Point( GetFrozenWidth(), 0 ), Point( GetFrozenWidth(), 0 ),
pDataWin->GetSizePixel() ) ); pDataWin->GetSizePixel() ) );
} }
@ -949,7 +950,7 @@ long BrowseBox::ScrollColumns( long nCols )
} }
// adjust external headerbar, if necessary // adjust external headerbar, if necessary
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
{ {
long nWidth = 0; long nWidth = 0;
for ( size_t nCol = 0; for ( size_t nCol = 0;
@ -961,7 +962,7 @@ long BrowseBox::ScrollColumns( long nCols )
nWidth += (*pCols)[ nCol ]->Width(); nWidth += (*pCols)[ nCol ]->Width();
} }
getDataWindow()->pHeaderBar->SetOffset( nWidth ); pDataWin->pHeaderBar->SetOffset( nWidth );
} }
if( bInvalidateView ) if( bInvalidateView )
@ -973,7 +974,7 @@ long BrowseBox::ScrollColumns( long nCols )
// implicitly show cursor after scrolling // implicitly show cursor after scrolling
if ( nCols ) if ( nCols )
{ {
getDataWindow()->Update(); pDataWin->Update();
Update(); Update();
} }
bScrolling = false; bScrolling = false;
@ -987,7 +988,7 @@ long BrowseBox::ScrollRows( long nRows )
{ {
// out of range? // out of range?
if ( getDataWindow()->bNoScrollBack && nRows < 0 ) if ( pDataWin->bNoScrollBack && nRows < 0 )
return 0; return 0;
// compute new top row // compute new top row
@ -1027,10 +1028,10 @@ long BrowseBox::ScrollRows( long nRows )
pDataWin->Scroll( 0, (short)-nDeltaY, SCROLL_FLAGS ); pDataWin->Scroll( 0, (short)-nDeltaY, SCROLL_FLAGS );
} }
else else
getDataWindow()->Invalidate(); pDataWin->Invalidate();
if ( nTopRow - nOldTopRow ) if ( nTopRow - nOldTopRow )
getDataWindow()->Update(); pDataWin->Update();
} }
EndScroll(); EndScroll();
@ -1055,7 +1056,7 @@ void BrowseBox::RowModified( long nRow, sal_uInt16 nColId )
// invalidate the specific field // invalidate the specific field
aRect = GetFieldRectPixel( nRow, nColId, false ); aRect = GetFieldRectPixel( nRow, nColId, false );
} }
getDataWindow()->Invalidate( aRect ); pDataWin->Invalidate( aRect );
} }
@ -1421,7 +1422,7 @@ bool BrowseBox::GoToRow( long nRow, bool bRowColMove, bool bKeepSelection )
if ( ( !bRowColMove && !IsCursorMoveAllowed( nRow, nCurColId ) ) ) if ( ( !bRowColMove && !IsCursorMoveAllowed( nRow, nCurColId ) ) )
return false; return false;
if ( getDataWindow()->bNoScrollBack && nRow < nTopRow ) if ( pDataWin->bNoScrollBack && nRow < nTopRow )
nRow = nTopRow; nRow = nTopRow;
// compute the last visible row // compute the last visible row
@ -1430,7 +1431,7 @@ bool BrowseBox::GoToRow( long nRow, bool bRowColMove, bool bKeepSelection )
long nLastRow = nTopRow + nVisibleRows; long nLastRow = nTopRow + nVisibleRows;
// suspend Updates // suspend Updates
getDataWindow()->EnterUpdateLock(); pDataWin->EnterUpdateLock();
// remove old highlight, if necessary // remove old highlight, if necessary
if ( !bMultiSelection && !bKeepSelection ) if ( !bMultiSelection && !bKeepSelection )
@ -1470,7 +1471,7 @@ bool BrowseBox::GoToRow( long nRow, bool bRowColMove, bool bKeepSelection )
uRow.nSel = nRow; uRow.nSel = nRow;
// resume Updates // resume Updates
getDataWindow()->LeaveUpdateLock(); pDataWin->LeaveUpdateLock();
// Cursor+Highlight // Cursor+Highlight
if ( !bMultiSelection && !bKeepSelection) if ( !bMultiSelection && !bKeepSelection)
@ -2117,26 +2118,26 @@ Rectangle BrowseBox::GetControlArea() const
void BrowseBox::SetMode( BrowserMode nMode ) void BrowseBox::SetMode( BrowserMode nMode )
{ {
getDataWindow()->bAutoHScroll = BrowserMode::AUTO_HSCROLL == ( nMode & BrowserMode::AUTO_HSCROLL ); pDataWin->bAutoHScroll = BrowserMode::AUTO_HSCROLL == ( nMode & BrowserMode::AUTO_HSCROLL );
getDataWindow()->bAutoVScroll = BrowserMode::AUTO_VSCROLL == ( nMode & BrowserMode::AUTO_VSCROLL ); pDataWin->bAutoVScroll = BrowserMode::AUTO_VSCROLL == ( nMode & BrowserMode::AUTO_VSCROLL );
getDataWindow()->bNoHScroll = BrowserMode::NO_HSCROLL == ( nMode & BrowserMode::NO_HSCROLL ); pDataWin->bNoHScroll = BrowserMode::NO_HSCROLL == ( nMode & BrowserMode::NO_HSCROLL );
getDataWindow()->bNoVScroll = BrowserMode::NO_VSCROLL == ( nMode & BrowserMode::NO_VSCROLL ); pDataWin->bNoVScroll = BrowserMode::NO_VSCROLL == ( nMode & BrowserMode::NO_VSCROLL );
DBG_ASSERT( !( getDataWindow()->bAutoHScroll && getDataWindow()->bNoHScroll ), DBG_ASSERT( !( pDataWin->bAutoHScroll && pDataWin->bNoHScroll ),
"BrowseBox::SetMode: AutoHScroll *and* NoHScroll?" ); "BrowseBox::SetMode: AutoHScroll *and* NoHScroll?" );
DBG_ASSERT( !( getDataWindow()->bAutoVScroll && getDataWindow()->bNoVScroll ), DBG_ASSERT( !( pDataWin->bAutoVScroll && pDataWin->bNoVScroll ),
"BrowseBox::SetMode: AutoVScroll *and* NoVScroll?" ); "BrowseBox::SetMode: AutoVScroll *and* NoVScroll?" );
if ( getDataWindow()->bAutoHScroll ) if ( pDataWin->bAutoHScroll )
getDataWindow()->bNoHScroll = false; pDataWin->bNoHScroll = false;
if ( getDataWindow()->bAutoVScroll ) if ( pDataWin->bAutoVScroll )
getDataWindow()->bNoVScroll = false; pDataWin->bNoVScroll = false;
if ( getDataWindow()->bNoHScroll ) if ( pDataWin->bNoHScroll )
aHScroll->Hide(); aHScroll->Hide();
nControlAreaWidth = USHRT_MAX; nControlAreaWidth = USHRT_MAX;
getDataWindow()->bNoScrollBack = pDataWin->bNoScrollBack =
BrowserMode::NO_SCROLLBACK == ( nMode & BrowserMode::NO_SCROLLBACK); BrowserMode::NO_SCROLLBACK == ( nMode & BrowserMode::NO_SCROLLBACK);
long nOldRowSel = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel; long nOldRowSel = bMultiSelection ? uRow.pSel->FirstSelected() : uRow.nSel;
@ -2172,29 +2173,28 @@ void BrowseBox::SetMode( BrowserMode nMode )
WB_VSCROLL | ( ( nMode & BrowserMode::THUMBDRAGGING ) ? WB_DRAG : 0 ); WB_VSCROLL | ( ( nMode & BrowserMode::THUMBDRAGGING ) ? WB_DRAG : 0 );
pVScroll = VclPtr<ScrollBar>( pVScroll = VclPtr<ScrollBar>(
( nMode & BrowserMode::TRACKING_TIPS ) == BrowserMode::TRACKING_TIPS ( nMode & BrowserMode::TRACKING_TIPS ) == BrowserMode::TRACKING_TIPS
? VclPtr<BrowserScrollBar>::Create( this, nVScrollWinBits, ? VclPtr<BrowserScrollBar>::Create( this, nVScrollWinBits, pDataWin.get() )
static_cast<BrowserDataWin*>( pDataWin.get() ) )
: VclPtr<ScrollBar>::Create( this, nVScrollWinBits )); : VclPtr<ScrollBar>::Create( this, nVScrollWinBits ));
pVScroll->SetLineSize( 1 ); pVScroll->SetLineSize( 1 );
pVScroll->SetPageSize(1); pVScroll->SetPageSize(1);
pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) ); pVScroll->SetScrollHdl( LINK( this, BrowseBox, ScrollHdl ) );
pVScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) ); pVScroll->SetEndScrollHdl( LINK( this, BrowseBox, EndScrollHdl ) );
getDataWindow()->bAutoSizeLastCol = pDataWin->bAutoSizeLastCol =
BrowserMode::AUTOSIZE_LASTCOL == ( nMode & BrowserMode::AUTOSIZE_LASTCOL ); BrowserMode::AUTOSIZE_LASTCOL == ( nMode & BrowserMode::AUTOSIZE_LASTCOL );
getDataWindow()->bOwnDataChangedHdl = pDataWin->bOwnDataChangedHdl =
BrowserMode::OWN_DATACHANGED == ( nMode & BrowserMode::OWN_DATACHANGED ); BrowserMode::OWN_DATACHANGED == ( nMode & BrowserMode::OWN_DATACHANGED );
// create a headerbar. what happens, if a headerbar has to be created and // create a headerbar. what happens, if a headerbar has to be created and
// there already are columns? // there already are columns?
if ( BrowserMode::HEADERBAR_NEW == ( nMode & BrowserMode::HEADERBAR_NEW ) ) if ( BrowserMode::HEADERBAR_NEW == ( nMode & BrowserMode::HEADERBAR_NEW ) )
{ {
if (!getDataWindow()->pHeaderBar) if (!pDataWin->pHeaderBar)
getDataWindow()->pHeaderBar = CreateHeaderBar( this ); pDataWin->pHeaderBar = CreateHeaderBar( this );
} }
else else
{ {
getDataWindow()->pHeaderBar.disposeAndClear(); pDataWin->pHeaderBar.disposeAndClear();
} }
if ( bColumnCursor ) if ( bColumnCursor )
@ -2289,9 +2289,9 @@ VclPtr<BrowserHeader> BrowseBox::CreateHeaderBar( BrowseBox* pParent )
void BrowseBox::SetHeaderBar( BrowserHeader* pHeaderBar ) void BrowseBox::SetHeaderBar( BrowserHeader* pHeaderBar )
{ {
static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar.disposeAndClear(); pDataWin->pHeaderBar.disposeAndClear();
static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar = pHeaderBar; pDataWin->pHeaderBar = pHeaderBar;
static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) ); pDataWin->pHeaderBar->SetStartDragHdl( LINK( this, BrowseBox, StartDragHdl ) );
} }
long BrowseBox::GetTitleHeight() const long BrowseBox::GetTitleHeight() const
@ -2299,7 +2299,7 @@ long BrowseBox::GetTitleHeight() const
long nHeight; long nHeight;
// ask the header bar for the text height (if possible), as the header bar's font is adjusted with // 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 // our (and the header's) zoom factor
HeaderBar* pHeaderBar = static_cast<BrowserDataWin*>( pDataWin.get() )->pHeaderBar; HeaderBar* pHeaderBar = pDataWin->pHeaderBar;
if ( pHeaderBar ) if ( pHeaderBar )
nHeight = pHeaderBar->GetTextHeight(); nHeight = pHeaderBar->GetTextHeight();
else else
@ -2377,4 +2377,14 @@ void BrowseBox::GetFocus()
} }
sal_uInt16 BrowseBox::GetVisibleRows()
{
return (sal_uInt16)((pDataWin->GetOutputSizePixel().Height() - 1 )/ GetDataRowHeight() + 1);
}
vcl::Window& BrowseBox::GetDataWindow() const
{
return *pDataWin;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -30,8 +30,6 @@
using namespace ::com::sun::star::datatransfer; using namespace ::com::sun::star::datatransfer;
#define getDataWindow() (static_cast<BrowserDataWin*>(pDataWin.get()))
void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel */ ) void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel */ )
{ {
@ -41,19 +39,17 @@ void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel *
sal_Int8 BrowseBox::AcceptDrop( const AcceptDropEvent& _rEvt ) sal_Int8 BrowseBox::AcceptDrop( const AcceptDropEvent& _rEvt )
{ {
BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin.get());
AcceptDropEvent aTransformed( _rEvt ); AcceptDropEvent aTransformed( _rEvt );
aTransformed.maPosPixel = pDataWindow->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) ); aTransformed.maPosPixel = pDataWin->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) );
return pDataWindow->AcceptDrop( aTransformed ); return pDataWin->AcceptDrop( aTransformed );
} }
sal_Int8 BrowseBox::ExecuteDrop( const ExecuteDropEvent& _rEvt ) sal_Int8 BrowseBox::ExecuteDrop( const ExecuteDropEvent& _rEvt )
{ {
BrowserDataWin* pDataWindow = static_cast<BrowserDataWin*>(pDataWin.get());
ExecuteDropEvent aTransformed( _rEvt ); ExecuteDropEvent aTransformed( _rEvt );
aTransformed.maPosPixel = pDataWindow->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) ); aTransformed.maPosPixel = pDataWin->ScreenToOutputPixel( OutputToScreenPixel( _rEvt.maPosPixel ) );
return pDataWindow->ExecuteDrop( aTransformed ); return pDataWin->ExecuteDrop( aTransformed );
} }
@ -73,16 +69,16 @@ sal_Int8 BrowseBox::ExecuteDrop( const BrowserExecuteDropEvent& )
void* BrowseBox::implGetDataFlavors() const void* BrowseBox::implGetDataFlavors() const
{ {
if (static_cast<BrowserDataWin*>(pDataWin.get())->bCallingDropCallback) if (pDataWin->bCallingDropCallback)
return &static_cast<BrowserDataWin*>(pDataWin.get())->GetDataFlavorExVector(); return &pDataWin->GetDataFlavorExVector();
return &GetDataFlavorExVector(); return &GetDataFlavorExVector();
} }
bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat ) bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat )
{ {
if ( static_cast< BrowserDataWin* >( pDataWin.get() )->bCallingDropCallback ) if ( pDataWin->bCallingDropCallback )
return static_cast< BrowserDataWin* >( pDataWin.get() )->IsDropFormatSupported( _nFormat ); return pDataWin->IsDropFormatSupported( _nFormat );
return DropTargetHelper::IsDropFormatSupported( _nFormat ); return DropTargetHelper::IsDropFormatSupported( _nFormat );
} }
@ -90,7 +86,7 @@ bool BrowseBox::IsDropFormatSupported( SotClipboardFormatId _nFormat )
void BrowseBox::Command( const CommandEvent& rEvt ) void BrowseBox::Command( const CommandEvent& rEvt )
{ {
if ( !getDataWindow()->bInCommand ) if ( !pDataWin->bInCommand )
Control::Command( rEvt ); Control::Command( rEvt );
} }
@ -101,9 +97,9 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
if ( StateChangedType::Mirroring == nStateChange ) if ( StateChangedType::Mirroring == nStateChange )
{ {
getDataWindow()->EnableRTL( IsRTLEnabled() ); pDataWin->EnableRTL( IsRTLEnabled() );
HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar; HeaderBar* pHeaderBar = pDataWin->pHeaderBar;
if ( pHeaderBar ) if ( pHeaderBar )
pHeaderBar->EnableRTL( IsRTLEnabled() ); pHeaderBar->EnableRTL( IsRTLEnabled() );
aHScroll->EnableRTL( IsRTLEnabled() ); aHScroll->EnableRTL( IsRTLEnabled() );
@ -136,7 +132,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
else if (StateChangedType::Zoom == nStateChange) else if (StateChangedType::Zoom == nStateChange)
{ {
pDataWin->SetZoom(GetZoom()); pDataWin->SetZoom(GetZoom());
HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar; HeaderBar* pHeaderBar = pDataWin->pHeaderBar;
if (pHeaderBar) if (pHeaderBar)
pHeaderBar->SetZoom(GetZoom()); pHeaderBar->SetZoom(GetZoom());
@ -156,7 +152,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
// do we have a handle column? // do we have a handle column?
bool bHandleCol = !pCols->empty() && (0 == (*pCols)[ 0 ]->GetId()); bool bHandleCol = !pCols->empty() && (0 == (*pCols)[ 0 ]->GetId());
// do we have a header bar? // do we have a header bar?
bool bHeaderBar = (nullptr != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar.get()); bool bHeaderBar = (nullptr != pDataWin->pHeaderBar.get());
if ( nTitleLines if ( nTitleLines
&& ( !bHeaderBar && ( !bHeaderBar
@ -242,7 +238,7 @@ void BrowseBox::ToggleSelection()
// only highlight painted areas! // only highlight painted areas!
bNotToggleSel = true; bNotToggleSel = true;
if ( false && !getDataWindow()->bInPaint ) if ( false && !pDataWin->bInPaint )
pDataWin->Update(); pDataWin->Update();
// accumulate areas of rows to highlight // accumulate areas of rows to highlight
@ -481,10 +477,10 @@ void BrowseBox::Resize()
BrowseBox::StateChanged( StateChangedType::InitShow ); BrowseBox::StateChanged( StateChangedType::InitShow );
if ( pCols->empty() ) if ( pCols->empty() )
{ {
getDataWindow()->bResizeOnPaint = true; pDataWin->bResizeOnPaint = true;
return; return;
} }
getDataWindow()->bResizeOnPaint = false; pDataWin->bResizeOnPaint = false;
// calc the size of the scrollbars // calc the size of the scrollbars
// (we can't ask the scrollbars for their widths cause if we're zoomed they still have to be // (we can't ask the scrollbars for their widths cause if we're zoomed they still have to be
@ -500,7 +496,7 @@ void BrowseBox::Resize()
nOldVisibleRows = (sal_uInt16)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1); nOldVisibleRows = (sal_uInt16)(pDataWin->GetOutputSizePixel().Height() / GetDataRowHeight() + 1);
// did we need a horizontal scroll bar or is there a Control Area? // did we need a horizontal scroll bar or is there a Control Area?
if ( !getDataWindow()->bNoHScroll && if ( !pDataWin->bNoHScroll &&
( ( pCols->size() - FrozenColCount() ) > 1 ) ) ( ( pCols->size() - FrozenColCount() ) > 1 ) )
aHScroll->Show(); aHScroll->Show();
else else
@ -538,7 +534,7 @@ void BrowseBox::Resize()
Invalidate( aInvalidArea ); Invalidate( aInvalidArea );
// external header-bar // external header-bar
HeaderBar* pHeaderBar = getDataWindow()->pHeaderBar; HeaderBar* pHeaderBar = pDataWin->pHeaderBar;
if ( pHeaderBar ) if ( pHeaderBar )
{ {
// take the handle column into account // take the handle column into account
@ -563,10 +559,10 @@ void BrowseBox::Paint(vcl::RenderContext& rRenderContext, const Rectangle& rRect
BrowserColumn *pFirstCol = (*pCols)[ 0 ]; BrowserColumn *pFirstCol = (*pCols)[ 0 ];
bool bHandleCol = pFirstCol && pFirstCol->GetId() == 0; bool bHandleCol = pFirstCol && pFirstCol->GetId() == 0;
bool bHeaderBar = getDataWindow()->pHeaderBar.get() != nullptr; bool bHeaderBar = pDataWin->pHeaderBar.get() != nullptr;
// draw delimitational lines // draw delimitational lines
if (!getDataWindow()->bNoHScroll) if (!pDataWin->bNoHScroll)
rRenderContext.DrawLine(Point(0, aHScroll->GetPosPixel().Y()), rRenderContext.DrawLine(Point(0, aHScroll->GetPosPixel().Y()),
Point(GetOutputSizePixel().Width(), Point(GetOutputSizePixel().Width(),
aHScroll->GetPosPixel().Y())); aHScroll->GetPosPixel().Y()));
@ -655,7 +651,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
// we want to have two pixels frame ... // we want to have two pixels frame ...
return; return;
vcl::Font aFont = GetDataWindow().GetDrawPixelFont( pDev ); vcl::Font aFont = pDataWin->GetDrawPixelFont( pDev );
// the 'normal' painting uses always the data window as device to output to, so we have to calc the new font // the 'normal' painting uses always the data window as device to output to, so we have to calc the new font
// relative to the data wins current settings // relative to the data wins current settings
@ -676,7 +672,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
pDev->DrawLine(Point(aRealPos.X() + aRealSize.Width() - 1, aRealPos.Y() + aRealSize.Height() - 1), pDev->DrawLine(Point(aRealPos.X() + aRealSize.Width() - 1, aRealPos.Y() + aRealSize.Height() - 1),
Point(aRealPos.X() + 1, aRealPos.Y() + aRealSize.Height() - 1)); Point(aRealPos.X() + 1, aRealPos.Y() + aRealSize.Height() - 1));
HeaderBar* pBar = getDataWindow()->pHeaderBar; HeaderBar* pBar = pDataWin->pHeaderBar;
// we're drawing onto a foreign device, so we have to fake the DataRowHeight for the subsequent ImplPaintData // we're drawing onto a foreign device, so we have to fake the DataRowHeight for the subsequent ImplPaintData
// (as it is based on the settings of our data window, not the foreign device) // (as it is based on the settings of our data window, not the foreign device)
@ -757,11 +753,11 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
pDev->SetClipRegion( pDev->PixelToLogic( aRegion ) ); pDev->SetClipRegion( pDev->PixelToLogic( aRegion ) );
// do we have to paint the background // do we have to paint the background
bool bBackground = !(nFlags & DrawFlags::NoBackground) && GetDataWindow().IsControlBackground(); bool bBackground = !(nFlags & DrawFlags::NoBackground) && pDataWin->IsControlBackground();
if ( bBackground ) if ( bBackground )
{ {
Rectangle aRect( aRealPos, aRealSize ); Rectangle aRect( aRealPos, aRealSize );
pDev->SetFillColor( GetDataWindow().GetControlBackground() ); pDev->SetFillColor( pDataWin->GetControlBackground() );
pDev->DrawRect( aRect ); pDev->DrawRect( aRect );
} }
@ -788,7 +784,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, bool _bForeignDevice, bool _bDrawSelections) void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, bool _bForeignDevice, bool _bDrawSelections)
{ {
Point aOverallAreaPos = _bForeignDevice ? _rRect.TopLeft() : Point(0,0); Point aOverallAreaPos = _bForeignDevice ? _rRect.TopLeft() : Point(0,0);
Size aOverallAreaSize = _bForeignDevice ? _rRect.GetSize() : GetDataWindow().GetOutputSizePixel(); Size aOverallAreaSize = _bForeignDevice ? _rRect.GetSize() : pDataWin->GetOutputSizePixel();
Point aOverallAreaBRPos = _bForeignDevice ? _rRect.BottomRight() : Point( aOverallAreaSize.Width(), aOverallAreaSize.Height() ); Point aOverallAreaBRPos = _bForeignDevice ? _rRect.BottomRight() : Point( aOverallAreaSize.Width(), aOverallAreaSize.Height() );
long nDataRowHeigt = GetDataRowHeight(); long nDataRowHeigt = GetDataRowHeight();
@ -1037,7 +1033,7 @@ void BrowseBox::PaintData( vcl::Window& rWin, vcl::RenderContext& rRenderContext
// initializations // initializations
if (!pCols || pCols->empty() || !rWin.IsUpdateMode()) if (!pCols || pCols->empty() || !rWin.IsUpdateMode())
return; return;
if (getDataWindow()->bResizeOnPaint) if (pDataWin->bResizeOnPaint)
Resize(); Resize();
// MI: who was that? Window::Update(); // MI: who was that? Window::Update();
@ -1051,13 +1047,12 @@ void BrowseBox::UpdateScrollbars()
return; return;
// protect against recursion // protect against recursion
BrowserDataWin *pBDW = static_cast<BrowserDataWin*>( pDataWin.get() ); if ( pDataWin->bInUpdateScrollbars )
if ( pBDW->bInUpdateScrollbars )
{ {
pBDW->bHadRecursion = true; pDataWin->bHadRecursion = true;
return; return;
} }
pBDW->bInUpdateScrollbars = true; pDataWin->bInUpdateScrollbars = true;
// the size of the corner window (and the width of the VSB/height of the HSB) // the size of the corner window (and the width of the VSB/height of the HSB)
sal_uLong nCornerSize = GetSettings().GetStyleSettings().GetScrollBarSize(); sal_uLong nCornerSize = GetSettings().GetStyleSettings().GetScrollBarSize();
@ -1070,9 +1065,9 @@ void BrowseBox::UpdateScrollbars()
{ {
// needs VScroll? // needs VScroll?
nMaxRows = (pDataWin->GetSizePixel().Height()) / GetDataRowHeight(); nMaxRows = (pDataWin->GetSizePixel().Height()) / GetDataRowHeight();
bNeedsVScroll = getDataWindow()->bAutoVScroll bNeedsVScroll = pDataWin->bAutoVScroll
? nTopRow || ( nRowCount > nMaxRows ) ? nTopRow || ( nRowCount > nMaxRows )
: !getDataWindow()->bNoVScroll; : !pDataWin->bNoVScroll;
} }
Size aDataWinSize = pDataWin->GetSizePixel(); Size aDataWinSize = pDataWin->GetSizePixel();
if ( !bNeedsVScroll ) if ( !bNeedsVScroll )
@ -1096,9 +1091,9 @@ void BrowseBox::UpdateScrollbars()
sal_uLong nLastCol = GetColumnAtXPosPixel( aDataWinSize.Width() - 1 ); sal_uLong nLastCol = GetColumnAtXPosPixel( aDataWinSize.Width() - 1 );
sal_uInt16 nFrozenCols = FrozenColCount(); sal_uInt16 nFrozenCols = FrozenColCount();
bool bNeedsHScroll = getDataWindow()->bAutoHScroll bool bNeedsHScroll = pDataWin->bAutoHScroll
? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols->size() ) ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols->size() )
: !getDataWindow()->bNoHScroll; : !pDataWin->bNoHScroll;
if ( !bNeedsHScroll ) if ( !bNeedsHScroll )
{ {
if ( aHScroll->IsVisible() ) if ( aHScroll->IsVisible() )
@ -1182,18 +1177,18 @@ void BrowseBox::UpdateScrollbars()
} }
if ( nActualCorderWidth ) if ( nActualCorderWidth )
{ {
if ( !getDataWindow()->pCornerWin ) if ( !pDataWin->pCornerWin )
getDataWindow()->pCornerWin = VclPtr<ScrollBarBox>::Create( this, 0 ); pDataWin->pCornerWin = VclPtr<ScrollBarBox>::Create( this, 0 );
getDataWindow()->pCornerWin->SetPosSizePixel( pDataWin->pCornerWin->SetPosSizePixel(
Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ), Point( GetOutputSizePixel().Width() - nActualCorderWidth, aHScroll->GetPosPixel().Y() ),
Size( nActualCorderWidth, nCornerSize ) ); Size( nActualCorderWidth, nCornerSize ) );
getDataWindow()->pCornerWin->Show(); pDataWin->pCornerWin->Show();
} }
else else
getDataWindow()->pCornerWin.disposeAndClear(); pDataWin->pCornerWin.disposeAndClear();
// scroll headerbar, if necessary // scroll headerbar, if necessary
if ( getDataWindow()->pHeaderBar ) if ( pDataWin->pHeaderBar )
{ {
long nWidth = 0; long nWidth = 0;
for ( size_t nCol = 0; for ( size_t nCol = 0;
@ -1205,13 +1200,13 @@ void BrowseBox::UpdateScrollbars()
nWidth += (*pCols)[ nCol ]->Width(); nWidth += (*pCols)[ nCol ]->Width();
} }
getDataWindow()->pHeaderBar->SetOffset( nWidth ); pDataWin->pHeaderBar->SetOffset( nWidth );
} }
pBDW->bInUpdateScrollbars = false; pDataWin->bInUpdateScrollbars = false;
if ( pBDW->bHadRecursion ) if ( pDataWin->bHadRecursion )
{ {
pBDW->bHadRecursion = false; pDataWin->bHadRecursion = false;
UpdateScrollbars(); UpdateScrollbars();
} }
} }
@ -1228,8 +1223,8 @@ void BrowseBox::SetUpdateMode( bool bUpdate )
// If WB_CLIPCHILDREN is st at the BrowseBox (to minimize flicker), // If WB_CLIPCHILDREN is st at the BrowseBox (to minimize flicker),
// the data window is not invalidated by SetUpdateMode. // the data window is not invalidated by SetUpdateMode.
if( bUpdate ) if( bUpdate )
getDataWindow()->Invalidate(); pDataWin->Invalidate();
getDataWindow()->SetUpdateMode( bUpdate ); pDataWin->SetUpdateMode( bUpdate );
if ( bUpdate ) if ( bUpdate )
@ -1249,7 +1244,7 @@ void BrowseBox::SetUpdateMode( bool bUpdate )
bool BrowseBox::GetUpdateMode() const bool BrowseBox::GetUpdateMode() const
{ {
return getDataWindow()->IsUpdateMode(); return pDataWin->IsUpdateMode();
} }
@ -1291,7 +1286,7 @@ IMPL_LINK(BrowseBox, ScrollHdl, ScrollBar*, pBar, void)
if ( pBar->GetDelta() == 0 ) if ( pBar->GetDelta() == 0 )
return; return;
if ( pBar->GetDelta() < 0 && getDataWindow()->bNoScrollBack ) if ( pBar->GetDelta() < 0 && pDataWin->bNoScrollBack )
{ {
UpdateScrollbars(); UpdateScrollbars();
return; return;
@ -1307,7 +1302,7 @@ IMPL_LINK(BrowseBox, ScrollHdl, ScrollBar*, pBar, void)
IMPL_LINK_NOARG(BrowseBox, EndScrollHdl, ScrollBar*, void) IMPL_LINK_NOARG(BrowseBox, EndScrollHdl, ScrollBar*, void)
{ {
if ( getDataWindow()->bNoScrollBack ) if ( pDataWin->bNoScrollBack )
{ {
EndScroll(); EndScroll();
return; return;
@ -1456,7 +1451,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
bResizing = false; bResizing = false;
} }
else else
MouseButtonUp( BrowserMouseEvent( static_cast<BrowserDataWin*>(pDataWin.get()), MouseButtonUp( BrowserMouseEvent( pDataWin,
MouseEvent( Point( rEvt.GetPosPixel().X(), MouseEvent( Point( rEvt.GetPosPixel().X(),
rEvt.GetPosPixel().Y() - pDataWin->GetPosPixel().Y() ), rEvt.GetPosPixel().Y() - pDataWin->GetPosPixel().Y() ),
rEvt.GetClicks(), rEvt.GetMode(), rEvt.GetButtons(), rEvt.GetClicks(), rEvt.GetMode(), rEvt.GetButtons(),
@ -1891,7 +1886,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId )
case BROWSER_MOVECOLUMNLEFT: case BROWSER_MOVECOLUMNLEFT:
case BROWSER_MOVECOLUMNRIGHT: case BROWSER_MOVECOLUMNRIGHT:
{ // check if column moving is allowed { // check if column moving is allowed
BrowserHeader* pHeaderBar = getDataWindow()->pHeaderBar; BrowserHeader* pHeaderBar = pDataWin->pHeaderBar;
if ( pHeaderBar && pHeaderBar->IsDragable() ) if ( pHeaderBar && pHeaderBar->IsDragable() )
{ {
sal_uInt16 nColId = GetCurColumnId(); sal_uInt16 nColId = GetCurColumnId();
@ -1952,7 +1947,7 @@ Rectangle BrowseBox::calcHeaderRect(bool _bIsColumnBar, bool _bOnScreen)
long nHeight; long nHeight;
if ( _bIsColumnBar ) if ( _bIsColumnBar )
{ {
nWidth = GetDataWindow().GetOutputSizePixel().Width(); nWidth = pDataWin->GetOutputSizePixel().Width();
nHeight = GetDataRowHeight(); nHeight = GetDataRowHeight();
} }
else else