Issue 81480 - Refactor sw code to support multiple layouts
Summary: Refactor sw code to support multiple layouts
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: OOo 2.3.0 RC1
Hardware: All Windows, all
: P3 Trivial with 58 votes (vote)
Target Milestone: 3.4.0
Assignee: AOO issues mailing list
QA Contact:
Depends on: 87241 100875
Blocks: 3959 4914
  Show dependency tree
Reported: 2007-09-11 09:35 UTC by liujiaxiang
Modified: 2015-06-14 17:49 UTC (History)
7 users (show)

See Also:
Latest Confirmation in: ---
Developer Difficulty: ---


Note You need to log in before you can comment on or make changes to this issue.
Description liujiaxiang 2007-09-11 09:35:19 UTC
In ODF Toolkit project, to do modularization in SW module
Comment 1 liujiaxiang 2007-09-11 09:37:04 UTC
add lijian in cc
Comment 2 Mathias_Bauer 2009-05-29 14:01:26 UTC
I have changed the summary as this issue is not related to odftoolkit
Comment 3 cx714 2009-09-03 00:28:27 UTC
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

Comment 4 Mathias_Bauer 2010-11-10 14:52:54 UTC
I have updated the source to the latest milestone, reviewed and polished the
code and did some testing.

Comment 5 cbraudy 2010-12-06 14:19:53 UTC
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 ... 
Comment 6 Mathias_Bauer 2010-12-15 08:21:57 UTC
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.
Comment 7 Mathias_Bauer 2010-12-15 18:13:20 UTC
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.
Comment 8 Mathias_Bauer 2010-12-15 18:15:51 UTC
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".
Comment 9 liotier 2014-01-31 10:05:13 UTC
Mathias, could you please tell us what commits are associated with fixing this bug ? In relation with and I am trying to understand whether this functionality has crossed to Libreoffice...
Comment 10 Mathias_Bauer 2014-01-31 13:59:49 UTC
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.
Comment 11 liotier 2014-01-31 14:04:53 UTC
Thanks for those precisions - they will come handy to those who will carry your work further !