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

Olivier Hallot olivier.hallot at documentfoundation.org
Wed Jul 27 17:05:06 PDT 2011


Thans Eike for the enlighment.

I am not  skilled in C++ (thanks for your patience), but scslots.hxx looks
different for GoUpSel and GoDownSel, if that matters, around the line that
starts with "73/*Offset*/" and "74/*Offset*/"


// Slot Nr. 145 : 26521
    SFX_NEW_SLOT_ARG(
ScCellShell,SID_CURSORDOWN_SEL,SID_CURSORDOWN_SEL,GID_NAVIGATOR,
                0 ,&aScCellShellSlots_Impl[146] /*Offset Next*/,

SFX_STUB_PTR(ScCellShell,ExecuteCursorSel),SFX_STUB_PTR(ScCellShell,GetStateCursor),

SFX_SLOT_CACHABLE|SFX_SLOT_SYNCHRON|SFX_SLOT_RECORDPERSET|SFX_SLOT_ACCELCONFIG|SFX_SLOT_READONLYDOC|0,
                0,
                SfxVoidItem,
                73/*Offset*/, 1/*Count*/, 0, SFX_SLOT_METHOD|0,"GoDownSel"
),
// Slot Nr. 146 : 26522
    SFX_NEW_SLOT_ARG(
ScCellShell,SID_CURSORUP_SEL,SID_CURSORUP_SEL,GID_NAVIGATOR,
                0 ,&aScCellShellSlots_Impl[147] /*Offset Next*/,

SFX_STUB_PTR(ScCellShell,ExecuteCursorSel),SFX_STUB_PTR(ScCellShell,GetStateCursor),

SFX_SLOT_CACHABLE|SFX_SLOT_SYNCHRON|SFX_SLOT_RECORDPERSET|SFX_SLOT_ACCELCONFIG|SFX_SLOT_READONLYDOC|0,
                0,
                SfxVoidItem,
                74/*Offset*/,
1/*Count*/,".GoUpSel",SFX_SLOT_METHOD|0,"GoUpSel" ),


Anyway,  the whole thing is that GoDownSel (/UpSel/LeftSel/RightSel) has
thus a property value  FN_PARAM_1 which represent a repetition of the
command named ("By"), I guess..

1) So the following code

rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "By"
args1(0).Value = 10
args1(1).Name = "Sel"
args1(1).Value = True

dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args1())

should select 10 lines downward, no?

But it don't as far as I can see. It moves 10 lines and select one more, the
11th.

I think the issue is in sc/source/ui/view/cellsh4.cxx, where the repetition
nRepeat

       if( IS_AVAILABLE( FN_PARAM_1, &pItem ) )
            nRepeat = static_cast<SCsCOLROW>(((const
SfxInt16Item*)pItem)->GetValue());

is not used as loop or passed properly when bSel is true, just below...

2) And 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 )

and besides, the recent fix of bug
https://bugs.freedesktop.org/show_bug.cgi?id=38955
fixes the recording but does not return the "By" property, as it may miss a
line like

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

thus the recorded macro does not show the "By" property

Again sorry for bothering, but isn't this a defect? I am not sure with
respect to the specifications.

Kind regards

Olivier

2011/7/27 Eike Rathke <ooo at erack.de>

> Hi Olivier,
>
> On Wednesday, 2011-07-27 14:50:33 -0300, Olivier Hallot wrote:
>
> > Investigating sc/sdi/cellsh.sdi
> > [...]
> > So it looks like GoDownSel has an argument "By", which seems to be
> "select
> > FN_PARAM_1 cells down", but GoUpSel (GoRightSel and GoLeftSel) does not
> have
> > this parameter.
> >
> > Which one is the correct?
>
> Tricky.. both ;-)  The slot parameters of the first definition of an
> ExecMethod are inherited by following definitions with the same
> ExecMethod. So actually SID_CURSORUP_SEL inherits By from the first
> definition of ExecuteCursorSel that happens to be SID_CURSORDOWN_SEL.
> Compare with the generated sc/$INPATH/inc/scslots.hxx
>
>  Eike
>
> --
>  PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
>  Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD
>
> _______________________________________________
> LibreOffice mailing list
> LibreOffice at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/libreoffice
>
>


-- 
Olivier Hallot
Founder and Steering Commitee Member
The Document Foundation
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110727/01f108ec/attachment.htm>


More information about the LibreOffice mailing list