You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openoffice.apache.org by Cley Faye <cl...@gmail.com> on 2014/10/20 10:56:58 UTC

Re: [libreoffice-users] Is there a way for a Basic macro to detect what application is running it?

Quickly looking through the (not very user friendly) help for LibreOffice
Basic, the closest thing I found is GetSolarVersion, but that's probably
not enough.

While checking if the type is a struct can be a good workaround, it's not
completely future-proof; there is a need for a function to distinguish
between version of the Basic API (not only between AOO and LO).

-- 
Cley Faye
http://cleyfaye.net

2014-10-19 21:06 GMT+02:00 Johnny Rosenberg <gu...@gmail.com>:

> Here's my problem:
>
> I have both Apache OpenOffice and LibreOffice installed and I use them
> both. I have quite a few Calc files with Basic macros. Today I found my
> first difference between the Basic API in LibreOffice vs. Apache
> OpenOffice:
>
> Dim Dlg As Object, Ctl As Object
> DialogLibraries.LoadLibrary("Standard")
> Dlg=CreateUnoDialog(DialogLibraries.Standard.ElDialog)
> Ctl=Dlg.getControl("DateField")
>
> Now, I want to use Ctl.setDate(myDate) and myDate=Ctl.getDate(), and here's
> the difference:
> In Apache OpenOffice, myDate is a Long. Today's date, 2014-10-19, is
> represented as 20141019. I made two functions to convert to and from the
> format I needed.
>
> When running my macro in LibreOffice, the macro was interrupted by an error
> message, of course. After some debugging I found that the LibreOffice
> version of Ctl.setDate/Ctl.getDate works with a struct:
> Type DateType
> Year As Long
> Month As Long
> Day As Long
> End Type
>
>
> This is of course not a big deal, I can make the macro accept both formats,
> but the macro need to know if LibreOffice or Apache OpenOffice is running
> it. How can I do that? I have tried to find the answer myself, both using
> xray and searching the web, but so far nothing.
>
>
> Kind regards
>
> Johnny Rosenberg
> ジョニー・ローゼンバーグ
>
> --
> 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
>

Re: [libreoffice-users] Is there a way for a Basic macro to detect what application is running it?

Posted by Alexandro Colorado <jz...@oooes.org>.
A
​ctually there was another change from the post that I put before, the
Setup.xcu seems to be replaced by the ​registrymodifications.xcu

This has an ID check that list  the following node:
  <item oor:path="/org.openoffice.Setup/Office">
    <prop oor:name="LastCompatibilityCheckID" oor:op="fuse">
      <value>411m6(Build:9775)</value>
    </prop>
  </item>

Unfortunately there is no such thing as a vendor name, but I hink this
could be good enough, unless someone come with a better node.

On Mon, Oct 20, 2014 at 3:56 AM, Cley Faye <cl...@gmail.com> wrote:

> Quickly looking through the (not very user friendly) help for LibreOffice
> Basic, the closest thing I found is GetSolarVersion, but that's probably
> not enough.
>
> While checking if the type is a struct can be a good workaround, it's not
> completely future-proof; there is a need for a function to distinguish
> between version of the Basic API (not only between AOO and LO).
>
> --
> Cley Faye
> http://cleyfaye.net
>
> 2014-10-19 21:06 GMT+02:00 Johnny Rosenberg <gu...@gmail.com>:
>
> > Here's my problem:
> >
> > I have both Apache OpenOffice and LibreOffice installed and I use them
> > both. I have quite a few Calc files with Basic macros. Today I found my
> > first difference between the Basic API in LibreOffice vs. Apache
> > OpenOffice:
> >
> > Dim Dlg As Object, Ctl As Object
> > DialogLibraries.LoadLibrary("Standard")
> > Dlg=CreateUnoDialog(DialogLibraries.Standard.ElDialog)
> > Ctl=Dlg.getControl("DateField")
> >
> > Now, I want to use Ctl.setDate(myDate) and myDate=Ctl.getDate(), and
> here's
> > the difference:
> > In Apache OpenOffice, myDate is a Long. Today's date, 2014-10-19, is
> > represented as 20141019. I made two functions to convert to and from the
> > format I needed.
> >
> > When running my macro in LibreOffice, the macro was interrupted by an
> error
> > message, of course. After some debugging I found that the LibreOffice
> > version of Ctl.setDate/Ctl.getDate works with a struct:
> > Type DateType
> > Year As Long
> > Month As Long
> > Day As Long
> > End Type
> >
> >
> > This is of course not a big deal, I can make the macro accept both
> formats,
> > but the macro need to know if LibreOffice or Apache OpenOffice is running
> > it. How can I do that? I have tried to find the answer myself, both using
> > xray and searching the web, but so far nothing.
> >
> >
> > Kind regards
> >
> > Johnny Rosenberg
> > ジョニー・ローゼンバーグ
> >
> > --
> > 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
> >
>



-- 
Alexandro Colorado
Apache OpenOffice Contributor
882C 4389 3C27 E8DF 41B9  5C4C 1DB7 9D1C 7F4C 2614