Singleton

From Apache OpenOffice Wiki
Jump to: navigation, search



A singleton declaration defines a global name for a UNO object and determines that there can only be one instance of this object that must be reachable under this name. The singleton instance can be retrieved from the component context using the name of the singleton. If the singleton has not been instantiated yet, the component context creates it. A new-style singleton declaration, that binds a singleton name to an object with a certain interface type, looks like this:

  singleton thePackageManagerFactory: 
  com::sun::star::depoyment::XPackageManager;

There are also old-style singletons, which reference (old-style) services instead of interfaces.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages