Mikhail Voitenko schrieb:
Hi Marten,

As Mathias has written it would really help if you provide the code snippet related to parameters generation of the call. There is currently no known problem in this area, thus the scenario you are using should have a specific that let the problem be reproducible. And to detect what goes wrong we need a possibility to reproduce the problem.


Ok, here is the Smalltalk code I execute. The smallest code I can execute on the Smalltalk
side to get the error is:

| writerDocument |
        
writerDocument := aMSKOO desktop
                loadComponentFromURL: 'file:///c:\test.odt' "<string>"
                TargetFrameName: '_blank' "<string>"
                SearchFlags: 0 "<long>"
                Arguments: Array new.

This code returns a valid OLE object (and opens a document), but the document is read-only. The file is indeed opened readonly - because not "lock" files are shown in this directory and I can open the file without problems via OpenOffice-application.

I could change the code to:

| writerDocument |
        
writerDocument := aMSKOO desktop
                loadComponentFromURL: 'file:///c:|test.odt' "<string>"
                TargetFrameName: '_blank' "<string>"
                SearchFlags: 0 "<long>"
                Arguments: Array new.

and I get an exception with content "com.sun.star.lang.IllegalArgumentException: URL seems to be an unsupported one."

This shows, that the stuff is at least something doing.

Then I changed the code to actually use parameters: In this document I used the attribute 
"Hidden"
and I set it to true and this also worked very well. I get a valid OLE object 
back and the file seems
to be opened readonly but hidden:

        | writerDocument aProperty  |
        
        aProperty := OOBeansPropertyValue ooNew: aMSKOO.
        aProperty
                name: 'Hidden' ;
                value: true.
                                
writerDocument := aMSKOO desktop
                        loadComponentFromURL: 'file:///c:\test.odt' "<string>"
                        TargetFrameName: '_blank' "<string>"
                        SearchFlags: 0 "<long>"
                        Arguments: (Array with: aProperty).
                        
        ^writerDocument

To verify that the boolean parameters are evaluated I change the last code to:

        | writerDocument aProperty  |
        
        aProperty := OOBeansPropertyValue ooNew: aMSKOO.
        aProperty
                name: 'Hidden' ;
                value: false.
                                
writerDocument := aMSKOO desktop
                        loadComponentFromURL: 'file:///c:\test.odt' "<string>"
                        TargetFrameName: '_blank' "<string>"
                        SearchFlags: 0 "<long>"
                        Arguments: (Array with: aProperty).
                        
        ^writerDocument

and the document is opened visible again (readonly). Then I change the code 
(now we are coming to the ReadOnly
attribute) to:

        | writerDocument aProperty  |
        
        aProperty := OOBeansPropertyValue ooNew: aMSKOO.
        aProperty
                name: 'READONLY' ;
                value: false.
                                
writerDocument := aMSKOO desktop
                        loadComponentFromURL: 'file:///c:\test.odt' "<string>"
                        TargetFrameName: '_blank' "<string>"
                        SearchFlags: 0 "<long>"
                        Arguments: (Array with: aProperty).
                        
        ^writerDocument

and the document is again opened visible readonly. The system does not 
recognize the 'READONLY' parameter - fine.Therefore
I change it to:

        | writerDocument aProperty  |
        
        aProperty := OOBeansPropertyValue ooNew: aMSKOO.
        aProperty
                name: 'ReadOnly' ;
                value: false.
                                
writerDocument := aMSKOO desktop
                        loadComponentFromURL: 'file:///c:\test.odt' "<string>"
                        TargetFrameName: '_blank' "<string>"
                        SearchFlags: 0 "<long>"
                        Arguments: (Array with: aProperty).
                        
        ^writerDocument

On the lowest level side i get an object

*OSVariantarg {
vt: 13
wReserved1: 0
wReserved2: 0
wReserved3: 0
}

which is an pointer to an OSVariantarg structure. The "13" means VtUnknown. If I change the code to

        | writerDocument aProperty  |
        
        aProperty := OOBeansPropertyValue ooNew: aMSKOO.
        aProperty
                name: 'ReadOnly' ;
                value: true
                                
writerDocument := aMSKOO desktop
                        loadComponentFromURL: 'file:///c:\test.odt' "<string>"
                        TargetFrameName: '_blank' "<string>"
                        SearchFlags: 0 "<long>"
                        Arguments: (Array with: aProperty).
                        
        ^writerDocument

I get the document opened readonly visible.
I can open a Vorlage (template) (*.ott) without problems, but opening scalc 
files results into the same error.

All the code above runs against OpenOffice 2.4.x without problems. Everything 
works as expected. This API calls
breaks with 3.0.0 on my system and I have no idea, what is going wrong here.

By the way - I created more or less 3000 Smalltalk classes for my OpenOffice framework in Smalltalk just be executing OLE stuff against OO 3.0.0 again and again and I never had any problems - but this API call does not work any more with 3.0.0.

I know its Smalltalk, I know there might be some low level stuff problems in my OLE framework of the product I use - but my best excusement is, that the code worked with 2.4.x without problems.

Marten













---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org

Reply via email to