OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[SOLVED] VisibleArea seems to be wrong in Draw Makro

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
gamp-ba
General User
General User


Joined: 06 Feb 2011
Posts: 11

PostPosted: Sun Jul 29, 2012 2:53 am    Post subject: [SOLVED] VisibleArea seems to be wrong in Draw Makro Reply with quote

Dear community, I would really appriciate any help
The macro is quite sinple:

Sub MainVisiblearea
oContr = ThisComponent.CurrentController
xray ocontr
End Sub

I create in a new drawing a rectangle at point 5.0/5.0 (cm, german) and size also 5.0/5.0
then i set zoom to 100% and move the square to the top left corner.
then i execute the macro. The visible size Startpoint X/Y (result by xray) ist always far greater than 5.0 in X and in Y - and this is wrong. I tested it now very often with differnt settings - visible area in draw is always wrong!

So, could any of my settings be wrong? Or is it ab bug?
Error occurs in OpenOffice 3.0 and in LibreOffice 3.3 on WindowsXP
If it is a bug, to whom should I forward it?

Another indicator, that visible area is wrong could be:
in the abobe mentioned drawing: I create an new rectangle at any position and delete it. I strore the drawing and close it. After opening again the square is moved to the left and up (so it is shifted, i think, this is due to an error in the visiblearea )


Last edited by gamp-ba on Mon Jul 30, 2012 6:25 am; edited 1 time in total
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Sun Jul 29, 2012 11:30 pm    Post subject: Reply with quote

Hi,
I don't understand your problem.
Code:
Sub MainVisiblearea
oContr = ThisComponent.CurrentController
xray ocontr
End Sub

This code has no relation with your rectangle. You xray the controller of the current OpenOffice window.
Quote:
The visible size Startpoint X/Y (result by xray) ist always far greater than 5.0 in X and in Y

What properties are you looking at?
Property VisibleArea concerns the whole slide.

If you want to xray your rectangle, select it. Start XrayMenu (provided in Xray version 6), and push button : Xray ThisComponent.CurrentSelection(0)

Remember that Size and Position are in units of 1/100 mm.
The Position is related to the top-left of the slide, not to the margins, as opposed to the user interface.
_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
gamp-ba
General User
General User


Joined: 06 Feb 2011
Posts: 11

PostPosted: Mon Jul 30, 2012 12:14 am    Post subject: visiblearea result seems to be wrong Reply with quote

Bernard, thanks for the answer. I try it again. the problem is, that in my opinion the result of visiblearea is WRONG. the rectangle is an example, to check it quickly with a simple drawing.
In my example, after shifting the rectangle to the top left position, the visiblearea should be at 5,0 or a little bit less. but it is close to six (5,8 oder so)
the visible area, as I understand , should be in paper coorinates (!) the area, shown in the scroll pane. If you move the scrollbars, the visible area changes. this is correct. my problem is, that the startpoint of the visible area is wrong (not the same, as the ruler and the papaercoordinates shown in the status bar, give.)

so, my example with the rectangle is only to get quickly a drawing to check my question /concern. you could do it with ANY other drawing. it is always the same.

2 weeks ago I startet a thread conderning mouse coordinates versus patercoordinates - with no success. may be, it was to complicated. but now i am sure, that the problem, that it doesn't work is the wrong response to the visible area.

sorry for long explanation, but i hope, it ist clearer now

the background of my macro is to check, if a mouseselection is relatively closer to the left or right side of a selevted geometry
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Mon Jul 30, 2012 4:46 am    Post subject: Re: visiblearea result seems to be wrong Reply with quote

gamp-ba wrote:
the visible area, as I understand , should be in paper coorinates (!) the area, shown in the scroll pane. If you move the scrollbars, the visible area changes. this is correct. my problem is, that the startpoint of the visible area is wrong (not the same, as the ruler and the papaercoordinates shown in the status bar, give.)

I did not see your problem because I use a template for my new documents.

If I don't use my template for Draw, the default values for the margins of a slide are :
Menu Format > Page
Left : 0.47cm
Right : 0.51cm
Top : 0.51cm
Bottom : 0.54 cm
These values are stupid. A normal default should be top and bottom margins identical, left and right identical, and certainly not these strange values but something like 1cm or 0.5cm.

If, with the default values, I compare the mouse position of the top-left area and the contents of VisibleArea, yes they are non consistent.

I set the margins, for example 1 cm for each, save the document.
I repeat the measurements : now the mouse coordinates and the VisibleArea are consistent.

Conclusion : do not use the default values, set your margins.
Prepare a template and set it as default for your new Draw documents.
_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
gamp-ba
General User
General User


Joined: 06 Feb 2011
Posts: 11

PostPosted: Mon Jul 30, 2012 6:16 am    Post subject: Visblearea wrong? Reply with quote

Bernard, thanks a lot indeed.
It works, when i set all the margins to zero (disadvantage is, that i receive the warning "the drawing boarder is out of printable region" (or so, sry for my translation)
All margins greater than zero lead to the error, as far as I tested it (with margins 0,5 or 0,3 or 0,2 or 0,1 cm). I started with a DINA4 format with standard margin of 1cm top, bottom, left and right.
Now I can go an writing my makro after analysing issues for a week und big frustration Smile

What do you think? in my opinion , this is a bug. does it make sense to report it to the devellopers.
And what ist the correct way, to do this?

again thank you very much
Hans
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1453
Location: France

PostPosted: Mon Jul 30, 2012 6:48 am    Post subject: Re: Visblearea wrong? Reply with quote

gamp-ba wrote:
It works, when i set all the margins to zero (disadvantage is, that i receive the warning "the drawing boarder is out of printable region" (or so, sry for my translation)
All margins greater than zero lead to the error, as far as I tested it (with margins 0,5 or 0,3 or 0,2 or 0,1 cm). I started with a DINA4 format with standard margin of 1cm top, bottom, left and right.

I don't have problems with non-zero margins. I only see the bug with default values.
You may create a bug report at this page. First, search if there is already one. If not, you need an account to create a report. Then log in, create the new bug report with good explanations. Perhaps some designer will investigate.
_________________
Bernard

OpenOffice.org 1.1.5 fr / Apache OpenOffice 4.0.1 / LibreOffice 4.1.0
MS-Windows 7 Home SP1
This forum is spammed, use instead Apache OpenOffice forums
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group