On Thu, 2011-11-10 at 01:41 +0100, Andreas Säger wrote:
> Am 10.11.2011 01:02, drew wrote:
> > On Wed, 2011-11-09 at 17:55 -0500, Andrew Douglas Pitonyak wrote:
> >>
> >>     sNames = oLibs.getElementNames()
> >>     For i = UBound(sNames) To LBound(sNames) Step -1
> >>       oLibs.removeLibrary(sNames(i))
> >>     Next
> >> End Sub
> >>
> 
>       sNames = oLibs.getElementNames()
>       For i = UBound(sNames) To LBound(sNames) Step -1
>         if sNames(i)<>"Standard" then
>       oLibs.removeLibrary(sNames(i))
>       ThisComponent.setModified(True)
>       endif
>       Next
> 
>   End Sub
> 
> 
> 
> >>
> >> --

Howdy Andreas,

Cool - now back to something Andrew noted - what about places where the
embedded macros might called from. Not sure how to find everywhere, but
we can enhance that basic procedure to clear out any document event
handlers.

Sub RemoveAllContainedLibs
   Dim sNames
   Dim oLibs
   Dim i%
   Dim EmptyEventProps(1) as new com.sun.star.beans.PropertyValue
 
   oLibs = ThisComponent.BasicLibraries
   sNames = oLibs.getElementNames()
   For i = UBound(sNames) To LBound(sNames) Step -1
     oLibs.removeLibrary(sNames(i))
   Next
   oLibs = ThisComponent.DialogLibraries
   sNames = oLibs.getElementNames()
   For i = UBound(sNames) To LBound(sNames) Step -1
     oLibs.removeLibrary(sNames(i))
   Next
   '
   ' clear all document event handlers
   For i = UBound(ThisComponent.Events.elementNames) To 
LBound(ThisComponent.Events.elementNames) Step -1
         
ThisComponent.Events.ReplaceByName(ThisComponent.Events.ElementNames(i), 
EmptyEventProps())
   next
   '
   ' force dirty flag on document
   ThisComponent.setModified(True)

End Sub




-- 
For unsubscribe instructions e-mail to: users+h...@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

Reply via email to