Apache OpenOffice (AOO) Bugzilla – Issue 81480
Refactor sw code to support multiple layouts
Last modified: 2022-10-28 12:54:19 UTC
In ODF Toolkit project, to do modularization in SW module
add lijian in cc
I have changed the summary as this issue is not related to odftoolkit
I am voting on this because I realize that without the support for multiple layouts, a draft view in Writer is impossible. Since that is the sole reason I cannot use Writer for my work (q.v. my comment re: issue 4914), I hereby cast my votes. Regards.
I have updated the source to the latest milestone, reviewed and polished the code and did some testing.
If this is needed to implement a Word style normal view, then go ahead and implement it! And soon. The continued multi-year lack of a "normal" view / layout is appalling and shameful. As a result, I find OO unusable for much of the work I do. And as others have written, it is really disgraceful that this hugely desired capability has been ignored for years ...
The current incomplete status will be integrated as a first step; when the problems in the drawing layer will be fixed, this refactoring can be finished. It makes sense to integrate the code in its current state to avoid further wasting of time with continuous code line resyncs.
SwDoc no longer has a pointer to a Layout, but it has a pointer to a current(!) ViewShell. Each ViewShell has a layout, but this may be shared with other ViewShells. Currently, where multiple layout is not completely supported, all ViewShells share the same layout (this is handled when a ViewShell is created and when a DrawPage is created). Methods for PageCount and PageSize have been moved from SwDoc to ViewShell, BrowseMode from SwDoc to SwViewOptions. The BrowseMode that is stored into the file is the BrowseMode of the current ViewShell (this is compatible to the way all other View settings are stored). Creating SwFrms or searching for them now always requires that a Layout is specified. For this reason some other methods (that needed to provide a layout) have got an SwRootFrm* or SwFrm*, including ctors of SwFrm objects. Deleting Frames has an optional SwRootFrm* parameter that allows to either treat only one layout or all layouts. Former callbacks from SwDoc to layout have been replaced by a "ForEach" loop handling all existing layouts. Some code still needs to be reviewed whether treating the current layout only is OK or if that needs to extended to handle all layouts.
I will reopen this task later when the CWS with the implementation done so far has been integrated. This allows to keep the votes and block tracking. But to get the CWS integrated, I either had to remove to task from it or I must set it to "fixed".
Mathias, could you please tell us what commits are associated with fixing this bug ? In relation with https://issues.apache.org/ooo/show_bug.cgi?id=3959 and https://bugs.freedesktop.org/show_bug.cgi?id=68167 I am trying to understand whether this functionality has crossed to Libreoffice...
I'm no longer working on OpenOffice, so I can only talk about what I did until 2011. Until that point in time we layer the ground for multiple layouts, but didn't actually use that capability because (AFAIR) some parts needed some extra work. All code that had hit the trunk of Ooo is part of Apache OO. As the LO people usually copied most of the OOo/AOO stuff, I assume all of this is in their repo also. The basic idea of the refactoring was to revert dependencies: instead of having the document know the one and only existing layout object and manage it from there, there should be just a collection of layouts that all know the document and actively retrieve information from there. AFAIR the remaining work was associated with dividing drawing objects into a model and a view part, so that every layout can have its own drawing object view (based on the same drawing object that is part of the core). Armin LeGrand and Oliver Wittmann have been involved in the discussions, and both of them are still working on AOO.
Thanks for those precisions - they will come handy to those who will carry your work further !