[Libreoffice-commits] .: svtools/inc svtools/source
Joseph Powers
jpowers at kemper.freedesktop.org
Wed Feb 2 07:38:07 PST 2011
svtools/inc/svtools/brwbox.hxx | 6 -
svtools/source/brwbox/brwbox1.cxx | 205 ++++++++++++++++++++++----------------
svtools/source/brwbox/brwbox2.cxx | 149 ++++++++++++---------------
svtools/source/brwbox/datwin.cxx | 22 +---
4 files changed, 199 insertions(+), 183 deletions(-)
New commits:
commit c97e6bafd6b7c4bf6af8aafdc6597a757c327238
Author: Joseph Powers <jpowers27 at cox.net>
Date: Wed Feb 2 07:37:30 2011 -0800
Remove DECLARE_LIST( BrowserColumns, BrowserColumn* )
diff --git a/svtools/inc/svtools/brwbox.hxx b/svtools/inc/svtools/brwbox.hxx
index 6dbaba2..6500d6a 100644
--- a/svtools/inc/svtools/brwbox.hxx
+++ b/svtools/inc/svtools/brwbox.hxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -36,6 +36,7 @@
#include <svtools/transfer.hxx>
#include <svtools/AccessibleBrowseBoxObjType.hxx>
#include <svtools/accessibletableprovider.hxx>
+#include <vector>
#ifndef INCLUDED_LIMITS_H
#include <limits.h>
@@ -48,11 +49,12 @@
#endif
class BrowserColumn;
-class BrowserColumns;
class BrowserDataWin;
class MultiSelection;
class BrowserHeader;
+typedef ::std::vector< BrowserColumn* > BrowserColumns;
+
namespace svt {
class BrowseBoxImpl;
class IAccessibleFactory;
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index ea459da..26b2fac 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -47,8 +47,6 @@ DBG_NAME(BrowseBox)
extern const char* BrowseBoxCheckInvariants( const void* pVoid );
-DECLARE_LIST( BrowserColumns, BrowserColumn* )
-
#define SCROLL_FLAGS (SCROLL_CLIP | SCROLL_NOCHILDREN)
#define getDataWindow() ((BrowserDataWin*)pDataWin)
@@ -195,8 +193,9 @@ BrowseBox::~BrowseBox()
delete pVScroll;
// free columns-space
- for ( USHORT n = 0; n < pCols->Count(); ++n )
- delete pCols->GetObject(n);
+ for ( size_t i = 0, n = pCols->size(); i < n; ++i )
+ delete (*pCols)[ i ];
+ pCols->clear();
delete pCols;
delete pColSel;
if ( bMultiSelection )
@@ -283,7 +282,7 @@ void BrowseBox::InsertHandleColumn( ULONG nWidth )
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- pCols->Insert( new BrowserColumn( 0, Image(), String(), nWidth, GetZoom(), 0 ), (ULONG) 0 );
+ pCols->insert( pCols->begin(), new BrowserColumn( 0, Image(), String(), nWidth, GetZoom(), 0 ) );
FreezeColumn( 0 );
// Headerbar anpassen
@@ -295,9 +294,6 @@ void BrowseBox::InsertHandleColumn( ULONG nWidth )
);
}
- /*if ( getDataWindow()->pHeaderBar )
- getDataWindow()->pHeaderBar->InsertItem( USHRT_MAX - 1,
- "", nWidth, HIB_FIXEDPOS|HIB_FIXED, 0 );*/
ColumnInserted( 0 );
}
@@ -307,8 +303,16 @@ void BrowseBox::InsertDataColumn( USHORT nItemId, const Image& rImage,
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- pCols->Insert( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ),
- Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nPos < pCols->size() )
+ {
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nPos );
+ pCols->insert( it, new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) );
+ }
+ else
+ {
+ pCols->push_back( new BrowserColumn( nItemId, rImage, String(), nWidth, GetZoom(), nBits ) );
+ }
if ( nCurColId == 0 )
nCurColId = nItemId;
if ( getDataWindow()->pHeaderBar )
@@ -330,8 +334,16 @@ void BrowseBox::InsertDataColumn( USHORT nItemId, const XubString& rText,
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- pCols->Insert( new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ),
- Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nPos < pCols->size() )
+ {
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nPos );
+ pCols->insert( it, new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ) );
+ }
+ else
+ {
+ pCols->push_back( new BrowserColumn( nItemId, Image(), rText, nWidth, GetZoom(), nBits ) );
+ }
if ( nCurColId == 0 )
nCurColId = nItemId;
@@ -356,8 +368,17 @@ void BrowseBox::InsertDataColumn( USHORT nItemId,
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- pCols->Insert( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ),
- Min( nPos, (USHORT)(pCols->Count()) ) );
+ if ( nPos < pCols->size() )
+ {
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nPos );
+ pCols->insert( it, new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) );
+ }
+ else
+ {
+ pCols->push_back( new BrowserColumn( nItemId, rImage, rText, nWidth, GetZoom(), nBits ) );
+ }
+
if ( nCurColId == 0 )
nCurColId = nItemId;
if ( getDataWindow()->pHeaderBar )
@@ -385,7 +406,7 @@ USHORT BrowseBox::ToggleSelectedColumn()
{
DoHideCursor( "ToggleSelectedColumn" );
ToggleSelection();
- nSelectedColId = pCols->GetObject(pColSel->FirstSelected())->GetId();
+ nSelectedColId = (*pCols)[ pColSel->FirstSelected() ]->GetId();
pColSel->SelectAll(FALSE);
}
return nSelectedColId;
@@ -411,13 +432,13 @@ void BrowseBox::FreezeColumn( USHORT nItemId, BOOL bFreeze )
return;
// get the position in the current array
- USHORT nItemPos = GetColumnPos( nItemId );
- if ( nItemPos >= pCols->Count() )
+ size_t nItemPos = GetColumnPos( nItemId );
+ if ( nItemPos >= pCols->size() )
// not available!
return;
// doesn't the state change?
- if ( pCols->GetObject(nItemPos)->IsFrozen() == bFreeze )
+ if ( (*pCols)[ nItemPos ]->IsFrozen() == bFreeze )
return;
// remark the column selection
@@ -427,14 +448,18 @@ void BrowseBox::FreezeColumn( USHORT nItemId, BOOL bFreeze )
if ( bFreeze )
{
// to be moved?
- if ( nItemPos != 0 && !pCols->GetObject(nItemPos-1)->IsFrozen() )
+ if ( nItemPos != 0 && !(*pCols)[ nItemPos-1 ]->IsFrozen() )
{
// move to the right of the last frozen column
USHORT nFirstScrollable = FrozenColCount();
- BrowserColumn *pColumn = pCols->GetObject(nItemPos);
- pCols->Remove( (ULONG) nItemPos );
+ BrowserColumn *pColumn = (*pCols)[ nItemPos ];
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nItemPos );
+ pCols->erase( it );
nItemPos = nFirstScrollable;
- pCols->Insert( pColumn, (ULONG) nItemPos );
+ it = pCols->begin();
+ ::std::advance( it, nItemPos );
+ pCols->insert( it, pColumn );
}
// adjust the number of the first scrollable and visible column
@@ -444,14 +469,18 @@ void BrowseBox::FreezeColumn( USHORT nItemId, BOOL bFreeze )
else
{
// to be moved?
- if ( nItemPos != FrozenColCount()-1 )
+ if ( (sal_Int32)nItemPos != FrozenColCount()-1 )
{
// move to the leftmost scrollable colum
USHORT nFirstScrollable = FrozenColCount();
- BrowserColumn *pColumn = pCols->GetObject(nItemPos);
- pCols->Remove( (ULONG) nItemPos );
+ BrowserColumn *pColumn = (*pCols)[ nItemPos ];
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nItemPos );
+ pCols->erase( it );
nItemPos = nFirstScrollable;
- pCols->Insert( pColumn, (ULONG) nItemPos );
+ it = pCols->begin();
+ ::std::advance( it, nItemPos );
+ pCols->insert( it, pColumn );
}
// adjust the number of the first scrollable and visible column
@@ -459,7 +488,7 @@ void BrowseBox::FreezeColumn( USHORT nItemId, BOOL bFreeze )
}
// toggle the freeze-state of the column
- pCols->GetObject(nItemPos)->Freeze( bFreeze );
+ (*pCols)[ nItemPos ]->Freeze( bFreeze );
// align the scrollbar-range
UpdateScrollbars();
@@ -481,12 +510,12 @@ void BrowseBox::SetColumnPos( USHORT nColumnId, USHORT nPos )
return;
// do not move handle column
- if (nPos == 0 && !pCols->GetObject(0)->GetId())
+ if (nPos == 0 && !(*pCols)[ 0 ]->GetId())
return;
// get the position in the current array
USHORT nOldPos = GetColumnPos( nColumnId );
- if ( nOldPos >= pCols->Count() )
+ if ( nOldPos >= pCols->size() )
// not available!
return;
@@ -508,11 +537,19 @@ void BrowseBox::SetColumnPos( USHORT nColumnId, USHORT nPos )
if ( nOldPos > nPos )
nNextPos = nOldPos - 1;
- BrowserColumn *pNextCol = pCols->GetObject(nNextPos);
+ BrowserColumn *pNextCol = (*pCols)[ nNextPos ];
Rectangle aNextRect(GetFieldRect( pNextCol->GetId() ));
// move column internally
- pCols->Insert( pCols->Remove( nOldPos ), nPos );
+ {
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nOldPos );
+ BrowserColumn* pTemp = *it;
+ pCols->erase( it );
+ it = pCols->begin();
+ ::std::advance( it, nPos );
+ pCols->insert( it, pTemp );
+ }
// determine new column area
Rectangle aToRect( GetFieldRect( nColumnId ) );
@@ -598,13 +635,13 @@ void BrowseBox::SetColumnMode( USHORT nColumnId, BrowserColumnMode nFlags )
return;
// get the position in the current array
- USHORT nColumnPos = GetColumnPos( nColumnId );
- if ( nColumnPos >= pCols->Count() )
+ size_t nColumnPos = GetColumnPos( nColumnId );
+ if ( nColumnPos >= pCols->size() )
// not available!
return;
// does the state change?
- BrowserColumn *pCol = pCols->GetObject(nColumnPos);
+ BrowserColumn *pCol = (*pCols)[ nColumnPos ];
if ( pCol->Flags() != nFlags )
{
pCol->Flags() = sal::static_int_cast< HeaderBarItemBits >(nFlags);
@@ -628,12 +665,12 @@ void BrowseBox::SetColumnTitle( USHORT nItemId, const String& rTitle )
// get the position in the current array
USHORT nItemPos = GetColumnPos( nItemId );
- if ( nItemPos >= pCols->Count() )
+ if ( nItemPos >= pCols->size() )
// not available!
return;
// does the state change?
- BrowserColumn *pCol = pCols->GetObject(nItemPos);
+ BrowserColumn *pCol = (*pCols)[ nItemPos ];
if ( pCol->Title() != rTitle )
{
::rtl::OUString sNew(rTitle);
@@ -670,18 +707,18 @@ void BrowseBox::SetColumnWidth( USHORT nItemId, ULONG nWidth )
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
// get the position in the current array
- USHORT nItemPos = GetColumnPos( nItemId );
- if ( nItemPos >= pCols->Count() )
+ size_t nItemPos = GetColumnPos( nItemId );
+ if ( nItemPos >= pCols->size() )
return;
// does the state change?
nWidth = QueryColumnResize( nItemId, nWidth );
- if ( nWidth >= LONG_MAX || pCols->GetObject(nItemPos)->Width() != nWidth )
+ if ( nWidth >= LONG_MAX || (*pCols)[ nItemPos ]->Width() != nWidth )
{
- long nOldWidth = pCols->GetObject(nItemPos)->Width();
+ long nOldWidth = (*pCols)[ nItemPos ]->Width();
// ggf. letzte Spalte anpassen
- if ( IsVisible() && nItemPos == pCols->Count() - 1 )
+ if ( IsVisible() && nItemPos == pCols->size() - 1 )
{
long nMaxWidth = pDataWin->GetSizePixel().Width();
nMaxWidth -= getDataWindow()->bAutoSizeLastCol
@@ -703,7 +740,7 @@ void BrowseBox::SetColumnWidth( USHORT nItemId, ULONG nWidth )
// soll die Aenderung sofort dargestellt werden?
BOOL bUpdate = GetUpdateMode() &&
- ( pCols->GetObject(nItemPos)->IsFrozen() || nItemPos >= nFirstCol );
+ ( (*pCols)[ nItemPos ]->IsFrozen() || nItemPos >= nFirstCol );
if ( bUpdate )
{
@@ -715,7 +752,7 @@ void BrowseBox::SetColumnWidth( USHORT nItemId, ULONG nWidth )
}
// Breite setzen
- pCols->GetObject(nItemPos)->SetWidth(nWidth, GetZoom());
+ (*pCols)[ nItemPos ]->SetWidth(nWidth, GetZoom());
// scroll and invalidate
if ( bUpdate )
@@ -724,7 +761,7 @@ void BrowseBox::SetColumnWidth( USHORT nItemId, ULONG nWidth )
long nX = 0;
for ( USHORT nCol = 0; nCol < nItemPos; ++nCol )
{
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
if ( pCol->IsFrozen() || nCol >= nFirstCol )
nX += pCol->Width();
}
@@ -767,7 +804,7 @@ void BrowseBox::SetColumnWidth( USHORT nItemId, ULONG nWidth )
nItemId ? nItemId : USHRT_MAX - 1, nWidth );
// adjust last column
- if ( nItemPos != pCols->Count() - 1 )
+ if ( nItemPos != pCols->size() - 1 )
AutoSizeLastColumn();
}
@@ -780,7 +817,7 @@ void BrowseBox::AutoSizeLastColumn()
if ( getDataWindow()->bAutoSizeLastCol &&
getDataWindow()->GetUpdateMode() )
{
- USHORT nId = GetColumnId( (USHORT)pCols->Count() - 1 );
+ USHORT nId = GetColumnId( (USHORT)pCols->size() - 1 );
SetColumnWidth( nId, LONG_MAX );
ColumnResized( nId );
}
@@ -807,7 +844,10 @@ void BrowseBox::RemoveColumn( USHORT nItemId )
nCurColId = 0;
// Spalte entfernen
- delete( pCols->Remove( (ULONG) nPos ));
+ BrowserColumns::iterator it = pCols->begin();
+ ::std::advance( it, nPos );
+ delete *it;
+ pCols->erase( it );
// OJ #93534#
if ( nFirstCol >= nPos && nFirstCol > FrozenColCount() )
{
@@ -874,10 +914,12 @@ void BrowseBox::RemoveColumns()
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- unsigned int nOldCount = pCols->Count();
+ size_t nOldCount = pCols->size();
+
// alle Spalten entfernen
- while ( pCols->Count() )
- delete ( pCols->Remove( (ULONG) 0 ));
+ for ( size_t i = 0; i < nOldCount; ++i )
+ delete (*pCols)[ i ];
+ pCols->clear();
// Spaltenselektion korrigieren
if ( pColSel )
@@ -905,7 +947,7 @@ void BrowseBox::RemoveColumns()
if ( isAccessibleAlive() )
{
- if ( pCols->Count() != nOldCount )
+ if ( pCols->size() != nOldCount )
{
// all columns should be removed, so we remove the column header bar and append it again
// to avoid to notify every column remove
@@ -945,9 +987,9 @@ String BrowseBox::GetColumnTitle( USHORT nId ) const
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
USHORT nItemPos = GetColumnPos( nId );
- if ( nItemPos >= pCols->Count() )
+ if ( nItemPos >= pCols->size() )
return String();
- return pCols->GetObject(nItemPos)->Title();
+ return (*pCols)[ nItemPos ]->Title();
}
//-------------------------------------------------------------------
@@ -963,7 +1005,7 @@ USHORT BrowseBox::ColCount() const
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- return (USHORT) pCols->Count();
+ return (USHORT) pCols->size();
}
//-------------------------------------------------------------------
@@ -1006,8 +1048,7 @@ long BrowseBox::ScrollColumns( long nCols )
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
if ( nFirstCol + nCols < 0 ||
- nFirstCol + nCols >= (long)pCols->Count() )
- //?MI: pCols->GetObject( nFirstCol + nCols )->IsFrozen() )
+ nFirstCol + nCols >= (long)pCols->size() )
return 0;
// implicitly hides cursor while scrolling
@@ -1029,7 +1070,7 @@ long BrowseBox::ScrollColumns( long nCols )
}
else
{
- long nDelta = pCols->GetObject(nFirstCol-1)->Width();
+ long nDelta = (*pCols)[ nFirstCol-1 ]->Width();
long nFrozenWidth = GetFrozenWidth();
Rectangle aScrollRect( Point( nFrozenWidth + nDelta, 0 ),
@@ -1075,7 +1116,7 @@ long BrowseBox::ScrollColumns( long nCols )
}
else
{
- long nDelta = pCols->GetObject(nFirstCol)->Width();
+ long nDelta = (*pCols)[ nFirstCol ]->Width();
long nFrozenWidth = GetFrozenWidth();
Rectangle aScrollRect( Point( nFrozenWidth, 0 ),
@@ -1114,13 +1155,13 @@ long BrowseBox::ScrollColumns( long nCols )
if ( getDataWindow()->pHeaderBar )
{
long nWidth = 0;
- for ( USHORT nCol = 0;
- nCol < pCols->Count() && nCol < nFirstCol;
+ for ( size_t nCol = 0;
+ nCol < pCols->size() && nCol < nFirstCol;
++nCol )
{
// HandleColumn nicht
- if ( pCols->GetObject(nCol)->GetId() )
- nWidth += pCols->GetObject(nCol)->Width();
+ if ( (*pCols)[ nCol ]->GetId() )
+ nWidth += (*pCols)[ nCol ]->Width();
}
getDataWindow()->pHeaderBar->SetOffset( nWidth );
@@ -1694,7 +1735,7 @@ BOOL BrowseBox::GoToColumnId( USHORT nColId, BOOL bMakeVisible, BOOL bRowColMove
if ( nColId != nCurColId || (bMakeVisible && !IsFieldVisible(nCurRow, nColId, TRUE)))
{
USHORT nNewPos = GetColumnPos(nColId);
- BrowserColumn* pColumn = pCols->GetObject( nNewPos );
+ BrowserColumn* pColumn = (nNewPos < pCols->size()) ? (*pCols)[ nNewPos ] : NULL;
DBG_ASSERT( pColumn, "no column object - invalid id?" );
if ( !pColumn )
return FALSE;
@@ -1852,7 +1893,7 @@ void BrowseBox::SelectAll()
uRow.pSel->SelectAll(TRUE);
// Handle-Column nicht highlighten
- BrowserColumn *pFirstCol = pCols->GetObject(0);
+ BrowserColumn *pFirstCol = (*pCols)[ 0 ];
long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
// highlight the row selection
@@ -1941,7 +1982,7 @@ void BrowseBox::SelectRow( long nRow, BOOL _bSelect, BOOL bExpand )
)
{
// Handle-Column nicht highlighten
- BrowserColumn *pFirstCol = pCols->GetObject(0);
+ BrowserColumn *pFirstCol = (*pCols)[ 0 ];
long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
// highlight only newly selected part
@@ -1997,12 +2038,12 @@ void BrowseBox::SelectColumnPos( USHORT nNewColPos, BOOL _bSelect, BOOL bMakeVis
if ( !bMultiSelection )
{
if ( _bSelect )
- GoToColumnId( pCols->GetObject(nNewColPos)->GetId(), bMakeVisible );
+ GoToColumnId( (*pCols)[ nNewColPos ]->GetId(), bMakeVisible );
return;
}
else
{
- if ( !GoToColumnId( pCols->GetObject( nNewColPos )->GetId(), bMakeVisible ) )
+ if ( !GoToColumnId( (*pCols)[ nNewColPos ]->GetId(), bMakeVisible ) )
return;
}
@@ -2023,7 +2064,7 @@ void BrowseBox::SelectColumnPos( USHORT nNewColPos, BOOL _bSelect, BOOL bMakeVis
Rectangle aFieldRectPix( GetFieldRectPixel( nCurRow, nCurColId, FALSE ) );
Rectangle aRect(
Point( aFieldRectPix.Left() - MIN_COLUMNWIDTH, 0 ),
- Size( pCols->GetObject(nNewColPos)->Width(),
+ Size( (*pCols)[ nNewColPos ]->Width(),
pDataWin->GetOutputSizePixel().Height() ) );
pDataWin->Invalidate( aRect );
if ( !bSelecting )
@@ -2307,14 +2348,14 @@ Rectangle BrowseBox::ImplFieldRectPixel( long nRow, USHORT nColumnId ) const
// compute the X-coordinte realtiv to DataWin by accumulation
long nColX = 0;
USHORT nFrozenCols = FrozenColCount();
- USHORT nCol;
+ size_t nCol;
for ( nCol = 0;
- nCol < pCols->Count() && pCols->GetObject(nCol)->GetId() != nColumnId;
+ nCol < pCols->size() && (*pCols)[ nCol ]->GetId() != nColumnId;
++nCol )
- if ( pCols->GetObject(nCol)->IsFrozen() || nCol >= nFirstCol )
- nColX += pCols->GetObject(nCol)->Width();
+ if ( (*pCols)[ nCol ]->IsFrozen() || nCol >= nFirstCol )
+ nColX += (*pCols)[ nCol ]->Width();
- if ( nCol >= pCols->Count() || ( nCol >= nFrozenCols && nCol < nFirstCol ) )
+ if ( nCol >= pCols->size() || ( nCol >= nFrozenCols && nCol < nFirstCol ) )
return Rectangle();
// compute the Y-coordinate relative to DataWin
@@ -2325,7 +2366,7 @@ Rectangle BrowseBox::ImplFieldRectPixel( long nRow, USHORT nColumnId ) const
// assemble the Rectangle relative to DataWin
return Rectangle(
Point( nColX + MIN_COLUMNWIDTH, nRowY ),
- Size( pCols->GetObject(nCol)->Width() - 2*MIN_COLUMNWIDTH,
+ Size( (*pCols)[ nCol ]->Width() - 2*MIN_COLUMNWIDTH,
GetDataRowHeight() - 1 ) );
}
@@ -2367,10 +2408,9 @@ USHORT BrowseBox::GetColumnAtXPosPixel( long nX, BOOL ) const
// accumulate the withds of the visible columns
long nColX = 0;
- USHORT nCol;
- for ( nCol = 0; nCol < USHORT(pCols->Count()); ++nCol )
+ for ( size_t nCol = 0; nCol < pCols->size(); ++nCol )
{
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
if ( pCol->IsFrozen() || nCol >= nFirstCol )
nColX += pCol->Width();
@@ -2416,21 +2456,14 @@ void BrowseBox::SetMode( BrowserMode nMode )
#ifdef DBG_MIx
Sound::Beep();
nMode =
-// BROWSER_COLUMNSELECTION |
-// BROWSER_MULTISELECTION |
BROWSER_THUMBDRAGGING |
BROWSER_KEEPHIGHLIGHT |
BROWSER_HLINES |
BROWSER_VLINES |
-// BROWSER_HIDECURSOR |
-// BROWSER_NO_HSCROLL |
-// BROWSER_NO_SCROLLBACK |
BROWSER_AUTO_VSCROLL |
BROWSER_AUTO_HSCROLL |
BROWSER_TRACKING_TIPS |
-// BROWSER_HIGHLIGHT_NONE |
BROWSER_HEADERBAR_NEW |
-// BROWSER_AUTOSIZE_LASTCOL |
0;
#endif
@@ -2519,7 +2552,7 @@ void BrowseBox::SetMode( BrowserMode nMode )
if ( bColumnCursor )
{
pColSel = pOldColSel ? pOldColSel : new MultiSelection;
- pColSel->SetTotalRange( Range( 0, pCols->Count()-1 ) );
+ pColSel->SetTotalRange( Range( 0, pCols->size()-1 ) );
}
else
{
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 12dd661..17d508d 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -50,8 +50,6 @@ DBG_NAMEEX(BrowseBox)
extern const char* BrowseBoxCheckInvariants( const void * pVoid );
-DECLARE_LIST( BrowserColumns, BrowserColumn* )
-
//===================================================================
void BrowseBox::StartDrag( sal_Int8 /* _nAction */, const Point& /* _rPosPixel */ )
@@ -204,11 +202,11 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
pHeaderBar->SetZoom(GetZoom());
// let the cols calc their new widths and adjust the header bar
- for ( USHORT nPos = 0; nPos < pCols->Count(); ++nPos )
+ for ( size_t nPos = 0; nPos < pCols->size(); ++nPos )
{
- pCols->GetObject(nPos)->ZoomChanged(GetZoom());
+ (*pCols)[ nPos ]->ZoomChanged(GetZoom());
if ( pHeaderBar )
- pHeaderBar->SetItemSize( pCols->GetObject(nPos)->GetId(), pCols->GetObject(nPos)->Width() );
+ pHeaderBar->SetItemSize( (*pCols)[ nPos ]->GetId(), (*pCols)[ nPos ]->Width() );
}
// all our controls have to be repositioned
@@ -217,7 +215,7 @@ void BrowseBox::StateChanged( StateChangedType nStateChange )
else if (STATE_CHANGE_ENABLE == nStateChange)
{
// do we have a handle column?
- sal_Bool bHandleCol = pCols->Count() && (0 == pCols->GetObject(0)->GetId());
+ sal_Bool bHandleCol = !pCols->empty() && (0 == (*pCols)[ 0 ]->GetId());
// do we have a header bar
sal_Bool bHeaderBar = (NULL != static_cast<BrowserDataWin&>(GetDataWindow()).pHeaderBar);
@@ -309,7 +307,6 @@ void BrowseBox::ColumnMoved( USHORT )
void BrowseBox::StartScroll()
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- //((Control*)pDataWin)->HideFocus();
DoHideCursor( "StartScroll" );
}
@@ -350,7 +347,7 @@ void BrowseBox::ToggleSelection( BOOL bForce )
long nLastRowInRect = 0; // fuer den CFront
// Handle-Column nicht highlighten
- BrowserColumn *pFirstCol = pCols->GetObject(0);
+ BrowserColumn *pFirstCol = pCols->empty() ? NULL : (*pCols)[ 0 ];
long nOfsX = (!pFirstCol || pFirstCol->GetId()) ? 0 : pFirstCol->Width();
// accumulate old row selection
@@ -389,7 +386,7 @@ void BrowseBox::ToggleSelection( BOOL bForce )
nColId = pColSel->NextSelected() )
{
Rectangle aRect( GetFieldRectPixel(nCurRow,
- pCols->GetObject(nColId)->GetId(),
+ (*pCols)[ nColId ]->GetId(),
FALSE ) );
aRect.Left() -= MIN_COLUMNWIDTH;
aRect.Right() += MIN_COLUMNWIDTH;
@@ -436,15 +433,14 @@ void BrowseBox::DrawCursor()
if ( bColumnCursor )
{
aCursor = GetFieldRectPixel( nCurRow, nCurColId, FALSE );
- //! --aCursor.Bottom();
aCursor.Left() -= MIN_COLUMNWIDTH;
aCursor.Right() += 1;
aCursor.Bottom() += 1;
}
else
aCursor = Rectangle(
- Point( ( pCols->Count() && pCols->GetObject(0)->GetId() == 0 ) ?
- pCols->GetObject(0)->Width() : 0,
+ Point( ( !pCols->empty() && (*pCols)[ 0 ]->GetId() == 0 ) ?
+ (*pCols)[ 0 ]->Width() : 0,
(nCurRow - nTopRow) * GetDataRowHeight() + 1 ),
Size( pDataWin->GetOutputSizePixel().Width() + 1,
GetDataRowHeight() - 2 ) );
@@ -455,8 +451,6 @@ void BrowseBox::DrawCursor()
--aCursor.Bottom();
}
- //!mi_mac pDataWin->Update();
-
if (m_aCursorColor == COL_TRANSPARENT)
{
// auf diesem Plattformen funktioniert der StarView-Focus richtig
@@ -485,9 +479,9 @@ ULONG BrowseBox::GetColumnWidth( USHORT nId ) const
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
USHORT nItemPos = GetColumnPos( nId );
- if ( nItemPos >= pCols->Count() )
+ if ( nItemPos >= pCols->size() )
return 0;
- return pCols->GetObject(nItemPos)->Width();
+ return (*pCols)[ nItemPos ]->Width();
}
//-------------------------------------------------------------------
@@ -496,9 +490,9 @@ USHORT BrowseBox::GetColumnId( USHORT nPos ) const
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- if ( nPos >= pCols->Count() )
+ if ( nPos >= pCols->size() )
return 0;
- return pCols->GetObject(nPos)->GetId();
+ return (*pCols)[ nPos ]->GetId();
}
//-------------------------------------------------------------------
@@ -507,8 +501,8 @@ USHORT BrowseBox::GetColumnPos( USHORT nId ) const
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- for ( USHORT nPos = 0; nPos < pCols->Count(); ++nPos )
- if ( pCols->GetObject(nPos)->GetId() == nId )
+ for ( USHORT nPos = 0; nPos < pCols->size(); ++nPos )
+ if ( (*pCols)[ nPos ]->GetId() == nId )
return nPos;
return BROWSER_INVALIDID;
}
@@ -519,9 +513,9 @@ BOOL BrowseBox::IsFrozen( USHORT nColumnId ) const
{
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
- for ( USHORT nPos = 0; nPos < pCols->Count(); ++nPos )
- if ( pCols->GetObject(nPos)->GetId() == nColumnId )
- return pCols->GetObject(nPos)->IsFrozen();
+ for ( size_t nPos = 0; nPos < pCols->size(); ++nPos )
+ if ( (*pCols)[ nPos ]->GetId() == nColumnId )
+ return (*pCols)[ nPos ]->IsFrozen();
return FALSE;
}
@@ -598,7 +592,7 @@ void BrowseBox::Resize()
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
if ( !bBootstrapped && IsReallyVisible() )
BrowseBox::StateChanged( STATE_CHANGE_INITSHOW );
- if ( !pCols->Count() )
+ if ( pCols->empty() )
{
getDataWindow()->bResizeOnPaint = TRUE;
return;
@@ -618,7 +612,7 @@ void BrowseBox::Resize()
// did we need a horiz. scroll bar oder gibt es eine Control Area?
if ( !getDataWindow()->bNoHScroll &&
- ( ( pCols->Count() - FrozenColCount() ) > 1 ) )
+ ( ( pCols->size() - FrozenColCount() ) > 1 ) )
aHScroll.Show();
else
aHScroll.Hide();
@@ -658,7 +652,7 @@ void BrowseBox::Resize()
if ( pHeaderBar )
{
// Handle-Column beruecksichtigen
- BrowserColumn *pFirstCol = pCols->GetObject(0);
+ BrowserColumn *pFirstCol = (*pCols)[ 0 ];
long nOfsX = pFirstCol->GetId() ? 0 : pFirstCol->Width();
pHeaderBar->SetPosSizePixel( Point( nOfsX, 0 ), Size( GetOutputSizePixel().Width() - nOfsX, GetTitleHeight() ) );
}
@@ -676,10 +670,10 @@ void BrowseBox::Paint( const Rectangle& rRect )
// initializations
if ( !bBootstrapped && IsReallyVisible() )
BrowseBox::StateChanged( STATE_CHANGE_INITSHOW );
- if ( !pCols->Count() )
+ if ( pCols->empty() )
return;
- BrowserColumn *pFirstCol = pCols->GetObject(0);
+ BrowserColumn *pFirstCol = (*pCols)[ 0 ];
BOOL bHandleCol = pFirstCol && pFirstCol->GetId() == 0;
BOOL bHeaderBar = getDataWindow()->pHeaderBar != NULL;
@@ -708,20 +702,20 @@ void BrowseBox::Paint( const Rectangle& rRect )
{
// iterate through columns to redraw
long nX = 0;
- USHORT nCol;
+ size_t nCol;
for ( nCol = 0;
- nCol < pCols->Count() && nX < rRect.Right();
+ nCol < pCols->size() && nX < rRect.Right();
++nCol )
{
// skip invisible colums between frozen and scrollable area
- if ( nCol < nFirstCol && !pCols->GetObject(nCol)->IsFrozen() )
+ if ( nCol < nFirstCol && !(*pCols)[ nCol ]->IsFrozen() )
nCol = nFirstCol;
// nur die HandleCol ?
if (bHeaderBar && bHandleCol && nCol > 0)
break;
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
// draw the column and increment position
if ( pCol->Width() > 4 )
@@ -748,7 +742,7 @@ void BrowseBox::Paint( const Rectangle& rRect )
}
// retouching
- if ( !bHeaderBar && nCol == pCols->Count() )
+ if ( !bHeaderBar && nCol == pCols->size() )
{
const StyleSettings &rSettings = GetSettings().GetStyleSettings();
Color aColFace( rSettings.GetFaceColor() );
@@ -819,10 +813,10 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
nDataRowHeight = nForeignHeightPixel;
// this counts for the column widths, too
- USHORT nPos;
- for ( nPos = 0; nPos < pCols->Count(); ++nPos )
+ size_t nPos;
+ for ( nPos = 0; nPos < pCols->size(); ++nPos )
{
- BrowserColumn* pCurrent = pCols->GetObject(nPos);
+ BrowserColumn* pCurrent = (*pCols)[ nPos ];
long nWidthLogic = PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width();
long nForeignWidthPixel = pDev->LogicToPixel(Size(nWidthLogic, 0), MAP_10TH_MM).Width();
@@ -845,7 +839,7 @@ void BrowseBox::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize,
long nTitleHeight = PixelToLogic(Size(0, GetTitleHeight()), MAP_10TH_MM).Height();
nTitleHeight = pDev->LogicToPixel(Size(0, nTitleHeight), MAP_10TH_MM).Height();
- BrowserColumn* pFirstCol = pCols->Count() ? pCols->GetObject(0) : NULL;
+ BrowserColumn* pFirstCol = !pCols->empty() ? (*pCols)[ 0 ] : NULL;
Point aHeaderPos(pFirstCol && (pFirstCol->GetId() == 0) ? pFirstCol->Width() : 0, 0);
Size aHeaderSize(aRealSize.Width() - aHeaderPos.X(), nTitleHeight);
@@ -899,9 +893,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->Count(); ++nPos )
+ for ( nPos = 0; nPos < pCols->size(); ++nPos )
{
- BrowserColumn* pCurrent = pCols->GetObject(nPos);
+ BrowserColumn* pCurrent = (*pCols)[ nPos ];
long nForeignWidthLogic = pDev->PixelToLogic(Size(pCurrent->Width(), 0), MAP_10TH_MM).Width();
long nWidthPixel = LogicToPixel(Size(nForeignWidthLogic, 0), MAP_10TH_MM).Width();
@@ -938,9 +932,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
Color aOldTextColor = _rOut.GetTextColor();
Color aOldFillColor = _rOut.GetFillColor();
Color aOldLineColor = _rOut.GetLineColor();
- long nHLineX = 0 == pCols->GetObject(0)->GetId()
- ? pCols->GetObject(0)->Width()
- : 0;
+ long nHLineX = 0 == (*pCols)[ 0 ]->GetId() ? (*pCols)[ 0 ]->Width() : 0;
nHLineX += aOverallAreaPos.X();
Color aDelimiterLineColor( ::svtools::ColorConfig().GetColorValue( ::svtools::CALCGRID ).nColor );
@@ -983,11 +975,11 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
}
// iterate through columns to redraw
- USHORT nCol;
- for ( nCol = 0; nCol < pCols->Count(); ++nCol )
+ size_t nCol;
+ for ( nCol = 0; nCol < pCols->size(); ++nCol )
{
// get column
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
// at end of invalid area
if ( aPos.X() >= _rRect.Right() )
@@ -997,7 +989,7 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
if ( nCol < nFirstCol && !pCol->IsFrozen() )
{
nCol = nFirstCol;
- pCol = pCols->GetObject(nCol);
+ pCol = (nCol < pCols->size() ) ? (*pCols)[ nCol ] : NULL;
if (!pCol)
{ // FS - 21.05.99 - 66325
// ist zwar eigentlich woanders (an der richtigen Stelle) gefixt, aber sicher ist sicher ...
@@ -1098,14 +1090,14 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
aOldLineColor = _rOut.GetLineColor();
aOldFillColor = _rOut.GetFillColor();
_rOut.SetFillColor( rSettings.GetFaceColor() );
- if ( pCols->Count() && ( pCols->GetObject(0)->GetId() == 0 ) && ( aPos.Y() <= _rRect.Bottom() ) )
+ if ( !pCols->empty() && ( (*pCols)[ 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( Color( COL_BLACK ) );
_rOut.DrawRect( Rectangle(
Point( aOverallAreaPos.X() - 1, aPos.Y() - 1 ),
- Point( aOverallAreaPos.X() + pCols->GetObject(0)->Width() - 1,
+ Point( aOverallAreaPos.X() + (*pCols)[ 0 ]->Width() - 1,
_rRect.Bottom() + 1) ) );
}
_rOut.SetFillColor( aOldFillColor );
@@ -1124,16 +1116,16 @@ void BrowseBox::ImplPaintData(OutputDevice& _rOut, const Rectangle& _rRect, BOOL
_rOut.SetLineColor( aDelimiterLineColor );
Point aVertPos( aOverallAreaPos.X() - 1, aOverallAreaPos.Y() );
long nDeltaY = aOverallAreaBRPos.Y();
- for ( USHORT nCol = 0; nCol < pCols->Count(); ++nCol )
+ for ( size_t nCol = 0; nCol < pCols->size(); ++nCol )
{
// get column
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
// skip invisible colums between frozen and scrollable area
if ( nCol < nFirstCol && !pCol->IsFrozen() )
{
nCol = nFirstCol;
- pCol = pCols->GetObject(nCol);
+ pCol = (*pCols)[ nCol ];
}
// skip column
@@ -1166,7 +1158,7 @@ void BrowseBox::PaintData( Window& rWin, const Rectangle& rRect )
BrowseBox::StateChanged( STATE_CHANGE_INITSHOW );
// initializations
- if ( !pCols || !pCols->Count() || !rWin.IsUpdateMode() )
+ if ( !pCols || pCols->empty() || !rWin.IsUpdateMode() )
return;
if ( getDataWindow()->bResizeOnPaint )
Resize();
@@ -1226,7 +1218,7 @@ void BrowseBox::UpdateScrollbars()
USHORT nFrozenCols = FrozenColCount();
BOOL bNeedsHScroll = getDataWindow()->bAutoHScroll
- ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols->Count() )
+ ? ( nFirstCol > nFrozenCols ) || ( nLastCol <= pCols->size() )
: !getDataWindow()->bNoHScroll;
if ( !bNeedsHScroll )
{
@@ -1255,19 +1247,11 @@ void BrowseBox::UpdateScrollbars()
Size( aDataWinSize.Width() - nHScrX, nCornerSize ) );
// Scrollable Columns insgesamt
- short nScrollCols = short(pCols->Count()) - (short)nFrozenCols;
- /*short nVisibleHSize= std::max(nLastCol == BROWSER_INVALIDID
- ? pCols->Count() - nFirstCol -1
- : nLastCol - nFirstCol - 1, 0);
-
- aHScroll.SetVisibleSize( nVisibleHSize );
- aHScroll.SetRange( Range( 0, Max( std::min(nScrollCols, nVisibleHSize), (short)0 ) ) );
- if ( bNeedsHScroll && !aHScroll.IsVisible() )
- aHScroll.Show();*/
+ short nScrollCols = short(pCols->size()) - (short)nFrozenCols;
// Sichtbare Columns
short nVisibleHSize = nLastCol == BROWSER_INVALIDID
- ? (short)( pCols->Count() - nFirstCol )
+ ? (short)( pCols->size() - nFirstCol )
: (short)( nLastCol - nFirstCol );
short nRange = Max( nScrollCols, (short)0 );
@@ -1333,13 +1317,13 @@ void BrowseBox::UpdateScrollbars()
if ( getDataWindow()->pHeaderBar )
{
long nWidth = 0;
- for ( USHORT nCol = 0;
- nCol < pCols->Count() && nCol < nFirstCol;
+ for ( size_t nCol = 0;
+ nCol < pCols->size() && nCol < nFirstCol;
++nCol )
{
// HandleColumn nicht
- if ( pCols->GetObject(nCol)->GetId() )
- nWidth += pCols->GetObject(nCol)->Width();
+ if ( (*pCols)[ nCol ]->GetId() )
+ nWidth += (*pCols)[ nCol ]->Width();
}
getDataWindow()->pHeaderBar->SetOffset( nWidth );
@@ -1401,10 +1385,10 @@ long BrowseBox::GetFrozenWidth() const
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
long nWidth = 0;
- for ( USHORT nCol = 0;
- nCol < pCols->Count() && pCols->GetObject(nCol)->IsFrozen();
+ for ( size_t nCol = 0;
+ nCol < pCols->size() && (*pCols)[ nCol ]->IsFrozen();
++nCol )
- nWidth += pCols->GetObject(nCol)->Width();
+ nWidth += (*pCols)[ nCol ]->Width();
return nWidth;
}
@@ -1426,7 +1410,7 @@ USHORT BrowseBox::FrozenColCount() const
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
USHORT nCol;
for ( nCol = 0;
- nCol < pCols->Count() && pCols->GetObject(nCol)->IsFrozen();
+ nCol < pCols->size() && (*pCols)[ nCol ]->IsFrozen();
++nCol )
/* empty loop */;
return nCol;
@@ -1464,9 +1448,8 @@ IMPL_LINK( BrowseBox,EndScrollHdl,ScrollBar*, EMPTYARG )
// kein Focus grabben!
/// GrabFocus();
- if ( /*pBar->GetDelta() <= 0 &&*/ getDataWindow()->bNoScrollBack )
+ if ( getDataWindow()->bNoScrollBack )
{
- // UpdateScrollbars();
EndScroll();
return 0;
}
@@ -1501,10 +1484,10 @@ void BrowseBox::MouseButtonDown( const MouseEvent& rEvt )
long nX = 0;
long nWidth = GetOutputSizePixel().Width();
- for ( USHORT nCol = 0; nCol < pCols->Count() && nX < nWidth; ++nCol )
+ for ( size_t nCol = 0; nCol < pCols->size() && nX < nWidth; ++nCol )
{
// is this column visible?
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
if ( pCol->IsFrozen() || nCol >= nFirstCol )
{
// compute right end of column
@@ -1556,15 +1539,15 @@ void BrowseBox::MouseMove( const MouseEvent& rEvt )
Pointer aNewPointer;
USHORT nX = 0;
- for ( USHORT nCol = 0;
- nCol < USHORT(pCols->Count()) &&
- ( nX + pCols->GetObject(nCol)->Width() ) < USHORT(GetOutputSizePixel().Width());
+ for ( size_t nCol = 0;
+ nCol < pCols->size() &&
+ ( nX + (*pCols)[ nCol ]->Width() ) < USHORT(GetOutputSizePixel().Width());
++nCol )
// is this column visible?
- if ( pCols->GetObject(nCol)->IsFrozen() || nCol >= nFirstCol )
+ if ( (*pCols)[ nCol ]->IsFrozen() || nCol >= nFirstCol )
{
// compute right end of column
- BrowserColumn *pCol = pCols->GetObject(nCol);
+ BrowserColumn *pCol = (*pCols)[ nCol ];
USHORT nR = (USHORT)(nX + pCol->Width() - 1);
// show resize-pointer?
@@ -1613,7 +1596,7 @@ void BrowseBox::MouseButtonUp( const MouseEvent & rEvt )
// width changed?
nDragX = Max( rEvt.GetPosPixel().X(), nMinResizeX );
- if ( (nDragX - nResizeX) != (long)pCols->GetObject(nResizeCol)->Width() )
+ if ( (nDragX - nResizeX) != (long)(*pCols)[ nResizeCol ]->Width() )
{
// resize column
long nMaxX = pDataWin->GetSizePixel().Width();
@@ -1661,7 +1644,7 @@ void BrowseBox::MouseButtonDown( const BrowserMouseEvent& rEvt )
{
if ( bColumnCursor && rEvt.GetColumn() != 0 )
{
- if ( rEvt.GetColumn() < pCols->Count() )
+ if ( rEvt.GetColumn() < pCols->size() )
SelectColumnPos( rEvt.GetColumn(), TRUE, FALSE);
}
}
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index c0b8352..1066e38 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -2,7 +2,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,8 +38,6 @@
#include <tools/debug.hxx>
-DECLARE_LIST( BrowserColumns, BrowserColumn* )
-
//===================================================================
void ButtonFrame::Draw( OutputDevice& rDev )
{
@@ -344,28 +342,28 @@ BrowseEvent BrowserDataWin::CreateBrowseEvent( const Point& rPosPixel )
// find column under mouse
long nMouseX = rPosPixel.X();
long nColX = 0;
- USHORT nCol;
+ size_t nCol;
for ( nCol = 0;
- nCol < pBox->pCols->Count() && nColX < GetSizePixel().Width();
+ nCol < pBox->pCols->size() && nColX < GetSizePixel().Width();
++nCol )
- if ( pBox->pCols->GetObject(nCol)->IsFrozen() || nCol >= pBox->nFirstCol )
+ if ( (*pBox->pCols)[ nCol ]->IsFrozen() || nCol >= pBox->nFirstCol )
{
- nColX += pBox->pCols->GetObject(nCol)->Width();
+ nColX += (*pBox->pCols)[ nCol ]->Width();
if ( nMouseX < nColX )
break;
}
USHORT nColId = BROWSER_INVALIDID;
- if ( nCol < pBox->pCols->Count() )
- nColId = pBox->pCols->GetObject(nCol)->GetId();
+ if ( nCol < pBox->pCols->size() )
+ nColId = (*pBox->pCols)[ nCol ]->GetId();
// compute the field rectangle and field relative MouseEvent
Rectangle aFieldRect;
- if ( nCol < pBox->pCols->Count() )
+ if ( nCol < pBox->pCols->size() )
{
- nColX -= pBox->pCols->GetObject(nCol)->Width();
+ nColX -= (*pBox->pCols)[ nCol ]->Width();
aFieldRect = Rectangle(
Point( nColX, nRelRow * pBox->GetDataRowHeight() ),
- Size( pBox->pCols->GetObject(nCol)->Width(),
+ Size( (*pBox->pCols)[ nCol ]->Width(),
pBox->GetDataRowHeight() ) );
}
More information about the Libreoffice-commits
mailing list