Added first uno control image.

This commit is contained in:
2016-12-07 01:50:28 +08:00
parent 296cfe3baa
commit a8787c38f0
21 changed files with 683 additions and 7 deletions

View File

@ -1,3 +1,17 @@
' Copyright (c) 2016 imacat.
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
' 0Main: The main module for the Pokémon GO IV calculator
' by imacat <imacat@mail.imacat.idv.tw>, 2016-11-27
@ -79,6 +93,9 @@ Function fnAskParam As aFindIVParam
oDialog.getControl ("cbxBest3").setVisible (False)
oDialog.getControl ("lstApprasal2").setVisible (False)
' TODO: To be removed.
oDialog.getControl ("imgTeam").getModel.setPropertyValue ("ImageURL", fnGetImageUrl ("TeamValor"))
If oDialog.execute = 0 Then
aQuery.bIsCancelled = True
fnAskParam = aQuery

View File

@ -1,3 +1,17 @@
' Copyright (c) 2016 imacat.
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
' 1Data: The Pokémon GO data for IV calculation
' by imacat <imacat@mail.imacat.idv.tw>, 2016-12-06
' Generated with 9Load.subReadDataSheets ()

55
PokemonGoIV/8Registry.vb Normal file
View File

@ -0,0 +1,55 @@
' 8Registry: Utilities used from other modules to access to PokemonGoIV private configuration
' 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
Dim oRegKey As Object
oRegKey = fnGetRegistryKeyContent (BASE_KEY & "FileResources/" & sName)
fnGetImageUrl = fnExpandMacroFieldExpression (oRegKey.Url)
End Function
' fnGetRegistryKeyContent: Returns the registry key content
Function fnGetRegistryKeyContent (sKeyName as string, Optional bforUpdate as Boolean)
Dim oConfigProvider As Object
Dim aNodePath (0) As New com.sun.star.beans.PropertyValue
oConfigProvider = createUnoService ( _
"com.sun.star.configuration.ConfigurationProvider")
aNodePath(0).Name = "nodepath"
aNodePath(0).Value = sKeyName
If IsMissing (bForUpdate) Then
fnGetRegistryKeyContent = oConfigProvider.createInstanceWithArguments ("com.sun.star.configuration.ConfigurationAccess", aNodePath())
Else
If bForUpdate Then
fnGetRegistryKeyContent = oConfigProvider.createInstanceWithArguments ("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath())
Else
fnGetRegistryKeyContent = oConfigProvider.createInstanceWithArguments ("com.sun.star.configuration.ConfigurationAccess", aNodePath())
End If
End If
End Function
' fnExpandMacroFieldExpression
Function fnExpandMacroFieldExpression (sURL As String) As String
Dim sTemp As String
Dim oSM As Object
Dim oMacroExpander As Object
' Gets the service manager
oSM = getProcessServiceManager
' Gets the macro expander
oMacroExpander = oSM.DefaultContext.getValueByName ( _
"/singletons/com.sun.star.util.theMacroExpander")
'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

View File

@ -1,3 +1,17 @@
' Copyright (c) 2016 imacat.
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
' 9Load: The Pokémon GO data sheets loader
' by imacat <imacat@mail.imacat.idv.tw>, 2016-11-28
@ -9,6 +23,20 @@ Sub subReadDataSheets
Dim sOutput as String, mData As Variant
sOutput = "" _
& "' Copyright (c) 2016 imacat." & Chr (10) _
& "' " & Chr (10) _
& "' Licensed under the Apache License, Version 2.0 (the ""License"");" & Chr (10) _
& "' you may not use this file except in compliance with the License." & Chr (10) _
& "' You may obtain a copy of the License at" & Chr (10) _
& "' " & Chr (10) _
& "' http://www.apache.org/licenses/LICENSE-2.0" & Chr (10) _
& "' " & Chr (10) _
& "' Unless required by applicable law or agreed to in writing, software" & Chr (10) _
& "' distributed under the License is distributed on an ""AS IS"" BASIS," & Chr (10) _
& "' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied." & Chr (10) _
& "' See the License for the specific language governing permissions and" & Chr (10) _
& "' limitations under the License." & Chr (10) _
& Chr (10) _
& "' 1Data: The Pokémon GO data for IV calculation" & Chr (10) _
& "' by imacat <imacat@mail.imacat.idv.tw>, " & Format (Date (), "yyyy-mm-dd") & Chr (10) _
& "' Generated with 9Load.subReadDataSheets ()" & Chr (10) _