Bug 86630 introduced a Page Number Wizard [1]. It allows to combine the tasks of creating / switching to the header/footer, and placing a relevant field there in a wanted position. There is a very important (even if NOTABUG) tdf#33304, with very many users in CC list. My bug 33304 comment 54 there mentions, that a tool that would insert header/footer *and at the same time* change margins to keep the layout would be a solution for users. The proposal here is to add a checkbox to the said Page Number Wizard, like "put it to the margin area", which would make it - in case when the header/footer didn't exist before - to do the relevant re-calculations, keeping the page body layout unchanged. [1] https://wiki.documentfoundation.org/ReleaseNotes/7.6#Writer
+1, worthwhile enhancement to accommodate multiple requests to shift header/footer into margin space needed for bug 33304
+1 wAIT
The page number wizard just combines things that the user could already do in other places. I suppose one could argue that the user could just change the page's top and bottom margin before... OK, +1 from me too. Could it be done automatically (no option)? * ultimately no: the difference between manual creation would be too jarring. Could this be enabled by default? * based on LO's fairly generous default margins, perhaps yes. * but probably no - it wouldn't match page styles with manually created footers. So for a footer, I expect that the calculation would be to reduce the bottom margin by the page style's footer spacing + the maximum(page style's default footer height, or height of Footer paragraph style font size). Other considerations: * a minimum margin should be observed: most printers can't print to paper edge. ** maybe 0.5cm minimum which is approximately the space needed for 12/14 pt. possible wording "fit into existing margins"
The code of course is in sw/source/uibase/shells/textfld.cxx. The existing page margin is easy to get: aNewDesc.GetMaster().GetULSpace() with .GetUpper() or .GetLower() "FooterBodyDistance" (Spacing) is forced here already. constTwips_5mm "FooterHeight" (Height) is left at zero, but in the UI it shows up as 0.10cm which is the minimum allowed in the UI. When set (SID_ATTR_PAGE_SIZE), this includes the FooterBodyDistance. The problem of course is going to be determining the height taken up by the Footer paragraph font size... If you look at the page header/footer UI when they are off, both "Spacing" and "Height" are set to 0.5 cm because DEF_DIST_WRITER is 500 tools::Long nDefaultDist = bIsCalc ? DEF_DIST_CALC : DEF_DIST_WRITER; SetMetricValue( *m_xDistEdit, nDefaultDist, MapUnit::Map100thMM ); SetMetricValue( *m_xHeightEdit, 500, MapUnit::Map100thMM );
Created attachment 194904 [details] 161646_fitExistingMarginsPageNumbering.odt: testing document The following implementation seems to work pretty good: https://gerrit.libreoffice.org/c/core/+/169349
Justin Luth committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/433c4180acd5c5a699e71ab2f749713db36dc165 tdf#161646 sw page number wizard: fit into existing margins It will be available in 25.2.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.