OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How evaluate functions in a non-standard locked library

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Gore
General User
General User


Joined: 13 May 2005
Posts: 13
Location: Andalucía

PostPosted: Tue May 17, 2005 11:02 am    Post subject: How evaluate functions in a non-standard locked library Reply with quote

I'm new here. Excuse me if the subject exists in another thread. I have searched but not found it.

My machine is windows xp running Ooo 1.1.4

I have a Calc document with two libraries: “Standard” and “LockedMacros”.

The spreadsheet cells call functions that resides in the library “LockedMacros”. The first is to load the library “LockedMacros”, I make it with a macro in Standard.Startup module assigned to a Document-event (open or activate) but nothing changes. The spreadsheets is plenty of “#NAME?”. It seems that cells are evaluated before the event occurs and the functions continue not being recognized.

Ooo reevaluate cells when a named ranges is added or removed. Hence, I force Ooo adding a new named range and deleting it inmediatly. All works fine and all cells are correctly evaluated.

The problem appear when the library “LockedMacros” is locked. If is unlocked it works but if the library is locked the system crash with a Ooo 1.1.4 Error Report and a fatal error.

My code is in the Standard Library. Startup Module:

Code:

Sub Load_Library
   dim sc as string
   sc = "LockedMacros"
   if not BasicLibraries.isLibraryLoaded(sc) then
      BasicLibraries.loadLibrary(sc)
      Bluff                                           'add and remove a new named range
   endif
End Sub

Sub Bluff
   dim oCellAddress as new com.sun.star.table.CellAddress
   oCellAddress.Sheet = 0
   oCellAddress.Column = 0
   oCellAddress.Row = 0

   if not ThisComponent.namedRanges.hasByName("pqrst") then
      ThisComponent.namedRanges.addNewByName("pqrst", "", oCellAddress, 0)
   endif
   ThisComponent.namedRanges.removeByName("pqrst")
End Sub


and, for example some functions in “LockedMacros.Macros” module

Code:

Function AddOne(n&) as Integer
   AddOne = n + 1
End Function


and some call to these function in a cell: "= ADDONE(9)"

Can you tell me where is the error? There is another way to work with a protected library without the #NAME? message?

Thanks, oooh my english!

Elías
Back to top
View user's profile Send private message
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Thu May 19, 2005 4:29 am    Post subject: Reply with quote

I have seen problems with paswword libraries in a document. One problem existed in OOo 1.1.3 and it was reported inexistent in OOo 1.1.4. I did not find it in OOo 1.9 but discovered another, new problem. For me this means these parts of software have been reworked several times.
I also see (OOo 1.1.3) another problem with Calc addin functions defined in a library other than Standard, see thread http://www.oooforum.org/forum/viewtopic.phtml?t=20270

In short, it is possible to work with macros stored in a password library stored in soffice. But it appears not possible to use Calc functions defined inside a library other than Standard. And you cannot set a password to a Standard library.

This is of course my personal opinion.
______
Bernard
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group