diff options
author | Andras Timar <andras.timar@collabora.com> | 2014-10-09 12:38:05 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2014-10-09 13:02:50 +0200 |
commit | 05f1a88e199cbffa786cf1fe8719638d205bae9f (patch) | |
tree | 4d3f141aaa8ca97978452fea2840b2e27ffe3268 /scripting | |
parent | 0be1c2e87a0ff932584dba0e96b535e6c5eea6d9 (diff) |
typo: Lable -> Label
Change-Id: I8b9e9f75dd22ee5bff678c5bc0e1fa9381a103de
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/workben/bindings/ScriptBinding.xba | 324 |
1 files changed, 162 insertions, 162 deletions
diff --git a/scripting/workben/bindings/ScriptBinding.xba b/scripting/workben/bindings/ScriptBinding.xba index dd5d235f91ad..f79ef2e5aef4 100644 --- a/scripting/workben/bindings/ScriptBinding.xba +++ b/scripting/workben/bindings/ScriptBinding.xba @@ -22,9 +22,9 @@ REM ----- Global Variables ----- 'bindingDialog can refer to either KeyBinding or MenuBinding dialog -private languages() as String -private extensions() as Object -private locations() as String +private languages() as String +private extensions() as Object +private locations() as String private filesysScripts() as String private filesysCount as integer private bindingDialog as object @@ -70,7 +70,7 @@ private allKeyBindings() as string 'KeyBindArrayOfArrays(2) contains SHIFT + CONTROL + letters 'KeyBindArrayOfArrays(3) contains CONTROL + F keys 'KeyBindArrayOfArrays(4) contains CONTROL + digits -'KeyBindArrayOfArrays(5) contains CONTROL + letters +'KeyBindArrayOfArrays(5) contains CONTROL + letters 'KeyBindArrayOfArrays(6) contains SHIFT + F keys private KeyBindArrayOfArrays(6) @@ -105,7 +105,7 @@ sub RefreshAllScripts() RefreshAppScripts( "USER" ) RefreshAppScripts( "SHARE" ) RefreshDocumentScripts -end sub +end sub sub RefreshAppScripts( appName as String ) On Error Goto ErrorHandler @@ -120,8 +120,8 @@ sub RefreshAppScripts( appName as String ) ErrorHandler: reset MsgBox ("Error: Unable to refresh Java (scripts)" + chr$(10) + chr$(10)+ "Detail: " & error$ + chr$(10) + chr$(10)+ "Action: Please restart Office",0,"Error" ) - -end sub + +end sub sub RefreshDocumentScripts() On Error Goto ErrorHandler @@ -144,8 +144,8 @@ sub RefreshDocumentScripts() ErrorHandler: reset MsgBox ("Error: Unable to refresh Java (scripts)" + chr$(10) + chr$(10)+ "Detail: " & error$ + chr$(10) + chr$(10)+ "Action: Please restart Office",0,"Error" ) - -end sub + +end sub REM ----- Launch Functions ----- @@ -158,16 +158,16 @@ Sub createAndPopulateKeyArrays() for FKey = 1 to 12 SCFKey( FKey - 1 ) = "SHIFT + CONTROL + F" + FKey next FKey - + KeyBindArrayOfArrays(0) = SCFKey() - + 'Create SHIFT + CONTROL + digits Dim SCDKey( 9 ) for Digit = 0 to 9 SCDKey( Digit ) = "SHIFT + CONTROL + " + Digit next Digit KeyBindArrayOfArrays(1) = SCDKey() - + 'Create SHIFT + CONTROL + letters Dim SCLKey( 25 ) @@ -176,35 +176,35 @@ Sub createAndPopulateKeyArrays() next Alpha KeyBindArrayOfArrays(2) = SCLKey() - 'Create CONTROL + F keys + 'Create CONTROL + F keys Dim CFKey( 11 ) for FKey = 1 to 12 CFKey( Fkey - 1 ) = "CONTROL + F" + FKey next FKey KeyBindArrayOfArrays(3) = CFKey() - + 'Create CONTROL + digits Dim CDKey( 9 ) for Digit = 0 to 9 CDKey( Digit ) = "CONTROL + " + Digit next Digit KeyBindArrayOfArrays(4) = CDKey() - + 'Create CONTROL + letters Dim CLKey( 25 ) - for Alpha = 65 to 90 + for Alpha = 65 to 90 CLKey( Alpha - 65 ) = "CONTROL + " + chr$( Alpha ) - next Alpha + next Alpha KeyBindArrayOfArrays(5) = CLKey() - + 'Create SHIFT + F Keys Dim SFKey( 11 ) for FKey = 1 to 12 SFKey( Fkey - 1 ) = "SHIFT + F" + FKey next FKey KeyBindArrayOfArrays(6) = SFKey() - -End Sub + +End Sub Sub updateMapWithDisabledKeys() 'disable CONTROL + F1 & @@ -212,8 +212,8 @@ Sub updateMapWithDisabledKeys() keyAllocationMap( 3, 0 ).Name = "" 'disable CONTROL + F4 & keyAllocationMap( 3, 3 ).Value = 1 - keyAllocationMap( 3, 3 ).Name = "" - 'disable CONTROL + F6 + keyAllocationMap( 3, 3 ).Name = "" + 'disable CONTROL + F6 keyAllocationMap( 3, 5 ).Value = 1 keyAllocationMap( 3, 5 ).Name = "" @@ -243,24 +243,24 @@ Sub initialiseFileExtensions() if(languages(index) <> "Java") then xPropSet = oConfigAccess.getByName(languages(index)) extns() = xPropSet.getPropertyValue("SupportedFileExtensions") - extensions(index) = extns() + extensions(index) = extns() endif next index end sub Sub ExecuteEditDebug() - + locations = Array ( "User", "Share", "Document", "Filesystem" ) languages = Array ( "BeanShell", "JavaScript" ) dialogName = "EditDebug" - initialiseFileExtensions() + initialiseFileExtensions() bindingDialog = LoadDialog( "ScriptBindingLibrary", "EditDebug" ) PopulateLanguageCombo() PopulateLocationCombo() PopulateScriptList( languages(0), locations(0) ) - bindingDialog.execute() + bindingDialog.execute() End Sub Sub ExecuteKeyBinding() @@ -283,18 +283,18 @@ Sub ExecuteKeyBinding() bindingDialog.execute() end Sub - + Sub initialiseNavigationComboArrays() locations = Array ( "User", "Share", "Document", "Filesystem" ) ReDim languages(0) as String ReDim extensions(0) as Object languages(0) = "Java" REM extensions(0) = "" - + ' Setup languages array for all supported languages oServiceManager = GetProcessServiceManager() svrArray = oServiceManager.getAvailableServiceNames - + langCount = 1 for index = 0 to ubound(svrArray) iPos = inStr(svrArray(index), "ScriptProviderFor") @@ -308,7 +308,7 @@ Sub initialiseNavigationComboArrays() languages(langCount) = lang langCount = langCount + 1 endif - endif + endif next index initialiseFileExtensions() End Sub @@ -318,14 +318,14 @@ Sub ExecuteEventBinding dialogName = "Event" createAllEventTypes() createAllEventBindings() - + 'Populate application event bindings array (from config xml file) if not (ReadXMLToArray( "Event" )) then Exit Sub endif 'Populate document event bindings array (using Office API calls) ReadEventsFromDoc() - + bindingDialog = LoadDialog( "ScriptBindingLibrary", "EventsBinding" ) initialiseNavigationComboArrays() PopulateLanguageCombo() @@ -352,10 +352,10 @@ Sub ExecuteMenuBinding() PopulateSubMenuList( 1 ) subMenuList = bindingDialog.getControl("SubMenuList") - + subMenuList.selectItemPos( 0, true ) - bindingDialog.execute() + bindingDialog.execute() end Sub @@ -395,7 +395,7 @@ function GetDocumentType( bindingType as string ) as string else if bindingType = "Menu" then GetDocumentType() = "writermenubar.xml" - end if + end if end if elseif document.SupportsService("com.sun.star.presentation.PresentationDocument") then if bindingType = "Key" then @@ -403,7 +403,7 @@ function GetDocumentType( bindingType as string ) as string else if bindingType = "Menu" then GetDocumentType() = "impressmenubar.xml" - end if + end if end if elseif document.SupportsService("com.sun.star.presentation.PresentationDocument") then if bindingType = "Key" then @@ -411,7 +411,7 @@ function GetDocumentType( bindingType as string ) as string else if bindingType = "Menu" then GetDocumentType() = "impressmenubar.xml" - end if + end if end if elseif document.SupportsService("com.sun.star.drawing.DrawingDocument") then if bindingType = "Key" then @@ -419,7 +419,7 @@ function GetDocumentType( bindingType as string ) as string else if bindingType = "Menu" then GetDocumentType() = "drawmenubar.xml" - end if + end if end if else MsgBox ("Error: Couldn't determine configuration file type" + chr$(10) + chr$(10) + "Action: Please reinstall Scripting Framework",0,"Error" ) @@ -438,8 +438,8 @@ end function function getScriptURI( selectedScript as String ) as String combo = bindingDialog.getControl( "LocationCombo" ) - location = combo.text - if ( location = "User" ) then + location = combo.text + if ( location = "User" ) then location = "user" elseif ( location = "Share" ) then location = "share" @@ -477,9 +477,9 @@ function getScriptURI( selectedScript as String ) as String next n getScriptURI() = "script://" + scriptInfo.getLogicalName + "?language=" _ + scriptInfo.getLanguage() + "&amp;function=" + _ - scriptInfo.getFunctionName() + "&amp;location=" + location + scriptInfo.getFunctionName() + "&amp;location=" + location end if - + end function function GetOfficePath() as string @@ -488,7 +488,7 @@ function GetOfficePath() as string path = settings.getByName( "PathSettings" ) unformattedOfficePath = path.getPropertyValue( "UserPath" ) - dim officePath as string + dim officePath as string const removeFromEnd = "/user" const removeFromEndWindows = "\user" @@ -511,7 +511,7 @@ function GetOfficePath() as string REM Prompt user end if end if - + GetOfficePath() = officePath end function @@ -525,7 +525,7 @@ function ReadXMLToArray( bindingType as string ) as boolean if ( bindingType = "Event" ) then xmlfilename = "eventbindings.xml" endif - + simplefileaccess = CreateUnoService( "com.sun.star.ucb.SimpleFileAccess" ) filestream = simplefileaccess.openFileRead( "file://" + GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName ) @@ -537,11 +537,11 @@ function ReadXMLToArray( bindingType as string ) as boolean redim menuItemLinePosition( 30 ) as Integer redim scriptNames( 120 ) as string redim scriptLinePosition( 120) as integer - + lineCount = 1 menuCount = 1 scriptCount = 1 - + do while not textin.isEOF() xmlline = textin.readLine() xmlFile( lineCount ) = xmlline @@ -560,12 +560,12 @@ function ReadXMLToArray( bindingType as string ) as boolean end if lineCount = lineCount + 1 loop - + 'Set global variable numberOfLines (lineCount is one too many at end of the loop) numberOfLines = lineCount - 1 'Set global variable menuCount (it is one too many at end of the loop) menuCount = menuCount - 1 - + filestream.closeInput() ReadXMLToArray( ) = true Exit function @@ -595,8 +595,8 @@ sub evaluateForEvent( xmlline as string, lineCount as integer ) 'if the xml line identifies a script or SB macro dim scriptName as string dim lineNumber as integer - if instr( xmlline, "event:language=" + chr$(34) + "Script" ) > 0 then - eventName = ExtractEventNameFromXMLLine( xmlline ) + if instr( xmlline, "event:language=" + chr$(34) + "Script" ) > 0 then + eventName = ExtractEventNameFromXMLLine( xmlline ) scriptName = ExtractEventScriptFromXMLLine( xmlline ) lineNumber = lineCount elseif instr( xmlline, "event:language=" + chr$(34) + "StarBasic" ) > 0 then @@ -604,14 +604,14 @@ sub evaluateForEvent( xmlline as string, lineCount as integer ) scriptName = "Allocated to Office function" lineNumber = 1 end if - + 'Need to sequence to find the corresponding index for the event type for n = 0 to ubound( allEventTypesApp() ) if ( eventName = allEventTypes( n ).Name ) then allEventTypesApp( n ).Name = scriptName allEventTypesApp( n ).Value = lineNumber end if - next n + next n end sub @@ -621,14 +621,14 @@ function isOKscriptProps( props() as Object, eventName as string ) as Boolean test = ubound( props() ) isOKscriptProps() = true exit function - + ErrorHandler: isOKscriptProps() = false end function sub ReadEventsFromDoc() On Error Goto ErrorHandler - + eventSupplier = ThisComponent for n = 0 to ubound( allEventTypes() ) Dim scriptProps() as Object @@ -636,7 +636,7 @@ sub ReadEventsFromDoc() if ( ubound( scriptProps ) > 0 ) then if ( scriptProps(0).Value = "Script" ) then 'Script binding - allEventTypesDoc(n).Name = scriptProps(1).Value + allEventTypesDoc(n).Name = scriptProps(1).Value allEventTypesDoc(n).value = 2 elseif( scriptProps(0).Value = "StarBasic" ) then 'StarBasic macro @@ -646,9 +646,9 @@ sub ReadEventsFromDoc() end if end if next n - + exit sub - + ' eventProps is undefined if there are no event bindings in the doc ErrorHandler: reset @@ -657,7 +657,7 @@ end sub sub WriteEventsToDoc() On Error Goto ErrorHandler - + eventSupplier = ThisComponent for n = 0 to ubound( allEventTypes() ) scriptName = allEventTypesDoc( n ).Name @@ -674,7 +674,7 @@ sub WriteEventsToDoc() 'Mark document as modified ( should happen automatically as a result of calling the API ) ThisComponent.CurrentController.getModel().setModified( True ) exit sub - + ErrorHandler: reset msgbox( "Error calling UNO API for writing event bindings to the document" ) @@ -686,7 +686,7 @@ sub RemoveEventFromDocViaAPI( event as string ) dim dispatcher as object dim parser as object dim url as new com.sun.star.util.URL - + document = ThisComponent.CurrentController.Frame parser = createUnoService("com.sun.star.util.URLTransformer") dim args(0) as new com.sun.star.beans.PropertyValue @@ -696,7 +696,7 @@ sub RemoveEventFromDocViaAPI( event as string ) url.Complete = "script://_$ScriptFrmwrkHelper.removeEvent?" _ + "language=Java&function=ScriptFrmwrkHelper.removeEvent" _ + "&location=share" - + parser.parseStrict(url) disp = document.queryDispatch(url,"",0) disp.dispatch(url,args()) @@ -709,7 +709,7 @@ sub AddEventToDocViaAPI( scriptName as string, eventName as string ) properties( 0 ).Value = "Script" properties( 1 ).Name = "Script" properties( 1 ).Value = scriptName - + eventSupplier = ThisComponent nameReplace = eventSupplier.getEvents() nameReplace.replaceByName( eventName, properties() ) @@ -724,7 +724,7 @@ function getKeyTypeOffset( key as String ) as integer length = Len( key ) if ( length > 1 ) then getKeyTypeOffset() = 0 - + elseif ( key >= "0" AND key <= "9" ) then getKeyTypeOffset() = 1 else @@ -737,24 +737,24 @@ function getKeyGroupIndex( key as String, offset as Integer ) as Integer ' ensure -1 is returned cutKey = mid( key,2 ) - if ( cutKey <> "" ) then + if ( cutKey <> "" ) then acode = asc ( mid( cutKey,1,1) ) - if ( acode > 57 ) then + if ( acode > 57 ) then getKeyGroupIndex() = -1 exit function end if end if - + select case offset case 0: num = cint( cutKey ) getKeyGroupIndex() = num - 1 exit function - case 1: + case 1: num = asc( key ) - 48 getKeyGroupIndex() = num exit function - case 2: + case 2: num = asc( key ) - 65 getKeyGroupIndex() = num exit function @@ -785,16 +785,16 @@ Sub processKeyXMLLine( lineCount as Integer, xmlline as String ) key = ExtractKeyCodeFromXMLLine( xmlline ) keyTypeOffset = getKeyTypeOffset( key ) offsetIntoArrayOfArrays = offsetIntoArrayOfArrays + keyTypeOffset - + ' Calculate from the key the offset into key group array we need to point to KeyGroupIndex = getKeyGroupIndex( key, keyTypeOffset ) if ( offsetIntoArrayOfArrays = -1 ) then 'Unknown key group, no processing necessary Exit Sub - end if + end if if ( KeyGroupIndex > -1 ) then - - ' Determine if a script framework binding is present or not + + ' Determine if a script framework binding is present or not if instr( xmlline, "script://" ) > 0 then ' its one of ours so update its details scriptName = ExtractScriptIdFromXMLLine( xmlline ) @@ -807,12 +807,12 @@ Sub processKeyXMLLine( lineCount as Integer, xmlline as String ) end if end if - end if + end if End Sub Sub WriteXMLFromArray() On Error Goto ErrorHandler - cfgFile = GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName + cfgFile = GetOfficePath() + "user/config/soffice.cfg/" + xmlFileName updateCfgFile( cfgFile ) 'if ( false ) then' config stuff not in build yet if ( true ) then @@ -821,7 +821,7 @@ Sub WriteXMLFromArray() msgbox ("Office must be restarted before your changes will take effect."+ chr$(10)+"Also close the Office QuickStarter (Windows and Linux)", 48, "Assign Script (Java) To Menu" ) endif Exit Sub - + ErrorHandler: reset MsgBox ("Error: Unable to write to Star Office configuration file" + chr$(10) + "/" + GetOfficePath() + "user/config/soffice.cfg/" +xmlFileName + chr$(10) + chr$(10) + "Action: Please make sure you have write access to this file",0,"Error" ) @@ -836,7 +836,7 @@ Sub UpdateCfgFile ( fileName as String ) displayDialogFlag = false args(0) = ThisComponent args(1) = displayDialogFlag - + ScriptProvider = createUnoService("drafts.com.sun.star.script.framework.provider.MasterScriptProvider") ScriptProvider.initialize( args() ) Script = ScriptProvider.getScript("script://_$ScriptFrmwrkHelper.updateCfgFile?" _ @@ -879,19 +879,19 @@ sub AddNewEventBinding( scriptName as string, eventPosition as integer, isApp as 'scriptProp.Value = numberOfLines allEventTypesApp( eventPosition ).Name = scriptName allEventTypesApp( eventPosition ).Value = numberOfLines - + newline = " <event:event event:name=" + chr$(34) + event + chr$(34) newline = newline + " event:language=" + chr$(34) + "Script" + chr$(34) + " xlink:href=" + chr$(34) - newline = newline + scriptName + chr$(34) + " xlink:type=" + chr$(34) + "simple" + chr$(34) + "/>" + newline = newline + scriptName + chr$(34) + " xlink:type=" + chr$(34) + "simple" + chr$(34) + "/>" xmlFile( numberOfLines ) = newline - xmlFile( numberOfLines + 1 ) = "</event:events>" + xmlFile( numberOfLines + 1 ) = "</event:events>" numberOfLines = numberOfLines + 1 else 'scriptProp.Name = scriptName 'scriptProp.Value = 2 allEventTypesDoc( eventPosition ).Name = scriptName allEventTypesDoc( eventPosition ).Value = 2 - end if + end if end sub REM ----- Array update functions ----- @@ -902,7 +902,7 @@ sub AddNewMenuBinding( newScript as string, newMenuLabel as string, newLinePosit dim newLineInserted as boolean dim lineCounter as integer lineCounter = 1 - + do while lineCounter <= numberOfLines if not newLineInserted then REM If the line number is the position at which to insert the new line @@ -914,7 +914,7 @@ sub AddNewMenuBinding( newScript as string, newMenuLabel as string, newLinePosit else indent = GetMenuWhiteSpace( xmlFile( newLinePosition - 1 ) ) newXmlFile( lineCounter ) = ( indent + "<menu:menuitem menu:id="+chr$(34) + newScript + chr$(34)+" menu:helpid="+chr$(34)+"1929"+chr$(34)+" menu:label="+chr$(34)+ newMenuLabel + chr$(34)+"/>" ) - newXmlFile( lineCounter + 1 ) = xmlFile( lineCounter ) + newXmlFile( lineCounter + 1 ) = xmlFile( lineCounter ) end if REM added -1 for debug --> ' indent = GetMenuWhiteSpace( xmlFile( newLinePosition ) ) @@ -930,14 +930,14 @@ sub AddNewMenuBinding( newScript as string, newMenuLabel as string, newLinePosit end if lineCounter = lineCounter + 1 loop - + numberOfLines = numberOfLines + 1 - + REM read the new file into the global array for n = 1 to numberOfLines xmlFile( n ) = newXmlFile( n ) next n - + end sub @@ -955,11 +955,11 @@ sub AddNewKeyBinding( scriptName as string, shift as boolean, control as boolean end if keyCombo = keyCombo + key newLine = newLine + " xlink:href="+chr$(34)+ scriptName +chr$(34) +"/>" - + if ( control AND shift ) then offsetIntoArrayOfArrays = 0 elseif ( control ) then - offsetIntoArrayOfArrays = 3 + offsetIntoArrayOfArrays = 3 elseif ( shift ) then offsetIntoArrayOfArrays = 6 endif @@ -977,7 +977,7 @@ sub AddNewKeyBinding( scriptName as string, shift as boolean, control as boolean xmlFile( keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value ) = newLine else ' this is a new binding, create a new line in xml file - for n = 1 to numberOfLines + for n = 1 to numberOfLines if n = numberOfLines then xmlFile( n ) = newLine xmlFile( n + 1 ) = "</accel:acceleratorlist>" @@ -987,8 +987,8 @@ sub AddNewKeyBinding( scriptName as string, shift as boolean, control as boolean end if next n - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value = n - keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Name = scriptName + keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Value = n + keyAllocationMap( offsetIntoArrayOfArrays, KeyGroupIndex ).Name = scriptName numberOfLines = numberOfLines + 1 endif @@ -1016,7 +1016,7 @@ sub RemoveScriptNameAndPosition( keyComboPosition ) dim updatedScriptLinePosition( 120 ) as integer dim removedScript as boolean removedScript = false - + for n = 1 to scriptCount if not removedScript then if not( n = keyComboPosition ) then @@ -1029,7 +1029,7 @@ sub RemoveScriptNameAndPosition( keyComboPosition ) end if next n scriptCount = scriptCount - 1 - + for n = 1 to scriptCount scriptNames( n ) = updatedScriptNames( n ) next n @@ -1045,8 +1045,8 @@ Sub PopulateLanguageCombo() for n = LBOUND( languages() ) to UBOUND ( languages() ) langCombo.addItem( languages( n ), n ) next n - langCombo.setDropDownLineCount( n ) - langCombo.text = langCombo.getItem( 0 ) + langCombo.setDropDownLineCount( n ) + langCombo.text = langCombo.getItem( 0 ) End Sub Sub PopulateLocationCombo() @@ -1056,7 +1056,7 @@ Sub PopulateLocationCombo() displayDialogFlag = false args(0) = ThisComponent args(1) = displayDialogFlag - + ScriptProvider = createUnoService("drafts.com.sun.star.script.framework.provider.MasterScriptProvider") ScriptProvider.initialize( args() ) @@ -1065,7 +1065,7 @@ Sub PopulateLocationCombo() for n = LBOUND( locations() ) to UBOUND ( locations() ) locCombo.addItem( locations( n ), n ) next n - locCombo.setDropDownLineCount( n ) + locCombo.setDropDownLineCount( n ) locCombo.text = locCombo.getItem( 0 ) End Sub @@ -1077,7 +1077,7 @@ sub PopulateScriptList( lang as String, loc as String ) smgr = getProcessServiceManager() context = smgr.getPropertyValue( "DefaultContext" ) - scriptstoragemgr = context.getValueByName( "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager" ) + scriptstoragemgr = context.getValueByName( "/singletons/drafts.com.sun.star.script.framework.storage.theScriptStorageManager" ) scriptLocationURI = "USER" if ( loc = "Share" ) then scriptLocationURI = "SHARE" @@ -1104,10 +1104,10 @@ sub PopulateScriptList( lang as String, loc as String ) scriptextn = filesysScripts( index ) pos = lastIndexOf( scriptextn, "." ) scriptextn = mid( scriptextn, pos + 1, len( scriptextn ) - pos ) - + for extnsIndex = lbound(extns()) to ubound(extns()) extn = extns(extnsIndex) - if ( scriptextn = extn ) then + if ( scriptextn = extn ) then if ( detailedView ) then locnDisplayList( index ).Name = filesysScripts( index ) locnDisplayList( index ).Value = filesysScripts( index ) @@ -1117,7 +1117,7 @@ sub PopulateScriptList( lang as String, loc as String ) locnDisplayList( index ).Value = filesysScripts( index ) end if scriptList.addItem( locnDisplayList( index ).Name, index ) - exit for + exit for end if next extnsIndex next index @@ -1125,7 +1125,7 @@ sub PopulateScriptList( lang as String, loc as String ) scriptList.selectItemPos( 0, true ) REM !!!!At this point we exit the sub!!!! - exit sub + exit sub endif @@ -1146,7 +1146,7 @@ sub PopulateScriptList( lang as String, loc as String ) if ( lang = implementations( n ).getLanguage() ) then if ( detailedView ) then tempDisplayList( n ).Name = logicalName _ - + " [" + implementations( n ).getFunctionName() + "]" + + " [" + implementations( n ).getFunctionName() + "]" tempDisplayList( n ).Value = implementations( n ) else tempDisplayList( n ).Name = logicalName @@ -1170,7 +1170,7 @@ sub PopulateMenuCombo() for n = 1 to menuCount menuComboBox.addItem( menuItems( n ), n - 1 ) next n - menuComboBox.setDropDownLineCount( 8 ) + menuComboBox.setDropDownLineCount( 8 ) menuComboBox.text = menuComboBox.getItem( 0 ) end sub @@ -1194,7 +1194,7 @@ sub PopulateSubMenuList( menuItemPosition as integer ) REM Other wise get the line before the next top-level menu begins xmlEndLine = menuItemLinePosition( menuItemPosition + 1 ) - 1 end if - + for lineNumber = xmlStartLine to xmlEndLine REM Insert all sub-menus and sub-popupmenus if not( instr( xmlFile( lineNumber ), menuXMLTag ) = 0 ) and instr( xmlFile( lineNumber ), "menupopup") = 0 then @@ -1202,10 +1202,10 @@ sub PopulateSubMenuList( menuItemPosition as integer ) if subMenuIndent = " " then subMenuIndent = "" else - subMenuIndent = subMenuIndent + subMenuIndent + subMenuIndent = subMenuIndent + subMenuIndent end if if not( instr( xmlFile( lineNumber ), "menuseparator" ) = 0 ) then - subMenuItems( subMenuCount ) = subMenuIndent + "----------------" + subMenuItems( subMenuCount ) = subMenuIndent + "----------------" else subMenuName = ExtractLabelFromXMLLine( xmlFile( lineNumber ) ) REM Add script Name if there is one bound to menu item @@ -1230,7 +1230,7 @@ sub PopulateSubMenuList( menuItemPosition as integer ) 'if subMenuCount = 1 then if menuItems( menuItemPosition ) = "Format" then subMenuList.addItem( "Unable to Assign Scripts to this menu", 0 ) - else + else for n = 1 to subMenuCount - 1 subMenuList.addItem( subMenuItems( n ), n - 1 ) next n @@ -1253,7 +1253,7 @@ sub PopulateTopLevelKeyBindingList() allKeyGroupsArray(4) = "CONTROL + digits" allKeyGroupsArray(5) = "CONTROL + letters" allKeyGroupsArray(6) = "SHIFT + F keys" - + keyCombo = bindingDialog.getControl( "KeyCombo" ) keyCombo.removeItems( 0, keyCombo.getItemCount() ) pos = 0 @@ -1264,7 +1264,7 @@ sub PopulateTopLevelKeyBindingList() keyCombo.addItem( allKeyGroupsArray( n ), pos ) pos = pos +1 endif - next n + next n keyCombo.text = keyCombo.getItem( 0 ) end sub @@ -1301,17 +1301,17 @@ sub populateEventList( focusPosition as integer ) eventList.removeItems( 0, eventList.getItemCount() ) dim isApp as boolean - if allApps.state = true then ' Application event - isApp = true + if allApps.state = true then ' Application event + isApp = true else isApp = false end if - ' use allEventTypes() to fill list box + ' use allEventTypes() to fill list box ' for each element compare with allEventTypesApp dim scriptName as string - dim lineNumber as integer - for n = 0 to ubound( allEventTypes() ) + dim lineNumber as integer + for n = 0 to ubound( allEventTypes() ) ' If the line number is 1 then SB macro ' more than 1 it is the line number of the script if isApp and n > 12 then @@ -1322,7 +1322,7 @@ sub populateEventList( focusPosition as integer ) scriptName = allEventTypesApp( n ).Name else lineNumber = allEventTypesDoc( n ).Value - scriptName = allEventTypesDoc( n ).Name + scriptName = allEventTypesDoc( n ).Name end if stringToAdd = "" if ( lineNumber >= 1 ) then @@ -1330,7 +1330,7 @@ sub populateEventList( focusPosition as integer ) end if eventList.addItem( allEventTypes( n ).Value + " " + stringToAdd, n ) next n - + eventList.selectItemPos( focusPosition, true ) end sub @@ -1412,7 +1412,7 @@ sub createAllEventBindings() 'dim props as new com.sun.star.beans.PropertyValue 'props.Name = "" 'Name = script name 'props.Value = 0 'Value = 0 for empty, 1 for macro, linenumber for script - + ' Creates all types of event bindings for both Application and Document ' Initially both arrays have no bindings allocated to the events ' The value for Doc is only Script/macro name (no need for line number) @@ -1482,7 +1482,7 @@ function ExtractEventNameFromXMLLine( xmlline as string ) idEnd = instr( xmlline, chr$(34)+" event:language" ) idLength = idEnd - idStart event = mid( xmlline, idStart, idLength ) - + ExtractEventNameFromXMLLine() = event end function @@ -1491,7 +1491,7 @@ function ExtractKeyCodeFromXMLLine( XMLLine as string ) as string keyCode = mid( XMLLine, keyStart, ( len( XMLLine ) - keyStart ) ) keyEnd = instr( keyCode, chr$(34) ) keyCode = mid( keyCode, 1, keyEnd - 1 ) - + ExtractKeyCodeFromXMLLine() = keyCode end function @@ -1502,7 +1502,7 @@ function GetMenuWhiteSpace( MenuXMLLine as string ) as string for i = 1 to numberOfSpaces whiteSpace = whiteSpace + " " next i - + GetMenuWhiteSpace() = whiteSpace end function @@ -1510,11 +1510,11 @@ function IsAllocatedMenuItem( script as string ) as boolean foundMenuItem = false Allocated = false count = 0 - do + do count = count + 1 if strcomp( script, subMenuItems( count ) ) = 0 then foundMenuItem = true - end if + end if loop while not( foundMenuItem ) and count < subMenuCount linePosition = subMenuItemLinePosition( count ) @@ -1533,7 +1533,7 @@ function HasShiftKey( keyCombo ) as boolean else hasShift = true end if - + HasShiftKey = hasShift end function @@ -1544,7 +1544,7 @@ function HasControlKey( keyCombo ) as boolean else hasControl = true end if - + HasControlKey = hasControl end function @@ -1565,7 +1565,7 @@ REM ------ Event Handling Functions (Listeners) ------ sub KeyListListener() keyShortCutList = bindingDialog.getControl( "KeyList" ) selectedShortCut = keyShortCutList.getSelectedItem() - combo = bindingDialog.getControl( "KeyCombo" ) + combo = bindingDialog.getControl( "KeyCombo" ) menuScriptList = bindingDialog.getControl( "ScriptList" ) selectedScript = menuScriptList.getSelectedItem() @@ -1578,10 +1578,10 @@ sub KeyListListener() keyGroupIndex = n exit for end if - next n + next n selectedKeyIndex = keyShortCutList.getSelectedItemPos() - if keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Value > 1 then + if keyAllocationMap( keyGroupIndex, selectedKeyIndex ).Value > 1 then bindingDialog.Model.Delete.enabled = true bindingDialog.Model.AddOn.enabled = true if selectedScript <> "" then @@ -1627,13 +1627,13 @@ end sub 'Populates the SubMenuList with the appropriate menu items from the Top-level menu selected from the combo box sub MenuComboListener() - combo = bindingDialog.getControl( "MenuCombo" ) + combo = bindingDialog.getControl( "MenuCombo" ) newToplevelMenu = combo.text counter = 0 do counter = counter + 1 loop while not( newToplevelMenu = menuItems( counter ) ) - + PopulateSubMenuList( counter ) end sub @@ -1645,14 +1645,14 @@ sub fireLangLocComboListernerOnRet( eventobj as object ) end sub sub LangLocComboListener() - - combo = bindingDialog.getControl( "LanguageCombo" ) + + combo = bindingDialog.getControl( "LanguageCombo" ) language = combo.text combo = bindingDialog.getControl( "LocationCombo" ) - location = combo.text + location = combo.text PopulateScriptList( language,location ) - + 'Enable/disable Assign button scriptList = bindingDialog.getControl( "ScriptList" ) if not (dialogName = "EditDebug") then @@ -1660,7 +1660,7 @@ sub LangLocComboListener() bindingDialog.Model.NewButton.enabled = false end if end if - + if ( location = "Filesystem" ) and ( language <> "Java" ) then bindingDialog.Model.Browse.enabled = true if not (dialogName = "EditDebug") then @@ -1672,10 +1672,10 @@ sub LangLocComboListener() bindingDialog.Model.fsonly.enabled = false end if endif - + ' extra dialog dependent processing if dialogName = "Menu" then - ' will set New button to false if no text in LableBox + ' will set New button to false if no text in LabelBox MenuLabelBoxListener() elseif dialogName = "Key" then ' will set Assigne button to false if appropriate @@ -1683,7 +1683,7 @@ sub LangLocComboListener() elseif dialogName = "Event" then EventListListener() end if - + end sub REM a keypress listener that in turn fires the KeyCL on a return key even only @@ -1695,7 +1695,7 @@ end sub 'Populates the KeyList with the appropriate key combos from the Top-level key group selected from the combo box sub KeyComboListener() - combo = bindingDialog.getControl( "KeyCombo" ) + combo = bindingDialog.getControl( "KeyCombo" ) keyGroup = combo.text for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) if ( allKeyGroupsArray( n ) = keyGroup )then @@ -1737,7 +1737,7 @@ sub EventListListener() menuScriptList = bindingDialog.getControl( "ScriptList" ) selectedScript = menuScriptList.getSelectedItem() - + dim binding as integer if allApps.state = true then binding = allEventTypesApp( eventPos ).Value @@ -1750,7 +1750,7 @@ sub EventListListener() else bindingDialog.Model.Delete.enabled = false end if - + if ( binding = 1 ) then ' staroffice binding, can't assign bindingDialog.Model.NewButton.enabled = false @@ -1772,7 +1772,7 @@ function getFilePicker() as Object REM file dialog oFilePicker = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" ) - combo = bindingDialog.getControl( "LanguageCombo" ) + combo = bindingDialog.getControl( "LanguageCombo" ) language = combo.text currentFilter = "" @@ -1901,20 +1901,20 @@ end sub sub MenuDeleteButton() subMenuList = bindingDialog.getControl( "SubMenuList" ) linePos = subMenuItemLinePosition( subMenuList.getSelectedItemPos() + 1 ) - + RemoveBinding( linePos ) - REM Update the top-level menu's line positions - combo = bindingDialog.getControl( "MenuCombo" ) + REM Update the top-level menu's line positions + combo = bindingDialog.getControl( "MenuCombo" ) newToplevelMenu = combo.text counter = 0 do counter = counter + 1 loop while not( newToplevelMenu = menuItems( counter ) ) - UpdateTopLevelMenus( counter + 1, false ) - + UpdateTopLevelMenus( counter + 1, false ) + MenuComboListener() - + subMenuList.selectItemPos( subMenuList.getSelectedItemPos(), true ) end sub @@ -1928,7 +1928,7 @@ sub MenuNewButton() subMenuList = bindingDialog.getControl( "SubMenuList" ) REM Update the top-level menu's line positions - combo = bindingDialog.getControl( "MenuCombo" ) + combo = bindingDialog.getControl( "MenuCombo" ) newToplevelMenu = combo.text counter = 0 do @@ -1936,9 +1936,9 @@ sub MenuNewButton() loop while not( newToplevelMenu = menuItems( counter ) ) UpdateTopLevelMenus( counter + 1, true ) - REM New line position is one ahead of the selected sub menu item + REM New line position is one ahead of the selected sub menu item linePos = subMenuItemLinePosition( subMenuList.getSelectedItemPos() + 1 ) + 1 - + AddNewMenuBinding( scriptURI, newMenuLabel, linePos ) MenuComboListener() @@ -1953,7 +1953,7 @@ sub BrowseButton() Dim sFiles As Variant oFilePicker = getFilePicker() - + REM execute file dialog If oFilePicker.execute() Then sFiles = oFilePicker.getFiles() @@ -1982,11 +1982,11 @@ sub BrowseButton() end if next index End If - End If + End If LangLocComboListener() End Sub -sub KeyOKButton() +sub KeyOKButton() WriteXMLFromArray() bindingDialog.endExecute() end sub @@ -2015,13 +2015,13 @@ sub KeyNewButton() menuScriptList = bindingDialog.getControl( "ScriptList" ) script = menuScriptList.getSelectedItem() scriptURI = getScriptURI( script ) - + keyList = bindingDialog.getControl( "KeyList" ) keyIndex = keyList.getSelectedItemPos() ShortCutKeyArray() = KeyBindArrayOfArrays( keyGroupIndex ) keyText = ShortCutKeyArray( keyIndex ) - - AddNewKeyBinding( scriptURI, HasShiftKey( keyText ), HasControlKey( keyText ), ExtractKeyFromCombo( keyText ) ) + + AddNewKeyBinding( scriptURI, HasShiftKey( keyText ), HasControlKey( keyText ), ExtractKeyFromCombo( keyText ) ) KeyComboListener() end sub @@ -2036,7 +2036,7 @@ sub KeyDeleteButton() keyGroup = combo.text dim keyGroupIndex as Integer dim selectedKeyIndex as Integer - for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) + for n = lbound ( allKeyGroupsArray() ) to ubound ( allKeyGroupsArray() ) if ( allKeyGroupsArray( n ) = keyGroup )then keyGroupIndex = n exit for @@ -2060,7 +2060,7 @@ sub EventNewButton() allApps = bindingDialog.getControl( "AllAppsOption" ) dim isApp as boolean - if allApps.state = true then 'Application + if allApps.state = true then 'Application isApp = true else 'Document isApp = false @@ -2084,14 +2084,14 @@ sub EventDeleteButton() 'eventProp.Name = "" 'eventProp.Value = 0 allEventTypesApp( eventPosition ).Name = "" - allEventTypesApp( eventPosition ).Value = 0 + allEventTypesApp( eventPosition ).Value = 0 RemoveBinding( linePosition ) else 'Document 'DeleteEvent( allEventTypes( eventPosition ) ) - allEventTypesDoc( eventPosition ).Name = "" + allEventTypesDoc( eventPosition ).Name = "" allEventTypesDoc( eventPosition ).Value = 0 end if - + PopulateEventList( eventPosition ) EventListListener() end sub |