.net Module AODL: Forms and Fields implementation

From Apache OpenOffice Wiki
Jump to: navigation, search

This is the wiki page for the Google Summer_of_Code_2007 proposal by Oleg Yegorov and mentored by Dieter Löschky and Lars Behrmann.

Proposal

FORMS
The first part of my project is to implement Forms support for the AODL library. My vision of it (briefly):

  1. The main classes for Forms support are located in the AODL.Document.Forms namespace.
  2. Each form is represented by the ODFForm class; this class should contain such properties as Href, TargetFrame, Method and others (which are the attributes of a form:form tag). It should implement the IHtml interface (allows to export non-nested forms into HTML)
  3. Those properties that have several possible values should have an enum type.
  4. Boolean properties will have an XmlBoolean type (enum with possible values: True, False, NotSet).
  5. Properties listed in form:properties tag should be reflected in a Properties property of ODFForm (these properties are application-specific). There should be smart methods that return the required property.
  6. Each form should have a collection of child controls (Controls property of ODFControlsCollection type); ODFControlsCollection will be a class derived from CollectionWithEvents.
  7. Everything connected with controls will be located in AODL.Document.Forms.Controls
  8. A separate class will stand for each control type (such as ODFText, ODFTextArea, ODFButton, ODFCheckBox etc.).
  9. ODFForm will have methods that help to search for any child controls by ID or by Name (or form by name), including those controls that are located in nested forms.
  10. TextDocument will also have a series of methods to iterate through all the controls within it.
  11. Each form has a property that represents child (one level below) forms. We should also remember that top-level form is situated in office:forms tag (unlike for those that are nested)
  12. TextDocument, OpenDocumentTextExporter and OpenDocumentImporter should be expanded to handle forms correctly while saving/loading a document.
  13. A new class FormsProcessor will be added to the AODL.Document.Import.OpenDocument.NodeProcessors namespace;

I have decided to resolve the synchronization between the draw:control in the contents nodes and the appropriate form:form element in the following way:

  1. A new auxiliary class AODL.Document.Forms.Controls.ODFControlRef will be added; this is an internal AODL class that stands for draw:control tag. It will have such properties as ID, X,Y,Width,Height,AnchorType, AnchorPageNumber,StyleName,TextStyleName and others that reflect draw:control attributes. And, of course, it will have a set of common properties such as Node.
  2. ODFFormControl will be a basic class for all form controls. All specific controls such as ODFButton will derive from it. ODFFormControl will have an internal variable _controlRef (ODFControlRef) that represents its reference; all the public properties of _controlRef will be accessible through public ODFFormControl properties.
  3. ODFFormControl will have a constructor taking parent form, content container and ID string as obligatory parameters. Of course, there will be other handy overloaded constructors with more parameters.
  4. ODFForm's controls collection will have appropriate Inserted and Removed events to implement the synchronization.
  5. I'll also add synchronous deletion of control in form:form tag when the reference is deleted.

The AODL Forms are already implemented.

FIELDS

  1. All the fields-related classes are located in AODL.Document.Fields namespace
  2. All the Fields classes that represent the appropriate 'content' snippets implement the IContent interface.
  3. Placeholder and TextInput classes stand for text:placeholder and text:text-input fields respectively.
  4. Placeholder class has such properties as PlaceholderType, Value, Description and some others. PlaceholderType is an enumeration.
  5. TextInput class has such Value, Descriptions properties etc.
  6. Implementation of text:variable-set will be separated in two classes: VariableDecl and VariableSet. VariableDeclCollection will be a class deriving from CollectionWithEvents to handle variable declaration lists.
  7. VariableDecl will stand for variable declaration snippet. Main properties besides Name and Node: Name and VariableValueType
  8. TextDocument is augmented with a variable declaration list property
  9. TextDocument has methods to find any VariableDecl. For example, by its name.
  10. VariableSet is a class that implements the text:variable-set. It has a series of properties bound to the possible attributes of text:variable-set tag.
  11. Of course, there will be some kind of synchronization between the two last mentioned classes
  12. Import/export handlers will support fields.

Current Status

Current status: Working on AODL Fields implementation
Project blog: http://soc-aodl.blogspot.com

Student Task List

  • Subscribe to ODF Toolkit mailing list. Done.
  • Submit a filled-out copy of the Joint Copyright Assignment form (JCA). Done.
  • Workout initial implementation details. Done

Forms:

  • Create a detailed Forms project proposal. Done
  • Implement the Forms support in the AODL. Done
  • Create tests. Done

Fields

  • Create a detailed Fields project proposal. Done
  • Implement the Fields support in the AODL. Done
  • Test AODL fields. Done

The official GSoC task has been completed

Further information about the ODF Toolkit

AODL code AODL Wiki page
The ODF Toolkit Wiki page.
The ODF Toolkit project homepage on the OpenOffice.org website.

Personal tools