Context


A context is nothing more than a set of name -value pairs. OOo maintains a default context that is available with the function GetDefaultContext. You can use a context to pass arbitrary values to a service when it is created. When a service is created, it requires a context. CreateUnoService uses the default context when creating a service.

In OOo 1.1.0, the default context is used automatically, and there's little reason to do anything else. The OOo Developer's Guide states that future versions of OOo will rely heavily on context objects. The implication is that it will be common to create objects with a context that differs from the default.

The interfaces com.sun.star.lang.XSingleComponentFactory and com.sun.star.lang.XMultiComponentFactory both support creating a service with a context; they contain the method CreateInstanceWithContext(service_name, context). Use CreateUnoService unless you need to modify the context values. The only reason to use the function GetDefaultContext() is to retrieve values from the context. In other words, you aren't very likely to use this function.




OpenOffice.org Macros Explained
OpenOffice.org Macros Explained
ISBN: 1930919514
EAN: 2147483647
Year: 2004
Pages: 203

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net