[Libreoffice] [PATCH] proposed fix for fdo#44283

julien2412 serval2412 at yahoo.fr
Tue Jan 10 13:38:16 PST 2012


Hello,

The bug is : "tabulator does not change row in tables"
First, let's have in mind the code of getColumnId
(svtools/source/brwbox/brwbox2.cxx) : 
    481 sal_uInt16 BrowseBox::GetColumnId( sal_uInt16 nPos ) const
    482 {
    483     DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
    484 
    485     if ( nPos >= pCols->size() )
    486         return BROWSER_INVALIDID;
    487     return (*pCols)[ nPos ]->GetId();
    488 }
So if want to go further than max row, it returns BROWSER_INVALIDID (equals
to SAL_MAX_UINT16)

So I think the problem is here  (still in brwbox2.cxx) :
    1999         case BROWSER_CURSORRIGHT:
   2000             if ( bColumnCursor )
   2001             {
   2002                 sal_uInt16 nNewPos = GetColumnPos( GetCurColumnId()
) + 1;
   2003                 sal_uInt16 nNewId = GetColumnId( nNewPos );
   2004                 if (nNewId != 0)    // Am Zeilenende ?  <-- we
should compare nNewId with BROWSER_INVALIDID not with 0
   2005                     bDone = GoToColumnId( nNewId );
   2006                 else
   2007                 {
   2008                     sal_uInt16 nColId = ( GetColumnId(0) == 0 ) ?
GetColumnId(1) : GetColumnId(0);
   2009                     if ( GetRowCount() )
   2010                         bDone = ( nCurRow < GetRowCount() - 1 ) &&
GoToRowColumnId( nCurRow + 1, nColId );
   2011                     else if ( ColCount() )
   2012                         GoToColumnId( nColId );
   2013                 }
   2014             }
   2015             else
   2016                 bDone = ScrollColumns( 1 ) != 0;
   2017             break;

But here is the code of getColumnId (still in brwbox2.cxx) : 
    481 sal_uInt16 BrowseBox::GetColumnId( sal_uInt16 nPos ) const
    482 {
    483     DBG_CHKTHIS(BrowseBox,BrowseBoxCheckInvariants);
    484 
    485     if ( nPos >= pCols->size() )
    486         return BROWSER_INVALIDID;
    487     return (*pCols)[ nPos ]->GetId();
    488 }
So if want to go further than max row, it returns BROWSER_INVALIDID (equals
to SAL_MAX_UINT16)

I replaced 0 by BROWSER_INVALIDID, it compiles and seems to work.

I propose this patch : 
http://nabble.documentfoundation.org/file/n3648948/patch.txt patch.txt 

Is it ok for you ? If yes I can commit and push on master (3.5 too ?)

Julien

--
View this message in context: http://nabble.documentfoundation.org/PATCH-proposed-fix-for-fdo-44283-tp3648948p3648948.html
Sent from the Dev mailing list archive at Nabble.com.


More information about the LibreOffice mailing list