[Libreoffice] Inconsistencies in GoDownSel and GoUpSel (cell selection in Calc)

Caolán McNamara caolanm at redhat.com
Thu Jul 28 01:02:03 PDT 2011


On Wed, 2011-07-27 at 21:05 -0300, Olivier Hallot wrote:
> 2) ... the code 
> 
> rem
> ----------------------------------------------------------------------
> dim args2(0) as new com.sun.star.beans.PropertyValue
> args2(0).Name = "By"
> args2(0).Value = 10
> 
> dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args2())
> 
> does not select more than 2 cells, probably because the loop nRepeat
> is missing, it is not taken from rReq in method
> 
> void ScCellShell::ExecuteCursorSel( SfxRequest& rReq )

Yes, that looks to be the case. Presumably to get this to work in
ScCellShell::ExecuteCursorSel the 1,s and -1's in should be
"nRepeat/-nRepeat" where nRepeat defaults to 1, then has something
like ...

const SfxItemSet*   pReqArgs = rReq.GetArgs();
if ( pReqArgs != NULL )
{
    const   SfxPoolItem* pItem;
    if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
        nRepeat = static_cast<SCsCOLROW>(((const
SfxInt16Item*)pItem)->GetValue());
}

to set it to the repeat value if set.

...

and then a final 

    rReq.AppendItem( SfxInt16Item(FN_PARAM_1,
static_cast<sal_Int16>(nRepeat)) );

before the trailing rReq.Done() to explictly record the nRepeat as "1"
if unset for macro recording.

C.



More information about the LibreOffice mailing list