Date: prev next · Thread: first prev next last
2014 Archives by date, by thread · List index



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,'<h1>kjhk</h1>jh',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+unsubscribe@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

Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.