WRITER : Extend support for RDF Metadata

Michael Stahl mstahl at redhat.com
Fri Nov 15 09:26:45 PST 2013

hi Arnaud,

sorry for late reply, somehow i missed your mail initially :(

On 06/11/13 10:00, Miklos Vajna wrote:
> Hi,
> On Thu, Oct 31, 2013 at 02:37:21PM +0100, arkarell <arnaud.malguy at arkarell.com> wrote:
>> I would like to extend support for "RDF metadata" in LibreOffice
>> Writer in order to be able to set metadata
>> on a lot of elements unsupported today like tables.
>> Is there anybody that could help me to find what source code are involved ?

unfortunately i don't have time to work on the implementation myself but
can point you to the relevant places in the code, answer questions and
review patches.

the main parts for adding an xml:id are:

1. derive the core object from sfx2::Metadatable
   and implement the pure virtual methods
   (see include/sfx2/Metadatable.hxx)

2. derive the UNO wrapper object from sfx2::MetadatableMixin
   and implement the pure virtual methods

3. adapt all places that copy the core object to call

4. for Undo, insert calls to Metadatable::CreateUndo
   and Metadatable::RestoreMetadata

5. in case the core object can be "merged" like paragraphs:
   add call to Metadatable::JoinMetadatable

of course you can "git grep" for these functions and classes to see
usage examples.

well one thing that is still a sort of unresolved conceptual issue is
how to copy/paste the RDF metadata in case some content entity with an
xml:id is copied.  especially _which_ RDF statements should be copied in
that case.

>> For information, I use the API of LibreOffice/OpenOffice for many
>> years now but it would be my first contribution at the LO code.
> There are two SfxPoolItems you can use to set metadata on items like
> paragraphs or tables:
> - SvXMLAttrContainerItem is used to store unknown XML attributes from
>   ODF (so they survive a roundtrip)
> - SfxGrabBagItem is a string-any map, so can store nested structures,
>   etc. -- but explicitly runtime-only, so ODF filter intentionally
>   ignores it.

that's totally not the way to go... the xml:id must be unique in the
document and these classes don't ensure that; they also don't make the
content entity available in the UNO RDF API.

On 13/11/13 12:14, Jan Holesovsky wrote:
> what you are searching for?  This applies to LibreOffice too if I am not
> mistaken.

yes that is still up to date since nothing has changed...


More information about the LibreOffice mailing list