diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2021-12-08 19:12:05 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-12-08 19:37:30 +0100 |
commit | bf38dd800e6e4e820a0cef84e082d9bcee8e8133 (patch) | |
tree | 9b766a78f9c3b11d5877d1056504b14112932b3f /wizards/source/tools | |
parent | eee091a91cbf9e490d12c07befd16df2fdbf5f29 (diff) |
Simplify some Optional handling
Change-Id: I2ba326faa47531c1d7c71ac05a8dd211cebac199
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126513
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'wizards/source/tools')
-rw-r--r-- | wizards/source/tools/Misc.xba | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/wizards/source/tools/Misc.xba b/wizards/source/tools/Misc.xba index 2f06e92a5938..9aa6d2e2f380 100644 --- a/wizards/source/tools/Misc.xba +++ b/wizards/source/tools/Misc.xba @@ -58,7 +58,7 @@ End Function ' Connects to a registered Database -Function ConnecttoDatabase(DSName as String, UserID as String, Password as String, Optional Propertylist(), Optional DriverProperties() as New com.sun.star.beans.PropertyValue) +Function ConnectToDatabase(DSName as String, UserID as String, Password as String, Optional Propertylist(), Optional DriverProperties() as New com.sun.star.beans.PropertyValue) Dim oDBContext as Object Dim oDBSource as Object ' On Local Error Goto NOCONNECTION @@ -68,11 +68,7 @@ Dim oDBSource as Object ConnectToDatabase = oDBSource.GetConnection(UserID, Password) Else If Not IsMissing(Propertylist()) Then - If Not IsMissing(DriverProperties()) Then - RegisterNewDataSource(DSName, PropertyList(), DriverProperties()) - Else - RegisterNewDataSource(DSName, PropertyList()) - End If + RegisterNewDataSource(DSName, PropertyList(), DriverProperties()) oDBSource = oDBContext.GetByName(DSName) ConnectToDatabase = oDBSource.GetConnection(UserID, Password) Else @@ -114,14 +110,11 @@ 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 - GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath()) + If IsMissing(bForUpdate) Then bForUpdate = False + If bForUpdate Then + GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath()) Else - If bForUpdate Then - GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", aNodePath()) - Else - GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath()) - End If + GetRegistryKeyContent() = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", aNodePath()) End If End Function |