[api-dev] Re: OLE Bridge - Strange exception

2008-11-17 Thread Carlos Rocha

Hi Joachim Lingner,

Could you strip down your program so that it still runs and the error 
can still be reproduced?


You mean make it as small as possible? yes I can, but it's an ActiveX 
(OCX) wrapper so it needs a client, and it uses another wrapper (COM) 
that allows me to embed OOo in a form. But all the stuff is done in the 
OCX wrapper.
If your idea is to test the smallest sample possible that reproduces the 
error I can get it (that's what I have at the momment), but it needs a 
client to call it, and I don't know how to make one with VB yet :(


Some more info:

1. I'm unable to close the document (or the frame). After forcing a 
dispose hasMoreComponents is still true, and if I create a new document 
after that, it is created without margins or the frame(?) (that allows 
us to write on it), but the interception still works, so I think that 
something inside the dispatch process is preventing the document (or the 
Frame) to close.


2. I tried to register a CloseListener with both the Document OR the 
Frame. If with the document, oDocument.close(true) doesn't throw a 
CloseVetoException if the CloseListener is removed inside queryClosing 
(but it doesn't close), but with the Frame CloseVetoException is thrown 
either way.


So, believing that nothing is wrong with the interception OOo core, I 
think I only need to know something more about what to do before 
releasing the Interception (or during the Interception self work - 
StatusListener, FeatureStateEvent,...)


Thank you for your time
Carlos


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



[api-dev] Re: OLE Bridge - Strange exception

2008-11-13 Thread Carlos Rocha

Hi Joachim,

Thanks for the reply.

Maybe the implmentation of XDispatchProviderInterceptor is faulty. I 
assume that you implemented it VB. In case you have not already have a 
look at


http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Objects_with_UNO_Interfaces 


Here is my implementation. The Interceptor registration is accepted and 
it works as expected, intercepting de URL commands I want. But I'm 
unable to release the Interceptor before closing the document.


'--- Declarations
Option Explicit

Private oMaster As Object, oSlave As Object
Private interfaces(0) As String

' XDispatchProviderInterception

Public Property Get Bridge_implementedInterfaces() As Variant
Bridge_implementedInterfaces = interfaces
End Property
'---
Private Sub Class_Initialize()
interfaces(0) = "com.sun.star.frame.XDispatchProviderInterceptor"
End Sub
'---
Public Function queryDispatch(URL, TargetFrameName, SearchFlags)
Select Case URL.complete
Case ".uno:SaveAs", ".uno:Save", ".uno:CloseWin", ".uno:CloseDoc", 
".uno:Quit"

Set queryDispatch = New XDispatch
Case Else
Set queryDispatch = oSlave.queryDispatch(URL, TargetFrameName, 
SearchFlags)

End Select
End Function
'---
Public Function queryDispatches(mDispatches)
'queryDispatches = mDispatches()
End Function
'---
Public Property Get getSlaveDispatchProvider()
Set getSlaveDispatchProvider = oSlave
End Property
'---
Public Sub setSlaveDispatchProvider(oSlaveDispatchProvider)
Set oSlave = oSlaveDispatchProvider
End Sub
'---
Public Property Get getMasterDispatchProvider()
Set getMasterDispatchProvider = oMaster
End Property
'---
Public Sub setMasterDispatchProvider(oMasterDispatchProvider)
Set oMaster = oMasterDispatchProvider
End Sub
'- End XDispatchProviderInterceptor


Carlos Rocha wrote:



Hi,

Using VB with Automation Bridge.

The folowing code raises an exception when calling 
"releaseDispatchProviderInterceptor". Everything else works fine, 
including the interception, but I'm unable to release it before 
closing the document.


//--
Set oXDispatchProviderInterceptor = New XDispatchProviderInterceptor




oFrame.registerDispatchProviderInterceptor oXDispatchProviderInterceptor
oFrame.releaseDispatchProviderInterceptor oXDispatchProviderInterceptor
//--

The error message is: (in case I can't attach the image)

/
Runtime error '1001':

com.sun.star.uno.RuntimeException: [automation bridge] unexpected 
exception in IUnknownWrapper_Impl::Invoke !!

/

What does this mean? anything wrong with oXDispatchProviderInterceptor 
object?





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



[api-dev] OLE Bridge - Strange exception

2008-11-12 Thread Carlos Rocha

Hi,

Using VB with Automation Bridge.

The folowing code raises an exception when calling 
"releaseDispatchProviderInterceptor". Everything else works fine, 
including the interception, but I'm unable to release it before closing 
the document.


//--
Set oXDispatchProviderInterceptor = New XDispatchProviderInterceptor

oFrame.registerDispatchProviderInterceptor oXDispatchProviderInterceptor
oFrame.releaseDispatchProviderInterceptor oXDispatchProviderInterceptor
//--

The error message is: (in case I can't attach the image)

/
Runtime error '1001':

com.sun.star.uno.RuntimeException: [automation bridge] unexpected 
exception in IUnknownWrapper_Impl::Invoke !!

/

What does this mean? anything wrong with oXDispatchProviderInterceptor 
object?


Thanks,
Carlos

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

[api-dev] Re: Intercepting commands ".uno.xxx..."

2008-11-09 Thread Carlos Rocha

Hi Andreas,

If you call registerDispatchProviderInterceptor() the framework will 
call setMasterDispatchProvider() and setSlaveDispatchProvider().

Do nothing there excepting caching those two dispatch objects.
 From this point your interceptor is part of the double-linked 
interceptor chain.


Note: NULL will be a valid parameter for those master/slave dispatch 
objects provided to you. Such null value will happen in case you 
deregister your interceptor ... and the framework creates a new chain 
without you ...


If you want to handle the request return "this" or any other suitable 
instance (e.g. a helper object) ... if not forward the request to your 
slave dispatch ! Master dispatch can be ignored. I've never seen a use 
case where it was rely needed .-)




I got it partially working by defining my own 
XDispatchProviderInterception and XDispatch. I can catch ".uno.Save" or 
".uno.SaveAs" in my XDispatch, but not ".uno.CloseWin" or 
".uno:CloseDoc". I wonder why, because I'm sure I return my own 
XDispacth for these commands in queryDispatch(). I'm getting a GPF when 
closing OOo but I believe I can address that.


I adapted Paolo sample to VB, but there is a thing that concernes me, 
and it seems you are the right person to clarify me why:


Paolo uses the same Dispatch object for every command he wants to catch, 
but if I do that a strange exception is raised when I move the mouse 
over the toolbar. By creating a new Dispatch for each command it works, 
thought they are all the same. Is this the right procedure, an 
independent Dispatch object for each command?


Also, during queryDispatch processing, right after 
registerDispatcherProviderInterceptor(), every command URL is called 
more than once, which means that I'm creating more than a XDispatch 
object for every command, and when popping up a menu (e.g the File menu) 
another XDispatch is created for every command entry in that menu.


My (initial) doubts are:

1. When exactly should the Interception be registered? (before loading a 
document, after loading it, ...)


2. Do I realy need a new XDispatch object for every command I want to 
catch, even if they are "equal" (the only thing I do in my XDispatch is 
to raise an event for my use)?


3. Why can't I catch ".uno:CloseWin" or ".uno.CloseDoc" (among others)? 
do I need to register th Interceptor somewhere else?


4. When calling e.g. "uno.Save" directly (without user interaction) the 
Interception doesn't work. Is this the intended behaviour?


Thanks a lot,
Carlos


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



[api-dev] Re: Intercepting commands ".uno.xxx..."

2008-11-04 Thread Carlos Rocha

Hello Paolo,

Why not? You can register your own dispatch-interceptor in Starbasic and 
you can even define your custom dispatches in order to react to user 
actions




It's a lot more complicated than I thought but now I know how to do it. 
Thanks.
The interception works fine, but it should restore the default dispatch 
mechanism before closing the document with it turned on ;)


Cheers
Carlos

PS: your sample would help many people to understand the dispatch 
interception. It worth a place in the snipets database :)



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



[api-dev] Re: Intercepting commands ".uno.xxx..."

2008-11-02 Thread Carlos Rocha

(I'm using Automation Bridge to communicate with OOo)

After reading again all the stuff and trying to digest the java sample, 
this is what I conluded:


I need to implement my own "DispatchProvider" as a COM object an pass it 
as a parameter to "registerDispatchProviderInterceptor", in the same way 
I do to register listeners, am I right? (is this the reason why Ariel 
said this can't be achieved with Basic?)


Then (e.g. using VB) I must define the dispatch() method to be called by 
OOo and react accordingly to the URL - let's say, if I want to handle 
".uno:SaveAs" myself I must return null, or else I must return...what?


Sorry, I'm lost


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



[api-dev] Re: Intercepting commands ".uno.xxx..."

2008-10-31 Thread Carlos Rocha
Thank you both for your advises. I will then take the command 
interception way.


@Ariel, I'm aware of the pages at wiki.services regarding Interception, 
and I think I understood what's in there. The link to the svn sample 
will be useful tho, but it's java. I was hoping on something more 
"readable", for dummies :)


@Carsten, so the PDF version of Developer's Guide is more complete than 
the one that came with the SDK_3.0? coudn't find it anywhere (thought I 
have the 2.4 pdf version from Dec 2007).



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



[api-dev] Intercepting commands ".uno.xxx..."

2008-10-30 Thread Carlos Rocha

Hi,

I'm embbeding OOo in a Win32 application and I need to catch some user 
intentions, like Save or Close the Document.


I'm unable to use XMenuListener (issue #94057) and don't know when (or 
if) XMenuExtended2 interface proposed by Ariel Constenla Haile will be 
available. And I'm not sure if this new interface would solve my needs.


Anyway, I think the safer way is to catch URL commands (.uno.xxx...) 
using Interception, but after a few days googling and searching I 
couldn't find out how to implement it.
I think I need a small pseudo-code or Basic sample with the required 
steps :(


Thank you


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



Re: [api-dev] Select function in XMenuListener is a reserved word

2008-10-01 Thread Carlos Rocha

Hi,

Do I have a way to know IF/HOW/WHEN this issue will be solved?
This is a show stopper for me, and I must decide whether or not I need 
an alternative way.


Thanks,
Carlos


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



Re: [api-dev] Select function in XMenuListener is a reserved word

2008-09-19 Thread Carlos Rocha

Hello Juergen,

Thank you.


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



Re: [api-dev] Select function in XMenuListener is a reserved word

2008-09-19 Thread Carlos Rocha

Hi Bernard, thx for the reply

Well, I'm not a VB expert, I only use it to simplify things hard to 
achieve in my environment, but I don't think your suggestion could solve 
it. I need to declare a method with the name "select" but VB6 doesn't 
allow it.
But thanks anyway, I just learned one more thing that might be useful in 
the future :)


Did you try the CallByName function of VBA ?

CallByName oMenuListener, "select", vbMethod, oMenuEvent




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



Re: [api-dev] Select function in XMenuListener is a reserved word

2008-09-18 Thread Carlos Rocha

Sorry, this duplicates issue 94057


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



[api-dev] Select function in XMenuListener is a reserved word

2008-09-18 Thread Carlos Rocha

Hi,

I'm trying to make an activex wrapper in VB6 to simplify the use of 
listeners with automation bridge.


With more or less work I've been able to put them to work, but now I got 
a problem I can't solve by myself :(


The function "select" in XMenuListener is a reserved word in VB6 and it 
refuses to compile no matter how I escape it. And I need to create such 
a function to map the listener, and


If I understand well, the function name doesn't follow the naming 
convention of other listeners (eg, XActivateListener has functions like 
"windowActivate" and not simply  "activate") I'm hoping that you, 
developers, can follow the same convention with XMenuListener by 
renaming the functions to "itemSelect", "itemActivate" and 
"itemDeactivate", if not too much trouble - or possible at all.


Thanks,
Carlos

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



[api-dev] Re: Automation doubts

2008-05-23 Thread Carlos Rocha

Doesn't work.

PathSettings("UIConfig", "file:///C:/MyConfig") just adds the new path 
to the old path, and is persistent. Now I must find how to remove it.


So, in the absence of more advises, it seems that I have to do this the 
hard way, by removing menu commands, adding menu commands, changing menu 
commands, for every open document, though it's hard to believe that such 
a powerful API (it is) can't handle this kind of things for us, poor 
integrators-trying-to-get-rid-of-MS :(


Thanks anyway


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



[api-dev] Re: Automation doubts

2008-05-22 Thread Carlos Rocha
well that is correct. But try it out. Set the environment variable 
UserInstallation and start your process from where you access the 
office. I assume that you will create if necessary a second office 
process with the new user installation. You can easy check it if you 
first start the office normally and then your own process.
But of course i am only guessing and haven't time to check it on my own. 
 Maybe it behaves different when OLE is involved.




Changing the UserInstallation environment variable before starting OO 
from my app works but I got an error (my fault for sure). But if the 
office is already open the UserInstallation variable is ignored.


I'll try to figure out how to use css.util.PathSettings to dynamicaly 
point to another configuration set, but I was hoping to ear you say "go 
ahead with that PathSettings thing. It might do what you want" :D


Carlos


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



Re: [api-dev] Re: Automation doubts

2008-05-21 Thread Carlos Rocha


i meant a completely independent user installation that you can 
configure in the way you want or need. You can use a specific user 
installation by starting with "soffice 
-env:UserInstallation=". An environment variable 
"UserInstallation" should work as well. This User installation can you 
put where you want. Any kind of special configuration can you do there.


Sorry, maybe I'm missing something but I didn't get it. I use OLE 
Automation to execute OO, so the office path is read from windows 
registry. If I change it wouldn't it be global for any other program 
that uses OLE? Besides, I think that the call to 
CreateObject("com.sun.star.lang.ServiceManager") only opens soofice.exe 
if it's not already running.
For what is stated in the SDK docs the properties "UIConfig" and 
"UserConfig" from "com.sun.star.util.PathSettings" seems to do the job 
and they could be changed from inside my program. I Just don't know 
exactly how to use it.


Sorry for my lack of knowledgement :(
Carlos


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



[api-dev] Re: Automation doubts

2008-05-20 Thread Carlos Rocha

Thanks for your fast reply.

I want to apologize for something I might say unintentionally, but 
english is not my primary language :)
Let me start to say that I'm reading OO docs for many months now, and I 
collected lots of sample code from many sources, including this list, 
but I don't program in Java, C++, Basic, Python, VB or Delphi. Some 
samples are easily portable, tho, specially VB.


to prevent confusion with the normal office installed on your computer i 
would suggest to work with your own local user installation. But that 
means that the office that is embedded in your app might have different 
user settings than the normal office.


Yes, the idea is to have different settings, but I don't want to rely on 
a (special or not) user account. I would prefere something like 
configuration files in a different path and, by using the API, "force" 
OO to use them instead. Could "css.util.PathSettings" be used for this 
purpose? It's easy to imagine some adapted menu configuration files (for 
example, the menu "Window" is useless for me for every opened file).
Of course, dynamically hiding/creating/changing menu elements is also a 
possibility, and for what I've read is the usual way. I just don't want 
to interfere with the normal office usage.


I am not sure if it possible to control the close button, it have to be 
checked. Anyway you can always keep a hidden document in the back 
ground. That is not nice but should work.


Yes, I though about that too, but it would appear as a "ghost" document 
in the Window menu (in the normal OO). Anyway, it's only a cosmetic issue.


yes it's possible to intercept commands and do something special. You 
even hide the normal menus and toolbars and do everything on your own. 
See for example the SDK example 
DevGuide/OfficeDev/ContextMenuInterceptor.java. I am sure you can find 
more examples online.



Thank you. I'll try that.

Carlos


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



[api-dev] Automation doubts

2008-05-19 Thread Carlos Rocha

Hi

I'm embedding OO in a program and I'm able to control it thru OLE 
automation. For this purpose I created a VB activeX to create listeners, 
receive events from OO, and pass them to my app. This is not a perfect 
solution but it's working.
The next step is to adapt OO UI to de design of my app, that provides a 
tabbed interface for different documents is different contexts (text 
documents, calc documents, etc, along some others of my own).
I don't want to limit in any way the normal usage of OO. The user must 
be able to use it independently of my program and have access to all his 
power.


Now I need to decide how to achieve a few things. For a start :)

1. It's possible to get rid of the desktop close button (the small "X" 
in the top-right) when there is only one opened document (when the 
document is opened by my app)?


2. I need to "intercept" menu commands in order to desallow the defined 
action and generate an event that I can intercept and decide the action.
I need this, for example, to redirect saving orders or to create new 
documents in the respective tabbed window.


I hope that a kind expert in this group can point me in the right direction.

TY,
Carlos


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