open document hidden bug?

View: New views
4 Messages — Rating Filter:   Alert me  

open document hidden bug?

by Daniel Käfer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I try to open a document hidden. Sometimes it works, the other time the
documents open visible.

My source code is:

[code]
this.xComponent = xComponentLoader.loadComponentFromURL(
            filename, // File folder and name
            "_default", // Open in existing blank frame...
            FrameSearchFlag.CREATE, // ... if none found, create one.
            this.documentProperties);    // Special document properties
[/code]

The Property 'Hidden' is alaway true (java.lang.Boolean).

If I replace '_default' with '_blank', it work perfect. Is this a bug or
a feature?

Thanks
Daniel Käfer

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: open document hidden bug?

by Carsten Driesner :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Daniel Käfer wrote:

> Hello,
>
> I try to open a document hidden. Sometimes it works, the other time the
> documents open visible.
>
> My source code is:
>
> [code]
> this.xComponent = xComponentLoader.loadComponentFromURL(
>            filename, // File folder and name
>            "_default", // Open in existing blank frame...
>            FrameSearchFlag.CREATE, // ... if none found, create one.
>            this.documentProperties);    // Special document properties
> [/code]
>
> The Property 'Hidden' is alaway true (java.lang.Boolean).
>
> If I replace '_default' with '_blank', it work perfect. Is this a bug or
> a feature?
Hi Daniel,

Could you please tell me more about the context where your code runs.
Especially when you can see that it doesn't work. Currently it looks
like a bug, but without more information this is hard to confirm. I
would like to debug your scenario, but therefore I need more information.

Regards,
Carsten

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: open document hidden bug?

by Daniel Käfer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Carsten Driesner schrieb:
> Could you please tell me more about the context where your code runs.
> Especially when you can see that it doesn't work. Currently it looks
> like a bug, but without more information this is hard to confirm. I
> would like to debug your scenario, but therefore I need more information.
Hello,

I try to open the document to fill some textfields with content.

I have pack all code in a class to demonstrate the problem (the Programm
terminate not correct). To execute the class OpenOffice must run and
listen on port 8000.

1. run it works,
2. run OpenOffice pop up.
3. run ok
4. run OpenOffice pop up
and so on.

[code]
import com.sun.star.beans.PropertyValue;
import com.sun.star.beans.XPropertySet;
import com.sun.star.bridge.UnoUrlResolver;
import com.sun.star.bridge.XUnoUrlResolver;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.frame.FrameSearchFlag;
import com.sun.star.frame.XComponentLoader;
import com.sun.star.frame.XDesktop;
import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;


public class Debug {

    XMultiComponentFactory xMCF;
    XComponentContext xComponentContext;
    String docPath = "file:///home/daniel/.twc/documents/1256202722289.sxw";

    public Debug() throws Exception {
        startOpenOffice();
        open();
    }

    public static void main(String[] args) throws Exception {
        new Debug();
    }

    private void open() throws Exception {

        PropertyValue[] properties = new PropertyValue[1];
        properties[0] = new PropertyValue();
        properties[0].Name = "Hidden";
        properties[0].Value = new Boolean(true);

        XDesktop xDesktop;
        // Get the desktop object.
            Object desktop = xMCF.createInstanceWithContext(
                    "com.sun.star.frame.Desktop", xComponentContext);
        // Get the XDesktop so you can close OpenOffice.org correctly
        xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class,
desktop);

        XComponentLoader xComponentLoader;
        xComponentLoader = (XComponentLoader)
UnoRuntime.queryInterface(XComponentLoader.class, xDesktop);

        xComponentLoader.loadComponentFromURL(
                docPath,
                "_default",
                FrameSearchFlag.CREATE,
                properties);  

    }

    private void startOpenOffice() throws Exception {
        // Create an OO Component Context
        XComponentContext xInitialComponentContext =
                Bootstrap.createInitialComponentContext(null);

        // create a connector, so that it can contact the office
        XUnoUrlResolver urlResolver =
                UnoUrlResolver.create(xInitialComponentContext);

        Object initialObject = urlResolver.resolve(
               
"uno:socket,host=127.0.0.1,port=8000;urp;StarOffice.ServiceManager");
        xMCF = (XMultiComponentFactory) UnoRuntime.queryInterface(
                XMultiComponentFactory.class, initialObject);

        // retrieve the component context as property (it is not yet
        // exported from the office). Query for the XPropertySet interface.
        XPropertySet xProperySet = (XPropertySet) UnoRuntime.queryInterface(
                XPropertySet.class, xMCF);
        // Get the default context from the office server.
        Object oDefaultContext =
xProperySet.getPropertyValue("DefaultContext");
        // Query for the interface XComponentContext.
        xComponentContext = (XComponentContext)
UnoRuntime.queryInterface(XComponentContext.class, oDefaultContext);
    }
}
[/code]

Regards,
Daniel

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: open document hidden bug?

by Mathias Bauer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Carsten Driesner wrote:

> Daniel Käfer wrote:
>> Hello,
>>
>> I try to open a document hidden. Sometimes it works, the other time the
>> documents open visible.
>>
>> My source code is:
>>
>> [code]
>> this.xComponent = xComponentLoader.loadComponentFromURL(
>>            filename, // File folder and name
>>            "_default", // Open in existing blank frame...
>>            FrameSearchFlag.CREATE, // ... if none found, create one.
>>            this.documentProperties);    // Special document properties
>> [/code]
>>
>> The Property 'Hidden' is alaway true (java.lang.Boolean).
>>
>> If I replace '_default' with '_blank', it work perfect. Is this a bug or
>> a feature?
> Hi Daniel,
>
> Could you please tell me more about the context where your code runs.
> Especially when you can see that it doesn't work. Currently it looks
> like a bug, but without more information this is hard to confirm. I
> would like to debug your scenario, but therefore I need more information.

IIRC it is by intent to ignore the "hidden" property for the "_default"
target as there are situations where it doesn't work or creates
surprising effects (like letting the current document window vanish
without a "poof" ;-)). Using "_default" puts the document window under
user control - this is not in line with the idea of a hidden window.

Perhaps we should document that.

Regards,
Mathias

--
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/GullFOSS
Please don't reply to "nospamformba@...".
I use it for the OOo lists and only rarely read other mails sent to it.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...