1<!-- 2 Licensed to the Apache Software Foundation (ASF) under one 3 or more contributor license agreements. See the NOTICE file 4 distributed with this work for additional information 5 regarding copyright ownership. The ASF licenses this file 6 to you under the Apache License, Version 2.0 (the 7 "License"); you may not use this file except in compliance 8 with the License. You may obtain a copy of the License at 9 10 http://www.apache.org/licenses/LICENSE-2.0 11 12 Unless required by applicable law or agreed to in writing, 13 software distributed under the License is distributed on an 14 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 KIND, either express or implied. See the License for the 16 specific language governing permissions and limitations 17 under the License. 18--> 19 20# Native OOXML Strict vs Transitional Export — Milestone W.1 21 22**Source:** Source audit only. 23**Confidence:** confirmed | probable | requires runtime verification 24 25--- 26 27## 1. Existing Export Paths Are Transitional-Only 28 29All three native export paths (XLSX, DOCX, and the absent PPTX) hardcode Transitional OOXML namespaces, relationship types, and content types. No existing export path can emit Strict OOXML. 30 31--- 32 33## 2. Hardcoded Transitional Assumptions by File 34 35### 2.1 XLSX — `main/sc/source/filter/excel/excdoc.cxx` 36 37| Assumption | Value | File:Line | Context | 38|------------|-------|-----------|---------| 39| SpreadsheetML namespace | `http://schemas.openxmlformats.org/spreadsheetml/2006/main` | `excdoc.cxx:793` | `ExcDocument::WriteXml()` — `startElement(XML_workbook, XML_xmlns, ...)` | 40| Office XML prefix | Hardcoded in `XclExpXmlStream` | `xestream.cxx` | Package stream creation | 41 42Strict OOXML uses the same SpreadsheetML namespace URI (`.../spreadsheetml/2006/main`) for both Transitional and Strict — the distinction for spreadsheets is primarily in the content types and the `Strict` attribute on the workbook. So XLSX has fewer Strict/Transitional differences than DOCX. 43 44### 2.2 DOCX — `main/sw/source/filter/ww8/docxexport.cxx` 45 46| Assumption | Value | File:Line | Context | 47|------------|-------|-----------|---------| 48| WordprocessingML namespace | `http://schemas.openxmlformats.org/wordprocessingml/2006/main` | `docxexport.cxx:609` | `WriteMainText()` — `FSNS(XML_xmlns, XML_w)` | 49| Office namespace | `urn:schemas-microsoft-com:office:office` | `docxexport.cxx:606` | `FSNS(XML_xmlns, XML_o)` | 50| Relationships namespace | `http://schemas.openxmlformats.org/officeDocument/2006/relationships` | `docxexport.cxx:607` | `FSNS(XML_xmlns, XML_r)` | 51| VML namespace | `urn:schemas-microsoft-com:vml` | `docxexport.cxx:608` | `FSNS(XML_xmlns, XML_v)` — Strict forbids VML | 52| Word 10 namespace | `urn:schemas-microsoft-com:office:word` | `docxexport.cxx:610` | `FSNS(XML_xmlns, XML_w10)` | 53| DrawingML wp namespace | `http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing` | `docxexport.cxx:611` | `FSNS(XML_xmlns, XML_wp)` | 54| Content type | `application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml` | `docxexport.cxx:650` | `openOutputStreamWithSerializer` | 55| Styles content type | `application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml` | `docxexport.cxx:403` | `InitStyles()` | 56| Numbering content type | `.../wordprocessingml.numbering+xml` | `docxexport.cxx:467` | `WriteNumbering()` | 57| FontTable content type | `.../wordprocessingml.fontTable+xml` | `docxexport.cxx:558` | `WriteFonts()` | 58| Style relationship type | `http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles` | `docxexport.cxx:399` | `InitStyles()` | 59| Footnotes relationship type | `.../2006/relationships/footnotes` | `docxexport.cxx:422` | `WriteFootnotesEndnotes()` | 60| Endnotes relationship type | `.../2006/relationships/endnotes` | `docxexport.cxx:443` | `WriteFootnotesEndnotes()` | 61| Header relationship type | `.../2006/relationships/header` | `docxexport.cxx:500` | `WriteHeaderFooter()` | 62| Footer relationship type | `.../2006/relationships/footer` | `docxexport.cxx:515` | `WriteHeaderFooter()` | 63| FontTable relationship type | `.../2006/relationships/fontTable` | `docxexport.cxx:558` | `WriteFonts()` | 64| OfficeDocument relationship type | `.../2006/relationships/officeDocument` | `docxexport.cxx:645` | `DocxExport()` constructor | 65 66Strict OOXML uses: 67 68- WordprocessingML namespace: `http://purl.oclc.org/ooxml/wordprocessingml/main` (instead of `.../2006/main`) 69- Relationship types: `.../officeDocument/2010/relationships/...` (instead of `.../2006/relationships/...`) 70- Strict content types with `strict` marker 71- No VML (drawingML only) 72 73### 2.3 `main/sw/source/filter/ww8/docxattributeoutput.cxx` 74 75No additional Transitional assumptions found beyond those in `docxexport.cxx`. The attribute output methods emit Transitional-compatible elements (e.g., `w:pPr`, `w:rPr`, `w:tblPr`) which are shared between Transitional and Strict, but the namespaces are set at the document level in `docxexport.cxx`. 76 77### 2.4 `main/sc/source/filter/excel/xestream.cxx` 78 79The `XclExpXmlStream` manages package streams. Content types and relationship types for XLSX parts would need to be audited per-part, but the workbook-level namespace is the primary Transitional marker. 80 81--- 82 83## 3. What Strict OOXML Would Require 84 85### 3.1 Namespace changes (DOCX) 86 87| Element | Transitional | Strict | 88|---------|-------------|--------| 89| `w:` namespace | `.../wordprocessingml/2006/main` | `http://purl.oclc.org/ooxml/wordprocessingml/main` | 90| `r:` namespace | `.../officeDocument/2006/relationships` | `.../officeDocument/2010/relationships` | 91| VML (`v:`) | `urn:schemas-microsoft-com:vml` | **Forbidden** — use DrawingML only | 92 93### 3.2 Content type changes 94 95| Part | Transitional content type | Strict content type | 96|------|--------------------------|---------------------| 97| document.xml | `...wordprocessingml.document.main+xml` | `...wordprocessingml.document.main+xml` (with strict marker) | 98| styles.xml | `...wordprocessingml.styles+xml` | `...wordprocessingml.styles+xml` | 99| numbering.xml | `...wordprocessingml.numbering+xml` | `...wordprocessingml.numbering+xml` | 100 101### 3.3 VML removal (DOCX) 102 103`DocxExport` uses `VMLExport` [docxexport.cxx:659] and declares `xmlns:v` [docxexport.cxx:608]. Strict OOXML forbids VML. All VML shape output would need to be converted to DrawingML. 104 105--- 106 107## 4. Recommended Centralized Abstraction (future milestone) 108 109Introduce an `OoxmlConformance` abstraction (not implemented) to avoid scattered conditionals: 110 111``` 112class OoxmlConformance { 113public: 114 enum Level { TRANSITIONAL, STRICT }; 115 116 // Namespace URIs 117 OUString getNamespace(NamespaceId id) const; // w:, r:, v:, etc. 118 119 // Relationship type URIs 120 OUString getRelationshipType(RelId id) const; // styles, footnotes, header, footer, etc. 121 122 // Content types 123 OUString getContentType(PartId id) const; // document, styles, numbering, etc. 124 125 // Whether VML is allowed 126 bool allowsVml() const; 127 128 // Whether Strict element/attribute restrictions apply 129 bool isStrict() const; 130}; 131``` 132 133**Usage pattern:** Serializers call `conformance->getNamespace(NS_WORDPROCESSINGML)` instead of hardcoding the URI. This centralizes all Transitional/Strict differences in one class. 134 135**Files to modify (future work):** 136 137- `main/sc/source/filter/excel/excdoc.cxx:793` — workbook namespace 138- `main/sw/source/filter/ww8/docxexport.cxx:605-612` — all document namespaces 139- `main/sw/source/filter/ww8/docxexport.cxx:399,403,422,443,500,515,558,559,645,646` — relationship types 140- `main/sw/source/filter/ww8/docxexport.cxx:650` — content type 141- `main/sc/source/filter/excel/xestream.cxx` — package part content types 142 143--- 144 145## 5. Strict OOXML Feasibility by Exporter 146 147| Exporter | Strict feasible? | Barriers | 148|----------|-----------------|----------| 149| XLSX | Probable (easier) | SpreadsheetML namespace is shared; mainly content-type and relationship-type changes needed | 150| DOCX | Requires significant work | VML must be removed; namespace changes; content-type changes | 151| PPTX | N/A (no exporter) | Would need to be Strict-capable from the start if implemented | 152 153**Recommendation:** Treat Strict OOXML as a separate future milestone (W.4 or later). Introduce the centralized `OoxmlConformance` abstraction before implementing Strict, to avoid scattered conditionals. 154 155--- 156 157## 6. Confidence Summary 158 159| Finding | Confidence | Basis | 160|---------|------------|-------| 161| All existing serializers hardcode Transitional namespaces | confirmed | Direct source reading: excdoc.cxx:793, docxexport.cxx:605-612 | 162| All existing serializers hardcode Transitional relationship types | confirmed | Direct source reading: docxexport.cxx:399-646 | 163| All existing serializers hardcode Transitional content types | confirmed | Direct source reading: docxexport.cxx:403-650 | 164| VML used in DOCX (forbidden in Strict) | confirmed | docxexport.cxx:608,659 | 165| No Strict OOXML export path exists | confirmed | No conformance abstraction; no Strict namespace/relationship/content-type code | 166| XLSX Strict easier than DOCX Strict | probable | SpreadsheetML namespace shared between Transitional/Strict | 167