Document Links

From Apache OpenOffice Wiki
Jump to: navigation, search

Each data source can maintain an arbitrary number of document links. The primary purpose of this function is to provide a collection of database forms used with a database.

Documentation note.png This feature is highly deprecated and should not be used anymore. Since 2.0.0, documents are stored within a database file, and not only linked from a data source.

The links are available at the interface of a data source that has one method:

  com::sun::star::container::XNameAccess getBookmarks()

The returned service is a The DefinitionContainer is not only a XNameAccess, but a, that is, new links are added using insertByName() as described in the chapter First Steps. Besides the name access, links are obtained through and

The returned bookmarks are simple strings containing URLs. Usually forms are stored at file:/// URLs. The following example adds a new document to the data source Bibliography:

  public static void addDocumentLink(XMultiServiceFactory _rMSF) throws {
      XNameAccess xNameAccess = (XNameAccess)UnoRuntime.queryInterface(
      // we use the predefined Bibliography data source
      XDataSource xDS = (XDataSource)UnoRuntime.queryInterface(
          XDataSource.class, xNameAccess.getByName("Bibliography"));
      // we need the XBookmarksSupplier interface of the data source
      XBookmarksSupplier xBookmarksSupplier = ( XBookmarksSupplier )UnoRuntime.queryInterface(
          XBookmarksSupplier.class, xDS);
      // get container with bookmark URLs
      XNameAccess xBookmarks = xBookmarksSupplier.getBookmarks();
      XNameContainer xBookmarksContainer = (XNameContainer)UnoRuntime.queryInterface(
          XNameContainer.class, xBookmarks);
      // insert new link
      xBookmarksContainer.insertByName("MyLink", "file:///home/ada01/Form_Ada01_DSADMIN.Table1.odt");

To load a linked document, use the bookmark URL with the method loadComponentFromUrl() at the interface of the singleton that is available at the global service manager. For details about the Desktop, see Office Development.

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