Lack of access to all functions in exposed interfaces? - openoffice.org

I have a rather fundamental issue with coding in OpenOffice/LibreOffice Basic that I can't seem to figure out. I don't always have access to all the functions I'm supposed to. Here's an example:
Sub TestSub
Dim doc As Object
doc = ThisComponent 'Note that we're in LibreOffice Writer
MsgBox(doc.Text.Dbg_SupportedInterfaces)
doc.Text.finishParagraph(Array()) 'Works OK
doc.Text.appendParagraph(Array()) 'Error, property or method not found
End Sub
The doc.Text.Dbg_SupportedInterfaces property tells me that one of the interfaces that I am supposed to have access to is com.sun.star.text.XParagraphAppend, which is meant to expose both finishParagraph and appendParagraph, yet I only seem to have access to finishParagraph. Why is this? This isn't an isolated case - all over the place I see that I am meant to have access to functions that I don't have access to.

Openoffice and Libreoffice are different projects. That's why they will be developed different and they will become much more different in the future. With your example Libreoffice has no more appendParagraph but finishParagraphInsert. See: http://api.libreoffice.org/docs/idl/ref/interfacecom_1_1sun_1_1star_1_1text_1_1XParagraphAppend.html
For BASIC development I recommend to use a debugging tool like XRAY. See: https://wiki.documentfoundation.org/Macros This tool will show only the properties and methods which are really there. Unfortunately there is even no more global index in API documentation of Libreoffice. So XRAY cannot link directly to the Libreoffice API documentation. Therefore at the moment I use the https://www.openoffice.org/api/docs/common/ref/index-files/index-1.html for both Openoffice and Libreoffice and check manually the Libreoffice API http://api.libreoffice.org/ if I am working on a macro for Libreoffice.

Related

Printing a ticket in xpages

In a xpages application I need to mount a label with a certain layout, analogous to the layout of a ticket. Searching, I have verified that the most used practice is to use openoffice to design the odt model and in java to use bilbiotec to JOD Reports. Do you advise to follow this line yourself, or do you have any suggestions?
I would concur with Marcus. The way forward is PDF output. There are a couple of ways to do this, depending on your constraints.
When user must design every aspect of the ticket using openoffice is a suitable approach, however you need a headless openoffice install for the rendering
If everything can be code, then PDFBox is a good way to go. Wrap your code into a managed bean
The middle path would be XSL:FO and Apache FOP. It allows alteration of the layout by providing a different style sheet. I wrote an article series outlining that approach.
Let us know what works for you!
There is also the POI4XPages plugin. You could design your form with Word and then use placeholders to populate the document and output as a pdf.
See https://poi4xpages.openntf.org/main.nsf/project.xsp?r=project/POI%204%20XPages/releases/E80C4FC9FB07E1E4852580E3006E02C7
Download the latest version (1.4) at http://p2.openntf.org/repository.nsf/home.xsp/poi4xpages/snapshots
Howard
I was able to solve my problem, because I discovered that here in the company there is the abcpdf software. Through a web service that uses the APis of this software, I pass the html code of the ticket and the web service returns the pdf document in an array of bytes. I created a managed javabean to consume the web service and display the pdf in the browser.
Thanks to all who have contributed in some way with suggestions.

Swagger UI for messaging API

I'd like to know if the following is possible.
Swagger is almost what I need to document a Message based API. For instance for a Command Message I'd like to say "Command" instead of "Post", and instead of "path" I'd like to have the name of the Command.
The spec mentions that Vendor Extensions are possible using "x-" properties but I am 1) not finding any examples of how to do this and 2) not sure if the use of these properties would help me meet my goals.
Might anyone be able to point me to some resources that can help me move along?
Swagger is designed to document REST APIs which are based on HTTP verbs. You can't replace verbs or invent new ones.
Vendor extensions are there to allow adding additional information that the specification does not allow, but ultimately, it is still intended for REST APIs.
From what I gather, you're trying to describe something different.
We do welcome suggestions for additional roads for Swagger (that is, cover non-REST APIs), and in order to do that, I'd suggest opening an issue on the swagger-spec repository.

Erlang: query more than 1000 LDAP elements using "eldap" library

I am using ejabberd, a jabber daemon written in Erlang. It is connected to our Active Directory using its LDAP interface and Erlang's eldap library.
Everything works so far with a small limitation causing a big problem:
A normal LDAP query receives up to 1000 elements and then stops.
We have more than 1000 employees and therefore receiver only a part of the whole query
Using *nix' ldapsearch tool, I can use the option -E pr=1000/noprompt for receiving multiple pages (which finally get concatenated to a single one) without any limitation.
How could I use this function using Erlang's eldap library?
I already read through the source code, but don't seem to find anything obvious.
#erlang had some nice ideas about this:
emauton: It looks to me like you're out of luck. Paged results are supplied by an LDAP extension, described in http://www.rfc-editor.org/rfc/rfc2696.txt. If you look at ldapsearch, you can see this being added to the query at http://goo.gl/lemNOS
emauton: Reading through the eldap source, this extension doesn't make an appearance. The good news is that it shouldn't be too hard to add, I think, by messing about with the 'controls' part of the LDAPMessage.
emauton: You should be able to set up your request according to the RFC using the right controlType & contents (referencing the ldapsearch code) and use it to make a paginating version of eldap:search

Accessing Mozilla Certificates from Delphi

I would like to access certificates stored in Mozilla products (Firefox and Thunderbird) from a Delphi (XE) applicaiton. For start I would like to list them, next it would be nice to be able to manage them (import, export, delete) and use them (sign). The software token would be sufficient although using all tokens supported by mozilla would be great.
So far I tried using XPCOM with http://d-gecko.svn.sourceforge.net/viewvc/d-gecko/trunk/ delphi binding. However there is not much documentation around and I am kinda confused with all the terminology and concepts. The best I could manage was:
var ns:nsIX509CertDB;
servMgr:nsIServiceManager;
p:Pchar;
begin
GRE_Startup;
NS_GetServiceManager(servmgr);
servMgr.GetServiceByContractID('#mozilla.org/security/x509certdb;1',NS_IX509CERTDB_IID,ns);
ns.FindCertNicknames(nil,1,count,p);
GRE_Shutdown;
end;
Using this code I did get instance of certdb object and I was able to ask it for certificates. However it seems to be completely empty (count from FindCertNicknames is 0) and it also does not react on changing OCSP (IsOcspOn always returns true). I am thinking that I did either create new certstore or that I need to activate default user profile somehow.
I also tried accessing softokn.dll as a PKCS#11 library. As this seem to have some sort of PKCS#11 API, it is not responding well. I.e. CKR_BAD_ARGUMENTS on C_Inititialize.
The last and really bad way would be accessing certificate files directly as it should be "standard" NSS but I realy do not like this way.
Our SecureBlackbox works with softtokn.dll via PKCS#11 and you can use interfaces provided by SecureBlackbox for handy certificate management.
I explored the PKCS#11 way a little more and I actually got it to do something. The softokn.dll library is "almost" standard PKCS#11 library, see https://developer.mozilla.org/en/PKCS11_Module_Specs . The key thing is that you need to initialize it with special arguments (the structure is described in the linked URL).
Its also handy to check the NSS erorr return values: see CKR_NETSCAPE_... at http://people.mozilla.com/~chofmann/l10n/tree/mozilla/security/nss/cmd/pk11mode/pk11mode.c .
The last key thing is that you need to specify the tokens by hand as the documentation is unclear about using secmod.db - there is a missing word, probably "supported", in "The MOD DB function is not through standard PKCS #11 interfaces".
All this is rather low-level coding and will still need a lot of work so it may be better to use SecureBalackbox as suggested by Eugene if you are starting from scratch.

Get watched issues in Redmine via REST API

We're looking to create a tool to help with time management in Redmine. The issue we are currently having is that we want to get a list of issues that are watched by a particular user but can't find an API for it. Does anyone know if this is possible or are we just going to have to try and modify Redmine directly?
SOLUTION: Similar to the solution provided below by dmf85, I found a solution to this problem that worked for me. The Issues API takes a query_id as one of its parameters. What I ended up doing was filtering my issues by Watcher (like dmf85 said) then saving the query. I then used the query_id from that saved custom query in my API call.
At least in Redmine 3.1, there’s an undocumented parameter for the Issues API that allows you to specify a watcher directly: watcher_id. It works just like assigned_to_id, you can pass either a user ID (i.e. watcher_id=23) or the special string me (i.e. watcher_id=me).
An example of URL could be like the following: https://example.com/redmine/issues.json?watcher_id=me&key=redmine_api_key
Under your issues tab in the interface, click:
add filter
watcher
select a watcher in the box
Then, click the atom, csv, or pdf link at the bottom for a link that you can write a program to consume at your discretion.
Does this help?

Resources