LibreOffice LibreOffice 26.2 SDK API Reference

Exported Interfaces | Public Member Functions | List of all members
XDocumentMetadataAccess Interface Reference

document metadata functionality related to the "manifest.rdf". More...

`import"XDocumentMetadataAccess.idl";`

Inheritance diagram for XDocumentMetadataAccess:

## Exported Interfaces
interface | XURI
interface | XRepositorySupplier

## Public Member Functions
XMetadatable | getElementByMetadataReference ([in] com::sun::star::beans::StringPair MetadataReference)
| get the unique ODF element with the given metadata reference. More...
XMetadatable | getElementByURI ([in] XURI URI) raises ( com::sun::star::lang::IllegalArgumentException )
| get the ODF element that corresponds to a URI. More...
sequence< XURI > | getMetadataGraphsWithType ([in] XURI Type) raises ( com::sun::star::lang::IllegalArgumentException )
| get the names of all metadata files with a given type. More...
XURI | addMetadataFile ([in] string FileName, [in] sequence< XURI > Types) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException )
| add a metadata file to the manifest. More...
XURI | importMetadataFile ([in] short Format, [in] com::sun::star::io::XInputStream InStream, [in] string FileName, [in] XURI BaseURI, [in] sequence< XURI > Types) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::datatransfer::UnsupportedFlavorException, com::sun::star::container::ElementExistException, ParseException, com::sun::star::io::IOException )
| import a metadata file into the document repository, and add it to the manifest. More...
void | removeMetadataFile ([in] XURI GraphName) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException )
| remove a metadata file from the manifest and the repository. More...
void | addContentOrStylesFile ([in] string FileName) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException )
| add a content or styles file to the manifest. More...
void | removeContentOrStylesFile ([in] string FileName) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException )
| remove a content or styles file from the manifest. More...
void | loadMetadataFromStorage ([in] com::sun::star::embed::XStorage Storage, [in] XURI BaseURI, [in] com::sun::star::task::XInteractionHandler InteractionHandler) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
| initialize document metadata from a storage. More...
void | storeMetadataToStorage ([in] com::sun::star::embed::XStorage Storage) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
| store document metadata to a storage. More...
void | loadMetadataFromMedium ([in] sequence< com::sun::star::beans::PropertyValue > Medium) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
| loads document metadata from a medium. More...
void | storeMetadataToMedium ([in] sequence< com::sun::star::beans::PropertyValue > Medium) raises ( com::sun::star::lang::IllegalArgumentException, com::sun::star::lang::WrappedTargetException )
| stores document metadata to a medium. More...
Public Member Functions inherited from XRepositorySupplier
XRepository | getRDFRepository ()
| provides the RDF Repository associated with this object. More...

## Additional Inherited Members
Public Attributes inherited from XURI
string | Namespace
| prefix More...
string | LocalName
| suffix More...
Public Attributes inherited from XNode
string | StringValue
| the string value of the node. More...

## Detailed Description

document metadata functionality related to the "manifest.rdf".

This interface contains some methods that create connections between the content and the RDF metadata of an ODF document. The main idea is to make querying and manipulating the data in the metadata manifest easier.

Note that this interface inherits from XURI: the base URI of the document is the string value of the RDF node. This is so that you can easily make RDF statements about the document.

Since
  OOo 3.2

See also
  XDocumentRepository

## Exported Interfaces

## ◆ XRepositorySupplier

interface XRepositorySupplier

## ◆ XURI

interface XURI

## Member Function Documentation

## ◆ addContentOrStylesFile()

void addContentOrStylesFile | ( | [in] string | FileName | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::container::ElementExistException
| ) |  |

add a content or styles file to the manifest.

This convenience method adds the required statements declaring a content or styles file to the manifest graph.

- If the FileName ends in "content.xml", an `odf:ContentFile` is added.
- If the FileName ends in "styles.xml" , an `odf:StylesFile` is added.
- Other FileNames are invalid.

Parameters

  FileName | the name of the stream in the ODF storage

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the FileName is invalid
  com::sun::star::container::ElementExistException | if a stream with the given FileName already exists

## ◆ addMetadataFile()

XURI addMetadataFile | ( | [in] string | FileName,
|  | [in] sequence< XURI > | Types
| ) |  |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::container::ElementExistException
| ) |  |

add a metadata file to the manifest.

This convenience method does the following:

- create a new graph with the given name in the repository
- insert statements declaring the new graph to be a metadata file into the manifest graph
- insert statements declaring `rdf:type` properties for the new graph into the manifest graph

Parameters

  FileName | the name of the stream in the ODF storage where the graph will be stored
  Types | a list of types that will be inserted as `rdf:type` properties for the graph

Returns
  the name of the new graph

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the FileName is invalid
  com::sun::star::container::ElementExistException | if a stream with the given FileName already exists

## ◆ getElementByMetadataReference()

XMetadatable getElementByMetadataReference | ( | [in] com::sun::star::beans::StringPair | MetadataReference | ) |

get the unique ODF element with the given metadata reference.

Parameters

  MetadataReference | a metadata reference, comprising the stream name and the XML ID For example: Pair("content.xml", "foo-element-1")

Returns
  the ODF element with the given metadata references if it exists, else `NULL`

## ◆ getElementByURI()

XMetadatable getElementByURI | ( | [in] XURI | URI | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException
| ) |  |

get the ODF element that corresponds to a URI.

Parameters

  URI | a URI that may identify an ODF element

Returns
  the ODF element that corresponds to the given URI, or `NULL`

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the given URI is `NULL`

## ◆ getMetadataGraphsWithType()

sequence< XURI > getMetadataGraphsWithType | ( | [in] XURI | Type | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException
| ) |  |

get the names of all metadata files with a given type.

Parameters

  Type | the `rdf:type` property of the requested named graphs

Returns
  the names of all metadata graphs that have a `rdf:type` property with the given Type as object

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the given Type is `NULL`

## ◆ importMetadataFile()

XURI importMetadataFile | ( | [in] short | Format,
|  | [in] com::sun::star::io::XInputStream | InStream,
|  | [in] string | FileName,
|  | [in] XURI | BaseURI,
|  | [in] sequence< XURI > | Types
| ) |  |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::datatransfer::UnsupportedFlavorException,
|  | com::sun::star::container::ElementExistException,
|  | ParseException,
|  | com::sun::star::io::IOException
| ) |  |

import a metadata file into the document repository, and add it to the manifest.

This convenience method does the following:

1. import the given file into a graph with the given name in the repository
2. insert statements declaring the new graph to be a metadata file into the manifest graph
3. insert statements declaring `rdf:type` properties for the new graph into the manifest graph

Parameters

  Format | the file format, see FileFormat
  InStream | the input stream
  FileName | the name of the stream in the ODF storage where the graph will be stored
  BaseURI | a base URI to resolve relative URI references
  Types | a list of types that will be inserted as `rdf:type` properties for the graph

Returns
  the name of the new graph

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the given stream is `NULL`, or BaseURI is `NULL` and the format requires use of a base URI, or the FileName is invalid
  com::sun::star::datatransfer::UnsupportedFlavorException | if the format requested is unknown or not supported
  com::sun::star::container::ElementExistException | if a stream with the given FileName already exists
  ParseException | if the input does not conform to the specified file format.
  com::sun::star::io::IOException | if an I/O error occurs.

See also
  FileFormat

## ◆ loadMetadataFromMedium()

void loadMetadataFromMedium | ( | [in] sequence< com::sun::star::beans::PropertyValue > | Medium | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::lang::WrappedTargetException
| ) |  |

loads document metadata from a medium.

If the Medium contains an InteractionHandler, it will be used for error reporting.

Parameters

  Medium | the com::sun::star::document::MediaDescriptor representing the source

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the argument does not contain a URL or Stream property
  com::sun::star::lang::WrappedTargetException | if an error occurs while loading

See also
  com::sun::star::document::MediaDescriptor

## ◆ loadMetadataFromStorage()

void loadMetadataFromStorage | ( | [in] com::sun::star::embed::XStorage | Storage,
|  | [in] XURI | BaseURI,
|  | [in] com::sun::star::task::XInteractionHandler | InteractionHandler
| ) |  |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::lang::WrappedTargetException
| ) |  |

initialize document metadata from a storage.

This method re-initializes the document metadata, loads the stream named "manifest.rdf" from the storage, and then loads all metadata streams mentioned in the manifest.

Note that it is not an error if the storage does not contain a manifest. In this case, the document metadata will be default initialized.

If an InteractionHandler argument is given, it will be used for error reporting. Otherwise, errors will be reported as exceptions.

Parameters

  Storage | a storage, representing e.g. an ODF package file, or sub-document
  BaseURI | a base URI to resolve relative URI references

N.B.: when loading from an ODF package, the base URI is not the URI of the package, but the URI of the directory in the package that contains the metadata.rdf

Parameters

  InteractionHandler | an InteractionHandler, used for error reporting

Exceptions

  com::sun::star::lang::IllegalArgumentException | if any argument is `NULL`
  com::sun::star::lang::WrappedTargetException | if an error occurs while loading and no InteractionHandler given

## ◆ removeContentOrStylesFile()

void removeContentOrStylesFile | ( | [in] string | FileName | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::container::NoSuchElementException
| ) |  |

remove a content or styles file from the manifest.

This convenience method removes the statements declaring a content or styles file from the manifest graph.

Parameters

  FileName | the name of the stream in the ODF storage

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the FileName is invalid
  com::sun::star::container::NoSuchElementException | if a graph with the given GraphName does not exist

## ◆ removeMetadataFile()

void removeMetadataFile | ( | [in] XURI | GraphName | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::container::NoSuchElementException
| ) |  |

remove a metadata file from the manifest and the repository.

This convenience method does the following:

1. delete the graph with the given GraphName in the repository
2. remove the statements declaring the graph to be a metadata file from the manifest graph

Parameters

  GraphName | the name of the graph that is to be removed

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the given GraphName is `NULL`
  com::sun::star::container::NoSuchElementException | if a graph with the given GraphName does not exist

## ◆ storeMetadataToMedium()

void storeMetadataToMedium | ( | [in] sequence< com::sun::star::beans::PropertyValue > | Medium | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::lang::WrappedTargetException
| ) |  |

stores document metadata to a medium.

Parameters

  Medium | the com::sun::star::document::MediaDescriptor representing the target

Exceptions

  com::sun::star::lang::IllegalArgumentException | if the argument does not contain a URL or Stream property
  com::sun::star::lang::WrappedTargetException | if an error occurs while storing

See also
  com::sun::star::document::MediaDescriptor

## ◆ storeMetadataToStorage()

void storeMetadataToStorage | ( | [in] com::sun::star::embed::XStorage | Storage | ) |
raises | ( | com::sun::star::lang::IllegalArgumentException,
|  | com::sun::star::lang::WrappedTargetException
| ) |  |

store document metadata to a storage.

This method stores all the graphs in the document metadata repository to the given storage.

Note that to be stored correctly, a named graph must have a complete entry in the manifest graph.

Parameters

  Storage | a storage, representing e.g. an ODF package file, or sub-document

Exceptions

  com::sun::star::lang::IllegalArgumentException | if Storage argument is `NULL`
  com::sun::star::lang::WrappedTargetException | if an error occurs while loading

The documentation for this interface was generated from the following file:

- com/sun/star/rdf/XDocumentMetadataAccess.idl