Hi Nicole,

Nicole Scholz escribió:
Hi!

I searched the mailing list for hiding and then showing a document but I didnt 
found a solution. I was able to hide the document but not to set it visible 
again.

I got a piece of code but I was not able to transfer it correctly so I can use 
it.

Here is my current code for setting the document visible:
xWriterDocument~XModel~getCurrentController()~XController~getFrame()~XFrame~getContainerWindow()~XWindow~setVisible(true)

Something of this code is wrong because I got the error message that the method 
setVisible is not found.


Since OOo 2.2 (?/ or so!) you can load a hidden document and then set it visible. The following OOo Basic code works:

Sub Hide_Show_Doc
        Dim oDoc as Object
        Dim aMediaDescriptor(0) as New com.sun.star.beans.PropertyValue
        
        aMediaDescriptor(0).Name = "Hidden"
        aMediaDescriptor(0).Value = TRUE
        
oDoc = StarDesktop.loadComponentFromURL("private:factory/swriter", "_default", 0, aMediaDescriptor)
        
        oDoc.getText().setString("I was hidden!")
        
        wait 10000      
        
        
oDoc.getCurrentController().getFrame().getContainerWindow().setVisible(true)
End Sub

Perhaps someone can give me an example in java which I can change.

a Java variation:

    public static void main(String[] args) {
        try {
            // get the remote office component context
            XComponentContext xContext = Bootstrap.bootstrap();

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

XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface(
                    XComponentLoader.class,
                    xContext.getServiceManager().createInstanceWithContext(
                    "com.sun.star.frame.Desktop", xContext) );

XTextDocument xTextDocument = (XTextDocument) UnoRuntime.queryInterface( XTextDocument.class, xComponentLoader.loadComponentFromURL( "private:factory/swriter", "_default", 0, aMediaDescriptor));

            xTextDocument.getText().setString("I was hidden!");

            Thread.sleep(10000);

            XController xController = xTextDocument.getCurrentController();
            XFrame xFrame = xController.getFrame();
            XWindow xContainerWindow = xFrame.getContainerWindow();

            xContainerWindow.setVisible(true);
        }
        catch (java.lang.Exception e){
            e.printStackTrace();
        }
        finally {
            System.exit( 0 );
        }
    }


Thanks Nicole
Regards
Ariel.


--
Ariel Constenla-Haile
La Plata, Argentina

[EMAIL PROTECTED]
[EMAIL PROTECTED]

http://www.ArielConstenlaHaile.com.ar/ooo/



"Aus der Kriegsschule des Lebens
                - Was mich nicht umbringt,
        macht mich härter."
                Nietzsche Götzendämmerung, Sprüche und Pfeile, 8.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to