Bug 119609 - Macro for Writer: Cannot read property of ParaBackGraphicURL
Summary: Macro for Writer: Cannot read property of ParaBackGraphicURL
Status: RESOLVED WONTFIX
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
: 119616 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-30 13:54 UTC by Kamil Landa
Modified: 2018-09-03 09:53 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
bt with debug symbols (11.62 KB, text/plain)
2018-08-30 20:35 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kamil Landa 2018-08-30 13:54:49 UTC
Run this macro from Writer and it will generate an error message.


Sub mistake 'Cannot read property of ParaBackGraphicURL
	dim oVCur, a
	oVCur=thisComponent.currentcontroller.getViewCursor() 'view cursor
	a=oVCur.getPropertyValue("ParaBackGraphicURL") 'for other proprerties it is OK
End Sub


Generated error:
BASIC runtime error.
An exception occurred 
Type: com.sun.star.uno.RuntimeException
Message: Getting from this property is not unsupported.


Version: 6.1.0.3 (x64)
Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1
CPU threads: 2; OS: Windows 6.1; UI render: default; 
Locale: cs-CZ (cs_CZ); Calc: CL
Comment 1 Oliver Brinzing 2018-08-30 14:30:54 UTC
confirming, calc property "BackGraphicURL" is affected too.

Version: 6.2.0.0.alpha0+ (x64)
Build ID: 7cb6dc2652ce7e2e7d9ec7464bb1eed0d93306d7
CPU threads: 4; OS: Windows 10.0; UI render: default; 
Locale: de-DE (de_DE); Calc: threaded

i think, root cause is the changed handling of image urls, for example https://bugs.documentfoundation.org/show_bug.cgi?id=119519
Comment 2 Julien Nabet 2018-08-30 14:39:00 UTC
Perhaps just to find difference in code more easily, could you give some examples of properties which work?
Comment 3 Oliver Brinzing 2018-08-30 16:16:45 UTC
FooterBackGraphicURL/HeaderBackGraphicURL are affected too

OPTION EXPLICIT

Sub TesPageStyleProps()

	On Local Error Goto ErrorHandler
	Dim oDoc as Object
	Dim osheet as Object
	Dim oPStyles as Object
	Dim oPStyle as Object
	Dim aProps as Object
	Dim vTmp
	Dim sProp as String
	Dim i as Integer
	
	oDoc = ThisComponent
	oSheet = oDoc.getSheets().getByIndex(0)
	oPStyles = oDoc.StyleFamilies.getByName("PageStyles")
	oPStyle = oPStyles.getByName(oSheet.PageStyle)

	aProps = oPStyle.PropertySetInfo.Properties
	For i = LBound(aProps) to UBound(aProps)
		sProp = aProps(i).Name
		vTmp = oPStyle.getPropertyValue(sProp)
	Next i
Exit Sub
ErrorHandler:
	MsgBox sProp
	Resume Next
End Sub
Comment 4 Kamil Landa 2018-08-30 17:13:15 UTC
Macro with example for some working properties:


Sub mistake2 'example with some working properties
	dim oVCur, a
	oVCur=thisComponent.currentcontroller.getViewCursor() 'view cursor
	
	a=oVCur.getPropertyValue("CharFontFamily") 'it works
	a=oVCur.getPropertyValue("CharColor") 'it works
	a=oVCur.getPropertyValue("CharWeight") 'it works
	a=oVCur.getPropertyValue("ParaVertAlignment") 'it works
	a=oVCur.getPropertyValue("ReferenceMark") 'it works
	a=oVCur.getPropertyValue("ParaTopMargin") 'it works
	a=oVCur.getPropertyValue("TextParagraph") 'it works

	a=oVCur.getPropertyValue("ParaBackGraphicURL") 'for other proprerties it is OK
End Sub




And testing macro for Writer: 

For "Standard" page styles is also affected FooterBackGraphicURL, for others BackGraphicURL. 


OPTION EXPLICIT

Sub TesPageStylePropsForWriter() 'test for Writer

	On Local Error Goto ErrorHandler
	Dim oDoc as Object, osheet as Object, oPStyles as Object, oPStyle as Object, aProps as Object, vTmp, sProp as String, i as Integer, j as Integer, elems
	
	oDoc = ThisComponent
	oPStyles = oDoc.StyleFamilies.getByName("PageStyles")
	elems=oPStyles.ElementNames()
	For j=lbound(elems) to ubound(elems)
		oPStyle = oPStyles.getByName(elems(j))
	
		aProps = oPStyle.PropertySetInfo.Properties
		For i = LBound(aProps) to UBound(aProps)
			sProp = aProps(i).Name
			vTmp = oPStyle.getPropertyValue(sProp)
		Next i
	Next j
Exit Sub
ErrorHandler:
	MsgBox elems(j) & ":" & chr(10) & sProp
	Resume Next
End Sub
Comment 5 Julien Nabet 2018-08-30 20:35:10 UTC
Created attachment 144564 [details]
bt with debug symbols

On pc Debian x86-64 with master sources updated today, I could reproduce this.
Here's a bt from throw statement.
Comment 7 Julien Nabet 2018-08-30 20:40:39 UTC
Tomaz: noticing the throw statement put in 7a8ed362eb163ac15a000ba1cfc74b58315800a1, thought you might be interested in this one.
Comment 8 Julien Nabet 2018-08-30 20:41:35 UTC
Oups, I forced my comment whereas Maxim had already responded.
Sorry!
Comment 9 Julien Nabet 2018-08-31 09:35:10 UTC
*** Bug 119616 has been marked as a duplicate of this bug. ***
Comment 10 Xisco Faulí 2018-09-03 09:53:09 UTC
(In reply to Maxim Monastirsky from comment #6)
> I'm afraid that it's the expected behavior since 6.1, please see:

Closing as RESOLVED WONTFIX