Bug 92872 - CALC cell selection fails
Summary: CALC cell selection fails
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.3.7.2 release
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-22 12:57 UTC by C. Andrews Lavarre
Modified: 2018-05-02 15:51 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
An .ods log of fail2ban results for a remote server containing the two described routines f2b_proc and f2b_fix (58.19 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-07-31 15:54 UTC, C. Andrews Lavarre
Details

Note You need to log in before you can comment on or make changes to this bug.
Description C. Andrews Lavarre 2015-07-22 12:57:57 UTC
When selecting a range with BASIC in CALC the selected range rows and columns are highlighted in blue on the respective rulers on the left (rows) and top (columns) but the actual cells are not highlighted in the grid. 

As a result various uno: commands fail. In particular
     	dispatcher.executeDispatch(document, ".uno:Cut", "", 0, Array())
does not actually cut the selected cells, so a subsequent Paste fails.

At other times the Cut succeeds in removing the contents from the grid, but Paste still does not deliver the cut data.

I am invoking the selection with
     	args0(0).Name = "By"
	args0(0).Value = 1
	dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args0())

(args0() has been properly declared previously). But I also tried 
	args1(0).Name = "By"
	args1(0).Value = 1
	args1(1).Name = "Sel"
	args1(1).Value = true
	dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args1())

and various other alternatives. In each case, the rulers on the left and top show blue for the selected range, but the actual grid cells are white, not surrounded with marching ants and colored in the grid.

I am invoking the macro with a control (button) and have ensured that 
     "Take focus on Click" is set to NO, but the button still keeps the focus after execution. Ensuring that the cell (not the button) has the focus by clicking in a cell before clicking the control (button) does not help.

I can send the entire macro code if you wish.

Thanks for all the good work.

C. Andrews (Andy) Lavarre
alavarre@gmail.com
Comment 1 Buovjaga 2015-07-31 11:37:16 UTC
(In reply to C. Andrews Lavarre from comment #0)
> I can send the entire macro code if you wish.

Yes, I think that would be good.
Comment 2 raal 2015-07-31 12:23:03 UTC
Hello,

Thank you for filing the bug. Please send us a sample document, as this makes it easier for us to verify the bug. 
I have set the bug's status to 'NEEDINFO', so please do change it back to 'UNCONFIRMED' once you have attached a document.
(Please note that the attachment will be public, remove any sensitive information before attaching it.)
How can I eliminate confidential data from a sample document?
https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F
Thank you
Comment 3 C. Andrews Lavarre 2015-07-31 15:46:13 UTC
The bug is repeatable. Attached is a spreadsheet that I use.

There are two buttons at the top of columns J and K:  Process and Arrange.

"Process" runs the macro "f2b_proc" (see below). "Arrange" runs the macro d2b_fix.

The procedure is the following:

I manually copy text in two columns from a terminal window in this form:
     21 117.21.0.0
     22 50.63.0.0
     31 218.87.0.0
     33 218.65.0.0
     51 61.160.0.0
     67 43.229.0.0
    101 221.229.0.0
    139 58.218.0.0
    143 222.186.0.0
    521 43.255.0.0
(these are data from fail2ban on number of failed attempts by the indicated IP subnet). 

1. I paste the data, which invokes the "Data > Text to Columns" routine  to parse the text into two columns in the current row at columns E and F.

2. I run "Process" (f2b_proc) to sort them DESCENDING on the first column (E), then cut and paste TRANSPOSE to current row, column J. The first time I run "Process" it correctly sorts, but the cut and paste fail. If I run "Process" again it succeeds.

3. Now the data are transposed in the two-row form
521	143	139	101	67	51	33	31	22	21
43.255.0.0	222.186.0.0	58.218.0.0	221.229.0.0	43.229.0.0	61.160.0.0	218.65.0.0	218.87.0.0	50.63.0.0	117.21.0.0

beginning at current row, column J.

4. I click Arrange (f2b_fix) to move column K

143
222.186.0.0

two columns to the right to column M.

I have added wait 1000 statements at various spots in both routines to have them work (sort of) but it still fails. The 143 column is cut, the array is properly opened and moved, but the paste fails.

===== 
Not a huge deal, but interesting. There seems to be some kind of unseen process messing up the timing since inserting wait statements definitely does affect the behaviour for the better.

Thanks again.

==================== Macro Language ====================
sub f2b_proc
' This routine was updated 7/19/2015 by C. Andrews Lavarre.
'	It sorts an array of data and moves it to the desired location 
' Define variables
	dim document   as Object
	dim dispatcher as object
	dim osheet as object
	dim ocell as object
	dim irow As Integer
'	Multi-dimensional argument arrays
	dim args0(0) as new com.sun.star.beans.PropertyValue
	dim args1(1) as new com.sun.star.beans.PropertyValue
	dim args5(5) as new com.sun.star.beans.PropertyValue
	dim args7(7) as new com.sun.star.beans.PropertyValue
	Dim saddr As String	'The cell address in $A$1 format	
' Get access to the document
	document   = ThisComponent.CurrentController.Frame
	dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
'Save the start point
	oCell = ThisComponent.getCurrentSelection()
	irow = oCell.CellAddress.Row + 1
	saddr = "$E$" & CStr(irow)
' Load the argument:
	args0(0).Name = "By"
	args0(0).Value = 1
' Select the entire array	
	dispatcher.executeDispatch(document, ".uno:GoRightSel", "", 0, args0())
	dispatcher.executeDispatch(document, ".uno:GoDownToEndOfDataSel", "", 0, args0())
'Sort Descending
	args7(0).Name = "ByRows"
	args7(0).Value = true
	args7(1).Name = "HasHeader"
	args7(1).Value = false
	args7(2).Name = "CaseSensitive"
	args7(2).Value = false
	args7(3).Name = "NaturalSort"
	args7(3).Value = false
	args7(4).Name = "IncludeAttribs"
	args7(4).Value = true
	args7(5).Name = "UserDefIndex"
	args7(5).Value = 0
	args7(6).Name = "Col1"
	args7(6).Value = 5
	args7(7).Name = "Ascending1"
	args7(7).Value = false
	dispatcher.executeDispatch(document, ".uno:DataSort", "", 0, args7())
	dispatcher.executeDispatch(document, ".uno:Cut", "", 0, Array())
'Go right five cells
	saddr = "$J" &"$" & CStr(irow)
	args0(0).Name = "ToPoint"
	args0(0).Value = saddr
	dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args0())
	wait 1000
' Paste transposed
	args5(0).Name = "Flags"
	args5(0).Value = "A"
	args5(1).Name = "FormulaCommand"
	args5(1).Value = 0
	args5(2).Name = "SkipEmptyCells"
	args5(2).Value = false
	args5(3).Name = "Transpose"
	args5(3).Value = true
	args5(4).Name = "AsLink"
	args5(4).Value = false
	args5(5).Name = "MoveMode"
	args5(5).Value = 4
	dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args5())
' Deselect
	dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args0())
end Sub

sub f2b_fix
' This routine was updated 7/22/15 by C. Andrews Lavarre.
'	It splits an array to move an element to a given column.
' define variables
	dim document   as Object
	dim dispatcher as object
' ----------------------------------------------------------------------
' get access to the document
	document   = ThisComponent.CurrentController.Frame	
	dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
' Declare multidimensional arguments
	dim args0(0) as new com.sun.star.beans.PropertyValue
	dim args1(1) as new com.sun.star.beans.PropertyValue
' Go right four cells
	args1(0).Name = "By"
	args1(0).Value = 4
	args1(1).Name = "Sel"
	args1(1).Value = false
	dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1())
' Split the array
	args0(0).Name = "By"
	args0(0).Value = 1
	dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args0())
	args0(0).Name = "Flags"
	args0(0).Value = ">"
	dispatcher.executeDispatch(document, ".uno:InsertCell", "", 0, args0())
' Go back three cells
	args1(0).Name = "By"
	args1(0).Value = 3
	args1(1).Name = "Sel"
	args1(1).Value = false
	dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1())
' Cut the cells
	args0(0).Name = "By"
	args0(0).Value = 1
	dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args0())
	dispatcher.executeDispatch(document, ".uno:Cut", "", 0, Array())
	wait 1000
' Go right three cells
	args1(0).Name = "By"
	args1(0).Value = 3
	args1(1).Name = "Sel"
	args1(1).Value = false
	dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args1())
' Paste them
	dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
	wait 1000
' Go back three cells
	args1(0).Name = "By"
	args1(0).Value = 3
	args1(1).Name = "Sel"
	args1(1).Value = false
	dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1())
' Close up the array
	args0(0).Name = "By"
	args0(0).Value = 1
	dispatcher.executeDispatch(document, ".uno:GoDownSel", "", 0, args0())
	args0(0).Name = "Flags"
	args0(0).Value = "L"
	dispatcher.executeDispatch(document, ".uno:DeleteCell", "", 0, args0())
' Go to the start of the IP row
	args1(0).Name = "By"
	args1(0).Value = 1
	args1(1).Name = "Sel"
	args1(1).Value = false
	dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args1())
	dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args1())
' Delete the row
	dispatcher.executeDispatch(document, ".uno:SelectRow", "", 0, Array())
	args0(0).Name = "Flags"
	args0(0).Value = "R"
	dispatcher.executeDispatch(document, ".uno:DeleteCell", "", 0, args0())
end sub
Comment 4 C. Andrews Lavarre 2015-07-31 15:54:57 UTC
Created attachment 117564 [details]
An .ods log of fail2ban results for a remote server containing the two described routines f2b_proc and f2b_fix

Submitted in response to:
     Comment # 1 on bug 92872 from Beluga
     Comment # 2 on bug 92872 from raal

Thank you for your attention. There is no sensitive information, unless you count the lists of subdomain IP addresses trying to hack my server...

The good news is that fail2ban really does work! The black list is now over 1700 entries long, mostly from China and Hong Kong...

:-)

Best regards, Andy
Comment 5 raal 2015-08-03 15:43:52 UTC
(In reply to C. Andrews Lavarre from comment #4)
> Created attachment 117564 [details]
> An .ods log of fail2ban results for a remote server containing the two
> described routines f2b_proc and f2b_fix
> 

Hello, there is no macro in ods file:
A Scripting Framework error occurred while running the Basic script vnd.sun.star.script:Standard.f2b.f2b_proc?language=Basic&location=application.

Message: The following Basic script could not be found:
library: 'Standard'
module: 'f2b'
method: 'f2b_proc'
location: 'application'
Comment 6 tommy27 2017-05-06 15:45:51 UTC
@ C. Andrews Lavarre 
is this bug still present in LibO 5.2.6 or 5.3.2?
Comment 7 Jean-Baptiste Faure 2017-09-08 12:11:20 UTC
set status to NEEDINFO from comment #5 and comment #6

Set status to NEEDINFO, please set it back to UNCONFIRMED once requested
informations are provided.

Best regards. JBF
Comment 8 QA Administrators 2018-04-04 13:08:53 UTC Comment hidden (obsolete)
Comment 9 QA Administrators 2018-05-02 15:51:42 UTC
Dear Bug Submitter,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-20180502