summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2006-03-22 09:53:27 +0000
committerOliver Bolte <obo@openoffice.org>2006-03-22 09:53:27 +0000
commit265025d520fc7558ff366d016a94557a2331de1c (patch)
tree3b4a3684b5816893a523c9276c586588bed398f3 /pyuno
parentf6e480a312ed0e70b590b660e9091a1ae315bc78 (diff)
INTEGRATION: CWS pyunofixes2 (1.3.40); FILE MERGED
2006/01/07 21:36:36 jbu 1.3.40.2: RESYNC: (1.3-1.4); FILE MERGED 2006/01/07 20:13:41 jbu 1.3.40.1: #i57379# added pyuno current context support
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/unohelper.py25
1 files changed, 21 insertions, 4 deletions
diff --git a/pyuno/source/module/unohelper.py b/pyuno/source/module/unohelper.py
index 5a31f2059131..94ece13bed92 100644
--- a/pyuno/source/module/unohelper.py
+++ b/pyuno/source/module/unohelper.py
@@ -4,9 +4,9 @@
#
# $RCSfile: unohelper.py,v $
#
-# $Revision: 1.4 $
+# $Revision: 1.5 $
#
-# last change: $Author: rt $ $Date: 2005-09-08 16:54:48 $
+# last change: $Author: obo $ $Date: 2006-03-22 10:53:27 $
#
# The Contents of this file are made available subject to
# the terms of GNU Lesser General Public License Version 2.1.
@@ -38,7 +38,7 @@ import os
import sys
from com.sun.star.lang import XTypeProvider, XSingleComponentFactory, XServiceInfo
-from com.sun.star.uno import RuntimeException
+from com.sun.star.uno import RuntimeException, XCurrentContext
from com.sun.star.beans.MethodConcept import ALL as METHOD_CONCEPT_ALL
from com.sun.star.beans.PropertyConcept import ALL as PROPERTY_CONCEPT_ALL
@@ -259,7 +259,24 @@ class Base(XTypeProvider):
return _unohelper_getHandle( self )[0]
def getImplementationId(self):
return _unohelper_getHandle( self )[1]
-
+
+class CurrentContext(XCurrentContext, Base ):
+ """a current context implementation, which first does a lookup in the given
+ hashmap and if the key cannot be found, it delegates to the predecessor
+ if available
+ """
+ def __init__( self, oldContext, hashMap ):
+ self.hashMap = hashMap
+ self.oldContext = oldContext
+
+ def getValueByName( self, name ):
+ if name in self.hashMap:
+ return self.hashMap[name]
+ elif self.oldContext != None:
+ return self.oldContext.getValueByName( name )
+ else:
+ return None
+
# -------------------------------------------------
# implementation details
# -------------------------------------------------