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

Gutter margin in Writer page styles

Bb2fd3b5456ad0012799b2045f4cd212?s=47 Miklos V
September 24, 2021
3

Gutter margin in Writer page styles

LibreOffice Conference 2021, Virtual

Bb2fd3b5456ad0012799b2045f4cd212?s=128

Miklos V

September 24, 2021
Tweet

Transcript

  1. Gutter margin in Writer page styles By Miklos Vajna Software

    Engineer at Collabora Productivity 2021-09-24
  2. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 2

    / 20 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
  3. Gutter margin in Writer page styles

  4. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 4

    / 20 Motivation One of the missing last section properties which are in each & every Word document • Use-case: book • Binding consumes a known amount of space on the left • Want to have equal amount of remaining horizontal space on the left & on the right after that • Can be also at the top, also RTL is to be considered (via wikipedia.org)
  5. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 5

    / 20 User interface
  6. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 6

    / 20 New / correct render result (more details)
  7. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 7

    / 20 Reference render result
  8. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 8

    / 20 Old / incorrect render result
  9. Second round: RTL support

  10. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 10

    / 20 User interface & layout (more details)
  11. How is this implemented?

  12. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 12

    / 20 Document model Internal C++ core representation: • Writer document: SwDoc • Writer page styles: SwPageDesc • Page style properties: SfxItemSet • Other margins are handled by SvxLRSpaceItem • New: SvxLRSpaceItem::m_nGutterMargin • New: SvxLRSpaceItem::m_nRightGutterMargin • Two members are needed for mirrored page styles (via wikipedia.org)
  13. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 13

    / 20 UNO API Public, stable representation: • Writer document: com.sun.star.text.TextDocument • Writer page styles: com.sun.star.style.PageStyle • Other margins are named like LeftMargin, RightMargin • New property: GutterMargin • New property: RtlGutter • Second property is inferred from the writing direction for ODT, set explicitly by the Word formats (via wikipedia.org)
  14. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 14

    / 20 Layout Just an increased left margin… except: • Take page border into account (gutter + left margin is outside the border, except for the border spacing • Mirrored page margins • RTL • On the left or on the right
  15. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 15

    / 20 Filters ODF and the rest: • A new ODF extension: <style:page-layout-properties loext:margin-gutter="…"> • Proposal at https://issues.oasis-open.org/browse/OFFICE-4105 • Position is just a per-document setting: GutterAtTop=false • Similar serialization and parsing for DOCX, DOC and RTF
  16. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 16

    / 20 User interface Not just a spin-button: • Combo box for the position • Preview widget accurately takes gutter space into account
  17. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 17

    / 20 Testing At various levels: • Layout is covered in CppunitTest_sw_core_layout • Also the mirrored margins case • DOCX filter is covered in CppunitTest_sw_ooxmlexport • The “from page” margin case and the “from text” one • ODT filter is covered in CppunitTest_sw_odfexport • DOC filter is covered in CppunitTest_sw_ww8export • RTF filter is covered in CppunitTest_sw_rtfexport • And then all the same for the “from top” case • And then all the same for the RTL case (via wikipedia.org)
  18. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 18

    / 20 Help content The content that ends up on https://help.libreoffice.org/:
  19. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 19

    / 20 Thanks Collabora is an open source consulting and product company • What we do and share with the community has to be paid by someone There is an exception to every rule • Most of this work was done as a Collabora Hackweek project
  20. Collabora Productivity LibreOffice Conference 2021, Virtual | Miklos Vajna 20

    / 20 Summary Writer now has full support for gutter margins • Not only not loosing this formatting setting • Also rendering it properly • Integrates correctly with the rest of the layout: borders, mirroring, RTL • Imports from / exports to all major file formats Thanks for listening! :-) • Slides: https://people.collabora.com/~vmiklos/slides/