Bug 47474 - missing "ParentWindow" property on XUIElementFactory::createUIElement API
Summary: missing "ParentWindow" property on XUIElementFactory::createUIElement API
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: framework (show other bugs)
Version:
(earliest affected)
3.5.1 release
Hardware: x86 (IA32) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-18 08:50 UTC by Filippo Maguolo
Modified: 2016-09-19 16:48 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Filippo Maguolo 2012-03-18 08:50:49 UTC
Implementation of XUIElementFactory Java UNO API component
provide only "Frame" property but not "ParentWindow" (instead OpenOffice that works correctly).

Sample code:

public XUIElement createUIElement(String url, PropertyValue[] properties) 
     throws NoSuchElementException, IllegalArgumentException 
{

        try {
            if (!url.startsWith("private:resource/toolpanel/com.example.xtoolpanel")) {
                throw new NoSuchElementException(url);
            }

            // retrieve the parent window and frame
            XWindow xParentWindow = null;
            XFrame frame = null;
            for (int i = 0; i < properties.length; i++) {
                PropertyValue propertyValue = properties[i];
                
                if (propertyValue.Name.equals("ParentWindow")) {
                    xParentWindow = UnoRuntime.queryInterface(XWindow.class, propertyValue.Value);
                    break;
                } else if (propertyValue.Name.equals("Frame")) {
                    frame = UnoRuntime.queryInterface(XFrame.class, propertyValue.Value);
                    break;
                }
            }

            if (xParentWindow == null) {
                throw new IllegalArgumentException("No parent window or frame provided in the creation arguments. Cannot create tool panel.");
            }

            /// create the panel
            XUIElement xUIElement = new AddInPanel(m_xContext, frame, xParentWindow);
            return xUIElement;

        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return null;
}
Comment 1 Robinson Tryon (qubit) 2013-11-18 19:10:35 UTC
Stephan, Michael - Advice here?
Comment 2 Michael Stahl (allotropia) 2013-11-18 21:11:48 UTC
is the problem that there is no "ParentWindow" property in "properties"
or is there one and it is 0?

there's a whole bunch of places calling createUIElement, and i wonder which
of these would be the culprit...

framework/source/layoutmanager/layoutmanager.cxx:        xUIElement = m_xUIEleme
ntFactoryManager->createUIElement( aName, aPropSeq );
framework/source/layoutmanager/toolbarlayoutmanager.cxx:            xUIElement =
 xUIElementFactory->createUIElement( aAddonToolBarName, aPropSeq );
framework/source/layoutmanager/toolbarlayoutmanager.cxx:            xUIElement =
 xUIElementFactory->createUIElement( aName, aPropSeq );
framework/source/uifactory/uielementfactorymanager.cxx:            return xUIEle
mentFactory->createUIElement( ResourceURL, Args );
sfx2/source/dialog/taskpane.cxx:                xFactory->createUIElement( m_sResourceURL, aCreationArgs.getPropertyValues() ),
sfx2/source/sidebar/SidebarController.cxx:            xUIElementFactory->createUIElement(
sfx2/source/toolbox/tbxitem.cxx:            xUIElement = xUIElementFactory->createUIElement( rSubToolBarResName, aPropSeq );


... so these do not even attempt to add a "ParentWindow":

ToolbarLayoutManager::implts_createAddonsToolBars
ToolbarLayoutManager::implts_createElement
LayoutManager::implts_createElement
SfxToolBoxControl::createAndPositionSubToolBar
Comment 3 Caolán McNamara 2013-11-21 15:09:53 UTC
I sort of suspect that this is something based on one of the sdk examples. e.g. sdk/examples/python/toolpanel and so its probably the sfx2/source/dialog/taskpane.cxx thing (maybe)

But I'm not sure how that toolpanel example is supposed to work, i.e. if I build it and install it in LibreOffice 4.1 or Apache OpenOffice 4.1 then I don't see any UI thing to view that example.

I think we need something we can reproduce the reported problem with and info as to what version of OpenOffice it does work in
Comment 4 QA Administrators 2014-06-01 21:30:12 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2014-07-08 17:17:56 UTC Comment hidden (obsolete)
Comment 6 Robinson Tryon (qubit) 2015-12-18 10:31:15 UTC Comment hidden (obsolete)
Comment 7 Xisco Faulí 2016-09-19 16:48:10 UTC Comment hidden (obsolete)