Issue 124936 - assignment of macros to libraries doesn't work
Summary: assignment of macros to libraries doesn't work
Status: CONFIRMED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.3.0 or older (OOo)
Hardware: All All
: P3 Major
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-20 09:34 UTC by mroe
Modified: 2014-05-20 12:10 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: 4.1.0
Developer Difficulty: ---


Attachments
testdocument for replicating problems with basic libraries (12.56 KB, application/vnd.oasis.opendocument.text)
2014-05-20 09:34 UTC, mroe
no flags Details
document to demonstrate PROBLEM 2 in comment 0 (16.85 KB, application/vnd.oasis.opendocument.text)
2014-05-20 10:26 UTC, mroe
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description mroe 2014-05-20 09:34:35 UTC
Created attachment 83427 [details]
testdocument for replicating problems with basic libraries

There is a big trouble in organizing macros in libraries.

Assumption: The help says
> You can also use the fully qualified name to call a procedure or function: Library.Module.Macro()
> For example, to call the Autotext macro from the Gimmicks library, use the following command:
> Gimmicks.AutoText.Main()

In the attached document there is only a small macro:
------------
Sub Main
	GlobalScope.DialogLibraries.loadLibrary( "Gimmicks" )
	Gimmicks.AutoText.Main()
End Sub
------------

PROBLEM 1
=========

Please do following:

1. Close AOO completely and restart it.
2. Open the attached document and run the macro.

Result: You will get an error message:
> Property or method not found: AutoText.

You can look into the library list to see that "Gimmicks" is loaded. If you open this library (click onto [+]) and you rerun the macro, now it will work.

Same for
------------
Sub Main
	GlobalScope.Gimmicks.AutoText.Main()
End Sub
------------


PROBLEM 2
=========

Condition: "Gimmicks" is loaded and the above macro runs.

If you change the library to
	MyBigLib.AutoText.Main()
you will get an error because there is no library "MyBigLib".

BUT change it e. g. to
	Euro.AutoText.Main()
the macro runs without any error although "Euro" isn't loaded and is has no macro "AutoText".


HINT: This problems not only belongs macros in documents.



Maybe the described problems correspondents with issue 87928.
Comment 1 hanya 2014-05-20 09:45:58 UTC
(In reply to mroe from comment #0)
> ------------
> Sub Main
> 	GlobalScope.DialogLibraries.loadLibrary( "Gimmicks" )
> 	Gimmicks.AutoText.Main()
> End Sub
You are loading Gimmicks library of dialogs. Please use BasicLibraries to load basic modules.
Comment 2 mroe 2014-05-20 10:26:41 UTC
Created attachment 83429 [details]
document to demonstrate PROBLEM 2 in comment 0

Sorry. :-(
Checked it again and again and again ...

But PROBLEM 2 exists as described.
So I add a new attachment with the macro
------------
Sub Main
	GlobalScope.BasicLibraries.loadLibrary( "Gimmicks" )
'	Euro.AutoText.Main() 'It runs although the library "Euro" has no module "AutoText".
	
	MsgBox( "Next run Main from Library 1:" )
	Library1.Main() 'It runs although no module is given.

	MsgBox( "Next run Main from Library 2:" )
	Library2.Main() 'It runs although no module is given.

	MsgBox( "Next run a nonexisting macro from Library 1 but exisits in Library 2:" )
	Library1.Module3.Test() 'It runs although "Library 1" has no macro "Test" and no module "Module3".
End Sub
------------
Comment 3 hanya 2014-05-20 12:10:46 UTC
When I push the button on the attached document, dozen of documents were created 
by Euro.AutoText.Main(). 
This means Library1.Main() call from unloaded libyrary Library1 goes bad procedure Standard.Module1.Main.
I think this kind of problem has been reported but I have no issue number now.