结构

From Apache OpenOffice Wiki
Jump to: navigation, search



OpenOffice.org 中的结构用于创建其他 UNO 类型的组合。这些结构与仅包括公共成员变量的 C 结构或 Java 类相对应。

虽然结构不封装数据,但更易于作为整体传输,而不用来回封送 get()set() 调用。这对于远程 通信尤为有利。

可以通过 .(点)运算符获得对结构成员的访问权限,如下所示

  aProperty.Name = "ReadOnly";


在 Java、C++ 和 OpenOffice.org Basic 中,关键字 new 用于实例化结构。在 OLE 自动化中,使用 com.sun.star.reflection.CoreReflection 来获取 UNO 结构。请勿使用服务管理器创建结构。


  //In Java:
  com.sun.star.beans.PropertyValue aProperty = 
                  new com.sun.star.beans.PropertyValue();
  'In StarBasic
  Dim aProperty as new com.sun.star.beans.PropertyValue
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages