Revision 854691

Go back to digest for 31st August 2008

Other in Office

Girish Ramakrishnan committed changes in /trunk/koffice:

Say hello to KoTextDocument.

Currently, we have no place to store meta data of the text shape's QTextDocument.
We have the style manager residing in the layout which is not an ideal place.
A place to store automatic list styles is also needed.

My initial thoughts were to have a KoTextDocument that subclasses QTextDocument that stores all this information.

Thomas pointed out that it would be nice to stick in all information in a QTextDocument somehow.
So, the approach chosen, is to store all the meta data as resources using QTextDocument::addResource().

To have a nice mechanism to access them, KoTextDocument is just a wrapper on top of QTextDocument.

Currently, the patch only stores the style manager but more will follow.

An important thing to know is that we should now use QTextDocument::clear() with care since it will clear away the resources too.

If you want to only clear the contents, one must use a QTextCursorto select all + clear selection.

File Changes

Added 2 files
  • /trunk/koffice/libs/kotext
  •   /KoTextDocument.cpp
  •   /KoTextDocument.h
Modified 19 files
  • /trunk/koffice
  •   /kword/part/KWDLoader.cpp
  •   /libs/kotext/CMakeLists.txt
  •   /libs/kotext/KoTextDebug.cpp
  •   /libs/kotext/KoTextDocumentLayout.cpp
  •   /libs/kotext/KoTextDocumentLayout.h
  •   /libs/kotext/KoTextSelectionHandler.cpp
  •   /libs/kotext/KoTextShapeData.cpp
  •   /plugins/textshape/Layout.cpp
  •   /plugins/textshape/Layout.h
  •   /plugins/textshape/TextShape.cpp
  •   /plugins/textshape/TextTool.cpp
  •   /kword/part/frames/KWTextFrameSet.cpp
  •   /libs/kotext/opendocument/KoTextLoader.cpp
  •   /libs/kotext/styles/KoParagraphStyle.cpp
  •   /libs/kotext/styles/KoStyleManager.cpp
  •   /libs/kotext/styles/KoStyleManager.h
  •   /plugins/textshape/tests/TestDocumentLayout.cpp
  •   /kword/part/frames/tests/TestDocumentLayout.cpp
  •   /libs/kotext/opendocument/tests/TestLoading.cpp
21 files changed in total