https://bugs.freedesktop.org/show_bug.cgi?id=47474

             Bug #: 47474
           Summary: missing "ParentWindow" property on
                    XUIElementFactory::createUIElement API
    Classification: Unclassified
           Product: LibreOffice
           Version: LibO 3.5.1 Release
          Platform: x86 (IA32)
        OS/Version: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Extensions
        AssignedTo: [email protected]
        ReportedBy: [email protected]


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;
}

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to