![]() | KParts - the building blocks of KOffice |
Prev | Next |
Each KOffice application is designed to fulfill very specific needs. For example, KSpread is a program for manipulating spreadsheets, while KWord is a program for word processing. By focusing on a specific area, each program aims for perfection in exactly this area. However, depending on what you do with KOffice, you'll often want to take advantage of functionality provided by different applications, but in the same document.
Suppose that you are preparing a document in KWord and want to illustrate some point using a table. While KWord provides its own functionality for the insertion of tables, this may not be enough for your needs. For example, you may want to use certain currency data formats or to do calculations using spreadsheet formulae. Now, some KWord programmer certainly could try to implement this functionality. However, KWord would never be as good as KSpread in this field; and if it tried to implement all the functionality you might possibly need, it would end up becoming unreasonably complex and the source code would become impossible to maintain.
The alternative to this is KParts. Its philosophy is simple: let every application do what it does best.
With KParts, your documents can use all functionality offered by all KOffice applications. You can take advantage of this by inserting so-called “parts” into your document. Every one of those parts is essentially another document, that is, “a document within a document”.
In the example mentioned above, you would simply insert a KSpread part into your KWord document. Then, whenever you edit your table, KSpread would take control in the background. Control would return to KWord when you stop working on the table and start working on text again. The only change you would notice is that the toolbars and menus, while editing the table, reflect the functionality of KSpread instead of that of KWord. This ability to include the functionality of one application in another is called “embedding”.
Prev | Home | Next |
First steps in KOffice | Up | Using KParts in your document |