2008-06-16 11:19:07 +00:00
|
|
|
'encoding UTF-8 Do not remove or change this line!
|
|
|
|
'**************************************************************************
|
2010-02-26 14:17:49 +01:00
|
|
|
' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
|
|
|
'
|
|
|
|
' Copyright 2000, 2010 Oracle and/or its affiliates.
|
|
|
|
'
|
|
|
|
' OpenOffice.org - a multi-platform office productivity suite
|
|
|
|
'
|
|
|
|
' This file is part of OpenOffice.org.
|
|
|
|
'
|
|
|
|
' OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
' it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
' only, as published by the Free Software Foundation.
|
|
|
|
'
|
|
|
|
' OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
' but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
' GNU Lesser General Public License version 3 for more details
|
|
|
|
' (a copy is included in the LICENSE file that accompanied this code).
|
|
|
|
'
|
|
|
|
' You should have received a copy of the GNU Lesser General Public License
|
|
|
|
' version 3 along with OpenOffice.org. If not, see
|
|
|
|
' <http://www.openoffice.org/license.html>
|
|
|
|
' for a copy of the LGPLv3 License.
|
|
|
|
'
|
2008-06-16 11:19:07 +00:00
|
|
|
'/******************************************************************************
|
|
|
|
'*
|
2011-01-24 09:53:55 +01:00
|
|
|
'* owner : gregor.hartmann@oracle.com
|
2008-06-16 11:19:07 +00:00
|
|
|
'*
|
|
|
|
'* short description : Tools to ease the use of the ToolsCustomize-Dialog
|
|
|
|
'*
|
|
|
|
'\******************************************************************************
|
|
|
|
|
|
|
|
function hToolsCustomizeOpen() as boolean
|
|
|
|
|
2010-03-04 14:05:07 +01:00
|
|
|
printlog( "Open Tools/Customize dialog" )
|
|
|
|
ToolsCustomize
|
2010-03-08 09:27:48 +01:00
|
|
|
hToolsCustomizeOpen() = hToolsCustomizeSelectTab( "Events" )
|
2008-06-16 11:19:07 +00:00
|
|
|
|
|
|
|
end function
|
|
|
|
|
|
|
|
'*******************************************************************************
|
|
|
|
|
|
|
|
function hToolsCustomizeSelectTab( cTab as string ) as boolean
|
|
|
|
|
|
|
|
'///<h3>Switch Tabpages on ToolsCustomize Dialog</h3>
|
|
|
|
'///<i>Starting point: The Tools/Customize dialog</i><br>
|
|
|
|
'///<u>Input</u>:
|
|
|
|
'///<ol>
|
|
|
|
'///+<li>Name of the Tab (string)</li>
|
|
|
|
'///<ul>
|
|
|
|
'///+<li>"Keyboard"</li>
|
|
|
|
'///+<li>"Menu"</li>
|
|
|
|
'///+<li>"Toolbars"</li>
|
|
|
|
'///+<li>"Events"</li>
|
|
|
|
'///</ul>
|
|
|
|
'///</ol>
|
|
|
|
'///<u>Returns</u>:
|
|
|
|
'///<ol>
|
|
|
|
'///+<li>Errorstatus (boolean)</li>
|
|
|
|
'///<ul>
|
|
|
|
'///+<li>TRUE if the requested tab is open</li>
|
|
|
|
'///+<li>FALSE on any other condition</li>
|
|
|
|
'///</ul>
|
|
|
|
'///</ol>
|
|
|
|
'///<u>Description</u>:
|
|
|
|
'///<ul>
|
|
|
|
|
|
|
|
const CFN = "hToolsCustomizeSelectTab::"
|
2010-03-08 10:56:05 +01:00
|
|
|
hToolsCustomizeSelectTab() = true
|
2008-06-16 11:19:07 +00:00
|
|
|
ctab = lcase( ctab )
|
|
|
|
|
|
|
|
'///+<li>Switch to one of the four available tabpages</li>
|
|
|
|
'///<ol>
|
2010-03-08 09:27:48 +01:00
|
|
|
|
|
|
|
printlog( "Open Tools/Customize: <" & ctab & ">" )
|
2008-06-16 11:19:07 +00:00
|
|
|
kontext
|
|
|
|
|
|
|
|
try
|
|
|
|
select case ctab
|
|
|
|
'///+<li>Keyboard</li>
|
2010-03-08 10:56:05 +01:00
|
|
|
case "keyboard" :
|
|
|
|
active.setPage TabTastatur
|
|
|
|
WaitSlot
|
|
|
|
kontext "TabTastatur"
|
|
|
|
if ( not Aendern.isVisible() ) then
|
|
|
|
printlog( CFN & "Keyboard tabpage is not available" )
|
|
|
|
hToolsCustomizeSelectTab() = false
|
|
|
|
endif
|
2008-06-16 11:19:07 +00:00
|
|
|
'///+<li>Menu</li>
|
2010-03-08 10:56:05 +01:00
|
|
|
case "menu" :
|
|
|
|
active.setPage TabCustomizeMenu
|
|
|
|
WaitSlot
|
|
|
|
kontext "TabCustomizeMenu"
|
|
|
|
if ( not Entries.isVisible() ) then
|
|
|
|
printlog( CFN & "Menu tabpage is not available" )
|
|
|
|
hToolsCustomizeSelectTab() = false
|
|
|
|
endif
|
2008-06-16 11:19:07 +00:00
|
|
|
'///+<li>Toolbars</li>
|
2010-03-08 10:56:05 +01:00
|
|
|
case "toolbars" :
|
|
|
|
active.setPage TabCustomizeToolbars
|
|
|
|
WaitSlot
|
|
|
|
kontext "TabCustomizeToolbars"
|
|
|
|
if ( not ToolbarContents.isVisible() ) then
|
|
|
|
printlog( CFN & "Toolbar tabpage is not available" )
|
|
|
|
hToolsCustomizeSelectTab() = false
|
|
|
|
endif
|
2008-06-16 11:19:07 +00:00
|
|
|
'///+<li>Events</li>
|
2010-03-08 10:56:05 +01:00
|
|
|
case "events" :
|
|
|
|
active.setPage TabCustomizeEvents
|
|
|
|
WaitSlot
|
|
|
|
kontext "TabCustomizeEvents"
|
|
|
|
if ( not AssignMacro.isVisible() ) then
|
|
|
|
printlog( CFN & "Assign Macro tabpage is not available" )
|
|
|
|
hToolsCustomizeSelectTab() = false
|
|
|
|
endif
|
2008-06-16 11:19:07 +00:00
|
|
|
end select
|
|
|
|
'///</ol>
|
|
|
|
catch
|
|
|
|
printlog( CFN & "Could not access requested tabpage" )
|
2010-03-08 10:56:05 +01:00
|
|
|
hToolsCustomizeSelectTab() = false
|
2008-06-16 11:19:07 +00:00
|
|
|
endcatch
|
|
|
|
'///</ul>
|
|
|
|
|
|
|
|
end function
|
|
|
|
|
|
|
|
'*******************************************************************************
|
|
|
|
|
|
|
|
function hDeselectSeparator() as integer
|
|
|
|
|
|
|
|
'///<h3>Make sure that we do not work on a separator item (Toolbars)</h3>
|
|
|
|
'///<i>Starting point: Tools/Customize: Toolbars must be open</i><br>
|
|
|
|
'///<u>Input</u>:
|
|
|
|
'///<ol>
|
|
|
|
'///+<li>Nothing</li>
|
|
|
|
'///</ol>
|
|
|
|
'///<u>Returns</u>:
|
|
|
|
'///<ol>
|
|
|
|
'///+<li>Position of the selected item (integer)</li>
|
|
|
|
'///<ul>
|
|
|
|
'///+<li>Always > 1</li>
|
|
|
|
'///+<li>Always < Max number of items</li>
|
|
|
|
'///</ul>
|
|
|
|
'///</ol>
|
|
|
|
'///<u>Description</u>:
|
|
|
|
'///<ul>
|
|
|
|
|
|
|
|
|
|
|
|
dim iCurrentItem as integer
|
|
|
|
dim cString as string
|
|
|
|
dim irc as integer
|
|
|
|
const CFN = "hDeselectSeparator::"
|
|
|
|
|
|
|
|
kontext "ToolsCustomizeToolbars"
|
2009-08-10 11:06:58 +00:00
|
|
|
if ( ToolbarContents.getItemCount > 0 ) then
|
2008-06-16 11:19:07 +00:00
|
|
|
|
2009-08-10 11:06:58 +00:00
|
|
|
iCurrentItem = ToolbarContents.getSelIndex()
|
|
|
|
cString = ToolbarContents.getSelText()
|
|
|
|
|
|
|
|
'///+<li>Check whether the selected item contains a number of minus-chars (---)</li>
|
|
|
|
if ( instr( cString , "----" ) ) then
|
2008-06-16 11:19:07 +00:00
|
|
|
|
2009-08-10 11:06:58 +00:00
|
|
|
'///+<li>If we are at the beginning of the list: Move up</li>
|
|
|
|
if ( iCurrentItem = 1 ) then
|
|
|
|
irc = 2
|
|
|
|
ToolbarContents.select( irc )
|
|
|
|
printlog( CFN & " Moved away from separator (up)" )
|
|
|
|
else
|
|
|
|
'///+<li>If we are somewhere else in the list, move down</li>
|
|
|
|
irc = iCurrentItem - 1
|
|
|
|
ToolbarContents.select( irc )
|
|
|
|
printlog( CFN & " Moved away from separator (down)" )
|
|
|
|
endif
|
|
|
|
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
irc = 0
|
2008-06-16 11:19:07 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
hDeselectSeparator() = irc
|
|
|
|
'///</ul>
|
|
|
|
|
|
|
|
end function
|
|
|
|
|
|
|
|
'*******************************************************************************
|
|
|
|
|