Package com.sun.star.document

Examples of com.sun.star.document.XEventsSupplier


        xMSF = _xMSF;
    }

    public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL) {
        try {
            XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
            PropertyValue[] oEventProperties = new PropertyValue[2];
            oEventProperties[0] = new PropertyValue();
            oEventProperties[0].Name = "EventType";
            oEventProperties[0].Value = EventType; // "Service", "StarBasic"
            oEventProperties[1] = new PropertyValue();
            oEventProperties[1].Name = "Script"; //"URL";
            oEventProperties[1].Value = EventURL;
            xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
        } catch (Exception exception) {
            exception.printStackTrace(System.out);
        }
    }
View Full Code Here


                "End Sub\n";
        newLib.insertByName("all", eventHandlerCode);

        // bind the macro to the OnLoad event
        final String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
        final XEventsSupplier eventsSupplier = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class,
                databaseDoc);
        eventsSupplier.getEvents().replaceByName("OnLoad", new PropertyValue[]
                {
                    new PropertyValue("EventType", 0, "Script", PropertyState.DIRECT_VALUE),
                    new PropertyValue("Script", 0, macroURI, PropertyState.DIRECT_VALUE)
                });
View Full Code Here

    public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL)
    {
        try
        {
            XEventsSupplier xEventsSuppl = UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
            PropertyValue[] oEventProperties = new PropertyValue[2];
            oEventProperties[0] = new PropertyValue();
            oEventProperties[0].Name = "EventType";
            oEventProperties[0].Value = EventType; // "Service", "StarBasic"
            oEventProperties[1] = new PropertyValue();
            oEventProperties[1].Name = "Script"; //PropertyNames.URL;
            oEventProperties[1].Value = EventURL;
            xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
        }
        catch (Exception exception)
        {
            exception.printStackTrace(System.out);
        }
View Full Code Here

        // same as above: The script didn't close the context, but the OOo framework should have
        assertEquals( "undo context was not auto-closed as expected", 0, m_undoListener.getCurrentUndoContextDepth() );

        // .............................................................................................................
        // scenario 3: assigning the script to some document event, and triggering this event
        final XEventsSupplier eventSupplier = UnoRuntime.queryInterface( XEventsSupplier.class, m_currentDocument.getDocument() );
        final XNameReplace events = UnoRuntime.queryInterface( XNameReplace.class, eventSupplier.getEvents() );
        final NamedValue[] scriptDescriptor = new NamedValue[] {
            new NamedValue( "EventType", "Script" ),
            new NamedValue( "Script", scriptURI )
        };
        events.replaceByName( "OnViewCreated", scriptDescriptor );
View Full Code Here

        XModel databaseDoc = impl_createDocWithMacro( libName, moduleName, eventHandlerCode );
        final String documentURL = databaseDoc.getURL();

        // bind the macro to the OnLoad event
        final String macroURI = "vnd.sun.star.script:" + libName + "." + moduleName + ".OnLoad?language=Basic&location=document";
        final XEventsSupplier eventsSupplier = UnoRuntime.queryInterface(XEventsSupplier.class, databaseDoc);
        eventsSupplier.getEvents().replaceByName("OnLoad", new PropertyValue[]
                {
                    new PropertyValue("EventType", 0, "Script", PropertyState.DIRECT_VALUE),
                    new PropertyValue("Script", 0, macroURI, PropertyState.DIRECT_VALUE)
                });
View Full Code Here

    public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL)
    {
        try
        {
            XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
            PropertyValue[] oEventProperties = new PropertyValue[2];
            oEventProperties[0] = new PropertyValue();
            oEventProperties[0].Name = "EventType";
            oEventProperties[0].Value = EventType; // "Service", "StarBasic"
            oEventProperties[1] = new PropertyValue();
            oEventProperties[1].Name = "Script"; //"URL";
            oEventProperties[1].Value = EventURL;
            xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
        }
        catch (Exception exception)
        {
            exception.printStackTrace(System.out);
        }
View Full Code Here

                "End Sub\n";
        newLib.insertByName("all", eventHandlerCode);

        // bind the macro to the OnLoad event
        final String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
        final XEventsSupplier eventsSupplier = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class,
                databaseDoc);
        eventsSupplier.getEvents().replaceByName("OnLoad", new PropertyValue[]
                {
                    new PropertyValue("EventType", 0, "Script", PropertyState.DIRECT_VALUE),
                    new PropertyValue("Script", 0, macroURI, PropertyState.DIRECT_VALUE)
                });
View Full Code Here

            "End Sub\n";
        newLib.insertByName( "all", eventHandlerCode );

        // bind the macro to the OnLoad event
        String macroURI = "vnd.sun.star.script:EventHandlers.all.OnLoad?language=Basic&location=document";
        XEventsSupplier eventsSupplier = (XEventsSupplier)UnoRuntime.queryInterface( XEventsSupplier.class,
            databaseDoc );
        eventsSupplier.getEvents().replaceByName( "OnLoad", new PropertyValue[] {
            new PropertyValue( "EventType", 0, "Script", PropertyState.DIRECT_VALUE ),
            new PropertyValue( "Script", 0, macroURI, PropertyState.DIRECT_VALUE )
        } );

        // store the document, and close it
View Full Code Here

    public static void attachEventCall(XComponent xComponent, String EventName, String EventType, String EventURL)
    {
        try
        {
            XEventsSupplier xEventsSuppl = (XEventsSupplier) UnoRuntime.queryInterface(XEventsSupplier.class, xComponent);
            PropertyValue[] oEventProperties = new PropertyValue[2];
            oEventProperties[0] = new PropertyValue();
            oEventProperties[0].Name = "EventType";
            oEventProperties[0].Value = EventType; // "Service", "StarBasic"
            oEventProperties[1] = new PropertyValue();
            oEventProperties[1].Name = "Script"; //"URL";
            oEventProperties[1].Value = EventURL;
            xEventsSuppl.getEvents().replaceByName(EventName, oEventProperties);
        }
        catch (Exception exception)
        {
            exception.printStackTrace(System.out);
        }
View Full Code Here

        // same as above: The script didn't close the context, but the OOo framework should have
        assertEquals( "undo context was not auto-closed as expected", 0, m_undoListener.getCurrentUndoContextDepth() );

        // .............................................................................................................
        // scenario 3: assigning the script to some document event, and triggering this event
        final XEventsSupplier eventSupplier = UnoRuntime.queryInterface( XEventsSupplier.class, m_currentDocument.getDocument() );
        final XNameReplace events = UnoRuntime.queryInterface( XNameReplace.class, eventSupplier.getEvents() );
        final NamedValue[] scriptDescriptor = new NamedValue[] {
            new NamedValue( "EventType", "Script" ),
            new NamedValue( "Script", scriptURI )
        };
        events.replaceByName( "OnViewCreated", scriptDescriptor );
View Full Code Here

TOP

Related Classes of com.sun.star.document.XEventsSupplier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.