Download it now!
Bug 124633 - Pivot table: Impossible to drag a field to top in Pivot Table Layout dialog
Summary: Pivot table: Impossible to drag a field to top in Pivot Table Layout dialog
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: difficultyBeginner, easyHack, skillCpp
Depends on:
Blocks: Pivot-Table Drag-and-Drop
  Show dependency treegraph
 
Reported: 2019-04-09 21:58 UTC by Mike Kaganski
Modified: 2019-05-03 14:38 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2019-04-09 21:58:06 UTC
Open attachment 150630 [details] from bug 124629; right-click inside the pivot table, and select "Edit Layout..." (or select a cell inside the pivot table, then menu Data▸Pivot Table▸Create...); try to drag Years2 in Column Fields to the topmost position (above Years). It is impossible; only possible to put it second. So moving a field to top requires two actions: moving it to the second position, then dragging topmost item one position down.
Comment 1 Roman Kuznetsov 2019-04-10 07:09:00 UTC
Confirm in

Version: 6.3.0.0.alpha0+
Build ID: 7327260de3c0c627e62f7c3fddbe3d71ea88e88f
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2019-04-05_06:26:35
Locale: ru-RU (ru_RU); UI-Language: en-US
Calc: threaded
Comment 2 Mike Kaganski 2019-04-10 08:11:38 UTC
Code pointers:

the code to handle drag&drop in the list boxes is in vcl/source/treelist/treelistbox.cxx. Look at SvTreeListBox::AcceptDrop, which uses GetDropTarget to find out *below* which element to draw the drop cursor, and which element to remember for actual drop. The drop method (SvTreeListBox::ExecuteDrop), as well as drop cursor drawing method (ImplShowTargetEmphasis), accept nullptr as target element, meaning "at the top". So the question is how to make GetDropTarget return nullptr when mouse is over top half of topmost element of the list (a hint: SvImpLBox::GetEntry might need to be modified to take an optional out bool parameter telling if the pos is at the top half of the element).
Comment 3 perzdj 2019-04-23 00:19:11 UTC
(In reply to Mike Kaganski from comment #2)
> Code pointers:
> 
> the code to handle drag&drop in the list boxes is in
> vcl/source/treelist/treelistbox.cxx. Look at SvTreeListBox::AcceptDrop,
> which uses GetDropTarget to find out *below* which element to draw the drop
> cursor, and which element to remember for actual drop. The drop method
> (SvTreeListBox::ExecuteDrop), as well as drop cursor drawing method
> (ImplShowTargetEmphasis), accept nullptr as target element, meaning "at the
> top". So the question is how to make GetDropTarget return nullptr when mouse
> is over top half of topmost element of the list (a hint: SvImpLBox::GetEntry
> might need to be modified to take an optional out bool parameter telling if
> the pos is at the top half of the element).

ImplShowTargetEmphasis(nullptr,true) doesn't draw anything and forcing GetDropTarget to return nullptr doesn't move an entry to the top but to the bottom.What am I doing wrong?
Comment 4 Mike Kaganski 2019-04-23 05:38:29 UTC
(In reply to perzde from comment #3)
> (In reply to Mike Kaganski from comment #2)
> > Code pointers:
> > 
> > the code to handle drag&drop in the list boxes is in
> > vcl/source/treelist/treelistbox.cxx. Look at SvTreeListBox::AcceptDrop,
> > which uses GetDropTarget to find out *below* which element to draw the drop
> > cursor, and which element to remember for actual drop. The drop method
> > (SvTreeListBox::ExecuteDrop), as well as drop cursor drawing method
> > (ImplShowTargetEmphasis), accept nullptr as target element, meaning "at the
> > top". So the question is how to make GetDropTarget return nullptr when mouse
> > is over top half of topmost element of the list (a hint: SvImpLBox::GetEntry
> > might need to be modified to take an optional out bool parameter telling if
> > the pos is at the top half of the element).
> 
> ImplShowTargetEmphasis(nullptr,true) doesn't draw anything and forcing
> GetDropTarget to return nullptr doesn't move an entry to the top but to the
> bottom.What am I doing wrong?

Hi! Thanks for looking into it.
But let's discuss all the code-related questions in a gerrit change that you create, where it's only possible to actually see what you do, and - what you do wrong, or where I am wrong.
Comment 5 perzdj 2019-04-24 14:40:34 UTC
(In reply to Mike Kaganski from comment #4)
> 
> Hi! Thanks for looking into it.
> But let's discuss all the code-related questions in a gerrit change that you
> create, where it's only possible to actually see what you do, and - what you
> do wrong, or where I am wrong.

I submitted a patch for review (work in progress). https://gerrit.libreoffice.org/#/c/71241/
Comment 6 Mike Kaganski 2019-05-03 14:38:16 UTC
Ah, it was fixed independently by Caolán in https://git.libreoffice.org/core/+/f82356d9a1ce1457593a5f42728e2962561328cf; see tdf#125095 where I described results from that patch.

perzde@hotmail.com : sorry for that; it happens sometimes. Looking forward to see your patches for other issues!