Re: [api-dev] Programming OOo as a Groupware App

2005-07-15 Thread Andreas Schlüns

Jürgen Schmidt wrote:


Hi,

see my comments inline

Bradley Bolen wrote:


Hello.
 
I asked the following on dev@udk.openoffice.org

about programming OOo as a groupware app.  There is a
reply that I received that I pasted below as well. The
responder (btw thanks Stephan Bergmann) suggested
asking on this mailing list.
Please excuse me if I am sending this to the wrong
  list.  This seemed to be the most appropriate.  I
  am wanting to modify OpenOffice to act similar to
  Microsoft's Netmeeting.  Specifically, I would like
  to modify it so that there would be a client and a
  server.  When OO starts up it would have a dialog
  asking for an Impress file to serve which would
  also be opened as normal.  The client OO would start
up
  with a dialog that would ask for the IP address of
  a server.  The client would then get the file and
 open it up.  And finally, the user of the server
would
  be able to click through the Impress document and
the
  change of slides would also occur on the client.

  My basic question boils down to, is this possible
  using UNO or will I need to change the base code?



yes, in general i would say it should be possible when you only allow 
read only access to the document. Everything else needs probably more 
changes in several places.
A further important point is that server and client have the same access 
rights to the document.


There may be exists another solution, where it's not required to share 
folders over the directory or install a complex infrastructure like 
ftp/http server. But you have to implement some helper may be ...


You can use the api to make a copy of the open document (opened on the 
server readonly or readwrite). You should connect your client to the 
remote server office using UNO. Then try to locate the document you need 
and call XStorable.storeToURL() there. Use private:stream as URL and 
a parameter OutputStream from type XOutputStream. Doing so you 
should be able to retrieve a copy of the open document from the server 
and save it on your local machine. Afterwards you can use the stream 
implementation too, to open the document on your local machine. Of 
course the same stream implementation must provide an XInputStream 
interface too. The interface method 
XComponentLoader.loadComponentFromURL() of the Desktop instance is your 
friend then.





  Specifically, is it possible to instantiate some
  object when OOo starts so that my dialog would pop



a job add-on is exactly what you need here


  up first and then I could return control to OOo is
  the user decided not to use the server or start up
  the server otherwise?  From what I understand from
the SDK, UNO provides the ability to get the remote
  document fairly easily.  I can then intercept any
  keystrokes and mouse-clicks on the client so to
  prevent the client user from moving around during
  the presentation.  I can use urp to get messages
  from the server about mouse-clicks so that the
  client will change slides when the server does. 



Everything you can control via API locally can be controlled remotely as 
well. I expect that you can attach a listener for this kind of changes 
but i am not 100% sure at the moment.


But the problem is that you must implement every set of functionality 
explicitly. There is no generic way as e.g. intercepting mouse events 
and transport it to the client. The reason for that: not every action 
which is done by the user on the server can be intercepted at one 
central place. And further not all functions can be reached via API.





  Are these valid ideas?  Am I completely off?  I have
  spent the past 3 or 4 weeks reading through the SDK
  trying to grasp all of the concepts.  However, I
  would like to try to avoid any unneccessary work by
  going down a path that is completely wrong.  From   what I 
understand from the SDK, I can do most of the


  above using UNO but the opening dialog is what I am   not sure 
about. I have looked at OOoBasic, but I

  really do not understand what is going on there yet.

  If it is possible to program this dialog, is it   possible to do 
this with C++?  Java is not my forte

  but seems to be what most of the documents in the
SDK
  use and it may be better if I go that route.



C++ can be used in the same way as Java. Java has the advantage that it 
will run on all supported platforms where as your C++ solution needs to 
be rebuild for each platform with the appropriate compiler.
For the dialog you can use the com.sun.star.awt toolkit which is of 
course not the easiest task (it lacks of functionality, completeness, 
...). But it is also possible to use a Basic dialog and combine this 
Basic dialog + some Basic macros with your C++ or Java UNO component. 
You can trigger your own UNO component easily from Basic.
Or you use Java for the dialog and implement everything in Java with the 
disadvantage of a different look and fell because your Java dialog would 
look a little bit different as the 

[api-dev] Runtime problems when using IntrospectionReflection via Java ...

2005-07-15 Thread Rony G. Flatscher




Hi there,

since a few hours, "all of a sudden" it has not been possible anymore
to successfully use [com.sun.star.lang.XMultiComponentFactory]
(supplying a context) or [com.sun.star.lang.XMultiServiceFactory] to
instantiate "com.sun.star.beans.Introspection" and/or
"com.sun.star.reflection.CoreReflection".

This worked and I was able to use XIntrospection and XIdlReflection to
analyze UNO objects at runtime. Then, ever since I tried to "play"
around with an empty array object (result of
"XidlReflection.getFields()") errors occurred and "all of a sudden" I
have not been able to instantiate the above two classes. 

Using a XMultiComponentFactory to create an instance yields the
following error message: 
"method invocation failed:
java.lang.reflect.InvocationTargetException target exception:
com.sun.star.uno.Exception: Query for service factory for
com.sun.star.loader.SharedLibrary failed."

Using a XMultiServiceFactory to create an instance yields merely null. 

---

If you have *any* hints, ideas what can cause such a behavriour, or
even more importantly, how once could solve that, I would highly
appreciate it.

Here is additional information:

  Operating system: WindowsXP, SP2,
  
  using OOo 1.1.4, English *and*
  OOo 1.9.m113.

The test programs use native Java reflection to analyze and invoke Java
UNO classes/objects. This part seems to (still) work flawlessly.

Now, for making it even easier for ooRexx (http://www.ooRexx.org) users
to use UNO, I would like to alleviate the need to explicitly request
interface objects and have that part figure out by the ooRexx support.
For that reason it is important to be able to use the
UNO-reflection/introspection part via Java.

This is what I did afterwards:

  De-installed OOo 1.9.m113, rebooted: program started to work
again on 1.1.4, then
  I re-installed OOo 1.9.m113, rebooted, program neither works with
1.1.4 (setting up the classpath to use 1.1.4 jars) nor with 1.1.9
(setting up the classpath to use the 1.1.9 jars), then
  I de-installed OOo 1.9.m113, "repaired 1.1.4", rebooted, now the
test program does not run on 1.1.4 either!

The erroneous behaviour is in all circumstances as mentioned above.

If it makes a difference: OOo uses the JRE version 1.4.1_02, whereas my
test programs use Java 1.4.1_06 (have a setup which allows me to use
arbitrarily any major Java version, i.e. 1.1, 1.2, 1.3, 1.4, 1.5).

---

So, again, would someone have any ideas, clues which could help me out?

TIA,

---rony








Re: [api-dev] Java and com.sun.star.beans.XIntrospection.inspect() ?

2005-07-15 Thread Rony G. Flatscher




Hi, 

w.r.t. my problem description with the subject "Runtime problems when
using IntrospectionReflection via Java" I also get a runtime error
with your program.

F:\work\tmp\ooo\testjava Introspect
Exception in thread "main" java.lang.NullPointerException
 at Introspect.main(Introspect.java:28)

Line # 28 is highlighted as red and bold in your original code below:

The following Java program works just fine for me:
  
  
import com.sun.star.beans.PropertyValue;
  
import com.sun.star.beans.XIntrospection;
  
import com.sun.star.beans.XIntrospectionAccess;
  
import com.sun.star.beans.XPropertySet;
  
import com.sun.star.bridge.UnoUrlResolver;
  
import com.sun.star.comp.helper.Bootstrap;
  
import com.sun.star.frame.FrameSearchFlag;
  
import com.sun.star.frame.XComponentLoader;
  
import com.sun.star.lang.XMultiComponentFactory;
  
import com.sun.star.uno.UnoRuntime;
  
import com.sun.star.uno.XComponentContext;
  
public final class Introspect {
  
 public static void main(String[] arguments) throws Exception {
  
 XMultiComponentFactory factory = (XMultiComponentFactory)
  
 UnoRuntime.queryInterface(
  
 XMultiComponentFactory.class,
  
 (UnoUrlResolver.create(
  
 Bootstrap.createInitialComponentContext(null)).
  
 resolve(
  
 "uno:socket,host=127.0.0.1,port=12345;urp;"
  
 + "StarOffice.ServiceManager")));
  
 XComponentContext context = (XComponentContext)
  
 UnoRuntime.queryInterface(
  
 XComponentContext.class,
  
 (((XPropertySet) UnoRuntime.queryInterface(
  
 XPropertySet.class, factory)).
  
 getPropertyValue("DefaultContext")));
  
 XIntrospectionAccess access =
  
 ((XIntrospection) UnoRuntime.queryInterface(
  
 XIntrospection.class,
  
 factory.createInstanceWithContext(
  
 "com.sun.star.beans.Introspection", context))).
  
 inspect(
  
 (((XComponentLoader) UnoRuntime.queryInterface(
  
 XComponentLoader.class,
  
 factory.createInstanceWithContext(
  
 "com.sun.star.frame.Desktop", context))).
  
 loadComponentFromURL(
  
 "private:factory/scalc", "_blank",
  
 FrameSearchFlag.CREATE, new PropertyValue[0])));
  
 System.exit(0);
  
 }
  
 private Introspect() {}
  
}
  

So it is affected as well (does not work anymore).

In the meantime I have de-installed all OpenOffices (1.1.4, 1.9),
deleted all remainders of these installations in the file-system, tried
to find traces in the Windows registry and deleted them. 

Then - after reboots - I re-installed OOo 1.9 only, but to no avail. 

Are there any registry-entries which might affect this behaviour that
have keys other than "OpenOffice" or "soffice" ? Or could it be, that
some cache is being used that contains erroneous data?

Regards,

---rony







[api-dev] How to use th PathSettings service

2005-07-15 Thread Ennio-Sr
Hi all,
I'm trying to set up a macro to change the default _MyDocuments_ dir.
Found a good example in Andrew Pitonyak macro.sxc (sublisting 5.76 by
Paolo Mantovani) but cannot fully understand  what happens:

I open a .sxc file in ~/OO_files/dir1 and save in it a macro which
simply calls the two functions found in Andrew's sublisting 5.76 after
defining sNewDir=file:///~/OO_files/dir2.
After running the macro I can see that _MyDocuments_ dir (as seen with
Tools - Options - OO.org/Paths) correctly shows dir2 as _MyDocuments_
directory. However, if I do: File/Open, the old dir1 is shown in the
selection box: I would expect this to be now positioned on 'dir2' (as I
think to have read in the relative Help).

Could somebody explain why?

Thanks for your attention.
Ennio.

-- 
[Perche' usare Win$ozz (dico io) se ...anche uno sciocco sa farlo.   \\?//
 Fa' qualche cosa di cui non sei capace!  (diceva Henry Miller) ](°|°)
[Why use Win$ozz (I say) if ... even a fool can do that.  )=(
 Do something you aren't good at! (as Henry Miller used to say) ]

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



Re: [api-dev] Java and com.sun.star.beans.XIntrospection.inspect() ?

2005-07-15 Thread Rony G. Flatscher




Christian Junker wrote:

  Just a remark:
Why do you delete registry keys manually (messy messy thing to do!)?
I recommend something like Registry Mechanic or any other
registry-cleaner, that works.
  

Well, I expected originally, that the de-install would take care of all
registry entries the install created. So I was a little bit surprised
that some entries "survived" the OOo de-installation while searching
for leftovers in the registry and deleted those that I knew didn't
cause any side-effects. 

Will look into registry cleaners.

But there must be a reason why the introspectionreflection Java
classes get "spoiled" such that they cannot be instantiated anymore,
even after one de-installs OOo and reboots, re-installs OOo, reboots
and tries to run the test programs that used to run. Finding out the
reason will allow solving the problem once and forever.

Regards,

---rony



  

2005/7/15, Rony G. Flatscher [EMAIL PROTECTED]:
  
  
 Hi, 
 
 w.r.t. my problem description with the subject "Runtime problems when using
IntrospectionReflection via Java" I also get a runtime error with your
program.
 
[...]