summaryrefslogtreecommitdiff
path: root/wizards/com/sun/star/wizards/common/Configuration.py
diff options
context:
space:
mode:
Diffstat (limited to 'wizards/com/sun/star/wizards/common/Configuration.py')
-rw-r--r--wizards/com/sun/star/wizards/common/Configuration.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/wizards/com/sun/star/wizards/common/Configuration.py b/wizards/com/sun/star/wizards/common/Configuration.py
index 5e42356efede..dbaf6ddc1766 100644
--- a/wizards/com/sun/star/wizards/common/Configuration.py
+++ b/wizards/com/sun/star/wizards/common/Configuration.py
@@ -44,3 +44,67 @@ class Configuration(object):
sView = "com.sun.star.configuration.ConfigurationAccess"
return oConfigProvider.createInstanceWithArguments(sView, tuple(args))
+
+ @classmethod
+ def getProductName(self, xMSF):
+ try:
+ oProdNameAccess = self.getConfigurationRoot(xMSF, "org.openoffice.Setup/Product", False);
+ return oProdNameAccess.getByName("ooName")
+ except Exception:
+ traceback.print_exc()
+ return "Unknown"
+
+ @classmethod
+ def getNode(self, name, parent):
+ return parent.getByName(name)
+
+ # This method creates a new configuration node and adds it
+ # to the given view. Note that if a node with the given name
+ # already exists it will be completely removed from
+ # the configuration.
+ # @param configView
+ # @param name
+ # @return the new created configuration node.
+ # @throws com.sun.star.lang.WrappedTargetException
+ # @throws ElementExistException
+ # @throws NoSuchElementException
+ # @throws com.sun.star.uno.Exception
+ @classmethod
+ def addConfigNode(self, configView, name):
+ try:
+ node = configView.getByName(name)
+ except Exception:
+ node = None
+ if (node is not None):
+ return node
+ else:
+ # create a new detached set element (instance of DataSourceDescription)
+ # the new element is the result !
+ node = configView.createInstance()
+ # insert it - this also names the element
+ configView.insertByName(name, node)
+ return node
+
+ @classmethod
+ def removeNode(self, configView, name):
+ if (configView.hasByName(name)):
+ configView.removeByName(name)
+
+ @classmethod
+ def commit(self, configView):
+ configView.commitChanges()
+
+ @classmethod
+ def getChildrenNames(self, configView):
+ return configView.getElementNames()
+
+ @classmethod
+ def getInt(self, name, parent):
+ o = getNode(name, parent)
+ if (com.sun.star.uno.AnyConverter.isVoid(o)):
+ return 0
+ return com.sun.star.uno.AnyConverter.toInt(o)
+
+ @classmethod
+ def set(self, value, name, parent):
+ parent.setHierarchicalPropertyValue(name, value)