From 4f954243e76c64fb09489cb5f501e395bf37e6ca Mon Sep 17 00:00:00 2001 From: LibreOļ¬ƒciant Date: Mon, 20 May 2019 10:06:15 +0200 Subject: - Partial refactoring using API calls - New bookmarks - Link from Basic Adv libraries to Platform page Caution: Please fix GlobalScope miss in parser in the first place! Change-Id: Ifeaa98d5491b659a1dddbdbe3dddc417779374cf Reviewed-on: https://gerrit.libreoffice.org/72583 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- source/text/sbasic/python/python_platform.xhp | 34 ++++++++++++++++++--------- source/text/sbasic/shared/03/lib_tools.xhp | 3 +++ source/text/sbasic/shared/03132100.xhp | 3 +++ 3 files changed, 29 insertions(+), 11 deletions(-) (limited to 'source') diff --git a/source/text/sbasic/python/python_platform.xhp b/source/text/sbasic/python/python_platform.xhp index 7ee0b379f9..acad02559f 100644 --- a/source/text/sbasic/python/python_platform.xhp +++ b/source/text/sbasic/python/python_platform.xhp @@ -21,10 +21,12 @@ Platform;isWindows Platform;ComputerName Platform;OSName + API;ConfigurationAccess + Tools;GetRegistryContent

Identifying the operating system

Identifying the operating system can be performed with Python or Basic language. - %PRODUCTNAME Basic lacks Mac OS X native recognition while ComputerName property is solely available for Windows. Basic calls to Python macros help overcome such limitations. + ComputerName property is solely available for Windows. Basic calls to Python macros help overcome %PRODUCTNAME Basic limitations.

Using a Python class:

import os, platform @@ -45,7 +47,8 @@ def PathDelimiter(self): return os.pathsep

Using a Basic classmodule:

- + %PRODUCTNAME Basic lacks MacOS X native recognition. Platform identification is possible using %PRODUCTNAME Application Programming Interface (API). + Option Compatible Option ClassModule Option Explicit @@ -59,24 +62,33 @@ End Property ' Platform.DirSeparator Public Property Get IsLinux As Boolean - isLinux = ( GetGUIType()=4 ) ' Applies to Mac OS X as well + isLinux = ( GetGUIType()=4 ) ' Applies to MacOS X as well End Property ' Platform.isLinux + Public Property Get IsMacOSX As Boolean + isMacOSX = ( OSName="MAC" ) + End Property ' Platform.isMacOSX + Public Property Get IsWindows As Boolean isWindows = ( GetGUIType()=1 ) End Property ' Platform.isWindows Public Property Get OSName As String - Select Case GetGUIType() - Case 1 : OSName = "Windows" - Case 4 : OSName = "Linux" - End Select + ' Return platform name as "MAC", "UNIX", "WIN" + ' Inferred from "Tools.UCB.ShowHelperDialog" function + + With Basiclibraries + If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools") + End With + Dim keyNode As Object 'com.sun.star.configuration.ConfigurationAccess + keyNode = Tools.Misc.GetRegistryKeyContent("org.openoffice.Office.Common/Help") + OSName = keyNode.GetByName("System") End Property ' Platform.OSName Public Property Get PathDelimiter As String Select Case OSName - Case "Linux" : PathDelimiter = ":" - Case "Windows" : PathDelimiter = ";" + Case "MAC", "UNIX" : PathDelimiter = ":" + Case "WIN" : PathDelimiter = ";" End Select End Property ' Platform.PathDelimiter @@ -107,7 +119,7 @@ - @@ -115,4 +127,4 @@ - + \ No newline at end of file diff --git a/source/text/sbasic/shared/03/lib_tools.xhp b/source/text/sbasic/shared/03/lib_tools.xhp index dcf6950a48..dac54b1688 100644 --- a/source/text/sbasic/shared/03/lib_tools.xhp +++ b/source/text/sbasic/shared/03/lib_tools.xhp @@ -1592,5 +1592,8 @@ +
+ +
diff --git a/source/text/sbasic/shared/03132100.xhp b/source/text/sbasic/shared/03132100.xhp index 0f04fb8fca..88aaa15719 100644 --- a/source/text/sbasic/shared/03132100.xhp +++ b/source/text/sbasic/shared/03132100.xhp @@ -48,6 +48,9 @@ MsgBox GetGUIType End Sub
+
+ +
-- cgit