https://issues.apache.org/ooo/show_bug.cgi?id=125901

          Issue ID: 125901
        Issue Type: DEFECT
           Summary: Multi-select list box in C++ indicates item 65535 is
                    selected when none (or multiple) are
           Product: App Dev
           Version: 4.0.1
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: api
          Assignee: [email protected]
          Reporter: [email protected]

If the C++ API is used to make a multi-select list box using some of these
constructs included here just for orientation

Reference<XInterface> model = xMSF->createInstance(       
OUSTRING("com.sun.star.awt.UnoControlListBoxModel"));
...
PropertySetHelper(model).set("MultiSelection", Any(multiSelection))
...
Reference<XListBox> result(insertByName(name, model), UNO_QUERY);

and an item selection listener is configured

Reference<XItemListener> xItemListener =
static_cast<XItemListener*>(&listener);
...
result->addItemListener(xItemListener);

then the listener will be called both when a selection is made and also when a
second selection is made or the first is unmade by, for example, clicking on a
previously selected item with the control key pressed.  When nothing is
selected (or maybe more than one item is selected) the usual procedure is to
indicate that item -1 is selected.  Instead, item 65535 is selected.

Somewhere in the OpenOffice code a sal_Int16 value of -1 is being converted to
a sal_Int32 value in the wrong way.  As a result, the listener's code needs a
work-around similar to this:

void onListSelected(int id, sal_Int32 selected) {
    bool hide = selected < 0 || selected == 65535;
...

It would be good to track that down and fix it.

This behavior has been observed for both Windows 7 and Fedora Linux64, but I
think the problem is probably more general.

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

Reply via email to