Bug 34635 - framework::DropdownToolbarController: dispatch does not get selected item text
Summary: framework::DropdownToolbarController: dispatch does not get selected item text
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
(earliest affected)
3.3.1 RC1
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Caolán McNamara
Depends on:
Reported: 2011-02-23 10:55 UTC by Dietmar
Modified: 2011-03-21 05:06 UTC (History)
0 users

See Also:
Crash report or crash signature:
Regression By:

Test Extension making use of DropdownBox (98.56 KB, application/vnd.openofficeorg.extension)
2011-03-18 13:09 UTC, Dietmar
Sourcecode with entire Netbeans project (773.87 KB, application/x-zip-compressed)
2011-03-18 13:11 UTC, Dietmar

Note You need to log in before you can comment on or make changes to this bug.
Description Dietmar 2011-02-23 10:55:03 UTC
see bug inherited from OOo: http://www.openoffice.org/issues/show_bug.cgi?id=104788 . 

It is about 1.5 years old and inhibits extension developers (like me) from using the Dropdownbox in the toolbar.

There is only ONE line that has to be changed according to the api mailing list and that bug report is below:

Index: framework/source/uielement/dropdownboxtoolbarcontroller.cxx 
--- framework/source/uielement/dropdownboxtoolbarcontroller.cxx	(revision 274324)
+++ framework/source/uielement/dropdownboxtoolbarcontroller.cxx	(working copy)
@@ -222,7 +222,7 @@
             xDispatch = getDispatchFromCommand( m_aCommandURL );
             aCommandURL = m_aCommandURL;
             aTargetURL = getInitializedURL();
-            aSelectedText = m_pListBoxControl->GetText();
+            aSelectedText = m_pListBoxControl->GetSelectEntry();

Background info:
In an extension one can design an own toolbar, that might contain this dropdownbox.
When this value is changed the extension gets notified via a dispatch through the above procedure.
The "aSelectedText" should contain the text content of the newly selected dropdownbox item, but due to this bug just returns an empty string.
So the extension does not know which item was selected.
My current work around: using ToggleDropdownButton (not as nice in this circumstance)
Comment 1 Caolán McNamara 2011-03-09 08:35:05 UTC
Yeah, as far as I can tell m_pListBoxControl wraps a vcl ListBox which inherits from vcl Control which inherits from vcl Window and nothing under Window overrides GetText so its doesn't seem to make sense to call GetText here as that would likely always return an empty string. GetSelectEntry on the other hand would do something seemingly sensible.
Comment 2 Caolán McNamara 2011-03-09 08:44:34 UTC
That said, this code has changed a lot since the bug was reported. Do you have any demonstration code for this to test it ?, especially because I see various other GetText calls in that dir that may or may not be right.

Tentatively changed the GetText to GetSelectEntry in that file for now (3.4 onwards)
Comment 3 Dietmar 2011-03-18 13:09:37 UTC
Created attachment 44593 [details]
Test Extension making use of DropdownBox

Install the extension, run it, change the value of "Table" or "Cell", a dialogbox pops up with "value of Text" then the Text of that field embedded in ":". Currently (LO 3.3.1) its an empty string.
Comment 4 Dietmar 2011-03-18 13:11:34 UTC
Created attachment 44594 [details]
Sourcecode with entire Netbeans project

The file in question is BL_TB_ApplyToBTn.java.
Comment 5 Michael Meeks 2011-03-21 05:06:19 UTC
first builds of 3.4 are due inside a couple of weeks.