Calligra/Projects/Annotations
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
UI Considerations
Plain text annotations are just shown next to the document, with wrapped text. If users insert objects with a fixed / minimum width to an annotation (like tables or pictures), they are not shown immediately. Instead, a "Show all" link is displayed in the annotation and when clicked, a layer expands from the annotation, showing it in full. If the user clicks anywhere outside the layer, it collapses again
Users should be able to edit text and apply basic formatting (e.g. bold/italic/underline, maybe color) without leaving the Review tool. For advanced options like applying styles, inserting objects, users have to switch to the respective tool.
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)