SFX2 Refactoring

From Apache OpenOffice Wiki
Jump to: navigation, search

The problem

Though sfx2 no longer is the framework for everything it still is the backbone of the implementation of Writer, Calc, Draw/Impress and Math. sfx2 basically supports the MVC principle but it does not allow to decouple the parts as desired. The "template pattern" approach produces a very tight coupling of all involved classes and traditionally this was even enhanced by the application developers as they didn't try to limit the sfx2 influence as much as possible.

For a better modularity we would like to remove sfx2 from the "model" implementation:

What we currently have
What we would like to have

SfxObjectShell nowadays not only represents the dispatches for document based functionality but also the model implementation (from a UNO API point of view). The Controller is part of the dispatching process anyway. In the new architecture the dispatching part will be separated and its instantiation will be postponed until the dispatch framework asks for it. The model can be used without creating an SfxObjectShell and so without instantiating all the overhead of the sfx2 infrastructure.

Some parts of this infrastructure will still be needed in the implementation of the model. These parts have to be identified and reimplemented in a way that it can be used as classes or services independent from sfx2. One example for this is the UNO service for tge DocumentInfo that currently is implemented the SfxDocumentInfo. This must be done the other way around: there will be a UNO service for the DocumentInfo that directly implements the API (mainly a PropertySet) and SfxDocumentInfo again will be a code wrapper that might be kept as long as code exists that still uses it. Converting this code to using the DocumentInfo service directly will make SfxDocumentInfo obsolete over time.

To Do

Title Description CWS State
Convert com.sun.star.document.DocumentInfo service Implement service without SFX2 and wrap it by SfxDocumentInfo basemodelrefactoring Done
Provide helper service for printing Printing currently needs SfxViewShell; service will belong to Controller basemodelrefactoring Done
Refactor closing/disposing Model should control lifetime completely basemodelrefactoring Done
Refactor persistence related code and load/save API Rewrite all code that is needed for load/save/export via API without SFX2 Started
Provide ViewFactory API Creating a View for a model must be possible without SFX code fwkdbdesign Done
Implement ViewFactory API Creating a View for a model must be possible without SFX code Open
Move generic FrameLoader out of SFX2 FrameLoader shall use only non-SFX code; requires ViewFactories Open
Personal tools