Bug 113729 - macro (autoopen) no more working in 5.4.2.2 LibreBase
Summary: macro (autoopen) no more working in 5.4.2.2 LibreBase
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.4.2.2 release
Hardware: All Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-11-09 07:46 UTC by Bertoldi
Modified: 2018-11-27 15:37 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
screeenshot of error (148.82 KB, image/jpeg)
2017-11-09 07:46 UTC, Bertoldi
Details
a file odb, when I open there is the bug (727.97 KB, application/vnd.sun.xml.base)
2017-11-09 14:20 UTC, Bertoldi
Details
the file odb, with embedded the macro (729.24 KB, application/vnd.sun.xml.base)
2017-11-09 16:21 UTC, Bertoldi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bertoldi 2017-11-09 07:46:29 UTC
Created attachment 137630 [details]
screeenshot of error

with the new version of LibreOffice I get an error message, not in Writer, not in Calc, but in Base:

"BASIC runtime error. Property or method not found: supportsService"

and is highlighted the line "If NOT thisComponent.supportsService (" com.sun.star.text.TextDocument ") Then" Apparently supportsService is no more recognized in LibreBase (or, better, in Basic: I don't know!).

I refer to the whole macro:

sub vai_qui
    If NOT ThisComponent.supportsService ("com.sun.star.text.TextDocument") Then
        Exit Sub
    End If

    oBookmarks = ThisComponent.getBookmarks ()
    If NOT oBookmarks.hasByName ("here") Then
        Exit Sub
    End If


    ViewCursor = ThisComponent.CurrentController.getviewCursor ()
    Bookmark = ThisComponent.Bookmarks.getByName ("here") .Anchor
    ViewCursor.gotorange (Bookmark, False)

    ViewCursor = ThisComponent.CurrentController.getviewCursor ()
    Bookmark = ThisComponent.Bookmarks.getByName ("here") .Anchor
    ViewCursor.gotorange (Bookmark, False)
end sub
Comment 1 Kevin Suo 2017-11-09 08:46:22 UTC
I do not reproduce (in both Writer and Base) with the following version:
Version:5.4.3.2
Build ID:92a7159f7e4af62137622921e809f8546db437e5
CPU Thread:4; OS:Linux 4.13; UI 渲染:GL; VCL: gtk2; 
Locale:zh-CN (zh_CN.UTF-8); Calc: single
Comment 2 Bertoldi 2017-11-09 12:42:43 UTC
I said that the problem is not in LibreWriter, but only in LibreBase.
And the realease is 5.4.2.2, not 5.4.3.2: where can I download the 5.4.3.2 ?
Thank you
Comment 3 Alex Thurgood 2017-11-09 13:09:39 UTC
supportsService only appears to be used with cppu (unit testing API) according to the current API documentation :

https://api.libreoffice.org/docs/cpp/ref/a00303.html#aa6f2e5b35071f866760890090cc1671e
Comment 4 Alex Thurgood 2017-11-09 13:11:38 UTC
It might be easier if you could provide a small Base file with the included macro for others to test.
Comment 5 Bertoldi 2017-11-09 14:18:27 UTC
Tried LO 5.4.3: as normal user *there is* the bug, as root no bug.
(As normal user I have a mysql direct connection: maybe is there the problem? In the mysql direct connexion?)
Comment 6 Bertoldi 2017-11-09 14:20:23 UTC
Created attachment 137643 [details]
a file odb, when I open there is the bug
Comment 7 Bertoldi 2017-11-09 14:22:36 UTC
But the macro is not embedded in the odb file, but in LibreOffice.
How should I modify the macro to avoid the error message?
Thank you
Comment 8 Kevin Suo 2017-11-09 14:32:34 UTC
(In reply to Bertoldi from comment #7)
I suggest to debug what the thisComponent really is at the moment when it gives the error msg. As you said the code is embeded in libreoffice but not the document, There is chance that thisComponent has changed to another object which does not support this method.

To get the macro embeded in the document, just create a new module  and copy paste your code. Test by yourself to see If you can reproduce before send.

Will test your document tomorrow as it's late night here.
Comment 9 Bertoldi 2017-11-09 16:21:45 UTC
Created attachment 137646 [details]
the file odb, with embedded the macro
Comment 10 Bertoldi 2017-11-11 11:51:53 UTC
Kevin?
Comment 11 Kevin Suo 2017-11-11 15:05:17 UTC
(In reply to Bertoldi from comment #10)
I do not reproduce with your test document in version 5.4.3.2.

Maybe it's related, as you have said, to the mysql connection. It maybe also because of sth else which causes the object ThisComponent having no method called supportsService.

What do you mean by running as "root"? Do you mean you login on the Base form you have designed as "root"? What did you do after the login, and at which stage is the macro run? Could you explain further in detail the steps you reproduce the bug? Maybe you can take a series of screenshots to explain. Make sure to remove the confidential information before posting on this bug report. You can also send me an email directly of removing confidential information is not possible.

Set back to UNCONFIRMED.
Comment 12 Kevin Suo 2017-11-11 15:14:22 UTC
(In reply to Bertoldi from comment #10)

I added the following code in the TRUE part of the if loop:
> msgbox("supportService is True!")

and added the following code in the False (else) part:
> msgbox("supportService is False!")

then when I run this macro manually in Base, I get msgbox "supportService is False!" which is expected.
When I paste this code as a libreoffice module, then run in Writer, it shows "supportService is True!" message, which is also expected.
Comment 13 Bertoldi 2017-11-12 16:42:14 UTC
I don't undestand: how can I avoid the error message? And why that error message teher is in LO 5.4 and not in 5.3?
Comment 14 tommy27 2017-11-16 10:33:55 UTC
did you try 5.4.3.2?
Comment 15 Bertoldi 2017-11-16 13:10:02 UTC
yes. Today I tried a workaround: open odb files as root: so I don't get error message.
Comment 16 Xisco Faulí 2018-11-27 13:07:48 UTC
Hi Bertoldi,
I can't reproduced it in

Version: 6.2.0.0.beta1+
Build ID: a63cd8bbe7cf881daa8dc7a7f32f3e5ac384e902
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
Locale: ca-ES (ca_ES.UTF-8); UI-Language: en-US
Calc: threaded

Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 17 Duns 2018-11-27 15:34:11 UTC
In effect in 6.0.6.2 the bug is resolved! No bug!
Comment 18 Xisco Faulí 2018-11-27 15:37:08 UTC
Thanks for retesting with the latest version.
Setting to RESOLVED WORKSFORME as the commit fixing this issue hasn't been identified.