WRITER : Extend support for RDF Metadata

arkarell arnaud.malguy at arkarell.com
Fri Nov 15 10:03:59 PST 2013

Hi Michael,

Thanks a lot for your detailled answer.

Le 15/11/2013 18:26, Michael Stahl a écrit :
> 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
>     Metadatable::RegisterAsCopyOf
> 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.
I managed few days ago to implement the points 1 and 2 for text:table.
I worked in analogy with what was done for sections.
I used the SwTableFmt core object and the SwXTextTable UNO wrapper 
object. But I also modified the SwXMLExport::ExportTable method in
sw/source/filter/xml/xmltble.cxx in order to export xml:id. And it's 
working, I can set and retrieve rdf metadata on tables !!!

I didn't treat any undo/copy/paste/merge, because first, as you said, 
specifications are missing and needs could be very different,  and second
because it doesn't seem to be already treated for yet supported 
elements. For instance, if i set metadata on a paragraph and copy/paste 
this paragraph,
the rdf data are not copied.

My problem in my modifications is that I put some code at some place but 
without knowledge of the purpose and links of impacted classes.
And I'm not sure to use the good class : for instance for table support 
in core object, why SwTableFmt and not SwTable ? Because SwSectionFmt ?
Do you have some documentation to understand these objects (core, uno 
wrapper, std or *Fmt, ...) and their relations ?




More information about the LibreOffice mailing list