diff --git a/PokemonGoIV/0Main.vb b/PokemonGoIV/0Main.vb index 609334b..6edd1aa 100644 --- a/PokemonGoIV/0Main.vb +++ b/PokemonGoIV/0Main.vb @@ -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 , 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 diff --git a/PokemonGoIV/1Data.vb b/PokemonGoIV/1Data.vb index 51b3f6b..76852c1 100644 --- a/PokemonGoIV/1Data.vb +++ b/PokemonGoIV/1Data.vb @@ -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 , 2016-12-06 ' Generated with 9Load.subReadDataSheets () diff --git a/PokemonGoIV/8Registry.vb b/PokemonGoIV/8Registry.vb new file mode 100644 index 0000000..0ee9ffe --- /dev/null +++ b/PokemonGoIV/8Registry.vb @@ -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 diff --git a/PokemonGoIV/9Load.vb b/PokemonGoIV/9Load.vb index 91138a3..c416308 100644 --- a/PokemonGoIV/9Load.vb +++ b/PokemonGoIV/9Load.vb @@ -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 , 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 , " & Format (Date (), "yyyy-mm-dd") & Chr (10) _ & "' Generated with 9Load.subReadDataSheets ()" & Chr (10) _ diff --git a/excludes/team-instinct-vector.svg b/excludes/team-instinct-vector.svg new file mode 100644 index 0000000..0d83e15 --- /dev/null +++ b/excludes/team-instinct-vector.svg @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + diff --git a/excludes/team-mystic-vector.svg b/excludes/team-mystic-vector.svg new file mode 100644 index 0000000..3bd124d --- /dev/null +++ b/excludes/team-mystic-vector.svg @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/excludes/team-valor-vector.svg b/excludes/team-valor-vector.svg new file mode 100644 index 0000000..8cb37d9 --- /dev/null +++ b/excludes/team-valor-vector.svg @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + diff --git a/oxt/AddonConfiguration.xcs b/oxt/AddonConfiguration.xcs new file mode 100644 index 0000000..e5405ca --- /dev/null +++ b/oxt/AddonConfiguration.xcs @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oxt/AddonConfiguration.xcu b/oxt/AddonConfiguration.xcu new file mode 100644 index 0000000..32a65b9 --- /dev/null +++ b/oxt/AddonConfiguration.xcu @@ -0,0 +1,63 @@ + + + + + + + + PokemonGoIV + + + Calculates the individual values (IVs) of the Pokémon. + 計算寶可夢的 IV 值。 + + + @VERSION@ + + + Apache License + + + imacat + 依瑪貓 + + + imacat@mail.imacat.idv.tw + + + Copyright © 2016 imacat + 版權所有 © 2016 依瑪貓 + + + + + + + + + + %origin%/icons/team-valor.png + + + + + %origin%/icons/team-mystic.png + + + + + %origin%/icons/team-instinct.png + + + + + + + + + Found no matching IV. + 找不出符合的 IV 值。 + + + + diff --git a/oxt/META-INF/manifest.xml b/oxt/META-INF/manifest.xml index d7cb8ef..8db909b 100644 --- a/oxt/META-INF/manifest.xml +++ b/oxt/META-INF/manifest.xml @@ -3,5 +3,7 @@ + + diff --git a/oxt/PokemonGoIV/0Main.xba b/oxt/PokemonGoIV/0Main.xba index d28fb1d..f14bfcf 100644 --- a/oxt/PokemonGoIV/0Main.xba +++ b/oxt/PokemonGoIV/0Main.xba @@ -1,6 +1,20 @@ -' 0Main: The main module for the Pokémon GO IV calculator +' 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 Option Explicit @@ -81,6 +95,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 diff --git a/oxt/PokemonGoIV/1Data.xba b/oxt/PokemonGoIV/1Data.xba index 9e5ab7c..12666b1 100644 --- a/oxt/PokemonGoIV/1Data.xba +++ b/oxt/PokemonGoIV/1Data.xba @@ -1,6 +1,20 @@ -' 1Data: The Pokémon GO data for IV calculation +' 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 () diff --git a/oxt/PokemonGoIV/8Registry.xba b/oxt/PokemonGoIV/8Registry.xba new file mode 100644 index 0000000..ab34638 --- /dev/null +++ b/oxt/PokemonGoIV/8Registry.xba @@ -0,0 +1,58 @@ + + +' 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 + \ No newline at end of file diff --git a/oxt/PokemonGoIV/9Load.xba b/oxt/PokemonGoIV/9Load.xba index 35785b9..3ae3092 100644 --- a/oxt/PokemonGoIV/9Load.xba +++ b/oxt/PokemonGoIV/9Load.xba @@ -1,6 +1,20 @@ -' 9Load: The Pokémon GO data sheets loader +' 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 Option Explicit @@ -11,6 +25,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) _ diff --git a/oxt/PokemonGoIV/DialogStrings_en_US.properties b/oxt/PokemonGoIV/DialogStrings_en_US.properties index fb69cda..2820e17 100644 --- a/oxt/PokemonGoIV/DialogStrings_en_US.properties +++ b/oxt/PokemonGoIV/DialogStrings_en_US.properties @@ -1,8 +1,8 @@ # Strings for Dialog Library PokemonGoIV 2.DlgMain.HelpText= -3.DlgMain.Title=Pok\u00c3\u00a9mon GO IV Calculator +3.DlgMain.Title=Pok\u00e9mon GO IV Calculator 22.DlgMain.txtPokemon.HelpText= -23.DlgMain.txtPokemon.Label=~Pok\u00c3\u00a9mon: +23.DlgMain.txtPokemon.Label=~Pok\u00e9mon: 26.DlgMain.txtCP.HelpText= 27.DlgMain.txtCP.Label=~CP: 28.DlgMain.numCP.HelpText= @@ -14,7 +14,7 @@ 40.DlgMain.txtPlayerLevel.HelpText= 41.DlgMain.txtPlayerLevel.Label=Player ~level: 46.DlgMain.cbxIsNew.HelpText= -47.DlgMain.cbxIsNew.Label=This Pok\u00c3\u00a9mon is ~newly-caught and was not powered-up yet. +47.DlgMain.cbxIsNew.Label=This Pok\u00e9mon has not been powered-up yet. 50.DlgMain.grpApprasals.HelpText= 51.DlgMain.grpApprasals.Label=Team Leader Apprasal 85.DlgMain.btnOK.HelpText= @@ -39,3 +39,5 @@ 195.DlgMain.txtBestAfter.HelpText= 201.DlgMain.cbxBest2.HelpText= 203.DlgMain.cbxBest3.HelpText= +205.DlgMain.imgTeam.HelpText= +207.DlgMain.imgTeam.HelpText= diff --git a/oxt/PokemonGoIV/DialogStrings_zh_TW.properties b/oxt/PokemonGoIV/DialogStrings_zh_TW.properties index 4820686..a420a33 100644 --- a/oxt/PokemonGoIV/DialogStrings_zh_TW.properties +++ b/oxt/PokemonGoIV/DialogStrings_zh_TW.properties @@ -14,7 +14,7 @@ 40.DlgMain.txtPlayerLevel.HelpText= 41.DlgMain.txtPlayerLevel.Label=\u73a9\u5bb6\u7b49\u7d1a(~L)\uff1a 46.DlgMain.cbxIsNew.HelpText= -47.DlgMain.cbxIsNew.Label=\u6211\u525b\u6293\u5230\u9019\u96bb\u5bf6\u53ef\u5922\uff0c\u9084\u6c92\u5f37\u5316\u904e(~N)\u3002 +47.DlgMain.cbxIsNew.Label=\u9019\u96bb\u5bf6\u53ef\u5922\u9084\u6c92\u5f37\u5316\u904e(~N)\u3002 50.DlgMain.grpApprasals.HelpText= 51.DlgMain.grpApprasals.Label=\u968a\u9577\u8a55\u50f9 85.DlgMain.btnOK.HelpText= @@ -39,3 +39,5 @@ 195.DlgMain.txtBestAfter.HelpText= 201.DlgMain.cbxBest2.HelpText= 203.DlgMain.cbxBest3.HelpText= +205.DlgMain.imgTeam.HelpText= +207.DlgMain.imgTeam.HelpText= diff --git a/oxt/PokemonGoIV/DlgMain.xdl b/oxt/PokemonGoIV/DlgMain.xdl index 9fac6a1..2c6439d 100644 --- a/oxt/PokemonGoIV/DlgMain.xdl +++ b/oxt/PokemonGoIV/DlgMain.xdl @@ -5,6 +5,7 @@ + @@ -260,6 +261,7 @@ + diff --git a/oxt/PokemonGoIV/script.xlb b/oxt/PokemonGoIV/script.xlb index f2a3b24..fc8d57b 100644 --- a/oxt/PokemonGoIV/script.xlb +++ b/oxt/PokemonGoIV/script.xlb @@ -4,4 +4,5 @@ + \ No newline at end of file diff --git a/oxt/icons/team-instinct.png b/oxt/icons/team-instinct.png new file mode 100644 index 0000000..45b58d9 Binary files /dev/null and b/oxt/icons/team-instinct.png differ diff --git a/oxt/icons/team-mystic.png b/oxt/icons/team-mystic.png new file mode 100644 index 0000000..7523dfa Binary files /dev/null and b/oxt/icons/team-mystic.png differ diff --git a/oxt/icons/team-valor.png b/oxt/icons/team-valor.png new file mode 100644 index 0000000..df5bbcb Binary files /dev/null and b/oxt/icons/team-valor.png differ