From Apache OpenOffice Wiki
Revision as of 15:49, 24 September 2009 by Hbrinkm (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Installing WriterFilter


The current CWS for WriterFilter is writerfilter07

Changing Filter Detection

For DOCX the new filter is the only and therefor the default.

If you want to use the new filter for WW8, too, do the following: In <SOINST>/share/registry/modules/org/openoffice/TypeDetection/Filter/fcfg_writer_filters.xcu add node with attribute oor:name="MS Word 97":

   <node oor:name="MS Word 97" oor:op="replace">
        <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER</value></prop>
        <prop oor:name="UIComponent"/>
        <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.WriterFilter</value></prop>
        <prop oor:name="UserData"><value>CWW8</value></prop>
        <prop oor:name="UIName">
            <value xml:lang="x-default">Microsoft Word 97/2000/XP (new)</value>
        <prop oor:name="FileFormatVersion"><value>0</value></prop>
        <prop oor:name="Type"><value>writer_MS_Word_97</value></prop>
        <prop oor:name="TemplateName"/>
        <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>

Remember to grant yourself write access to the xcu.

Now, if you load a file recognized as "Word 97", WriterFilter will be used.


There is a directory writerfilter/documentation/doxygen. It contains the Doxyfile to run doxygen with.

Debug tokenizers

You will need an installation of OpenOffice.org with the libraries from writerfilter delivered into the $SOINST/program directory.

Dump WW8 tokens

$SOINST/program/uno -l libwriterfilter.uno.so -c debugservices.doctok.ScannerTestService -- file://...

Dump WordprocessingML tokens

$SOINST/program/uno -l libwriterfilter.uno.so -c debugservices.ooxml.ScannerTestService -- file://...

Use TagLogger

The class writerfilter::TagLogger is defined in writerfilter/inc/resourcemodel/TagLogger.hxx.

It has a SAX like interface.


TagLogger::Pointer_t pLogger(TagLogger::getInstance(<name>)) // get an instance i.
pLogger->startDocument(); // start the document
pLogger->startElement(<element>); // start a new element
pLogger->attribute(<attribute>,<value>); // add an attribute to the current element
// add more attributes...
pLogger->chars(<string>); // add text to the current element
// add more text...
// add more nested elements...
pLogger->endElement(); // end the current element
// add more elements...
pLogger->endDocument(); // end the document
TagLogger::dump(<name>); // dump the TagLogger's content

The output will be written to


If $TAGLOGGERTMP is not set, /tmp will be used instead.

TagLogger is already used in writerfilter/source/{filter,ooxml,dmapper}. To activate, use the following defines while compiling (Please refer to writerfilter/inc/resourcemodel/WW8ResourceModel.hxx for more insight about what attributes, properties, stream or resolving mean in this context.):

This activates logging for elements ooxml. Has to be provided, when DEBUG_DOMAINMAPPER is set, too.
Logging of context-stack in ooxml
Logging of attributes in ooxml
Logging of properties in ooxml
Logging of resolving references in ooxml
Logging of allocation and deallocation of memory
Logging of stream content
Logging of token related events


The properties of sprm 0x6a03 (sprmCPicLocation) have to be resolved. Otherwise the FC of the picture to come is not stored.

Personal tools