summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-01-11 18:55:14 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2012-01-11 18:59:44 +0100
commita3261b16471995832f6791b5831c640c72948a95 (patch)
tree0980cbe58ad28ffb7c6d150fd90fcb8fb2e0f0f3 /svtools
parent34219bd53d4270e6741e2b8596b4210e1c47da1a (diff)
fdo#44283: finish 8a17792f2e5 (Handle/invalid column ID cleanup)
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/brwbox/brwbox1.cxx22
-rw-r--r--svtools/source/brwbox/brwbox2.cxx22
-rw-r--r--svtools/source/brwbox/brwbox3.cxx2
-rw-r--r--svtools/source/brwbox/brwhead.cxx2
-rw-r--r--svtools/source/brwbox/datwin.cxx2
-rw-r--r--svtools/source/brwbox/editbrowsebox.cxx12
6 files changed, 29 insertions, 33 deletions
diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx
index cca40ce047fb..5ddaa03cc565 100644
--- a/svtools/source/brwbox/brwbox1.cxx
+++ b/svtools/source/brwbox/brwbox1.cxx
@@ -307,9 +307,9 @@ void BrowseBox::InsertDataColumn( sal_uInt16 nItemId, const XubString& rText,
if ( getDataWindow()->pHeaderBar )
{
- // Handlecolumn nicht in der Headerbar
+ // Handle column not in the header bar
sal_uInt16 nHeaderPos = nPos;
- if (nHeaderPos != HEADERBAR_APPEND && !GetColumnId(0))
+ if (nHeaderPos != HEADERBAR_APPEND && GetColumnId(0) == HandleColumnId )
nHeaderPos--;
getDataWindow()->pHeaderBar->InsertItem(
nItemId, rText, nWidth, nBits, nHeaderPos );
@@ -347,7 +347,7 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze )
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
// never unfreeze the handle-column
- if ( nItemId == 0 && !bFreeze )
+ if ( nItemId == HandleColumnId && !bFreeze )
return;
// get the position in the current array
@@ -424,12 +424,8 @@ void BrowseBox::FreezeColumn( sal_uInt16 nItemId, sal_Bool bFreeze )
void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos )
{
- // never set pos of the handle-column
- if ( nColumnId == 0 )
- return;
-
- // do not move handle column
- if (nPos == 0 && !(*pCols)[ 0 ]->GetId())
+ // never set pos of the handle column
+ if ( nColumnId == HandleColumnId )
return;
// get the position in the current array
@@ -504,7 +500,7 @@ void BrowseBox::SetColumnPos( sal_uInt16 nColumnId, sal_uInt16 nPos )
if ( getDataWindow()->pHeaderBar )
{
sal_uInt16 nNewPos = nPos;
- if ( !GetColumnId(0) )
+ if ( GetColumnId(0) == HandleColumnId )
--nNewPos;
getDataWindow()->pHeaderBar->MoveItem(nColumnId,nNewPos);
}
@@ -550,7 +546,7 @@ void BrowseBox::SetColumnTitle( sal_uInt16 nItemId, const String& rTitle )
DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
// never set title of the handle-column
- if ( nItemId == 0 )
+ if ( nItemId == HandleColumnId )
return;
// get the position in the current array
@@ -2383,8 +2379,8 @@ void BrowseBox::SetMode( BrowserMode nMode )
if ( pDataWin )
pDataWin->Invalidate();
- // kein Cursor auf Handle-Column
- if ( nCurColId == 0 )
+ // no cursor on handle column
+ if ( nCurColId == HandleColumnId )
nCurColId = GetColumnId( 1 );
m_nCurrentMode = nMode;
diff --git a/svtools/source/brwbox/brwbox2.cxx b/svtools/source/brwbox/brwbox2.cxx
index 92c29de12bd6..9a4a7b2b2df7 100644
--- a/svtools/source/brwbox/brwbox2.cxx
+++ b/svtools/source/brwbox/brwbox2.cxx
@@ -416,8 +416,8 @@ void BrowseBox::DrawCursor()
else
bReallyHide |= ( GetCursorHideCount() > 0 );
- // keine Cursor auf Handle-Column
- if ( nCurColId == 0 )
+ // no cursor on handle column
+ if ( nCurColId == HandleColumnId )
nCurColId = GetColumnId(1);
// Cursor-Rechteck berechnen
@@ -1682,8 +1682,8 @@ void BrowseBox::MouseButtonDown( const BrowserMouseEvent& rEvt )
// DataRow?
if ( rEvt.GetRow() >= 0 )
{
- // Zeilenselektion?
- if ( rEvt.GetColumnId() == 0 || !bColumnCursor )
+ // line selection?
+ if ( rEvt.GetColumnId() == HandleColumnId || !bColumnCursor )
{
if ( bMultiSelection )
{
@@ -1757,7 +1757,7 @@ void BrowseBox::MouseButtonDown( const BrowserMouseEvent& rEvt )
}
else
{
- if ( bMultiSelection && rEvt.GetColumnId() == 0 )
+ if ( bMultiSelection && rEvt.GetColumnId() == HandleColumnId )
{
// toggle all-selection
if ( uRow.pSel->GetSelectCount() > ( GetRowCount() / 2 ) )
@@ -1990,7 +1990,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId )
if ( bColumnCursor )
{
sal_uInt16 nNewId = GetColumnId(ColCount() -1);
- bDone = (nNewId != 0) && GoToColumnId( nNewId );
+ bDone = nNewId != HandleColumnId && GoToColumnId( nNewId );
break;
}
case BROWSER_CURSORENDOFFILE:
@@ -2001,11 +2001,13 @@ void BrowseBox::Dispatch( sal_uInt16 nId )
{
sal_uInt16 nNewPos = GetColumnPos( GetCurColumnId() ) + 1;
sal_uInt16 nNewId = GetColumnId( nNewPos );
- if (nNewId != 0) // Am Zeilenende ?
+ if (nNewId != BROWSER_INVALIDID) // At end of row ?
bDone = GoToColumnId( nNewId );
else
{
- sal_uInt16 nColId = ( GetColumnId(0) == 0 ) ? GetColumnId(1) : GetColumnId(0);
+ sal_uInt16 nColId = GetColumnId(0);
+ if ( nColId == BROWSER_INVALIDID || nColId == HandleColumnId )
+ nColId = GetColumnId(1);
if ( GetRowCount() )
bDone = ( nCurRow < GetRowCount() - 1 ) && GoToRowColumnId( nCurRow + 1, nColId );
else if ( ColCount() )
@@ -2019,7 +2021,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId )
if ( bColumnCursor )
{
sal_uInt16 nNewId = GetColumnId(1);
- bDone = (nNewId != 0) && GoToColumnId( nNewId );
+ bDone = (nNewId != HandleColumnId) && GoToColumnId( nNewId );
break;
}
case BROWSER_CURSORTOPOFFILE:
@@ -2030,7 +2032,7 @@ void BrowseBox::Dispatch( sal_uInt16 nId )
{
sal_uInt16 nNewPos = GetColumnPos( GetCurColumnId() ) - 1;
sal_uInt16 nNewId = GetColumnId( nNewPos );
- if (nNewId != 0)
+ if (nNewId != HandleColumnId)
bDone = GoToColumnId( nNewId );
else
{
diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx
index b8875fa67994..3a9c062a933e 100644
--- a/svtools/source/brwbox/brwbox3.cxx
+++ b/svtools/source/brwbox/brwbox3.cxx
@@ -450,7 +450,7 @@ sal_uInt16 BrowseBox::GetCurrColumn() const
// -----------------------------------------------------------------------------
sal_Bool BrowseBox::HasRowHeader() const
{
- return ( GetColumnId( 0 ) == 0 ); // HandleColumn == RowHeader
+ return ( GetColumnId( 0 ) == HandleColumnId ); // HandleColumn == RowHeader
}
// -----------------------------------------------------------------------------
sal_Bool BrowseBox::IsCellFocusable() const
diff --git a/svtools/source/brwbox/brwhead.cxx b/svtools/source/brwbox/brwhead.cxx
index 80d394525750..db8c9105ee13 100644
--- a/svtools/source/brwbox/brwhead.cxx
+++ b/svtools/source/brwbox/brwhead.cxx
@@ -97,7 +97,7 @@ void BrowserHeader::EndDrag()
sal_uInt16 nOldPos = _pBrowseBox->GetColumnPos(nId),
nNewPos = GetItemPos( nId );
- if (!_pBrowseBox->GetColumnId(0)) // Handle
+ if (_pBrowseBox->GetColumnId(0) == BrowseBox::HandleColumnId)
nNewPos++;
if (nOldPos != nNewPos)
diff --git a/svtools/source/brwbox/datwin.cxx b/svtools/source/brwbox/datwin.cxx
index f5f5493e1dbe..9390602dd85f 100644
--- a/svtools/source/brwbox/datwin.cxx
+++ b/svtools/source/brwbox/datwin.cxx
@@ -459,7 +459,7 @@ sal_Bool BrowserDataWin::ImplRowDividerHitTest( const BrowserMouseEvent& _rEvent
if ( ! ( GetParent()->IsInteractiveRowHeightEnabled()
&& ( _rEvent.GetRow() >= 0 )
&& ( _rEvent.GetRow() < GetParent()->GetRowCount() )
- && ( _rEvent.GetColumnId() == 0 )
+ && ( _rEvent.GetColumnId() == BrowseBox::HandleColumnId )
)
)
return sal_False;
diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx
index a9b821c5f4b7..1cce2188b353 100644
--- a/svtools/source/brwbox/editbrowsebox.cxx
+++ b/svtools/source/brwbox/editbrowsebox.cxx
@@ -72,8 +72,6 @@ namespace svt
using com::sun::star::accessibility::XAccessible;
//==================================================================
- #define HANDLE_ID 0
-
//==================================================================
//= EditBrowserHeader
//==================================================================
@@ -270,7 +268,7 @@ namespace svt
void EditBrowseBox::PaintField( OutputDevice& rDev, const Rectangle& rRect,
sal_uInt16 nColumnId ) const
{
- if (nColumnId == HANDLE_ID)
+ if (nColumnId == HandleColumnId)
{
if (bPaintStatus)
PaintStatusCell(rDev, rRect);
@@ -506,7 +504,7 @@ namespace svt
LINK( this, EditBrowseBox, CellModifiedHdl ).Call( NULL );
}
- if (0 == rEvt.GetColumnId())
+ if (rEvt.GetColumnId() == HandleColumnId)
{ // it was the handle column. save the current cell content if necessary
// (clicking on the handle column results in selecting the current row)
if (IsEditing() && aController->IsModified())
@@ -877,7 +875,7 @@ namespace svt
if (GetSelectColumnCount() || (aMouseEvent.Is() && aMouseEvent->GetRow() < 0))
nInfo |= COLSELECT;
if ((GetSelection() != NULL && GetSelectRowCount()) ||
- (aMouseEvent.Is() && aMouseEvent->GetColumnId() == HANDLE_ID))
+ (aMouseEvent.Is() && aMouseEvent->GetColumnId() == HandleColumnId))
nInfo |= ROWSELECT;
if (!nInfo && nNewRow != nEditRow)
nInfo |= ROWCHANGE;
@@ -1027,7 +1025,7 @@ namespace svt
return;
}
- if (nEditRow >= 0 && nEditCol > HANDLE_ID)
+ if (nEditRow >= 0 && nEditCol > HandleColumnId)
{
aController = GetController(nRow, nCol);
if (aController.Is())
@@ -1247,7 +1245,7 @@ namespace svt
{
// when double clicking on the column, the optimum size will be calculated
sal_uInt16 nColId = rEvt.GetColumnId();
- if (nColId != HANDLE_ID)
+ if (nColId != HandleColumnId)
SetColumnWidth(nColId, GetAutoColumnWidth(nColId));
}