Skip to content

feat: pictures and shapes on a sheet - #197

Merged
anderix merged 2 commits into
mainfrom
63-sheet-drawings
Nov 24, 2026
Merged

anderix merged 2 commits into
mainfrom
63-sheet-drawings

Conversation

@anderix

@anderix anderix commented Nov 24, 2026

Copy link
Copy Markdown
Member

Closes #63

  • doc/sheet/drawing.rs collects table:shapes (anchored to the sheet) and the drawings inside cells (anchored to the cell, and stretched to table:end-cell-address where one is given), as SheetDrawing { element, anchor, offset }.
  • drawing_place gives where a drawing stands from current column widths and row heights, hidden ones at zero. It gives none while a cell-anchored drawing's row or column is hidden. drawing_cell gives the cell a drawing stands in and how far into it.
  • A drawing is drawn at the svg:x/y/width/height LibreOffice wrote.
  • Resizing or hiding a row or column moves each cell-anchored drawing by its anchor's move. An end-anchored drawing also stretches by its end cell's move. The new place is written back to svg:*, which is what LibreOffice does on save.
  • I probed LibreOffice by round trip and through its PDF. It keeps svg:x/y for a shape in a cell, and recomputes an end-anchored shape's size from the end cell. It also moved one end-anchored shape and printed one picture below a hidden row by a rule I couldn't reproduce, so those are drawn where they are written.
  • xods draws the drawings over the cells after the grid, from the cell each stands in, clipped to that cell's frozen or scrolling pane, with odox_ui::Canvas. They scroll and zoom with the grid.
  • The PDF prints each drawing on its cell's page, carried at the print scale by an Item::Turned transform. The printed area reaches the cells drawings stand in.
  • Restructuring still refuses as before.
  • Fixture corpus/libreoffice/drawings.ods was written by LibreOffice.

…, moving with the cells they are anchored to
…lines and groups stay put, and pictures without a description are asked about
@anderix

anderix commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Review fixes are in the second commit.

Critical

  • 1: drawings_reach gives the cells drawings reach, far corners included. Metrics::of and the PDF's printed area both extend to it, and xods skips any drawing whose cell falls outside the grid.
  • 2: where the drawings are under a table is found once per index build and cached per sheet (OnceCell). Each frame only builds the drawings themselves.

Important

  • 1: only shapes placed by svg:x/y with no draw:transform are moved. Lines, connectors, dimensions, groups and turned shapes are left as written, with no attributes added (a_line_or_a_group_is_left_as_written_when_rows_are_hidden).
  • 2: the PDF reaches the far corners, and each drawing is clipped to its page's column band. A drawing taller than its band is cut there rather than continued; that is deferred.
  • 3: ods::undescribed now finds pictures without a description, and export refuses as ODT and ODP do. The shared export question asks for the description (a_picture_on_a_sheet_that_says_nothing_is_asked_about).

Minors

  • 1: moves are skipped if the count of anchored drawings changed.
  • 2: moves under 0.001pt are ignored.
  • 3: the unit comes from Length::unit_of.
  • 6: draw:display and drawooo:display are honoured (a_drawing_says_where_it_is_shown). LibreOffice marked the end-anchored fixture shape printer and then left it out of its own PDF too. I follow ODF's meaning, which is print-only.
  • 7: within stops walking at the written lines and works out the rest arithmetically.
  • 8: the added code comment is gone and the rewritten one is restored.

Deferred

  • 4: an error after the resize, which hasn't been seen.
  • 5: frozen-pane cut.

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.

xods: draw pictures and shapes on a sheet

1 participant