Thursday, July 19, 2007

I will be on my vacation till July, 29.
Cheers!

Sunday, July 15, 2007

I've just released a new version of AODL.
Several major and minor bugs have been fixed and new tests were introduced.

Major bugs:
- When performing TextDocument.Forms.Remove or TextDocument.Forms.Clear the appropriate ODFControlRefs were not removed from the content collections. As a result, "placeholders" pointing to non-existent controls remained in the document
- The same for ODFForm.Controls

I will continue looking for new bugs :)

Tuesday, July 3, 2007

We've been disputing about storing field references in a centralized container with my mentor Lars Behrmann :)
I've made some changes to the code to fit the exact needs:

1. I've added a base abstract class Field. It fully implements the
IContent interface and has a Value property (internal field value).
It also has an internal _collection property that defines the content
collection it is located in (paragraph etc.)

2. A typed FieldsCollection has been added and a Fields property to
the TextDocument class.
FieldsCollection has FindFieldByName method that helps to look up the desired
field in the collection; such methods as Add, Remove etc. are
overloaded in such a way that they support full synchronization with
the content collection the field snippet is _really_ stored in.
IContentCollection has also been modified to maintain this
synchronization.

for example think about this piece of code:

Paragraph p1 = new Paragraph(td);
p1.TextContent.Add(new SimpleText(td, "Insert text here: "));
Placeholder plch1 = new Placeholder(td, PlaceholderType.Text, "A text placeholder");
plch1.Value = "Text";
p1.Content.Add(plch1);
td.Content.Add(p1);


after executing this, td.Fields will contain the plch1 Placeholder
reference.
If we do this:

Field f = td.Fields.FindFieldByValue("Text");
td.Fields.Remove(f);


the field will also be removed from p1.Content.
And conversely, if we do
p1.Content.Remove(plch1),
the td.Fields collection will be empty :)

3. Of course, the TextDocument.Fields collection is properly filled
while doing import.

4. When exporting a document to HTML, any field is replaced with its
internal value.

Now I'm working on testing all these new features :)