After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 376517 - Orca does not report indentation in OOo Writer documents correctly
Orca does not report indentation in OOo Writer documents correctly
Status: RESOLVED FIXED
Product: orca
Classification: Applications
Component: general
2.17.x
Other All
: Normal major
: ---
Assigned To: Rich Burridge
Orca Maintainers
Depends on:
Blocks: 404411
 
 
Reported: 2006-11-18 01:43 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2007-10-09 20:30 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Patch to implement the suggested workaround. (744 bytes, patch)
2007-01-04 17:00 UTC, Rich Burridge
committed Details | Review
Patch to add in speaking "pixels". (563 bytes, patch)
2007-01-05 17:20 UTC, Rich Burridge
none Details | Review
Reworked patch to add ngettext support as requested in comment #37 and use correct line numbers for previous diff. (1.21 KB, patch)
2007-10-04 16:41 UTC, Rich Burridge
none Details | Review
Re-revised patch. (1.17 KB, patch)
2007-10-04 18:29 UTC, Rich Burridge
none Details | Review
Re-re-revised patch. (1.74 KB, patch)
2007-10-04 18:35 UTC, Rich Burridge
none Details | Review
Fourth time's a charm! (I hope). (1.26 KB, patch)
2007-10-04 19:02 UTC, Rich Burridge
committed Details | Review

Description Joanmarie Diggs (IRC: joanie) 2006-11-18 01:43:34 UTC
Please describe the problem:
Bug #372964 is an RFE addressing the need for Orca to provide customizable text attribute settings.  While the proposed solution provides access to nearly all of the requested information, it seems that indentation in OOo Writer documents is always reported as "0". 

Steps to reproduce:
1. Apply the latest patch for bug #372964
2. Launch OOo Writer
3. Press the "Increase Indent" button on Writer's Formatting toolbar
4. Type "This is a test."
5. Move to any character within "This is a test" and press Insert F

Actual results:
Orca reports that the text indentation is "0".

Expected results:
Orca would report that the text is indented.

Does this happen every time?
Yes.

Other information:
Comment 1 Rich Burridge 2006-12-04 17:47:13 UTC
This is another OOo bug. We are always getting "indent:0;" back
irrespective of the actual text indentation.

I've opened OOo issue #72262 against this
http://www.openoffice.org/issues/show_bug.cgi?id=72262
and adjusted the summary of this bug accordingly.
Comment 2 Rich Burridge 2007-01-04 16:57:47 UTC
From a comment that Oliver made to Will today, it seems that the
text attribute that's getting adjust here is "left-margin:".

I just did the instructions I wrote for OOo issue #72161, namely:

  Startup Writer and create a small document with:

  The quick
  brown fox
  jumps over
  the lazy dog.

  Position the text caret at the beginning of the "brown fox" line
  and use the "Increase Indent" icon from the toolbar line to add
  an indentation to this line.

I added a couple of lines of debug to readCharAttributes() in default.py
and got the following (Insert-f for the first two lines of the document):


readCharAttributes: default text attributes: size:12; left-margin:0; pixels-below-lines:0; pixels-above-lines:0; variant:normal; invisible:false; right-margin:0; strikethrough:false; underline:none; indent:0; style:normal; weight:400; justification:left
readCharAttributes: char attrs:  ('', 0, 10)

readCharAttributes: default text attributes: size:12; left-margin:47; pixels-below-lines:0; pixels-above-lines:0; variant:normal; invisible:false; right-margin:0; strikethrough:false; underline:none; indent:0; style:normal; weight:400; justification:left
readCharAttributes: char attrs:  ('', 0, 10)

We can see that "left-margin:" has changed from 0 to 47.
Knowing this we can probably script around this. The default value
for enabledTextAttributes in settings.py is:

enabledTextAttributes = "size:; family-name:; weight:400; indent:0; underline:none; strikethrough:false; justification:left; style:normal;"

I suggest we just adjust this in the StarOffice.py script to:

enabledTextAttributes = "size:; family-name:; weight:400; left-margin:0; underline:none; strikethrough:false; justification:left; style:normal;"

Does that seem reasonable?


Comment 3 Rich Burridge 2007-01-04 17:00:39 UTC
Created attachment 79396 [details] [review]
Patch to implement the suggested workaround.

This seems to work nicely (assuming everybody is okay 
with it saying "left margin 47").

Please let me know if you are okay with this. If so, I'll check it in.
Comment 4 Joanmarie Diggs (IRC: joanie) 2007-01-04 17:14:33 UTC
> This seems to work nicely (assuming everybody is okay 
> with it saying "left margin 47").

47 whats?
Comment 5 Willie Walker 2007-01-04 17:15:00 UTC
I think this looks fine.  What would the impact be of leaving "indent" in there and just adding "left-margin"?  In addition, what does the number 47 mean?  It is millimeters, pixels, a percentage?
Comment 6 Rich Burridge 2007-01-04 17:29:59 UTC
I've no idea what 47 means. I'd guess pixels. It's not millimetres or 
a precentage. Yes, we could leave "indent" in there too.

For now, I'll check in the existing patch (plus "indent") and leave the
bug open until we can find out from Oliver what the 47 means. Then we
can add some most custom scripting to StarOffice.py to speak the units
as well.

It'll at least be an improvement over what we currently have. Thanks.
Comment 7 Rich Burridge 2007-01-04 17:44:14 UTC
Change checked in (plus "indent"). Email sent to Oliver. I'll
update with what he says. On reflection, I'm going to guess 
that they are points.
Comment 8 Mike Pedersen 2007-01-04 20:15:20 UTC
Depending on what Oliver says it would be really nice to take this value and calculate some meaningful unit of measure from it.   
Comment 9 Joanmarie Diggs (IRC: joanie) 2007-01-04 21:22:30 UTC
Just tried the patch.  Very cool!

Since this is still open:  How about adding right-margin (which also defaults to 0)?  I just made that change and then created a blockquote in Writer by indenting from the left and dragging the ruler to move the end of the line to 6 inches.  With the right margin addition to StarOffice.py, I can now distinguish blockquotes from left-side indents and also tell if my blockquote is balanced (i.e. has the same amount of indentation on both sides).
Comment 10 Rich Burridge 2007-01-04 21:30:21 UTC
Good idea. Done (and checked into SVN trunk). Thanks!
Comment 11 Joanmarie Diggs (IRC: joanie) 2007-01-04 21:37:48 UTC
w.r.t. comment #8, if you take the reported value and divide it by 95, you'll get the margin in inches give or take a couple hundredths of an inch.  I verified this for a variety of fonts, styles, font sizes, zoom levels, etc.

On another note, it just occurred to me:  We still aren't getting indentation if the indentation was accomplished via tabbing.  Maybe that's what indent is for? 
Comment 12 Joanmarie Diggs (IRC: joanie) 2007-01-04 21:57:19 UTC
Sorry to be spammy, but I just found something else:  If you have a negative indent (e.g. -47) and have punctuation set to some or none, you lose the minus sign in speech.  I suppose this is a broader issue so let me know if you'd like me to file it as such.

Since I'm already commenting....  Rich:  Your guess about the mystery number being points seems right: 95-point text is 1 inch tall (and an indent of 95 whatevers means you're indented 1 inch).
Comment 13 Rich Burridge 2007-01-04 22:42:21 UTC
> I suppose this is a broader issue so let me know if you'd like
> me to file it as such.

Yes. Please file a new bug on that one. Thanks.
Comment 14 Oliver Braun 2007-01-05 08:30:41 UTC
OpenOffice.org bridges to ATK, not to at-spi. The ATK docs (http://developer.gnome.org/doc/API/2.0/atk/AtkText.html#AtkTextAttribute) say:

ATK_TEXT_ATTR_LEFT_MARGIN	 The pixel width of the left margin

OOo uses 100th of mm internally, so if that would suit you better, we could expose this as additional attribute in OOo 2.2.
Comment 15 Rich Burridge 2007-01-05 16:02:14 UTC
Thanks Oliver. So Mike/Joanie et al, what would you like spoken
here?  I don't think we can convert to mm's as that'll confuse
most American's. Maybe leave as "pixels"...

Please let me know and I'll adjust the script accordingly.
Comment 16 Mike Pedersen 2007-01-05 16:48:50 UTC
Could we possibly calculate perhaps 10ths of an inch?  Perhaps we could hear indented 1.2 inches or something like that.  
Comment 17 Rich Burridge 2007-01-05 17:08:41 UTC
The problem here is that most of the rest of the world is using the
metric system. (It's only countries like America that's got it's head 
firmly up its butt and still using a useless archaic measuring system. 
1/2 :-) )

Our GNOME/Gtk+ localization facilities don't make it easy to swap from one 
system to another.

Will suggested (also half jokingly) that it would be nice to try
to determine what units the OOo ruler is using and use that, but I
don't believe that that is possible.

For now I'm just going to get it to speak "pixels". I don't
currently know how hard that is, so I'm not sure if this will make
it for the Orca 2.17.5 tarball on Sunday.
Comment 18 Rich Burridge 2007-01-05 17:20:44 UTC
Created attachment 79464 [details] [review]
Patch to add in speaking "pixels".

Simple patch as it turns out. As it's part of the ATK spec,
I've adjusted the default.py code to handle this (as opposed to
making it specific for OOo).
Comment 19 Joanmarie Diggs (IRC: joanie) 2007-01-05 17:39:42 UTC
Stupid question time (must be because I'm American ;-) )

I realize what Oliver quoted, but aren't "pixels" the little dots that make up what is being displayed?  If so, given a document with indentation, wouldn't one expect different results at different resolutions? My left margin is consistently 47 regardless of resolution.  Aren't these points rather than pixels??  Sorry to be dense....
Comment 20 Rich Burridge 2007-01-05 17:50:09 UTC
You are absolutely right, which suggests (to me at least), that 
perhaps the ATK docs at:
http://developer.gnome.org/doc/API/2.0/atk/AtkText.html#AtkTextAttribute
which currently say:

ATK_TEXT_ATTR_LEFT_MARGIN        The pixel width of the left margin

should be updated to use a better unit of measurement.
Comment 21 Oliver Braun 2007-01-05 18:43:35 UTC
Even though I am clearly not an toolit expert, I tend to disagree: the 100th mm/point units are valid for printing, but not fo displaying on the screen. This is mostly because the application would not only need the screen resolution, but also the screen width the calculate the correct number of pixels, which I believe is not possible.

If you change the resultion of your screen, your document still uses the same static dpi mapping, which you can get from the fact that you see more of your document when you increase the resolution. If the mapping were dynamic, the display size of the document would have to stay the same.
Comment 22 Oliver Braun 2007-04-20 09:11:39 UTC
I have to take back what I wrote above: screen resolution can be queried and should be honored by OOo. Sorry for the confusion (and the delay).

However, meanwhile I has the followin conversation with Bill Hanemann on this:

Oliver Braun wrote:
<quote>
many of the ATK text attributes are specified to use pixels as unit of measure, which - at least in theory - depends on the resolution and size of the monitor one uses.

I find this rather unsatisfying for several reasons:
- CSS do not have this limitation, they allow in, cm , mm, pt, pc for fixed values, sometimes percent and even "auto"
- OOo uses "100th of mm", "percent" and "auto" internally
- Orca users have expressed they would prefer a unit of measure more meaningful to them to be spoken.

So I wonder what the point in forcing app & at-tool to calculate values forth and back is. Specifically I have the problem of having to "guess" the value for "auto" on superscript.

[..]

What do you think is the best way to proceed ?
</quote>

Bill Hanemann wrote:
<quote>
I think it may be best to allow ATK's value to include an (optional) units string, i.e

10mm

or 25pt, as long as this matches the equivalent strings in the CSS spec.
</quote>


So, beside that there seems to be a bug in OOo or Xorg, which results in incorrect margin values at least for some screen reslutions, we might head for using a different unit of measure (OOo uses 100th of mm internally) and change the ATK specification accordingly. What do you think ?
Comment 23 Willie Walker 2007-05-02 15:35:08 UTC
I may be coming at this from the wrong angle, so please correct me if I'm misunderstanding the problem.

> I think it may be best to allow ATK's value to include an (optional) units
> string, i.e
> 
> 10mm
> 
> or 25pt, as long as this matches the equivalent strings in the CSS spec.

Having an optional units string appended to the value seems reasonable to me.

> So, beside that there seems to be a bug in OOo or Xorg, which results in
> incorrect margin values at least for some screen reslutions, we might head for
> using a different unit of measure (OOo uses 100th of mm internally) and change
> the ATK specification accordingly. What do you think ?

Without the optional units string, it seems as though we need to have an implicit unit for those things without the optional units string.  If ATK/AT-SPI currently implies something (is it pixels?), then that is probably the way to go rather than modifying the spec.
Comment 24 Oliver Braun 2007-05-03 05:16:39 UTC
(In reply to comment #23)
> Without the optional units string, it seems as though we need to have an
> implicit unit for those things without the optional units string.  If
> ATK/AT-SPI currently implies something (is it pixels?), then that is probably
> the way to go rather than modifying the spec.
>

ATK/AT-SPI are somewhat inconsistent at this point: AT-SPI just specifies "The text attributes correspond to CSS attributes where possible", which would mean one unit of in, cm , mm, pt, pc or px, while ATK limits this choice to px.

The mapping from ATK to AT-SPI has some more problems in this case:

1) the CSS string is "margin-left", not "left-margin" (http://www.w3.org/TR/CSS21/box.html#margin-properties)

2) ATK seems not to insert the unit of measure in the string

Maybe OOo should ignore the ATKTEXT_ATTR_*_MARGIN constants and directly return the CSS values ?
Comment 25 Willie Walker 2007-05-07 13:51:50 UTC
> Maybe OOo should ignore the ATKTEXT_ATTR_*_MARGIN constants and directly return
> the CSS values ?

If there's a standard in place (e.g., CSS), then it seems to me to make sense to use it.  Li, can you comment on this from the AT-SPI/ATK perspective? 
Comment 26 Li Yuan 2007-05-16 05:49:56 UTC
Appending unit to the value is a good choice to me. And I prefer the default value is pixels. Is there any code need to be changed except document?
Comment 27 Li Yuan 2007-05-16 06:04:19 UTC
I mean what I need to do is to change the definition of ATKTEXT_ATTR_* . And OOo will append unit to value and Orca will read it, right?
Comment 28 Oliver Braun 2007-05-16 07:43:55 UTC
Sounds reasonable to me. 

The only optional addition to this would be to have the at-spi/atkbridge add the unit of measure symbol (px) for applications not specifying it, but this would probably break some ATs for all applications, not "just" OOo.
Comment 29 Willie Walker 2007-05-16 14:23:32 UTC
(In reply to comment #28)
> Sounds reasonable to me. 
> 
> The only optional addition to this would be to have the at-spi/atkbridge add
> the unit of measure symbol (px) for applications not specifying it, but this
> would probably break some ATs for all applications, not "just" OOo.

I think this sounds OK, too.  To help prevent some breakage, perhaps 'px' need not be added, since that is the current default unit?

Rich, Joanie - what do you think of this?
Comment 30 Rich Burridge 2007-05-16 16:22:30 UTC
I see Bugzilla is back again now.

That's fine with me. We can easily adjust the StarOffice.py script
to add in speaking/brailling "pixels" if it's the default. I don't
think we want to try to get too clever and handle "localizing" into
inches or cms. It'll just complicate the code.
Comment 31 Joanmarie Diggs (IRC: joanie) 2007-05-16 16:28:51 UTC
(In reply to comment #29)
> I think this sounds OK, too.  To help prevent some breakage, perhaps 'px' need
> not be added, since that is the current default unit?

I'm not sure I'm following. Is px merely the default unit or is it the only unit?  

If the only unit is px, I don't see the need to add it on if doing so might break things.  Like Rich said, he can do that in StarOffice.py. If other units are possible, would we still add on the unit?  If not, because of possible breakage, how can we provide access to the unit?
Comment 32 Li Yuan 2007-05-17 01:59:53 UTC
I think px is just the default unit. We can use other unit like mm or pt. If applications want to use unit which is not px, they should append the unit to the value. If there is not unit in the value, the unit will be px.
Comment 33 Willie Walker 2007-05-17 13:55:22 UTC
(In reply to comment #32)
> I think px is just the default unit. We can use other unit like mm or pt. If
> applications want to use unit which is not px, they should append the unit to
> the value. If there is not unit in the value, the unit will be px.

Is the unit text a localized form or a computer form?  That is, will we need to translate it as appropriate?
Comment 34 Li Yuan 2007-05-18 02:37:21 UTC
What is CSS using? Localized form or computer form?
Comment 35 Oliver Braun 2007-05-18 06:46:47 UTC
The CSS is intended to be interpreted by a browser, thus it is using the computer form (see http://www.w3.org/TR/CSS21/syndata.html#value-def-length).

So the atk spec should be changed to allow optional unit strings (in computer form, as defined by CSS). The at-spi documentation doesn't specify any attributes, otherwise I would have proposed to document the default of 'px' there. 

Regarding localization, I think the application should honor the users preferences and pass the same unit (in computer form) e.g. the rulers are using.

OOo currently supports centimeter, millimeter, inch, pica and point, which map to the CSS values "cm", "mm", "in", "pc" und "pt". The mapping between computer form back to localized form would have to be done by orca (based on the language it is configured to read).

Please note that in CSS there often is also a value "auto", which might be used by OOo as well.

Comment 36 Willie Walker 2007-05-25 16:27:23 UTC
Removing target milestone from [blocked] bugs.  We have little control over them, so we're better off letting priority and severity be our guide for poking the related components.
Comment 37 Willie Walker 2007-10-01 15:39:23 UTC
In looking at the current code in trunk, I see support for "pixels" output at line 3314 in default.py:outputCharAttributes.  Does that address this bug?  In addition, I think we probably should consider ngettext for the current line at 3314.  Rich, can you look into doing this?
Comment 38 Rich Burridge 2007-10-04 16:41:42 UTC
Created attachment 96651 [details] [review]
Reworked patch  to add ngettext support as requested in comment #37 and use correct line numbers for previous diff.
Comment 39 Rich Burridge 2007-10-04 16:42:19 UTC
Oh, and yes, we are still blocked.
Comment 40 Rich Burridge 2007-10-04 16:44:18 UTC
Actually, I take it back. We are not blocked. That's the OOo metabug.
Can others please test this when they have a spare moment. Thanks!
Comment 41 Joanmarie Diggs (IRC: joanie) 2007-10-04 16:56:59 UTC
I get: SPEECH OUTPUT: 'left-margin 12.51mm pixels'
Comment 42 Rich Burridge 2007-10-04 17:30:01 UTC
I'm not sure what you tested to get that, so here's that I just tried:

Steps to reproduce:

1/ Start Orca from SVN trunk. Make sure that you are speaking 
   indentation. I.e:
     orca.settings.enableSpeechIndentation = True

2/ Start oowriter

3/ Enter (at one level of indent) "The quick brown fox." followed by Return.

4/ Press up arrow to get back to that first line.

For me, Orca speaks:

SPEECH OUTPUT: 'The quick brown fox.'

This seems wrong. I would have expected it to announce the indentation.
I'm investigating that.

If I then do Insert-f, I get:

SPEECH OUTPUT: 'size 12'
SPEECH OUTPUT: 'family-name Times'
SPEECH OUTPUT: 'left-margin 12.51mm'

So...

1/ What were you testing?
2/ What do you get for the above test?

Thanks.
Comment 43 Rich Burridge 2007-10-04 17:36:49 UTC
Okay, so it's not speaking the indentation because
speakTextIndentation() in default.py only speaks
indentation if it's tabs or spaces. That's not what
we've got here.
Comment 44 Joanmarie Diggs (IRC: joanie) 2007-10-04 18:07:13 UTC
1.  Essentially the same test.
2.  Same thing as before.

readCharAttributes: default text attributes: line-height:100%; paragraph-style:Default; justification:left; pixels-below-lines:0mm; pixels-above-lines:0mm; indent:0mm; right-margin:0mm; left-margin:12.51mm; vertical-align:baseline; writing-mode:lr-tb; text-shadow:none; text-rotation:0; text-decoration:none; font-effect:none; stretch:normal; direction:ltr; language:en-us; scale:1; style:normal; variant:normal; family-name:Times; weight:400; size:12; strikethrough:none; underline:none; invisible:false; fg-color:0,0,0; bg-color:255,255,255
SPEECH OUTPUT: 'size 12'
SPEECH OUTPUT: 'family-name Times'
SPEECH OUTPUT: 'left-margin 12.51mm pixels'
Comment 45 Rich Burridge 2007-10-04 18:25:21 UTC
Well whoop-de-doo! 

Here's my readCharAttributes debug line:

readCharAttributes: default text attributes: line-height:100%; paragraph-style:Default; justification:left; pixels-below-lines:0mm; pixels-above-lines:0mm; indent:0mm; right-margin:0mm; left-margin:12.51mm; vertical-align:baseline; writing-mode:lr-tb; text-shadow:none; text-rotation:0; text-decoration:none; font-effect:none; stretch:normal; direction:ltr; language:en-us; scale:1; style:normal; variant:normal; family-name:Times; weight:400; size:12; strikethrough:none; underline:none; invisible:false; fg-color:0,0,0; bg-color:255,255,255

I have no idea why you are getting something different than me.

Comment 46 Rich Burridge 2007-10-04 18:29:27 UTC
Created attachment 96655 [details] [review]
Re-revised patch.

Ack! I transcribed it wrong. Try this one.
Comment 47 Rich Burridge 2007-10-04 18:30:05 UTC
Thanks to Joanie for pointing out my mistake (quietly on IRC).
Comment 48 Rich Burridge 2007-10-04 18:35:59 UTC
Created attachment 96656 [details] [review]
Re-re-revised patch.

Sigh. Must...get...sleep...
Comment 49 Rich Burridge 2007-10-04 19:02:09 UTC
Created attachment 96657 [details] [review]
Fourth time's a charm! (I hope).

Joanie and I worked out what I was doing wrong. It seems
that that previous first patch had been rewritten at some
point and already incorporated it a different way. 

The new patch now just does the ngettext change.

If I've got it wrong this time, I'm going to leave it until
another day!
Comment 50 Joanmarie Diggs (IRC: joanie) 2007-10-04 19:07:04 UTC
Works beautifully! :-)
Comment 51 Rich Burridge 2007-10-04 20:15:02 UTC
Thanks Joanie. Patch committed to SVN trunk. Setting bug to "[pending]" state.
Comment 52 Rich Burridge 2007-10-09 20:30:57 UTC
Closing as FIXED.