Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Multi-page floating tables in Writer

Miklos V
September 22, 2023
21

Multi-page floating tables in Writer

Miklos V

September 22, 2023
Tweet

Transcript

  1. Miklos Vajna
    Software Engineer
    [email protected]
    2023-09-22
    Multi-page floating tables
    in Writer

    View full-size slide

  2. 2
    About Miklos

    From Hungary

    More details:

    https://www.collaboraoffice.com/about-us/

    Google Summer of Code 2010 / 2011

    Rewrite of the Writer RTF import/export

    Then a full-time LibreOffice developer for SUSE

    Now a contractor at Collabora

    View full-size slide

  3. 3
    Results so far

    View full-size slide

  4. 5
    Selection & dragging of split tables

    View full-size slide

  5. 6
    In-footer floating table

    View full-size slide

  6. 7
    Floating table in a section

    View full-size slide

  7. 8
    Page break before a floating table

    View full-size slide

  8. 9
    Table inside a multi-column section

    View full-size slide

  9. 10
    UI to disable split of a floating table

    View full-size slide

  10. 11
    Chaining enabled, so no split frames

    View full-size slide

  11. 12
    Disabling split of flys at a layout level

    View full-size slide

  12. 13
    Section break directly between tables

    View full-size slide

  13. 14
    Nested tables: the split outer only

    View full-size slide

  14. 15
    Negative vertical offsets

    View full-size slide

  15. 16
    Anhcor text starts with a newline

    View full-size slide

  16. 17
    Hidden anchors

    View full-size slide

  17. 18
    No overlap setting on floating tables

    View full-size slide

  18. 19
    Border rendering problems

    View full-size slide

  19. 20
    Footnote support

    View full-size slide

  20. 21
    How is this implemented?

    View full-size slide

  21. 22
    Document model
    SwFlyFrameFormat

    Stored in SwDoc::mpSpzFrameFormatTable

    Has an SfxItemSet

    New pool item subclass: SwFormatFlySplit

    Look it up using RES_FLY_SPLIT

    View full-size slide

  22. 23
    UNO API
    SwXTextFrame

    SwXTextDocument has a getTextFrames()

    The text frame supports XPropertySet

    A new IsSplitAllowed property there

    So a floating table is a fly frame that’s allowed to split

    And only contains exactly one inner table

    View full-size slide

  23. 24
    Layout representation
    1
    2
    3
    4
    5
    3
    3
    4
    5
    Frame height is
    automatic
    At-paragraph
    anchored text frame
    Top left of anchor
    frames
    Content flows
    around the frame
    on the last page
    Vertical offset is
    only rendered on
    the first page
    1
    2
    #libreoffice-dev_20170512.log:12:44 < mst_> vmiklos: now we only need a flyframe that is also a flowframe and we'd have floating tables :)

    View full-size slide

  24. 25
    Legacy mode for Word <= 2010

    View full-size slide

  25. 26
    Filters
    ODF + the Word formats

    ODT import + export: pages="true">

    DOCX:

    DOC: sprmTPc, and 6 others for positioning

    RTF: very similar to DOC, just not binary

    Separate markup for doc-level “no split” and frame-level “don’t overlap”

    View full-size slide

  26. 27
    Testing
    Various testing types

    Load a Word document, assert layout result from cppunit

    Build an SwDoc from C++ code, assert the layout result

    UITest for the UI part

    Crashtesting

    Watching the sanitizers tinderbox

    View full-size slide

  27. 29
    Specification
    Just an optional new boolean attribute

    Where to put it? Frame? Frame style?

    Should it be a property of the inner text box?

    Settled down on frame-as-direct-format, similar to ZOrder

    No-overlap for frames: reuse markup from shapes

    “Don’t split” per-document setting → settings.xml

    View full-size slide

  28. 30
    Summary
    Originally requested in 2013, multi-page floating tables are coming to
    Writer

    COOL 23.05 / LibreOffice (perhaps) 7.6

    Status: 50%+ done, but you can already try it out

    How it interacts with headers/footers, orphan/widow control, minimal
    row height, compatibility modes, change tracking, etc. – is complex, but
    we’re working on it

    Defaulting to the way today’s Word (>= 2013) does it, but also have a
    legacy mode for older documents

    View full-size slide