Apache OpenOffice (AOO) Bugzilla – Full Text Issue Listing |
Summary: | different behaviour for "CharColor" and "CharBackColor" properties in java | ||
---|---|---|---|
Product: | App Dev | Reporter: | John R. D'Orazio <priest> |
Component: | api | Assignee: | AOO issues mailing list <issues> |
Status: | UNCONFIRMED --- | QA Contact: | |
Severity: | Normal | ||
Priority: | P5 (lowest) | Keywords: | usability |
Version: | 4.1.1 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 10 | ||
Issue Type: | DEFECT | Latest Confirmation in: | --- |
Developer Difficulty: | --- |
Description
John R. D'Orazio
2015-09-16 00:25:29 UTC
I have run some further tests, and I see that the CharBackColor property has swapped the alpha value such that a value of 0 (or 0.0, or 0x00) is treated as opaque and a value of 255 (or 1.0, or 0xFF) is treated as transparent. This is not the case for the CharColor property which seems to behave as it should. xPropertySet.setPropertyValue("CharBackColor", Color.YELLOW.getRGB()); //-> has no visible effect because is treated as transparent! xPropertySet.setPropertyValue("CharBackColor", Color.YELLOW.getRGB() - 0xFF000000); //-> sets an opaque yellow background color! having subtracted the alpha bits and setting them 0 should give a transparent color, but Open Office is treating transparent as opaque in this case! I think I understand a little better what is happening here. It seems that OpenOffice perhaps doesn't support the alpha bit for background colors, and so assumes an empty bit such as 0x00. However 0x00 actually means 100% transparency, compared to 0xFF which means 0% transparency (full opacity). However, since Java automatically sets the alpha bit with the Color object or with JColorChooser or any similar handling of colors, the only way to get OpenOffice to correctly accept the color value is to explicitly unset or clear the alpha bit before setting the integer value for the "CharBackColor" property. I am currently doing this with a bitwise operation that clears the bit. Example: xPropertySet.setPropertyValue("CharBackColor", Color.YELLOW.getRGB() & ~0xFF000000); I will do a little more investigation to see if I can gather any more information on this issue... I can also add that "int" is the correct type in Java for the "long" type in UNO, I found a page about type mapping for Java: https://wiki.openoffice.org/wiki/Uno/Java/Specifications/Type_Mapping I can also add that I have tried to set the "CharBackTransparent" property both to true and to false before setting the "CharBackColor" property, but it had no effect. In any case I have to clear the alpha bit. (So what exactly does the "CharBackTransparent" property do? Is it supposed to enable transparency for background colors? Doesn't seem to be working if it is...) I believe I understand what the "CharBackTransparent" property is doing, basically it means if you want "no color" as opposed to white background, then you set "CharBackTransparent" to true so that no matter what the "CharBackColor" is set to, there will still be no background at all (you would need this property if the alpha bit is not read from the "CharBackColor" property in fact). Therefore it is of no help when you are wanting to see and set a Character Background Color. "CharBackTransparent" would have to be set to false in order to see any background color, but it does not modify how the alpha bit in "CharBackColor" is being dealt with, it's a simple ovverride is what I'm guessing. |