Skip to content

feat: parse PPTX connector shapes (cxnSp)#167

Merged
developer0hye merged 5 commits intomainfrom
feat/cxnsp-connector-shapes
Mar 13, 2026
Merged

feat: parse PPTX connector shapes (cxnSp)#167
developer0hye merged 5 commits intomainfrom
feat/cxnsp-connector-shapes

Conversation

@developer0hye
Copy link
Copy Markdown
Owner

@developer0hye developer0hye commented Mar 13, 2026

Summary

  • Parse <p:cxnSp> (connector shape) elements that were previously completely ignored, causing all connecting lines and arrows in PPTX diagrams to disappear
  • Proper line positioning with flipH/flipV — uses (x1,y1)→(x2,y2) start/end points within the bounding box instead of negative coordinates
  • Triangle arrowheads — parse <a:tailEnd>/<a:headEnd> from <a:ln> and render as filled polygon triangles, overlaid with #place() for correct positioning
  • Bent connector polylinesbentConnector2-5 render as proper Z-shaped multi-segment paths with adjustable bend points from <a:avLst>
  • Fallback line colors from <p:style><a:lnRef> scheme references when connectors don't have explicit fills

Key changes

  • ir/elements.rs: ShapeKind::Line now has x1,y1,x2,y2 + arrowheads; new ShapeKind::Polyline and ArrowHead enum
  • parser/pptx_slides.rs: Recognize <p:cxnSp>, parse flips/arrowheads/adj values/style colors
  • parser/pptx_shapes.rs: Connector geometry helpers (line endpoints, bent connector points)
  • render/typst_gen_shapes.rs: Polyline rendering + arrowhead triangle generation with #place() overlay

Test plan

  • 12 unit tests: straight connectors, flips, bent connectors with adj values, arrowheads, style colors, mixed shapes, place overlay
  • All 1021 tests pass
  • Visual comparison of real PPTX slide with 11 connectors — all render correctly with proper positioning and arrowheads

🤖 Generated with Claude Code

developer0hye and others added 5 commits March 14, 2026 00:27
PPTX connector shapes (<p:cxnSp>) were completely ignored by the parser,
causing all connecting lines and arrows in diagrams to disappear in the
converted PDF output.

Key changes:
- Recognize <p:cxnSp> elements alongside <p:sp> in the XML event loop
- Parse flipH/flipV attributes on <a:xfrm> for correct line direction
- Resolve fallback line color from <p:style><a:lnRef> scheme references
- Map bent/curved connector presets to straight line approximations

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
- Change ShapeKind::Line to use (x1,y1)-(x2,y2) start/end points
  so flipped lines render within their bounding box correctly
- Add ShapeKind::Polyline for multi-segment bent connectors
- Add ArrowHead enum and parse <a:tailEnd>/<a:headEnd> from <a:ln>
- Render triangle arrowheads as filled polygons at line endpoints
- Map bentConnector2-5 to proper Z-shaped polyline paths with
  adjustable bend points from <a:avLst><a:gd> values
- Render polylines as consecutive #line() segments in Typst

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Arrowhead polygons and polyline line segments were rendered sequentially
inside a #place() block, causing Typst to stack them vertically instead
of overlaying at the correct coordinates. Wrap each #polygon() and
#line() segment in #place(top + left)[...] so they overlay correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Collapse nested if-let chain in adj value parsing, suppress
too_many_arguments for test helper, and apply rustfmt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye developer0hye merged commit 6df8a76 into main Mar 13, 2026
13 of 14 checks passed
@developer0hye developer0hye deleted the feat/cxnsp-connector-shapes branch March 13, 2026 16:26
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