2016-12-07 01:50:28 +08:00
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
2017-05-05 11:42:03 +08:00
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="7Registry" script:language="StarBasic">' 7Registry: Utilities used from other modules to access to PokemonGoIV private configuration
2016-12-07 01:50:28 +08:00
' Taken from TextToColumns, 2016-12-07
Option Explicit
Const BASE_KEY As String = "/org.openoffice.Office.Addons.PokemonGoIV.AddonConfiguration/"
' fnGetImageUrl: Returns the image URL for the UNO image controls.
Function fnGetImageUrl (sName As String) As String
2016-12-12 17:13:09 +08:00
BasicLibraries.loadLibrary "Tools"
2017-03-01 23:48:57 +08:00
Dim oRegKey As Object
2016-12-07 16:37:48 +08:00
2016-12-12 17:13:09 +08:00
oRegKey = GetRegistryKeyContent (BASE_KEY & "FileResources/" & sName)
2016-12-07 01:50:28 +08:00
fnGetImageUrl = fnExpandMacroFieldExpression (oRegKey.Url)
End Function
2016-12-07 16:37:48 +08:00
' fnGetResString: Returns the localized text string.
Function fnGetResString (sID As String) As String
2016-12-12 17:13:09 +08:00
BasicLibraries.loadLibrary "Tools"
2016-12-07 16:37:48 +08:00
Dim oRegKey As Object
2016-12-12 17:13:09 +08:00
oRegKey = GetRegistryKeyContent (BASE_KEY & "Messages/" & sID)
2016-12-07 16:37:48 +08:00
fnGetResString = oRegKey.Text
End Function
2016-12-07 01:50:28 +08:00
' fnExpandMacroFieldExpression
Function fnExpandMacroFieldExpression (sURL As String) As String
2017-03-01 23:48:57 +08:00
Dim sTemp As String
Dim oSM As Object
Dim oMacroExpander As Object
2016-12-07 01:50:28 +08:00
' Gets the service manager
oSM = getProcessServiceManager
' Gets the macro expander
oMacroExpander = oSM.DefaultContext.getValueByName ( _
2017-03-01 23:48:57 +08:00
"/singletons/com.sun.star.util.theMacroExpander")
2016-12-07 01:50:28 +08:00
'cut the vnd.sun.star.expand: part
sTemp = Join (Split (sURL, "vnd.sun.star.expand:"))
'Expand the macrofield expression
sTemp = oMacroExpander.ExpandMacros (sTemp)
sTemp = Trim (sTemp)
fnExpandMacroFieldExpression = sTemp
End Function
</script:module>