Re: [libreoffice-users] Adequate API

2014-12-14 Thread Andrew Douglas Pitonyak


On 12/13/2014 06:22 PM, RAM B wrote:

Why there is no adequate API for so long time to program office suite?

OO:=CreateOleObject('com.sun.star.ServiceManager');
ddd:=oo.createinstance('com.sun.star.frame.Desktop');


varr := VarArrayCreate([0, 1], varvariant);
doc:=ddd.LoadComponentFromURL( 'private:factory/swriter', '_blank', 0,
VarArrayCreate([0, -1], varVariant));
ot:=doc.gettext;
cp:=ot.createtextcursor;
ot.insertstring(cp,'h1kjhk/h1jh',false);

like

doc:=createDocument(swriter,OOO_Blank);

cur:=createCursor();

insertString(cur,hello!);

why?

RAM B.



The original intent of the API was to directly control the internals 
using the existing objects built-in to LO. It was not intended to be 
used as you suggest. The existing API has certain advantages in many 
ways, sadly, accessibility is not one of them. More specifically, it is 
confusing at best until you have spent a lot of time looking at it.


Off hand, there is no specific reason that wrapper methods could not be 
written to do this sort of thing, but that requires a volunteer to 
choose to do it and have community buy in (or I suppose that some of 
these things could be done as an add-on or extension). So, then it just 
needs someone who has sufficient need, desire, or money to choose to do it.


Not sure that is what you meant to ask or not I do most of my work 
in basic, so my tendency would be write a Basic macro to do the work. 
This would not make it available (I think) from your example code, only 
from Basic. I think it would need to be full UNO implementation. If you 
see a real need and are able to build support for this, you could be the 
person to make this happen. Off hand, I would say that creating the new 
language or extension would be the most difficult part. The example as 
you present it would flat out not work since the calls would probably 
have to somehow be related to a document or thing. In other words, you 
can't just call insertString without context (I think anyway), so you 
would need some kind of object from which to call insertString. It turns 
out that your cursor object supports this call directly. Now i think 
that I am rambling.


Oh, and I see a real need for a simplified API but I do not have the 
time to lead such an effort; sadly.


--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info:  http://www.pitonyak.org/oo.php


--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted


[libreoffice-users] Adequate API

2014-12-13 Thread RAM B

Why there is no adequate API for so long time to program office suite?

OO:=CreateOleObject('com.sun.star.ServiceManager');
ddd:=oo.createinstance('com.sun.star.frame.Desktop');


varr := VarArrayCreate([0, 1], varvariant);
doc:=ddd.LoadComponentFromURL( 'private:factory/swriter', '_blank', 0,
VarArrayCreate([0, -1], varVariant));
ot:=doc.gettext;
cp:=ot.createtextcursor;
ot.insertstring(cp,'h1kjhk/h1jh',false);

like

doc:=createDocument(swriter,OOO_Blank);

cur:=createCursor();

insertString(cur,hello!);

why?

RAM B.

--
To unsubscribe e-mail to: users+unsubscr...@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted