模块

From Apache OpenOffice Wiki
Jump to: navigation, search


模块是命名空间,与 C++ 中的命名空间或 Java 中的包类似。模块将服务、接口、结构、异常、枚举、类型定义、常数组以及子模块与相关的功能内容或性能组合在一起。使用它们在 API 中指定一致的块,这样可以生成结构良好的 API。例如,模块 com.sun.star.text 包含接口以及其他类型,用于进行文本处理。其他一些典型模块包括 com.sun.star.unocom.sun.star.drawingcom.sun.star.sheetcom.sun.star.table。一个模块内的标识符不会与其他模块内的标识符相冲突,因此,同一名称可能多次出现。API 参考的全局索引说明了确实存在这种情况。


尽管模块似乎与 OpenOffice.org 的各个部分相对应,但是 API 模块与 OpenOffice.org 应用程序 Writer、Calc 和 Draw 之间不存在直接的关系。Calc 和 Draw 中使用模块 com.sun.star.text 的接口。像 com.sun.star.stylecom.sun.star.document 等模块提供的普通服务和接口不是针对 OpenOffice.org 任何一个部分的。


您在 API 参考中看到的模块是通过在模块说明中嵌套 UNO IDL 类型进行定义的。例如,模块 com.sun.star.uno 包含接口 XInterface

  module com {
      module sun {
          module star {
              module uno {
                  interface XInterface {
                      ... 
                  }; 
              };
          };
      };
  };
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages