Bug 81231 - Remove Text Highlighting macro not working in 4.3.x
Summary: Remove Text Highlighting macro not working in 4.3.x
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected) rc
Hardware: Other All
: medium normal
Assignee: Maxim Monastirsky
Whiteboard: target:4.4.0 target:4.3.1
Keywords: regression
Depends on:
Reported: 2014-07-11 13:10 UTC by tommy27
Modified: 2014-07-16 11:39 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
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 and 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: 

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:

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":


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:
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: