WRITER : Extend support for RDF Metadata

Michael Stahl mstahl at redhat.com
Fri Nov 15 12:43:11 PST 2013

On 15/11/13 19:03, arkarell wrote:

> 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 !!!

wow, sounds great!

> 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.

yes... what is currently copied is just the xml:id, not the metadata.
that may still be useful, for example if you Cut and Paste in the same

> 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 ?

generally the UNO wrapper object is obvious, and the core object is the
one to which the UNO wrapper object has a pointer.

as you can see from code in untbl.cxx such as ...

  SwXTextTable::SwXTextTable(SwFrmFmt& rFrmFmt)
      : SwClient( &rFrmFmt )

... and SwXTextTable::attachToRange ...

                SwFrmFmt* pTblFmt = pTable->GetFrmFmt();
                lcl_FormatTable( pTblFmt );


... it is obvious (well it's obvious if you understand first that
SwClient/SwModify is the horribly deficient notification / observer
mechanism on which all of Writer is built) that you picked the right
class with SwTableFmt (which is a subclass of SwFrmFmt).

> Do you have some documentation to understand these objects (core, uno 
> wrapper, std or *Fmt, ...) and their relations ?

... not really ... you can look at the doxygen documentation[1] to get a
quick overview (especially useful to quickly see inheritance trees)...
and [2] is a useful article in general...  but usually for this purpose
it's a SwXFoo UNO wrapper class that is a SwClient of some core class,
which is sometimes a SwFrmFmt or subclass.  often there are several core
classes for different aspects of the entity.

things get especially tricky here if the core object is a SfxPoolItem,
like it is with SwXMeta and ::sw::Meta ... but i hope there aren't more
of these left that need an xml:id.

[1] http://docs.libreoffice.org/sw.html
[2] https://wiki.openoffice.org/wiki/Writer/Core_And_Layout

More information about the LibreOffice mailing list