 Good afternoon everyone. This is the Gator Marginine writer-paste I store I'm Miklos. I'm currently working for Kulabara I have been working on writer for quite a while and today I'm here to present you brand new writer feature present in Libreface 7.2 Which is a Gator Marginine in writer-paste I So what is the motivation for this feature? writer has several different page styles one of them is the several different styles and one of them is the page styles next to paragraph styles or character styles or or list styles and Page styles are used to specify all kinds of different page properties. You can't even directly apply formatting to a page You always have to go via a page style This includes several different margins of things such as left margin, right margin, top margin or bottom margin If you look at our competition Word has an extract type of margin. It's called the Gator Margin This is the whole concept of it is not that complex You can imagine that you are editing a book in a writer and You want to make sure that you have some equal amount of right and left margin But then you print that book you give it to someone to actually do a binding on that book and that Binding consumes a little bit of space on typically on the left side of those pages Which means that the left margin will be smaller and the right margin will be larger So they are they do not equal anymore and it looks unprofessional So what you can do is that you define an extra space for the Gator Margin And then from the for the remaining space you can see on the user interface that the left and the right margin Again equals and then it looks nice Obviously you could do the same way just picking the left and right margin But then you don't really have this feedback on the user interface that the remaining space after binding as is something that it was on both sides And like it sounds this simple the The way to complex it is that there are a few more details here It can be not only on on the left, but also it can have a custom position You might want to consider right to left right and directions and page borders and a few more things So the user interface we have this page style dialog in online and also in desktop LibroFence We have a new Viget to control and not only the left right the bottom of margins, but also the Gator And also for the Gator position you can Have it on the left or or at the top So this is how a new rendering result looks like what you can see there is that on the left side There is some larger spacing and on the right side. There is a smaller spacing and This is how the reference looks like for a docx file again larger spacing on the left and Smaller amount of spacing on the right And this is how we used to render this document in the past which is not correct the same amount of space on the left and on the right This was the first round of this work and after Giving it a bit of a rest it turned out that there are a few more things to be done so there was a second round of this work and That was mostly focused on On the right to left support so it turns out that at least in the oaxama specification. There is a dedicated Section level property for If this Gator margin is right to left or left to right and Then we might be as to write our pastimes So in case you open some work format then you get no get an additional Checkbox on the paste I dialogue where you can see if this this Gator margin should be on the left or on the right this means that even if like the position is not at the top Which means left it might be actually left or right and This is what you see in this screenshot that in this case if this extract Boolean sucked in is enabled then you have much more space on the right and not on the left The question is like how this feature is implemented as usual, there is this checklist on the tdfiki in the development slash writer page how to add for a new feature and The procedure was quite similar here as well compared to other features so first We need Some way of Representing this feature in the C++ classes in the core internal document model One writer document is this as w doc class and inside then at we have several pastimes One pastile is represented by the ACW page does because in page descriptor or page description and inside that We have item sites as kind of property lists for For the various settings This will be important one. We will get to mirror margins so As part of that we have a pool item called left right space item and that one has members for left margin, right margin, top margin, bottom margin and so on That class now gained two new numbers the gather margin, and we have a dedicated right Gattler margin These two numbers are needed because when we will have a mirrored page layout then we will generate dedicated page styles internally For left and right pages. This is to have the layout this way It will not have to do the mirroring as part of rendering But as we create the layout, we will have a separate generated set of properties for left and right pages which means that even if you Don't enable the right left something you just have your gather margin in the inner pages Then the generated left and left set of properties and right set of properties Will have different item socks. So on the left side, you will have a gather margin set to some known zero positive amount of space and then on the Like this will be on odd pages and then on even pages You will have the gather margin set to zero and the right gather margin will be set to some positive value Once you have a document model Then the next step you want to have is some public uno API some new uno property for this because this is How most of the work done by the auditing port and the docx import is done? It will build the document model using the uno API So again for the writer document, we have the comes and start tax tax document service and Inside that we have the various style families We have the paystiles and one paystile is represented by this comes and start style paystile service No, this this paystile object has various properties like left margin top margin right margin and so on and Initially, I added one new property there this gather margin and Then in the second round, which is against some integer typically zero, but it might be something larger and In the second round a Second new property was added there and if the gutter is rough right to left, which is a boolean This is this right to left nose is something that's explicit in word formats Also for word format the user interface makes this explicit, but in case of ODF, this is something we can infer from the writing direction. So if you use gather margin and you save it to paystile and Write it to ODF Then the right to left something is not something we write to them fine format Rather, we go just write the writing direction and on import we just add the right to left boolean flag based on the writing direction so then here the ODF format is a bit less redundant because Typical in nobody would need this right to left Gator form a writing direction, which is left to right On the other hand for word formats We do one-to-one mapping from the file format. So in case there will be this any zone mismatch between the writing direction and The RTF flag of the gutter then we can preserve that correctly It sounds like a reasonable compromise to kind of please everyone Now we get to the layout, which is typically the most complex piece for righto And ideally this shouldn't be that complex like like the layout is pulling the the left margin value from the document model And know what we do what we should do is that we Pour the left margin and the gutter on the left side and they put the right margin on the right side and be done with That but there are a number of additional complexities. So first is the page border the page border is somehow between the between the edge of the page and the edge of the area where the body text is is laid out and The question is if you add some additional spacing though, then where the where the page border should be should it be and the place where the Gutter spacing and the left margin spacing meets or should it be This inner place where both the left margin and the gutter margin consumed its space and made the body texture Yeah, and the answer to this is that the precedent is that the world is in doing both of these Spacings together and then it means the body texture Yes, if the need the same just to not introduce some additional painful unwanted incompatibility So And to make this even more complex the border space and border the page border itself can have its own spacing But that spacing is between the page border and the page body area So that way you can make it so that the page border is still Going towards the the edge of the page So this was one thing to to find out how to do correctly and then decide and Make sure that the layout is taking page borders into account correctly and Then the second tricky piece was this Page mark mirror art page margins. So what we do is that we have some like initially we have a single item set in the document model for page size and then we generate a Dedicated left set item set and right item set from that and then we use this left Properties for left pages and right properties for the right pages, which means that even if you ignore right to left mass we generate Left got a margin for left pages and try to get a margin for right pages And then lay out can be faster because it doesn't have to know if this is a left page or right page It just won't guess this item So if you just render the correct amount of spacing on the left and on the right So this is for the mayor old page layout and Sort you have the right to left mass So even if the There is no mirror page layout Then then what's nominally left is more like start of the page and start is right for right left And left is left for left to right Nothing I forgot to note here is that we can also have the gutter position at the top Which is again something layout has to take into account But that's somewhat simpler because the right left must as is is something you can ignore If you are at the top, that's always at the top. So that's that's not special Then you have the Importers or exporters and this is what we in general call it filters So for UDF we have this Page layout properties XML element in the style name space and that has various attributes for the existing left, right Whatever mergers and we know we have a margin gutter property Attribute as a new attribute in the library's extension name space and there is a proposal of wide at the UDFTC to put this Actual next will be a standard For the gutter position that's something that's simply in the settings XML. It's a document global property So there is no standardization for that. We just write gutter is at the top and if this is true or false This could be a paste type property, but then where does the support per section The use for this property as well. So it sounds like nobody really needs this then why add this complexity to the code We have similar sterilization and parsing for docx and doc and RTF What's somewhat complex is that in the word format you have the Border the page border Spacing in a more complex way, you know the of it's always simple spacings and positive or zero amount of space And that's it But for for word the the border can be from the page edge or from the text and that's somewhat more complex Which means that in some cases we need to do a bit of mapping at import time and export time to to arrive to this simpler document model That we have in writer. That's always Calculating the pattern the border spacing from one reference point Then for the user interface, it could be just a spin button for for the cattle margin But in reality, this is a bit more complex. You have the gutter position, which is Which is it could be a chat box But it's a combo box because that's what's familiar for word users and we also have this checkbox for If this is right to left or not This is hidden in the ODF case because in ODF case the info is from the writing direction Also, what's some additional complexity is that you have this this preview widget on the on the dialogue And that preview widget is taking that on margin into account. So you do see And some increase the amount of last space and here and right spacing and the left and the right margin is the same so it only happens because the dog get on margin is as Taking it take them take an intercount during calculation of that preview widget Now we get to testing which again should be simple, but then it gets more tricky so we have a core layout task just for the actual layout if if we Render the page border at the correct place, but then we have a separate task case for the mirrored margins case Then we have The writer or XML export to suit which is actually import and export and we cover the docx filter there And then we have some separate task cases For the page borders if the page border is measured from the page or from the text in one case We exactly do what what writer would do anyway, and in the other case we need this mapping to the right of the Then we have an ODF export test you which is again oddity import and export So we need to cover the ODF is there then we have the WW8, which is the binary doc format important export RTF has the markup to represent got on margins and If the gutter position is from the latter from the top We also have RTF markup for the right leftness of the gutter margin. So all this is covered in the RTF export Test used which is again import and export and Then you redo everything just for the from top case Well, the the gutter margin is not on the lab, but on the on the top and then you repeat everything for the right to left so it's It's more than a matrix and just for testing and it sounded like it's something simple, but then it gets complicated And then we had to do have content for this So the users actually see what's a gutter margin in case they are not familiar with console if they don't have a tick And they are harder. Yeah. Yeah, this is for my name And as you know this had to be paid by somebody even if it's chart for the community for free. So thanks for that and To sum this up Writer know has full support for gutter margin This is something that's in each and every word document and we used to lose this something in case it was not there I know we preserve it properly render it properly interact with that properly And here is where you can see the slides in case you want to watch them later. Thanks for watching And in case you have any questions and perhaps after this there will be an opportunity to Thanks again That's yes, indeed. We have I was thanking you and I was saying that yes indeed we have some questions from some minutes for questions and I see so far one question from mark who was wondering how does it work with? Vertical writing layout Thanks for the question So it's a it's a bit of a shame Right to laugh not there's something that was covered in detail and for the actual vertical writing That's not something that that was explicitly Loaded into or something that was explicitly tested The idea is that this is the gutter margin is is typically influencing some existing margin like top margin left margin right margin and Hopefully it does the right thing also for vertical layout But in case it does not done it would be worse somebody point to describe what is the expected behavior learned How we go wrong there because like it it might happen that something is problematic Somewhat ironically, I think the original request from this was why at some partner who had a customer somewhere at Some in some country of our vertical writing is not that's rare. So it's it's somewhat irony that This was not explicitly tested. So feedback on that would be welcome Hopefully it just works out of the box or if it is not hopefully it's something that's reasonably straightforward to fix any other questions I Don't see any question here Does anyone has anything to add so I guess mark needs to get in touch with you regarding this Yeah, we know each other. Okay. Okay. Okay, cool