office-gobmx/oox
Hossein c16158772d Using .md extension/Markdown syntax for modules README
Renaming all README files for all top level modules to README.md,
applying no content change at this stage to be able to track history
of the files. These files should be edited to use correct Markdown
syntax later.

Change-Id: I542fa3f3d32072156f16eaad2211a397cc212665
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112977
Tested-by: Jenkins
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
2021-03-24 11:46:14 +01:00
..
documentation
inc Make sal/config.h the first in pch 2021-03-09 06:51:51 +01:00
qa Drop some unused includes 2021-03-12 09:06:20 +01:00
source tdf#140714 Import graphics cropped into custom geometry as custom shapes. 2021-03-23 09:32:22 +01:00
util
AllLangMoTarget_oox.mk
CppunitTest_oox_crypto.mk
CppunitTest_oox_drawingml.mk
CppunitTest_oox_mathml.mk
CppunitTest_oox_shape.mk
CppunitTest_oox_tokenmap.mk
CppunitTest_oox_vba_compression.mk
CppunitTest_oox_vba_encryption.mk
CppunitTest_oox_vml.mk
CustomTarget_generated.mk
IwyuFilter_oox.yaml
Library_oox.mk
Makefile
Module_oox.mk
Package_customshapes.mk
Package_generated.mk
README.md Using .md extension/Markdown syntax for modules README 2021-03-24 11:46:14 +01:00
README.vars

Support for Office Open XML, the office XML-format designed by Microsoft.

== DrawingML Custom shapes and presets ==

Custom shapes are part of DrawingML and are different to binary ppt and VML in older formats. The import happens in oox/source/drawingml, where they are imported as LO's enhanced custom shape's. see offapi/com/sun/star/drawing/CustomShape.idl and offapi/com/sun/star/drawing/EnhancedCustomShape*.idl Check CustomShapeProperties::pushToPropSet() and see how custom shape properties are converted.

Preset shapes are custom shapes whose guides and handles have been defined in OOXML specification. By specifying preset type and the adjustment values, the reset can be taken from the shape definition.

example of drawingml preset:

     <a:prstGeom prst="star5">
       <a:avLst/>
     </a:prstGeom>

example of drawingml custom shape (equal to star5 preset):

we needed to extend our custom shapes for missing features and so 5 new segment commands were added. G command for arcto drawingml record and H I J K commands for darken, darkenless, lighten, lightenless records. the commands are save into ODF in special namespace drawooo, which is extension not yet in the standard. Thorsten suggested to put it in such a namespace and keep original (incomplete) geometry for backward compatibility, before we can extend the ODF. that's why you will see 2 of them in cases where some of the new commands was needed.

In order to convert preset shapes to LO's enhanced custom shape, we need to load shape definition of preset shapes. The procedure to convert the definition from OOXML spec for LO is documented ( also a script ) in oox/source/drawingml/customshapes/README. The scripts in oox/source/drawingml/customshapes/ also generate pptx files for single presets and also for all presets cshape-all.pptx. The cshape-all.pptx file is then loaded into Impress build with debug enabled in oox and the command line output contains information. The generated definition is oox-drawingml-cs-presets.

Check CustomShapeProperties::initializePresetDataMap() to see how generated presets data are loaded into LO. While importing presets, we prefix the name with "ooxml-" so that we can detect it on export as save it again as preset.

The generated pptx files can be used when debugging bugs in custom shapes import/export. also the cshape-all.pptx can be used to test the round trips. there's small problem with these pptx as they cannot be imported into powerpoint, but that can be fixed quickly. when fixed, we can use it to test powerpoint odp export and see how complete it is regarding custom shapes. OpenXML SDK tools might help when fixing cshape-all.pptx http://www.microsoft.com/en-us/download/details.aspx?id=30425

== Export == Here is how LO's enhanced custom shapes are exported:

  • Shape name is ooxml-* - they are imported from ooxml, export as is.
  • Denylist - ODF presets that has OOXML equivalent. We convert adjustment values case by case. Microsoft Office is rather strict about adjustment values, either none of them are provided so that default values are taken, or the exact set of handles have to be provided. In some cases we are converting from the preset with less handles to the one with more handles so that default values suitable for the odf one need to be provided.
  • Allowlist - ODF presets that has OOXML equivalent but looks a bit different, export them as PolyPolygon.

Check Andras Timar's presentation[1] and ShapeExport::WriteCustomShape() for further detail.

FUTURE WORK: because we have to make sure that all the roundtrips like PPTX --> ODP --> PPTX work correctly and doesn't lose data. the only problematic part is probably saving custom shapes (ie. not presets) to PPTX. that part of code predates work on custom shapes and is unable to export general custom shapes yet. It will need a bit of work as LO has more complex equations than DrawingML. other parts should work OK, PPTX --> ODP should work and don't lose any data. presets should already survive PPTX --> ODP --> PPTX roundtrip

[1]https://archive.fosdem.org/2016/schedule/event/drawingml/attachments/ slides/1184/export/events/attachments/drawingml/slides/1184/ andras_timar_fosdem_2016.pdf