Calligra/Projects/Annotations: Difference between revisions

From KDE Community Wiki
(Created page with "For implementation of Annotations we will implement it stepwise 1) load it 2) show&edit 3) save 4) create == Load == We create a subclass of TextShape called AnnotationS...")
 
No edit summary
Line 12: Line 12:
The TextTool should register itself as being able to edit it. The Review and References tools should not.
The TextTool should register itself as being able to edit it. The Review and References tools should not.


In KoTextLoader load annotation we create the shape instead of loading into QTextFrame. And then we make the shape load the content into it's own QtextDocument
In KoTextLoader load annotation we create the shape instead of loading into QTextFrame. And then we make the shape load the content into it's own QtextDocument (see: KoTextLoader::loadShape on how to create the shape)


Into the original document we still insert a KoAnnotation (using KoTextRangeManager). The difference is just where we store the content
Into the original document we still insert a KoAnnotation (using KoTextRangeManager). The difference is just where we store the content

Revision as of 13:38, 26 January 2013

For implementation of Annotations we will implement it stepwise

1) load it 
2) show&edit
3) save
4) create

Load

We create a subclass of TextShape called AnnotationShape

   class AnnotationTextShape : public TextShape

It registers itself as being able to read annotations, but other than that it's basically just TextShape with a different name. The TextTool should register itself as being able to edit it. The Review and References tools should not.

In KoTextLoader load annotation we create the shape instead of loading into QTextFrame. And then we make the shape load the content into it's own QtextDocument (see: KoTextLoader::loadShape on how to create the shape)

Into the original document we still insert a KoAnnotation (using KoTextRangeManager). The difference is just where we store the content

Show & Edit

To have the AnnotationTextShape show up in the side panel we need to tweak Words to not create frames out of these kind of shapes but instead place it in the side area.

The geometry of the AnnotationTextShape should be locked so only words can move it around

Words will probably need some kind of manager class to handle the layout of the annotation shapes. At some point this layout will be a s complex so it can look like in Kompare

Save

Save is probably going to be really simple. The shapes shouldn't save them selves like other freefloating shapes. Instead KoAnnotation should just ask the shape to save it self of the current behavoir of QTextFrame being save.

Create

An action should be added to the Review tool that creates an annotation but beyond that there really is'nt much to it. However the Review tool is not yet ready to be hacked on (we need to await the removal of the changetracking stuff, so this is why this item is last)