...
- Activate XLSX export choice in calc_MS_Excel_2007_XML.xcu
In current code base 4.1, filter\source\config\fragments\filters\calc_MS_Excel_2007_XML.xcu, who defines XLSX files filter service, you can find below code:
...
- Register XLSX export service in oox\source\xls\excelfilter.cxx & oox\util\oox.component
In this file a service name was already defined as "com.sun.star.comp.oox.xls.ExcelFilter". See oox\source\xls\excelfilter.cxx, a object ExcelFilter was already there, and it implemented services of "com.sun.star.comp.oox.xls.ExcelFilter". See code:
...
- Add XLSX export entry point in oox\source\xls\excelfilter.cxx
In fact ExcelFilter is only a entry point of XLSX export, it isn't responsible for real export but will delegate to other object in sc module. In fact, in AOO code, real OOXML export is owned by each individual application, say sc, sd, sw. Usually export filters in application layer are located in the same folder as binary filters and use similar logic.
For example, in sc\source\filter\excel\xestream.cxx there are two classes, XclExpStream and XclExpXmlStream. XclExpStream is responsible exporting binary files, XclExpXmlStream is responsible for exporting OOXML files. Similar as binary filter, OOXML filters also export elements from parent to child and usually XclExpXmlXXX classes are OOXML specific and they have a SaveXml method for exporting their data. However, some classes are shared by both binary and OOXML filter. In this case, a Save method is for exporting binary data, a SaveXml method is for export OOXML dataexporting OOXML data.
Back to this example, in order to activate XclExpXmlStream, we need to add a method filter to ExcelFilter. Then once export XLSX files, this method will called from sfx2 automatically. In this method, we need to create a service, let's say "com.sun.star.comp.Calc.OOXMLExporter" and also need to implement this service in XclExpXmlStream. Then call the service, now XclExpXmlStream will take over the detailed export works.
- Register service and component at application side
Now the final step is to register the service at application side. In this example, we need to register a "com.sun.star.comp.Calc.OOXMLExporter" service and a service component to XclExpXmlStream. It is the most important and most complicated step. Please follow this wiki to get detail: https://wiki.openoffice.org/wiki/Uno/Cpp/Tutorials/component_tutorial
Now all works done, XclExpXmlStream should get worked when export a XLSX file.
PPTX and DOCX Export Framework
The framework of PPTX export is same with that of XLSX. DOCX is similar. But as sw is using gbuild but sc sd are still using dmake, the last step of previous section, register service and component, has some differences. I will not introduce in detail.