Bug 140618 - Calc: Problem with macro for on/off Automatic Spell Checking
Summary: Calc: Problem with macro for on/off Automatic Spell Checking
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.1.0.4 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: bibisectRequest
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2021-02-23 10:07 UTC by Kamil Landa
Modified: 2021-02-25 09:12 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:
Regression By:


Attachments
test file (8.96 KB, application/vnd.oasis.opendocument.spreadsheet)
2021-02-24 06:39 UTC, raal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Landa 2021-02-23 10:07:37 UTC
Part1:
Type some incorrect text to the Sheet. Run the macro in Basic Editor (menu Run/ Run) and in Calc it doesn't funct - Automatic Spell Checking will not be activate/deactivate. 
But if you run macro from the Calc menu (Tools/ Macros/ Run macro) then it runs.

For Writer it runs from the Basic Editor and also from the Writer menu. 

It is problem in all tested versions - 7.0.4.2/7.1.1.1/7.2.0.0.alpha0+ Windows7/10x64

Macro is edited (add msgbox) Macro Record from version 7.0.4.2:

Sub AutomaticSpellCheckingOnOff 'activate or deactivate Automatic Spell Checking
	dim document as object, dispatcher as object
	dim args1(0) as new com.sun.star.beans.PropertyValue
		args1(0).Name="SpellOnline"
		if msgbox("Yes = Activate Automatic Spell Checking" & chr(13) & "No = Deactivate it",4)=6 then 'Activate/Deactivate Automatic Spell Checking
			args1(0).Value=true 'non-functional for Run in Basic Editor
		else
			args1(0).Value=false 'non-functional for Run in Basic Editor
		end if
	document=ThisComponent.CurrentController.Frame
	dispatcher=createUnoService("com.sun.star.frame.DispatchHelper")
	dispatcher.executeDispatch(document, ".uno:SpellOnline", "", 0, args1()) 'Macro Record in 7.0.4.2 saves parameter args1()
End Sub

--------------------------
Part2:
In 7.1.1.1/7.2.0.0.alpha0+ it ignores the parameter args1() in the command dispatcher.executeDispatch(document, ".uno:SpellOnline", "", 0, args1()) in the upper macro, so it is possible only to flip ON/OFF, but not to set only ON or to set only OFF. 

In these versions, the Tools/ Macros/ Record Macro saves on/off Automatic Spell Checking with the empty parameter Array() -> dispatcher.executeDispatch(document, ".uno:SpellOnline", "", 0, Array()).

Macro Record from 7.1.1.1:

sub RecordSpellCheckOnOff
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:SpellOnline", "", 0, Array()) 'Macro Record in 7.1.1.1 saves empty parameter Array()
end sub




Version: 7.0.4.2 (x64)
Build ID: dcf040e67528d9187c66b2379df5ea4407429775
CPU threads: 2; OS: Windows 6.1 Service Pack 1 Build 7601; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: en-GB
Calc: CL

Version: 7.1.1.1 (x64) / LibreOffice Community
Build ID: 575c5867c4cc13d7ae78f9ce39a54a52ed38c769
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL

Version: 7.2.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 576c6054d8d445cc977fc3789c572cfc2a3ccd83
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL
Comment 1 raal 2021-02-24 06:37:45 UTC
I can confirm part 1 with Version: 7.2.0.0.alpha0+ / LibreOffice Community
Build ID: 7b649f835cc00ed76927c6821a135605609bed4e
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3
Locale: cs-CZ (cs_CZ.UTF-8); UI: en-US
Calc: threaded
and Version 4.1.0.0.alpha0+ (Build ID: efca6f15609322f62a35619619a6d5fe5c9bd5a)

part2 looks like different bug, please create new one and add me to CC (regression, it worked in 7.0.4.2).
Comment 2 raal 2021-02-24 06:39:15 UTC
Created attachment 170015 [details]
test file
Comment 3 Kamil Landa 2021-02-24 11:37:37 UTC
Part1 is one clean bug - it is not possible to turn on/off Automatic Spell Checking by macro in Basic Editor in versions 7.0/7.1/7.2 (and maybe also in older versions)

But there are maybe 2 bugs in Part2
2a) no accepting the parameter args1() in versions 7.1/7.2
2b) Macro Record in versions 7.1/7.2 saves empty parameter Array() instead args1() in version 7.0

I'm not sure if to do one or two new threads for Part2.
Comment 4 raal 2021-02-24 16:46:20 UTC
(In reply to Kamil Landa from comment #3)
> Part1 is one clean bug - it is not possible to turn on/off Automatic Spell
> Checking by macro in Basic Editor in versions 7.0/7.1/7.2 (and maybe also in
> older versions)
> 
> But there are maybe 2 bugs in Part2
> 2a) no accepting the parameter args1() in versions 7.1/7.2
> 2b) Macro Record in versions 7.1/7.2 saves empty parameter Array() instead
> args1() in version 7.0
> 
> I'm not sure if to do one or two new threads for Part2.

Looks like two bugs.