The Flake library is a low level library for all kinds of graphical content to be placed on any KOffice canvas. This includes a line to text-areas or even movies. Just as important, this library will include tools to manipulate the graphical content. At least at the level of Flake objects. This goes from moving/rotating the object to a basis for complex brushes for a paint program.
Who uses Flake
A shape is a rectangle or a text or a movie. A shape paints itself and has content. A Tool get user input. Tools do things on data, tools do things on shapes. Both shapes and tools are plugins. So they are independent of applications. For example; I have a textshape that paints text. It comes with a texttool that takes mouse and keyboard events and alters the text that the textshape shows. This idea of combining a shape and a text is done in flake by "ID"s . Each shape has an ID and a tool has an ID. If they have the same ID they belong together. Example; I select a text shape and the toolbox will show a icon to activate the text tool.
The way that a shape is kept separete from the application and from the Flake layer is similar to how a Widget in a GUI is kept separate from the application. The shape inherits from the abstract KoShape class and all the logic embeddd in the KoShape class is enough for the flake layer to do all things with it like positioning and moving as well as rotating and deleting it. Just like a widget does not know the difference between painting on one app, or another a shape will not know the difference. The flake library will take care of all details.
It is common to combine a shape-plugin with one or more tools which are made specifically to work on that shape type. So, a text shape comes with a tool that knows how to address the shape not only by the abstract KoShape class, but also by the KoTextShape API and is therefor able to alter the data that that shape displays. In this case text.
Flake natively only has a vector shape. All other types of shapes (including the text one used in the example above) are plugins and not part of Flake itself.
Use KoShape as a base object for any application-specific graphical content, and extend KoShapeContainer for objects that can contain others.
KoShape is the base class for all flake objects. Flake objects extend it to allow themselves to be manipulated by the KoTool s. The content of such an object is independent and based on the model of the data this object represents.
If you want to be a supplier of shape objects; create a library with a KoShapeFactory class and install a .desktop service file with the following content:
[Desktop Entry] Encoding=UTF-8 Name=My Flake Shapes Plugin ServiceTypes=KOffice/Shape Type=Service X-KDE-Library=myflakeshapesplugin X-Flake-Version=1