https://bz.apache.org/ooo/show_bug.cgi?id=126531

          Issue ID: 126531
        Issue Type: DEFECT
           Summary: different behaviour for "CharColor" and
                    "CharBackColor" properties in java
           Product: App Dev
           Version: 4.1.1
          Hardware: PC
                OS: Windows 10
            Status: UNCONFIRMED
          Severity: normal
          Priority: P5
         Component: api
          Assignee: issues@openoffice.apache.org
          Reporter: john.dora...@cappellaniauniroma3.org

==Overview==
When using the com.sun.star.beans.XPropertySet interface in a java extension, I
am seeing different behaviour for the "CharColor" property and the
"CharBackColor" property. The API documentation says that they take a "long"
value; and it then gives as an example the usage of a hex number such as
0x00FFFF00
(https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Formatting). The
"CharBackColor" property, differently from the "CharColor" property, will not
take an integer value such as the one produced by the Color.getRGB() method.

==Steps to reproduce==
The "CharColor" property will take an integer as produced by the getRGB()
method:

    xPropertySet.setPropertyValue("CharColor", Color.YELLOW.getRGB());

This will correctly set the character color to yellow.
However this will not work for the "CharBackColor" property:

    xPropertySet.setPropertyValue("CharBackColor", Color.YELLOW.getRGB());

This simply will not do anything, it does not give an error but it also does
not set the background to yellow. This will work instead:

    xPropertySet.setPropertyValue("CharBackColor", 0x00FFFF00);

Casting a variable as "long" and passing it in as value for the "CharBackColor"
property results in an error:

long bgColor = 0x00FFFF00; //Long bgColor = (long) 0x00FFFF00
xPropertySet.setPropertyValue("CharBackColor", bgColor);

com.sun.star.lang.IllegalArgumentException: 
    at com.sun.star.bridges.jni_uno.JNI_proxy.dispatch_call(Native Method)
    at com.sun.star.bridges.jni_uno.JNI_proxy.invoke(JNI_proxy.java:171)
    at com.sun.proxy.$Proxy6.setPropertyValue(Unknown Source)

==Actual results==
Passing an integer value as produced by Color.getRGB() into the "CharBackColor"
property will not throw an error but will have no result. Passing a value cast
as "long" or "Long" or "int" will result in an error.

==Expected results==
Passing a Color.getRGB() value into the "CharBackColor" property should be
sufficient to correctly set the color.

-- 
You are receiving this mail because:
You are the assignee for the issue.

Reply via email to