Difference between revisions of "Documentation/DevGuide/OfficeDev/Document API Filter Development"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Robot: Changing Category:Documentation/Developers Guide/Office Development)
Line 8: Line 8:
 
}}
 
}}
 
{{DISPLAYTITLE:Document API Filter Development}}
 
{{DISPLAYTITLE:Document API Filter Development}}
First, we provide an overview of the import and export process using a document API, and gain an understanding of the general concepts.  
+
First, we provide an overview of the import and export process in {{PRODUCTNAME}}, and gain an understanding of the general concepts.  
  
 
=== Introduction ===
 
=== Introduction ===
  
Inside {{PRODUCTNAME}} a document is represented by its document service, called model. On disk, the same document is represented as a file or possibly as a dynamic generated output, for example, of a database statement. We cannot assign it to a file on disk, so we call it content to describe it. A filter component is used to convert between these different formats.
+
Inside {{PRODUCTNAME}} a document is represented by its document service, called model. On disk, the same document is represented as a file or possibly as a dynamically generated output, for example, of a database statement. To generalize this and abstract from single disk files we just call it "content". The content is a serialization of a model, e.g. the ODF or the Word model. A filter component is used to convert between this model and the internal model defined by the document core model.
  
 
[[Image:import_export.png|none|thumb|300px|Import/Export Filter Process]]
 
[[Image:import_export.png|none|thumb|300px|Import/Export Filter Process]]
  
If you make use of UNO, this above diagram can be turned into programming reality quite easily. The three entities in the diagram, content, model, and filter, all have direct counterparts in UNO services. The services consist of several interfaces that map to a specific implementation, for example, using C++ or Java.
+
In our API the three entities in the above diagram, content, model, and filter, are defined as UNO services. The services consist of several interfaces that map to a specific implementation, for example, using C++ or Java.
  
The filter writer creates a class that implements the <idl>com.sun.star.document.ExportFilter</idl> or <idl>com.sun.star.document.ImportFilter</idl> services, or both. To achieve this, the corresponding stream or URL is obtained from the <idl>com.sun.star.document.MediaDescriptor</idl>. The incoming data is then interpreted and the model is used by calling the appropriate methods. The available methods depend on the type of document as described by the document service.
+
The filter implementer has to develop a class that implements the <idl>com.sun.star.document.ExportFilter</idl> or <idl>com.sun.star.document.ImportFilter</idl> service, or both in case the filter should support import and export. The filter will get a <idl>com.sun.star.document.MediaDescriptor</idl> that defines the stream the filter must use for its input or output.  
  
 
For a list of available document services, refer to the section [[Documentation/DevGuide/OfficeDev/Component/Models#Document Specific Features|Document Specific Features]].
 
For a list of available document services, refer to the section [[Documentation/DevGuide/OfficeDev/Component/Models#Document Specific Features|Document Specific Features]].

Revision as of 08:48, 30 September 2008



First, we provide an overview of the import and export process in OpenOffice.org, and gain an understanding of the general concepts.

Introduction

Inside OpenOffice.org a document is represented by its document service, called model. On disk, the same document is represented as a file or possibly as a dynamically generated output, for example, of a database statement. To generalize this and abstract from single disk files we just call it "content". The content is a serialization of a model, e.g. the ODF or the Word model. A filter component is used to convert between this model and the internal model defined by the document core model.

Import/Export Filter Process

In our API the three entities in the above diagram, content, model, and filter, are defined as UNO services. The services consist of several interfaces that map to a specific implementation, for example, using C++ or Java.

The filter implementer has to develop a class that implements the com.sun.star.document.ExportFilter or com.sun.star.document.ImportFilter service, or both in case the filter should support import and export. The filter will get a com.sun.star.document.MediaDescriptor that defines the stream the filter must use for its input or output.

For a list of available document services, refer to the section Document Specific Features.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools