Adding preference shortcut to toolbar

Discuss the spreadsheet application

Adding preference shortcut to toolbar

Postby orionp3 » Sun Feb 16, 2020 7:42 am

I would like to add a short-cut ("grid lines" - off/on and colour preference) to the standard toolbar rather than have to dig through the preferences menu which covers all components of Open Office.
Is there any way of doing this ?
Thanks.
open office 73 on mac macOS 10.14.6 (Mojave)
orionp3
 
Posts: 2
Joined: Sun Feb 16, 2020 7:27 am

Re: adding preference shortcut to toolbar

Postby Zizi64 » Sun Feb 16, 2020 9:39 am

https://extensions.openoffice.org/en/project/gridlines

Or you can write your own macro code based on the API descriptions and the code of the extension, because it is quite old extension. Maybe it will not work with the newer versions of the AOO/LO:

Code: Select all   Expand viewCollapse view
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="GridLinesMod" script:language="StarBasic">REM  *****  BASIC  *****

Dim GridLinesListener As Object
Global SheetsWithHideGridLines
&apos;-----------------------------------------------------------------
Sub RunGridLinesListener
   GridLinesListener = createUnoListener ("SHEET_","com.sun.star.beans.XPropertyChangeListener")
   ThisComponent.CurrentController.addPropertyChangeListener("ActiveSheet",GridLinesListener)
   GetSheetsWithHideGridLines
End Sub
&apos;-----------------------------------------------------------------
Sub SHEET_propertyChange(oEvent)
   Dim ActiveSheet$
   Dim i%   
   
   ActiveSheet = ThisComponent.CurrentController.ActiveSheet.AbsoluteName
      For i = 0 To uBound(SheetsWithHideGridLines)
         If ActiveSheet = SheetsWithHideGridLines(i) Then
            ThisComponent.CurrentController.showGrid = False
            i = uBound(SheetsWithHideGridLines) + 1
         Else
            ThisComponent.CurrentController.showGrid = True
         End If
      Next
End Sub
&apos;----------------------------------------------------------------
Sub GetSheetsWithHideGridLines
   Dim ActiveSheet$
   Dim i%
   Dim u%   
   
   ActiveSheet = ThisComponent.CurrentController.ActiveSheet.AbsoluteName
   If IsEmpty(SheetsWithHideGridLines) Then
      SheetsWithHideGridLines = Array(ActiveSheet)
      ThisComponent.CurrentController.showGrid = False
   Else
   u = UBound(SheetsWithHideGridLines)
         For i = 0 to u
            If SheetsWithHideGridLines(i) = ActiveSheet Then
               SheetsWithHideGridLines(i) = ""
               ThisComponent.CurrentController.showGrid = True
               Exit Sub
            End If
         Next
         Redim Preserve SheetsWithHideGridLines (u + 1)
         SheetsWithHideGridLines(u + 1) = ActiveSheet
         ThisComponent.CurrentController.showGrid = False
   End If
End Sub

</script:module>
Tibor Kovacs, Hungary; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 9548
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Adding preference shortcut to toolbar

Postby orionp3 » Wed Feb 19, 2020 2:24 pm

Hello again, and many thanks for your guidance. Unfortunately, I should have made clear at the time that I'm not particularly computer literate at least not to the extent of writing code and integrating that code with an application. So, my apologies by omitting that info. For what it's worth I am happy to copy and past to the Mac terminal.
Thanks again and any further guidance from this point on would of course be most appreciated.
open office 73 on mac macOS 10.14.6 (Mojave)
orionp3
 
Posts: 2
Joined: Sun Feb 16, 2020 7:27 am


Return to Calc

Who is online

Users browsing this forum: No registered users and 16 guests