Bug 81231

Summary: Remove Text Highlighting macro not working in 4.3.x
Product: LibreOffice Reporter: tommy27 <barta>
Component: BASICAssignee: Maxim Monastirsky <momonasmon>
Status: RESOLVED FIXED    
Severity: normal CC: barta, matus, nopower, suokunlong
Priority: medium Keywords: regression
Version: 4.3.0.1 rc   
Hardware: Other   
OS: All   
See Also: https://bugs.freedesktop.org/show_bug.cgi?id=81187
Whiteboard: target:4.4.0 target:4.3.1
Crash report or crash signature: Regression By:

Description tommy27 2014-07-11 13:10:01 UTC
the simple macro below that used to work in LibO 4.2.5 and earlier releases doesn't work anymore in LibO 4.3.0.1 and 4.3.0.2 under Win7x64 and WinXP, unless it is modified as it follows.

---------------------------------
original 4.2.x macro code
---------------------------------

Sub RemoveTextHighlighting

dim document   as object
dim dispatcher as object

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dispatcher.executeDispatch(document, ".uno:BackColor", "", 0, Array())

End Sub


---------------------------------
modified 4.3.x macro code
---------------------------------

Sub RemoveTextHighlighting

	Dim document   as object
	Dim dispatcher as object

	document   = ThisComponent.CurrentController.Frame
	dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

	REM We need to define the args for the dispatcher. without this the backcolor will not change.
	Dim args1(0) as new com.sun.star.beans.PropertyValue
	args1(0).name = "BackColor"
	args1(0).value = -1

	dispatcher.executeDispatch(document, ".uno:BackColor", "", 0,args1())
	
End Sub

---------------------------------

to test the macro just highlight some text on a Writer document then select it and run the macro. it should remove the highlight.

I set status as NEW because of independent confirmation here: 
https://bugs.freedesktop.org/show_bug.cgi?id=81187#c6


has the BASIC interpreter changed in 4.3.x ? 
why the same code that works in 4.2.x doesn't works in 4.3.x ?
Comment 1 Kevin Suo 2014-07-11 14:31:45 UTC
I see from 4.3 release wiki page and find this commit:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=8c6342c25896e515869500f538370de336b123c7

This commit is about dispatcher change, may be related to this issue. (and maybe I am wrong...)
Comment 2 tommy27 2014-07-11 17:52:55 UTC
thanks Kevin.
I add Matus to CC list and ask him if he confirms your suspicion.

I'll later test all my macros to see if there's other broken compatibility between 4.2.x and 4.3.x
Comment 3 Matúš Kukan 2014-07-14 06:24:05 UTC
I don't see why that commit would be responsible.
Might be worth to bibisect.
Comment 4 Maxim Monastirsky 2014-07-14 08:14:19 UTC
That's my fault, sorry.
Comment 5 Commit Notification 2014-07-14 15:00:25 UTC
Maxim Monastirsky committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=cdfd24fe2a45ab41c84f813eb0d6a52a9d731a79

fdo#81231 Make this macro work again



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 6 Maxim Monastirsky 2014-07-16 11:39:50 UTC
The commit notification didn't work for some reason, so here is the commit for the 4-3 branch:

http://cgit.freedesktop.org/libreoffice/core/commit/?h=libreoffice-4-3&id=3a4e6c4673a4e4dde774d1f6267256d8d8c48e59