Kaydet (Commit) 2bd57a62 authored tarafından Xisco Fauli's avatar Xisco Fauli

fdo#37290: migrate Basic to new resource service

üst 34fd3756
...@@ -271,14 +271,18 @@ End Sub ...@@ -271,14 +271,18 @@ End Sub
Function InitResources(Description, ShortDescription as String) as boolean Function InitResources(Description, ShortDescription as String) as boolean
Dim xResource as Object
Dim aArgs(0) as String
On Error Goto ErrorOcurred On Error Goto ErrorOcurred
oResSrv = createUnoService( "com.sun.star.resource.VclStringResourceLoader" ) aArgs(0) = ShortDescription
If (IsNull(oResSrv)) then oConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
xResource = getProcessServiceManager().createInstanceWithArguments( "org.libreoffice.resource.ResourceIndexAccess", aArgs() )
If (IsNull(xResource)) then
InitResources = FALSE InitResources = FALSE
MsgBox( Description & ": No resource loader found", 16, GetProductName()) MsgBox("could not initialize ResourceIndexAccess")
Else Else
InitResources = TRUE InitResources = TRUE
oResSrv.FileName = ShortDescription oResSrv = xResource.getByName( "String" )
End If End If
Exit Function Exit Function
ErrorOcurred: ErrorOcurred:
...@@ -294,7 +298,7 @@ End Function ...@@ -294,7 +298,7 @@ End Function
Function GetResText( nID as integer ) As string Function GetResText( nID as integer ) As string
On Error Goto ErrorOcurred On Error Goto ErrorOcurred
If Not IsNull(oResSrv) Then If Not IsNull(oResSrv) Then
GetResText = oResSrv.getString( nID ) GetResText = oResSrv.getByIndex( nID )
Else Else
GetResText = "" GetResText = ""
End If End If
...@@ -814,4 +818,4 @@ End Sub ...@@ -814,4 +818,4 @@ End Sub
Function CalIsLeapYear(ByVal iYear as Integer) as Boolean Function CalIsLeapYear(ByVal iYear as Integer) as Boolean
CalIsLeapYear = ((iYear Mod 4 = 0) And ((iYear Mod 100 <> 0) Or (iYear Mod 400 = 0))) CalIsLeapYear = ((iYear Mod 4 = 0) And ((iYear Mod 100 <> 0) Or (iYear Mod 400 = 0)))
End Function End Function
</script:module> </script:module>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment