Difference between revisions of "Writer/ToDo/Writer Refactoring/SwDoc ViewShell SwRootFrm"

From Apache OpenOffice Wiki
< Writer‎ | ToDo
Jump to: navigation, search
m (Status)
(Status)
 
(25 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 +
{{Writer Project|Category=Writer/Effort/Stalled}}
 +
__TOC__
 +
 
= Modularization: View Model =
 
= Modularization: View Model =
  
Line 30: Line 33:
 
1. Step
 
1. Step
 
  Move member pLayout (SwRootFrm*) from class SwDoc to class ViewShell.
 
  Move member pLayout (SwRootFrm*) from class SwDoc to class ViewShell.
  Move member pCurrShell (ViewShell*) from class SwRootFrm to class SwDoc.
+
  Create a function GetCurrentViewShell() at class SwDoc.
  Move all other ViewShell related members from class SwRootFrm to class SwDoc.
+
  Establish a 1:1 relationship between view and layout.
 +
Connect SwDoc and its ViewShells with a broadcasting mechanism.
  
 
2. Step
 
2. Step
Line 40: Line 44:
 
Done
 
Done
 
  Move member pLayout (SwRootFrm*) from class SwDoc to class ViewShell.
 
  Move member pLayout (SwRootFrm*) from class SwDoc to class ViewShell.
Comment out code if removed SwDoc::pLayout has been used.
 
Writer is buildable .
 
 
  Create SwRootFrm in ViewShell::Init(..)
 
  Create SwRootFrm in ViewShell::Init(..)
 +
new member mpRoot for all SwFrms for quick access to own layout
 +
Add a new member function GetCurrentViewShell() to SwDoc.
 +
Add a new member function GetCurrentLayout() to SwDoc.
 +
GetAllLayouts for notifications to all layouts
 +
Resync with milestone DEV300m31
 +
 
Ongoing
 
Ongoing
  Use new member ViewShell::pLayout in all member functions of ViewShell, where needed.
+
  Move BrowserMode from SwDoc to ViewOptions (still many places to review HTML_MODE and BROWSER_MODE)
 +
Consider reimplementation of ToggleBrowserMode in SwDoc
 +
Review implementation of ToggleBrowserMode/PrintPrevie in SwViewShell
 +
Replace SwCntntNode::GetFrm by SwCntntNode::getLayoutFrm
 +
Consider not sharing (but copying) Layout in ViewShells used for printing
 +
Make sure that printing always happens with ViewShell in OptionsSequence (except PDF-Export)
 +
What happened to ViewShell::PrintPreViewPage?
 +
Review xxx::DelFrms looks and xxx::MakeFrm
 +
Testing
 +
 
 +
Experimental
 +
Refactor Writer drawing model: every layout gets an own draw page
 +
Controls need virtual objects for multiple views
  
Next minor step
+
Next minor steps
  Check all code which has been comment out because of missed SwDoc::pLayout if it can be reactivated
+
  Every occurrence of GetCurrentViewShell and GetCurrentLayout has to be investigated, e.g.
  simply by replacing pDoc->GetRootFrm() with GetLayout() (in member functiona of ViewShell)
+
  SwDoc::PrtDataChanged() (done)
or with pSh->GetLayout() (in member functions of SwViewImp)
+
  SwDoc::DoIdleJobs()?
 +
  SwDoc::SpellItAgainSam(..)(done)
 +
  SwDoc::InvalidateAutoCompleteFlag(..)(done)
 +
  SwDoc::ChgPageDesc(..)(done)
 +
  SwDoc::SetFtnInfo(..)(done)
 +
  SwDoc::SetEndNoteInfo(..)(done)
 +
  SwFtnIdxs::UpdateAllFtn(..)(done)
 +
  SwLineNumberInfo::Modify(..)(done)
 +
  SwDoc::SetCurFtn(..)(done)
 +
  SwTOXBaseSection::Update(..)(done)
 +
  ViewShell::PaintDesktop(..)(done)
 +
  ViewShell::CreateAccessiblePreview(..)(done)
 +
  ViewShell::PrtOle2(..)(done)
 +
  SwTxtNode::IsSymbol(..)(done)
 +
  SwTxtNode::GetMinMaxSize(..)(done)
 +
HTML tables needs investigation

Latest revision as of 17:50, 28 May 2010

Writer Icon.png

Writer Project

Please view the guidelines
before contributing.

Popular Subcategories:

Extension:DynamicPageList (DPL), version 2.3.0 : Warning: No results.

Internal Documentation:

Extension:DynamicPageList (DPL), version 2.3.0 : Warning: No results.

API Documentation:

Ongoing Efforts:

Extension:DynamicPageList (DPL), version 2.3.0 : Warning: No results.

Sw.OpenOffice.org

Modularization: View Model

Writer refactoring

As a part of our Writer refactoring we are planning to change the dependencies between the Writer model and its views.

The Writer model contains all paragraphs, tables, drawing object etc. and their properties. It is represented in the class SwDoc.

The class ViewShell represents visualizations of this model, every window (e.g. the normal document view, the print preview, the online view) needs a ViewShell.

The class SwRootFrm is another part of the view, it contains the formatting information for the document objects. I.e. for every visible object (character, table, drawing object...) it contains the position and size. The ViewShell calls its Paint(..) function to display document content.

Today's structure

Today we have the following structure regarding SwDoc, ViewShell, SwRootFrm...

Each SwDoc has a member pLayout which points to a SwRootFrm. It has no direct connection to a ViewShell.

Every ViewShell has a member pDoc which points to a SwDoc. It has no direct connection to a SwRootFrm.
The ViewShells are organized as a Ring, i.e. ViewShells with the same SwDoc are connected via pPrev, pNext pointers.

Every SwRootFrm has a member pCurrShell which points to a ViewShell. It has no direct connection to the SwDoc.

Problem

The layout (SwRootFrm) is logically a part of the view, but currently hosted at the model (SwDoc). If there are several views to the model, they have to share one layout. This results in the effect that views with different layout are impossible, e.g two online views or a normal view and a online view.

Solution

Moving the layout(SwRootFrm) from the model(SwDoc) to the view(ViewShell).

1. Step

Move member pLayout (SwRootFrm*) from class SwDoc to class ViewShell.
Create a function GetCurrentViewShell() at class SwDoc.
Establish a 1:1 relationship between view and layout.
Connect SwDoc and its ViewShells with a broadcasting mechanism.

2. Step

Solve all problems resulting from 1. ;-)

Status

Done

Move member pLayout (SwRootFrm*) from class SwDoc to class ViewShell.
Create SwRootFrm in ViewShell::Init(..)
new member mpRoot for all SwFrms for quick access to own layout
Add a new member function GetCurrentViewShell() to SwDoc.
Add a new member function GetCurrentLayout() to SwDoc.
GetAllLayouts for notifications to all layouts
Resync with milestone DEV300m31

Ongoing

Move BrowserMode from SwDoc to ViewOptions (still many places to review HTML_MODE and BROWSER_MODE)
Consider reimplementation of ToggleBrowserMode in SwDoc
Review implementation of ToggleBrowserMode/PrintPrevie in SwViewShell
Replace SwCntntNode::GetFrm by SwCntntNode::getLayoutFrm
Consider not sharing (but copying) Layout in ViewShells used for printing
Make sure that printing always happens with ViewShell in OptionsSequence (except PDF-Export)
What happened to ViewShell::PrintPreViewPage?
Review xxx::DelFrms looks and xxx::MakeFrm
Testing

Experimental

Refactor Writer drawing model: every layout gets an own draw page
Controls need virtual objects for multiple views

Next minor steps

Every occurrence of GetCurrentViewShell and GetCurrentLayout has to be investigated, e.g.
  SwDoc::PrtDataChanged()  (done)
  SwDoc::DoIdleJobs()?
  SwDoc::SpellItAgainSam(..)(done)
  SwDoc::InvalidateAutoCompleteFlag(..)(done)
  SwDoc::ChgPageDesc(..)(done)
  SwDoc::SetFtnInfo(..)(done)
  SwDoc::SetEndNoteInfo(..)(done)
  SwFtnIdxs::UpdateAllFtn(..)(done)
  SwLineNumberInfo::Modify(..)(done)
  SwDoc::SetCurFtn(..)(done)
  SwTOXBaseSection::Update(..)(done)
  ViewShell::PaintDesktop(..)(done)
  ViewShell::CreateAccessiblePreview(..)(done)
  ViewShell::PrtOle2(..)(done)
  SwTxtNode::IsSymbol(..)(done)
  SwTxtNode::GetMinMaxSize(..)(done)
HTML tables needs investigation
Personal tools