Re: [api-dev] multiple-inheritance interafces and method name clashes

2005-10-20 Thread Stephan Bergmann

Rony G. Flatscher wrote:



... cut ...

Just curious: how do you write down in ooRexx calls to method bar 
on an object that implements the two interfaces


  module m1 { interface XFoo { void bar(); }; };
  module m2 { interface XFoo { void baz(); }; };


Hmm, good question.

Could you please hint how you would do that in Java (pseudo-code 
suffices, ie. without casting)? Reason being, that whatever can be 
done via Java can be done in ooRexx (using a very relaxed, almost 
pseudo-code like syntax).


In Java:

  import m1.XFoo; // the key to using short, unambiguous XFoo 
later on

  ...
  Object o = ...;
  XFoo foo = (XFoo) UnoRuntime.queryInterface(XFoo.class, o);

  foo.bar(); 


Oh, o.k., then this is how you would do it in ooRexx:

o~XFoo~bar


The point I tried to make is that in

  o~XFoo~bar

XFoo is ambiguous (it could denote either m1.XFoo or m2.XFoo), and I 
was wondering how you solve that.


Well, as ooRexx uses Java (instead of C++) for the bridging, the 
solution would be the same as for Java. Or could object o have two 
different interfaces by the same name? If so, then it would be possible 
to explicitly query the interface supplying the class object for the 
respective interface, like you show in your example (except, I would 
then explicitly use m1.XFoo.class and m2.XFoo.class in queryInterface() 
instead)..


Originally, I had thought of something like:

o~m1~XFoo~bar 


or maybe:

o~m1.XFoo~bar

[this way being able to unambiguously resolve the interface by choosing 
resp. qualifying its name with the module-name making it distinguishable 
from m2.XFoo]


You are thus stuck with the same fragility problem as OOo Basic and 
PyUNO:  As in general you cannot know statically whether a given object 
(referenced by o) only implements one m_a1...m_ak.XFoo in one module 
(m_a1...m_ak) or multiple m_a1...m_ak.XFoo, ...,  m_z1...m_zl.XFoo in 
different modules, the notation


  o~XFoo~bar

can become ambiguous at runtime.

but became unsure, hence my request for a Java example. In that Java 
example I assumed (probably falsely) that object o possesses the XFoo 
interface from m1 (but not from m2) by the name XFoo, which then can 
be easily addressed by ooRexx (as there would not be a reason to 
distinguis between the two).


Not sure what you want to say.  In Java, m1.XFoo and m2.XFoo denote Java 
interface types, and any (otherwise ambiguous) use of simply XFoo in 
the program text is disambiguated at compile time throught the use of 
import declarations.  This is completely different from ooRexx (if I 
understand it correctly), where the XFoo in o~XFoo~bar is the name of 
a method; that name is chosen systematically (if there is a UNO 
interface named m_1...m_k.XFoo, name the method XFoo), but in a way that 
name clashes can occur (if there are two UNO interfaces named 
m_a1...m_ak.XFoo and m_b1...m_bl.XFoo).


If both interfaces could be present in o, then you need to qualify it 
with so many names as to make it unambiguously clear, which XFoo one 
wants to use (one possibility in ooRexx could then be o~m1.XFoo~bar, 
although it is not implemented that way in the present beta, but could 
be added, if that problem really can pop-up).


---rony

P.S.: It still looks a little bit strange to me that the module name m1 
resp. m2 would not be used for uniquely identifying which XFoo you would 
like to address.


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



Re: [api-dev] Returnvalues from Macros

2005-10-20 Thread Mathias Bauer
Alexander Peters wrote:
 Hello!
 I use OLE to connect to OpenOffice.org Writer and want to get 
 Returncodes from Macros which i execute with a dispatcher. How can i 
 make this? Or is there an other way to execute macros to get a 
 returnvalue? Any Codesnip in any language will help me.

A dispatched macro can't return a value.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

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



[api-dev] Pure Virtual Method called, Aborted Error

2005-10-20 Thread Rahul Kulkarni
Hello All,

I get the error Pure Virtual Method called, Aborted when I execute my
component using XMain run() method by using uno executable. This occurs when
I make the service single instance by using a static variable inside the
code.

Any ideas, pointers about it. What could be the reason.

Help will be highly appreciated.
Thanks and Regards,
// Rahul


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