< Calligra
Revision as of 17:56, 6 December 2010 by Cyrille (talk | contribs) (Created page with '= Architecture and Design of KOffice 2.0 = This document is intended to present a general, high-level overview of software architecture and user interface design of KOffice 2.0....')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Architecture and Design of KOffice 2.0

This document is intended to present a general, high-level overview of software architecture and user interface design of KOffice 2.0. Note that because of different workflow not all KOffice applications are fully integrated into this design: notably Kexi and KPlato. The KSpread integration with the KOffice 2.0 design has not progressed very far at the time of writing, although there are plenty of opportunities.

Also note that KOffice consists of two "wings" a creative wing and a productive wing, with KWord as the join. The first contains Krita, Karbon and Kivio, the second contains KPresenter, KSpread, KPlato, Kexi, KChart and KFormula.

A second division is between the big, document-oriented stand-alone applications and the smaller applications that are more like really big shapes: kformula and kchart.

The Applications

KOffice consists of several applications that offer a specialized interface for a certain task to a generic set of content components. For instance, the word processor is optimized for the creating of paged text documents with a certain layout. The drawing application is optimized for creating single page vector images. The presentation application is optimized for making slideshows. But all the applications use the text component, the same vector graphics components and the same chart components.

Applications are specialized through their canvas and document and their menu structure:

A multi-page document needs a different canvas and document from a single-page document, which again is different from a slideshow. Thus, every KOffice application needs to implement a particular document type and a specific KoCanvasBase-based canvas for displaying the document. The document contents consist mainly of shapes. The scrollbars around the canvas are provide by KOffice, by the way. Some applications contain more than one canvas implementation: Krita for instance has both a QPainter and an OpenGL canvas. (Which could be useful for Karbon, too.)

The menu structure contains additional user actions that extend the basic functionality provided by the shape tools with document-specific functionality.

Shapes and Tools

Similar to Gobe Productive and Apple's iWorks, KOffice documents are composed from fine-grained components, shapes. A shape can contain text, vector graphics, a table, a chart, raster graphics, music -- the possibilities are infinite.

Shapes can be selected in a gui element called the "shape selector". A particular shape, say a vector shape, can come in many different forms: think kivio stencils. We are still developing a shape selector that can handle and organize many different shape types and shape templates.

Shapes contain data and know how to draw themselves using Qt's painting code, load themselves from a chunk of (odf-compliant) XML and save themselves to XML. Shapes can be moved, rotated, scaled, added and deleted using the pointer tool. Vector shapes can also contain gradient or other fills, nodes and lines: there are generic tools for setting these. It is the intention to make fill and line tools also work on, for instance, the borders of other shape types.

The data contained in the shape is edited using tools. As soon as a shape is selected the associated tools are added to a special area in the toolbox. Selecting a tool shows the the tool option page in a docking window. The tool receives all keyboard, mouse and tablet events from the canvas and is supposed to use these events to mess with the data contained in the shape. There is one tool instance for each pointing device attached to the computer: mouse, stylus, airbrush, eraser, art pen.

User Interface

File:KOfficeGUI.png
KOffice gui example

Thus, the basic design of a KOffice application contains the following components:

  • toolbox
  • shape selector
  • dock windows
  • menus and toolbars
  • canvas

Here, we have the toolbox top-left, shape selector at the bottom, tool option page top-right, other dockers on the right, menu on top and the canvas with some shapes in the middle.

The shape selector needs work. The use of toolbar buttons in KDE4 and KOffice2 has changed from the Microsoft example of tens of toolbars stuffed with buttons to the Apple example of only few very useful buttons.

There is still a lot of work to be done to make our user interfaces more useful and pleasant to use. The functionality is ready, the basic order of things (i.e., the list above) is pretty sound, but the actual implementation is not done at all.

The Libraries

KOffice 2.0 contains a set of base libraries that provide the common functionality:

  • Flake: the canvas interface, the tool interface and the shape definitions
  • Main: the document and view base classes, support for import/export filters
  • GuiUtils: zooming, widgets, document section browser
  • kokross: support for scripting in many scripting languages, with some gui components for managing scripts
  • kopageapp: the base for applications that have multiple pages but without text running from one page to another (kpresenter and kivio)
  • kopainter: common graphics stuff like gradients
  • kotext: text handling
  • pigment: professional color handling including color correction
  • resources: handling of resources like clipart, brushes etc. (needs a refactor!)
  • store: odf and old-style native file handling. May be extracted from koffice in the future and provided to all of KDE.

The Plugins

As discussed at Developing KOffice Plugins, KOffice is very extensible. You can add new file import/export filters, content types (for example, a music notation shape was developed as a plugin), tools, dockers, text plugins and application specific plugins like Krita's image filters.


Content is available under Creative Commons License SA 4.0 unless otherwise noted.