.net Module AODL: Forms and Fields implementation
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.
The first part of my project is to implement Forms support for the AODL library. My vision of it (briefly):
- The main classes for Forms support are located in the AODL.Document.Forms namespace.
- 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)
- Those properties that have several possible values should have an enum type.
- Boolean properties will have an XmlBoolean type (enum with possible values: True, False, NotSet).
- 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.
- Each form should have a collection of child controls (Controls property of ODFControlsCollection type); ODFControlsCollection will be a class derived from CollectionWithEvents.
- Everything connected with controls will be located in AODL.Document.Forms.Controls
- A separate class will stand for each control type (such as ODFText, ODFTextArea, ODFButton, ODFCheckBox etc.).
- 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.
- TextDocument will also have a series of methods to iterate through all the controls within it.
- 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)
- TextDocument, OpenDocumentTextExporter and OpenDocumentImporter should be expanded to handle forms correctly while saving/loading a document.
- 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:
- 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.
- 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.
- 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.
- ODFForm's controls collection will have appropriate Inserted and Removed events to implement the synchronization.
- I'll also add synchronous deletion of control in form:form tag when the reference is deleted.
The AODL Forms are already implemented.
- All the fields-related classes are located in AODL.Document.Fields namespace
- All the Fields classes that represent the appropriate 'content' snippets implement the IContent interface.
- Placeholder and TextInput classes stand for text:placeholder and text:text-input fields respectively.
- Placeholder class has such properties as PlaceholderType, Value, Description and some others. PlaceholderType is an enumeration.
- TextInput class has such Value, Descriptions properties etc.
- 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.
- VariableDecl will stand for variable declaration snippet. Main properties besides Name and Node: Name and VariableValueType
- TextDocument is augmented with a variable declaration list property
- TextDocument has methods to find any VariableDecl. For example, by its name.
- 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.
- Of course, there will be some kind of synchronization between the two last mentioned classes
- Import/export handlers will support fields.
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
- Create a detailed Forms project proposal. Done
- Implement the Forms support in the AODL. Done
- Create tests. Done
- 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