Issue 76752

Summary: Bug with polylineshape with OOo2.2 under linux
Product: App Dev Reporter: ddorange <ddorange>
Component: apiAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Trivial    
Priority: P3 CC: andrew, issues
Version: 3.3.0 or older (OOo)   
Target Milestone: ---   
Hardware: All   
OS: Linux, all   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---

Description ddorange 2007-04-27 10:31:17 UTC
Hello,

I found a bug in OOo2.2 (under Linux only)

<code>
Sub LigneBrisee()
Dim monDocument As Object, maPage As Object
Dim maForme As Object
Dim lesPoints(4) As New com.sun.star.awt.Point
monDocument = thisComponent
maPage = monDocument.DrawPage
maForme = monDocument.createInstance("com.sun.star.drawing.PolyLineShape")
maforme.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
lesPoints(0).X =  4000 : lesPoints(0).Y =  2000
lesPoints(1).X =  4500 : lesPoints(1).Y =  4000
lesPoints(2).X = 2500  : lesPoints(2).Y = 3000
lesPoints(3).X = 2500  : lesPoints(3).Y = 4000
lesPoints(4).X = 4000  : lesPoints(4).Y =  4000
maPage.add(maForme)
maForme.LineWidth = 80
maForme.PolyPolygon = Array(lesPoints())
End Sub
</code>

In a swriter document I get a stuck shape at the left border of the page. I
can't change its position using the mouse.
 
Print maForme.HoriOrientPosition  gives a surprising result : -29822752 instead
of 0 or 2000.

I'm dmaths developper (www.dmaths.org)
For me it's a big problem, because we can't plot curves under linux with OOo2.2.

Thanks for your answer.
Comment 1 jsc 2007-04-27 11:59:10 UTC
jsc -> os: after a short discussion with sj, we think it's more a writer issue.
Can you check it or can you assign it to the appropriate developer
Comment 2 ddorange 2007-05-03 14:40:43 UTC
Hello everybody.

Is that issue assigned to the right people ?
Comment 3 Oliver Specht 2007-05-04 08:23:59 UTC
Target set to OOo 2.x

To workaround the problem put the following lines at the end of your macro:

maForme.VertOrientRelation = 7 'relative to page area
maForme.HoriOrientRelation = 7 'relative to page area
maForme.VertOrientPosition = 0
maForme.HoriOrientPosition = 0

BTW I'd also propose not to use page anchored objects para paragraph anchored
objects.
Comment 4 ddorange 2007-05-08 19:59:38 UTC
Hello,

I'm sorry but I can't put the shape at the right. For example I can't plot curves.

Try this addon : http://ddorange.free.fr/DmathsAddon.oxt

The plotting curves works perfectly with all OOo under windows and with OOo<=2.1
under Linux.

Thanks for all.
Comment 5 Oliver Specht 2007-05-09 07:45:42 UTC
Reassigned to od
Comment 6 ddorange 2007-11-03 23:39:00 UTC
Hello, what can I do now ?

The following code works under windows and do'nt underlinux.
It's now impossible to insert PolylineShape.

We cannot plot curves with dmaths ...



<code>
Sub LigneBrisee()
	Dim monDocument As Object, maPage As Object
	Dim maForme As Object
	Dim lesPoints(4) As New com.sun.star.awt.Point	
	monDocument = thisComponent
	monTexte = monDocument.Text
	monCurseur = monTexte.createTextCursor	
	maPage = monDocument.DrawPage
	maForme = monDocument.createInstance("com.sun.star.drawing.PolyLineShape")
	maForme.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
	lesPoints(0).X =  2100 : lesPoints(0).Y =  2100
	lesPoints(1).X =  4500 : lesPoints(1).Y =  4000
	lesPoints(2).X = 2200  : lesPoints(2).Y = 3000
	lesPoints(3).X = 2500  : lesPoints(3).Y = 4000
	lesPoints(4).X = 4000  : lesPoints(4).Y =  4000
	
	monTexte.insertTextContent(monCurseur, maForme, false)
	
	maForme.LineWidth = 80
	maForme.PolyPolygon = Array(lesPoints())

	
	Print maForme.VertOrientPosition
	maForme.VertOrientRelation = 0 'relative to page area
	maForme.HoriOrientRelation = 0 'relative to page area


	Print maForme.HoriOrientPosition		
	maForme2 = monDocument.createInstance("com.sun.star.drawing.PolyLineShape")
	maForme2.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
	lesPoints(0).X =  2000 : lesPoints(0).Y =  2000
	lesPoints(1).X =  3000 : lesPoints(1).Y =  2500
	lesPoints(2).X = 2500  : lesPoints(2).Y = 3000
	lesPoints(3).X = 3000  : lesPoints(3).Y = 6000
	lesPoints(4).X = 4000  : lesPoints(4).Y =  4000
	monTexte.insertTextContent(monCurseur, maForme2, false)
	maForme2.LineWidth = 60
	maForme2.PolyPolygon = Array(lesPoints())
	Print maForme2.VertOrientPosition
	maForme2.VertOrientRelation = 0 'relative to page area
	maForme2.HoriOrientRelation = 0 'relative to page area
	Print maForme2.HoriOrientPosition	
End Sub
</code>

Comment 7 roadrunner0 2007-11-04 19:16:36 UTC
I tested with Nov. 3rd ddorange's code and worked.
Left anchored objects with polylines did appear, and were re-sizable.

I am using OOo 2.3 in OpenSUSE 10.2.

(sorry, but don't use OOo2.2 anymore)
Comment 8 andrew 2007-11-04 20:13:42 UTC
First of all, you do not declare your variables. OK, it works fine, but it
really bothers me...

Does this version work for you?

Sub LigneBrisee_new()
	Dim monDocument As Object, maPage As Object
	Dim maForme As Object
	Dim lesPoints(4) As New com.sun.star.awt.Point	
	monDocument = thisComponent
	monTexte = monDocument.Text
	monCurseur = monTexte.createTextCursor	
	maPage = monDocument.DrawPage
	maForme = monDocument.createInstance("com.sun.star.drawing.PolyLineShape")
	maForme.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
	maForme.HoriOrientRelation = com.sun.star.text.RelOrientation.FRAME
	maForme.VertOrientRelation = com.sun.star.text.RelOrientation.FRAME
	lesPoints(0).X =  2100 : lesPoints(0).Y =  2100
	lesPoints(1).X =  4500 : lesPoints(1).Y =  4000
	lesPoints(2).X = 2200  : lesPoints(2).Y = 3000
	lesPoints(3).X = 2500  : lesPoints(3).Y = 4000
	lesPoints(4).X = 4000  : lesPoints(4).Y =  4000
	
	monTexte.insertTextContent(monCurseur, maForme, false)
	
	maForme.LineWidth = 80
	maForme.PolyPolygon = Array(lesPoints())

	
	Print maForme.VertOrientPosition
'	maForme.VertOrientRelation = 0 'relative to page area
'	maForme.HoriOrientRelation = 0 'relative to page area


	Print maForme.HoriOrientPosition		
	maForme2 = monDocument.createInstance("com.sun.star.drawing.PolyLineShape")
	maForme2.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
	maForme2.HoriOrientRelation = com.sun.star.text.RelOrientation.FRAME
	maForme2.VertOrientRelation = com.sun.star.text.RelOrientation.FRAME
	lesPoints(0).X =  2000 : lesPoints(0).Y =  2000
	lesPoints(1).X =  3000 : lesPoints(1).Y =  2500
	lesPoints(2).X = 2500  : lesPoints(2).Y = 3000
	lesPoints(3).X = 3000  : lesPoints(3).Y = 6000
	lesPoints(4).X = 4000  : lesPoints(4).Y =  4000
	monTexte.insertTextContent(monCurseur, maForme2, false)
	maForme2.LineWidth = 60
	maForme2.PolyPolygon = Array(lesPoints())
	Print maForme2.VertOrientPosition
'	maForme2.VertOrientRelation = 0 'relative to page area
'	maForme2.HoriOrientRelation = 0 'relative to page area
	Print maForme2.HoriOrientPosition	
End Sub
Comment 9 Oliver-Rainer Wittmann 2007-11-05 07:34:31 UTC
OD->ddorange:
"Target milestone" = OOo 2.3 does not make sense, because OOo 2.3 is already
released. Thus, this version of OOo can not be changed.
I've reset "Target milestone" back to "OOo 2.x"
Comment 10 Oliver-Rainer Wittmann 2008-01-11 14:23:58 UTC
Due to lack of resources retarget to OOo 3.0
Comment 11 Oliver-Rainer Wittmann 2008-04-28 11:35:28 UTC
Due to limited resources re-target to OOo 3.x
Comment 12 Marcus 2017-05-20 11:28:10 UTC
Reset assigne to the default "issues@openoffice.apache.org".