From f816f3d29b5cccab68bcc472090e98fb01af81b6 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Sat, 6 Feb 2021 23:28:41 +0100 Subject: [PATCH] Turn document margins into settings --- nw/core/toodt.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/nw/core/toodt.py b/nw/core/toodt.py index b45e5c04..ee83673c 100644 --- a/nw/core/toodt.py +++ b/nw/core/toodt.py @@ -132,6 +132,12 @@ class ToOdt(Tokenizer): self._mBotText = "0.247cm" self._mBotMeta = "0.106cm" + ## Document Margins + self._mDocTop = "2.000cm" + self._mDocBtm = "2.000cm" + self._mDocLeft = "2.000cm" + self._mDocRight = "2.000cm" + ## Colour self._colHead12 = None self._opaHead12 = None @@ -683,10 +689,6 @@ class ToOdt(Tokenizer): def _pageStyles(self): """Set the default page style. """ - # If we're in flat layout, the page style goes to the main auto-styles - # In archived file, we make a duplicate auto-styles in the self._xPage - # variable which is later added to the styles.xml to go with the - # master-page definition theAttr = {} theAttr[_mkTag("style", "name")] = "PM1" if self._isFlat: @@ -695,10 +697,10 @@ class ToOdt(Tokenizer): xPage = etree.SubElement(self._xAut2, _mkTag("style", "page-layout"), attrib=theAttr) theAttr = {} - theAttr[_mkTag("fo", "margin-top")] = "2.000cm" - theAttr[_mkTag("fo", "margin-bottom")] = "2.000cm" - theAttr[_mkTag("fo", "margin-left")] = "2.000cm" - theAttr[_mkTag("fo", "margin-right")] = "2.000cm" + theAttr[_mkTag("fo", "margin-top")] = self._mDocTop + theAttr[_mkTag("fo", "margin-bottom")] = self._mDocBtm + theAttr[_mkTag("fo", "margin-left")] = self._mDocLeft + theAttr[_mkTag("fo", "margin-right")] = self._mDocRight etree.SubElement(xPage, _mkTag("style", "page-layout-properties"), attrib=theAttr) xHead = etree.SubElement(xPage, _mkTag("style", "header-style")) @@ -707,7 +709,7 @@ class ToOdt(Tokenizer): theAttr[_mkTag("fo", "min-height")] = "0.600cm" theAttr[_mkTag("fo", "margin-left")] = "0.000cm" theAttr[_mkTag("fo", "margin-right")] = "0.000cm" - theAttr[_mkTag("fo", "margin-bottom")] = "0.499cm" + theAttr[_mkTag("fo", "margin-bottom")] = "0.500cm" etree.SubElement(xHead, _mkTag("style", "header-footer-properties"), attrib=theAttr) return