Difference between revisions of "AODL wishlist"

From Apache OpenOffice Wiki
Jump to: navigation, search
m (Bugfix)
 
(2 intermediate revisions by one other user not shown)
Line 5: Line 5:
  
 
Here is the sourcecode to fix the problem:
 
Here is the sourcecode to fix the problem:
 +
 +
'''Add this to the Cell data object:'''
 +
 +
<pre>
 +
///
 +
/// Gets or sets the number of columns repeated.
 +
///
 +
/// The number of columns repeated.
 +
public int NumberOfColumnsRepeated { get; set; }
 +
</pre>
 +
  
 
'''The method CreateTableCell()'''
 
'''The method CreateTableCell()'''
Line 33: Line 44:
 
int repeating = 0;
 
int repeating = 0;
  
if(node.Attributes.Count > 0) {
+
foreach(XmlAttribute attr in node.Attributes) {
foreach(XmlAttribute attr in node.Attributes) {
+
if(attr.Name == "table:number-columns-repeated") {
if(attr.Name == "table:number-columns-repeated") {
+
int.TryParse(attr.Value, out repeating);
int.TryParse(attr.Value, out repeating);
+
cell.NumberOfColumnsRepeated = repeating;
cell.NumberOfColumnsRepeated = repeating;
+
}
+
 
}
 
}
 
}
 
}
Line 55: Line 64:
 
iColl.Add(iContent);
 
iColl.Add(iContent);
 
}
 
}
else
+
else if(this.OnWarning != null)
 
{
 
{
if(this.OnWarning != null)
+
AODLWarning warning = new AODLWarning("Couldn't create IContent from a table cell.");
{
+
warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
AODLWarning warning = new AODLWarning("Couldn't create IContent from a table cell.");
+
warning.Node = nodeChild;
warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
+
this.OnWarning(warning);
warning.Node = nodeChild;
+
this.OnWarning(warning);
+
}
+
 
}
 
}
 
}
 
}
Line 97: Line 103:
 
row.CellCollection.Add(cell);
 
row.CellCollection.Add(cell);
  
if(cell.NumberOfColumnsRepeated > 0) {
+
for(int i = 1; i < cell.NumberOfColumnsRepeated; i++) {
 
XmlNode copyNode = cell.Node.CloneNode(true);
 
XmlNode copyNode = cell.Node.CloneNode(true);
 
copyNode.Attributes.RemoveAll();
 
copyNode.Attributes.RemoveAll();
Line 114: Line 120:
 
row.CellSpanCollection.Add(iContent as CellSpan);
 
row.CellSpanCollection.Add(iContent as CellSpan);
 
}
 
}
else
+
else if(this.OnWarning != null)
 
{
 
{
if(this.OnWarning != null)
+
AODLWarning warning = new AODLWarning("Couldn't create IContent from a row node. Content is unknown table row content!");
{
+
warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
AODLWarning warning = new AODLWarning("Couldn't create IContent from a row node. Content is unknown table row content!");
+
warning.Node = iContent.Node;
warning.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
+
this.OnWarning(warning);
warning.Node = iContent.Node;
+
this.OnWarning(warning);
+
}
+
 
}
 
}
 
}
 
}
Line 130: Line 133:
 
...
 
...
 
</pre>
 
</pre>
 
 
  
 
==Bugfix==
 
==Bugfix==

Latest revision as of 23:09, 26 February 2010

In this article, you can add descriptions of features you would like to see in AODL. This can serve as a source of inspiration for developers and contributers. Hopefully, these might be implemented during the Summer of Code 2007 work on this project

Bugfix

I have fixed a bug on loading a existing table who have some empty cells (OpenOffice creates here a attribute "table:number-columns-repeated" who declares the number of copies of this cell.

Here is the sourcecode to fix the problem:

Add this to the Cell data object:

/// 
/// Gets or sets the number of columns repeated.
/// 
/// The number of columns repeated.
public int NumberOfColumnsRepeated { get; set; }


The method CreateTableCell()

...
...
...

//Create a new Cel
Cell cell					= new Cell(this._document, node);
IContentCollection iColl	= new IContentCollection();
//Recieve CellStyle
IStyle cellStyle			= this._document.Styles.GetStyleByName(cell.StyleName);

if(cellStyle != null)
{
	int i=0;
	cell.Style				= cellStyle;
	if(cellStyle.StyleName == "ce244")
		i=1;
}
//No need for a warning


// this is the new code:::

// check for thew "table:number-columns-repeated" attribute
int repeating = 0;

foreach(XmlAttribute attr in node.Attributes) {
	if(attr.Name == "table:number-columns-repeated") {
		int.TryParse(attr.Value, out repeating);
		cell.NumberOfColumnsRepeated = repeating;
	}
}

// :::end of new code



//Create the cells content
foreach(XmlNode nodeChild in cell.Node.ChildNodes)
{
	IContent iContent		= this.CreateContent(nodeChild);

	if(iContent != null)
	{
		iColl.Add(iContent);
	}
	else if(this.OnWarning != null)
	{
		AODLWarning warning			= new AODLWarning("Couldn't create IContent from a table cell.");
		warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
		warning.Node				= nodeChild;
		this.OnWarning(warning);
	}
}

cell.Node.InnerXml			= "";

foreach(IContent iContent in iColl)
	cell.Content.Add(iContent);
return cell;

...
...
...
</cite>

'''The method CreateTableRow()'''
<pre>
...
...
...

foreach(IContent iContent in iColl)
{
if(iContent is Cell)
{


// this is the new code:::
	// new way
	Cell cell = (Cell)iContent;
	cell.Row = row;

	row.CellCollection.Add(cell);

	for(int i = 1; i < cell.NumberOfColumnsRepeated; i++) {
		XmlNode copyNode = cell.Node.CloneNode(true);
		copyNode.Attributes.RemoveAll();
		row.CellCollection.Add(this.CreateTableCell(copyNode));
	}

// :::end of new code

	// old way ...
	//( (Cell)iContent ).Row = row;
	//row.CellCollection.Add(cell);
}
else if(iContent is CellSpan)
{
	((CellSpan)iContent).Row	= row;
	row.CellSpanCollection.Add(iContent as CellSpan);
}
else if(this.OnWarning != null)
{
	AODLWarning warning			= new AODLWarning("Couldn't create IContent from a row node. Content is unknown table row content!");
	warning.InMethod			= AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
	warning.Node				= iContent.Node;
	this.OnWarning(warning);
}
}

...
...
...

Bugfix

include bugfix posted on sourceforge.net

several month ago i had a problem with aodl and large tables.. i posted the bug, testcode and the bugfix a few days later on the sourceforge bugtracker. please fix this big bug!

i haven't found a email-adress to which i could direct mail this request, but i hope someone will read this text and fix the bug! THX! Artemis1121 09:49, 17 October 2007 (CEST)

Styles

Font by String

Allow indicating and using fonts by string, such as "Broadway BT", rather than FontFamilies.BroadwayBT;

Otherwise, when I would try to use a typeface not included in the standard installations, such as "Gentium" or "DejaVu Sans", these would never be available under the hardcoded system.

Table Cell Widths Allow define of cell widths for individual cells or columns.

Graphics

Captions Is there a way to add a caption to a Frame that has a graphic in it? I can simply add text below a figure, but I would like the captions to be sequences so that I could then build a table of contents. Below is a snippet of xml from an ODT content.xml file that shows what I need (written from OpenOffice). A little bit from the end is a text: sequence element. How do I add this using AODL? The graphics are no problem it's just the sequence that I'm lost on.

SVG Work with SVG Import to allow runtime SVG insertion.

AutoText

My document assembly strategy relies heavily upon use of AutoText entries. Please implement Autotext features.

Master Documents

Easy insertion of smaller documents into Master documents without XmlDoc.ImportNode

Temporary Files

Please insert a possibility to change the path whitch is used for the temporary extraction of the ODF-Files. Maybe it can be set to the systemwide Temp-Directory.

Personal tools