Skip to content

feat(odf.js): add a real .sxi writer for OpenOffice.org 1.x presentations - #902

Merged
Mearman merged 4 commits into
mainfrom
feat/odf-sxi-writer
Sep 4, 2026
Merged

feat(odf.js): add a real .sxi writer for OpenOffice.org 1.x presentations#902
Mearman merged 4 commits into
mainfrom
feat/odf-sxi-writer

Conversation

@Mearman

@Mearman Mearman commented Sep 4, 2026

Copy link
Copy Markdown
Member

Part of #821. writeOdp landed in #900; this wires up the .sxi wrapper the same way #878 (writeSxw) and #889/#894 (writeSxc) already did for .sxw/.sxc -- transformToOoo1Package is generic across every ODF media type, so no changes to the transform itself, just a third pair of writer entry points (writeSxi/writeSxiContent) wrapping writeOdp/writeOdpContent.

Verified the same two ways the sxw/sxc writers were: the round-trip law through this package's own unmodified reader (readSxiContent(writeSxiContent(document)) reproduces document up to normaliseOdpContent, including the flat and tree forms and the rotated-shape floating-point tolerance the odp suite already carries), and a second, independent check that the output genuinely looks like OpenOffice.org 1.x XML rather than merely something the transform's own catch-all tolerates (its own namespace URIs, no mimetype part, no office:presentation genre wrapper, a shape written as a bare draw:text-box rather than ODF's draw:frame-wrapped one).

Also checked against real LibreOffice 26.2.5.2: a .sxi built with writeSxiContent (a title, a rotated shape, a table, an image, multi-line speaker notes) converts cleanly with soffice --headless --convert-to fodp and --convert-to pdf (both exit 0, LibreOffice identifies the input as a genuine Impress document), every authored string survives verbatim in the flat XML, and the rendered PDF confirms correct layout with the speaker notes absent from the slide itself.

Full check suite green: pnpm exec turbo run _lint _typecheck _test _test:workers --filter=odf.js --force (1156 tests) and a full-workspace pnpm exec turbo run _lint _typecheck --force (57 tasks).

.sxd still has no writer -- it needs a writeOdg underneath it first, tracked as its own follow-up.

A real, pre-existing coverage gap found and fixed along the way

While self-verifying this PR (mutating writeSxi to skip transformToOoo1Package and confirming the test suite would catch it), the whole suite still passed — the tree-level "holds through the tree form" test can't distinguish genuine OpenOffice.org 1.x output from writeOdp's own plain ODF passed straight through, because transformOoo1Package returns anything it doesn't detect as OpenOffice.org 1.x completely unchanged: skipping the forward and reverse transform round-trips by accident (identity composed with itself).

Checked whether this was specific to my own new code or a pre-existing gap: mutating the already-merged writeSxw and writeSxc the identical way leaves their own existing tests green too. Not something this PR introduced -- a real gap in already-shipped test coverage (#878, #889/#894). Fixed for all three tree-level entry points with an isOoo1Package(pkg) assertion, the same check each writer's own "genuine OpenOffice.org 1.x XML" describe block already makes against its *Content sibling. Confirmed each of the three new assertions actually fails against the corresponding mutation before restoring the real implementation.

…ions

writeSxi/writeSxiContent wrap writeOdp/writeOdpContent through
transformToOoo1Package, the exact pattern writeSxw/writeSxc already use
for .odt/.ods -- the transform is already generic across every ODF
media type, so wiring .sxi up to it needed no changes to the transform
itself, only a third pair of writer entry points.
…ed reader

Mirrors the sxc suite's own two-part discipline: the round-trip law
(normaliseOdpContent(readSxiContent(writeSxiContent(document))) equals
normaliseOdpContent(document), through both the flat and tree forms,
with the same rotated-shape floating-point tolerance exception
typed/odp/write-round-trip.test.ts already states) and a second,
independent check that the output genuinely looks like OpenOffice.org
1.x XML -- its own namespace URIs, no mimetype part, no office:presentation
genre wrapper, and a shape written as a bare draw:text-box rather than
ODF's draw:frame-wrapped one.
Updates the Status/Usage/Architecture sections and the root monorepo
README to state real .sxi write support, including a real LibreOffice
26.2.5.2 check (soffice --headless --convert-to fodp/pdf) alongside the
existing round-trip suite.
… is genuinely OOo1x

Each of writeSxw/writeSxc/writeSxi's own "holds through the tree form"
test built a package and checked it read back correctly, but never
checked what kind of package it actually was. transformOoo1Package
returns anything it does not detect as OpenOffice.org 1.x completely
unchanged, so a writer that silently skipped transformToOoo1Package
would still round-trip -- the identity composed with itself -- while
producing a package with a .sxw/.sxc/.sxi extension and plain ODF
content inside it. Confirmed directly: mutating writeSxw, writeSxc, and
writeSxi in turn to skip the transform left every existing test in this
file passing. isOoo1Package is the assertion that actually distinguishes
the two, and each writer's own "genuine OpenOffice.org 1.x XML" describe
block already makes the identical check against its *Content sibling --
this closes the same gap for the tree-level entry point.
@Mearman
Mearman marked this pull request as ready for review September 4, 2026 02:01
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review Completed 2026-09-04T02:05:22.454253Z a233c74 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Mearman
Mearman merged commit 0a34a3d into main Sep 4, 2026
45 of 47 checks passed
@Mearman
Mearman deleted the feat/odf-sxi-writer branch September 4, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant