存储服务管理器已备后用

From Apache OpenOffice Wiki
Jump to: navigation, search


单个工厂需要使用一个静态 create_<ImplementationClass>() 函数。例如,create_MyService1Impl() 接受对组件上下文的引用,并使用 new ImplementationClass() 实例化实现类。<ImplementationClass> 要求使用对 com.sun.star.uno.XComponentContext 的引用,并在实例中存储引用已备将来使用,可以为它编写构造函数。

  static Reference< XInterface > SAL_CALL create_MyService2Impl(
      Reference< XComponentContext > const & xContext )
      SAL_THROW( () )
  {
      // passing the component context to the constructor of MyService2Impl
      return static_cast< lang::XTypeProvider * >( new MyService2Impl( xContext ) );
  }
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages