You are viewing a plain text version of this content. The canonical link for it is here.
Posted to odf-commits@incubator.apache.org by sv...@apache.org on 2018/05/13 20:59:30 UTC

[odftoolkit] branch trunk updated: #ODFTOOLKIT-474# Patch by Georg Fuechsle - Simple API: List decorators with different bullet points

This is an automated email from the ASF dual-hosted git repository.

svanteschubert pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/odftoolkit.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c222c0d  #ODFTOOLKIT-474# Patch by Georg Fuechsle - Simple API: List decorators with different bullet points
c222c0d is described below

commit c222c0dc14b7bbb8c30029532b38bc9e863cac68
Author: Svante Schubert <Sv...@gmail.com>
AuthorDate: Wed May 9 15:21:01 2018 +0200

    #ODFTOOLKIT-474# Patch by Georg Fuechsle - Simple API: List decorators with different bullet points
---
 .../simple/text/list/BulletDecorator.java          |  11 +-
 ...lletDecorator.java => BulletDecoratorBase.java} |  36 +++---
 .../odftoolkit/simple/text/list/DiscDecorator.java |  47 ++++++++
 .../simple/text/list/NumberDecorator.java          | 111 +-----------------
 ...mberDecorator.java => NumberDecoratorBase.java} |  44 ++++---
 .../text/list/NumberedAlphaLowerDecorator.java     |  44 +++++++
 .../text/list/NumberedAlphaUpperDecorator.java     |  44 +++++++
 .../text/list/NumberedGreekLowerDecorator.java     |  44 +++++++
 .../text/list/NumberedRomanLowerDecorator.java     |  44 +++++++
 .../text/list/NumberedRomanUpperDecorator.java     |  44 +++++++
 .../simple/text/list/SquareDecorator.java          |  47 ++++++++
 .../org/odftoolkit/simple/text/list/ListTest.java  | 127 ++++++++++++++++++++-
 12 files changed, 493 insertions(+), 150 deletions(-)

diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java
index bc33927..acf3d3d 100644
--- a/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java
@@ -1,4 +1,4 @@
-/* 
+/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
@@ -21,7 +21,6 @@ package org.odftoolkit.simple.text.list;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import org.odftoolkit.odfdom.dom.OdfContentDom;
 import org.odftoolkit.odfdom.dom.element.style.StyleListLevelPropertiesElement;
 import org.odftoolkit.odfdom.dom.element.style.StyleTextPropertiesElement;
@@ -35,6 +34,7 @@ import org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles;
 import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle;
 import org.odftoolkit.odfdom.incubator.doc.text.OdfTextListStyle;
 import org.odftoolkit.simple.Document;
+import static org.odftoolkit.simple.text.list.BulletDecoratorBase.DEFAULT_BULLET_CHAR;
 import org.w3c.dom.Node;
 
 /**
@@ -44,7 +44,7 @@ import org.w3c.dom.Node;
  * with red color.
  * <p>
  * A BulletDecorator can be reused in the same Document.
- * 
+ *
  * @since 0.4
  */
 public class BulletDecorator implements ListDecorator {
@@ -53,7 +53,6 @@ public class BulletDecorator implements ListDecorator {
 			"2.001cm", "2.399cm", "2.8cm", "3.2cm", "3.601cm" };
 	private static String DEFAULT_TEXT_MIN_LABEL_WIDTH = "0.4cm";
 	private static String DEFAULT_FONT_NAME = "Tahoma";
-	private static String DEFAULT_BULLET_CHAR = "•";
 	private static String DEFAULT_NAME = "Simple_Default_Bullet_List";
 
 	private OdfTextListStyle listStyle;
@@ -62,7 +61,7 @@ public class BulletDecorator implements ListDecorator {
 
 	/**
 	 * Constructor with Document.
-	 * 
+	 *
 	 * @param doc
 	 *            the Document which this BulletDecorator will be used on.
 	 */
@@ -115,7 +114,7 @@ public class BulletDecorator implements ListDecorator {
 			Logger.getLogger(BulletDecorator.class.getName()).log(Level.SEVERE, null, e);
 		}
 	}
-	
+
 	public void decorateList(List list) {
 		TextListElement listElement = list.getOdfElement();
 		listElement.setTextStyleNameAttribute(listStyle.getStyleNameAttribute());
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecoratorBase.java
similarity index 83%
copy from simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java
copy to simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecoratorBase.java
index bc33927..af35971 100644
--- a/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecorator.java
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/BulletDecoratorBase.java
@@ -1,4 +1,4 @@
-/* 
+/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
@@ -21,7 +21,6 @@ package org.odftoolkit.simple.text.list;
 
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import org.odftoolkit.odfdom.dom.OdfContentDom;
 import org.odftoolkit.odfdom.dom.element.style.StyleListLevelPropertiesElement;
 import org.odftoolkit.odfdom.dom.element.style.StyleTextPropertiesElement;
@@ -44,17 +43,17 @@ import org.w3c.dom.Node;
  * with red color.
  * <p>
  * A BulletDecorator can be reused in the same Document.
- * 
+ *
  * @since 0.4
  */
-public class BulletDecorator implements ListDecorator {
+public abstract class BulletDecoratorBase implements ListDecorator {
 
-	private static String[] DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES = { null, "0.401cm", "0.799cm", "1.2cm", "1.6cm",
+	private static final String[] DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES = { null, "0.401cm", "0.799cm", "1.2cm", "1.6cm",
 			"2.001cm", "2.399cm", "2.8cm", "3.2cm", "3.601cm" };
-	private static String DEFAULT_TEXT_MIN_LABEL_WIDTH = "0.4cm";
-	private static String DEFAULT_FONT_NAME = "Tahoma";
-	private static String DEFAULT_BULLET_CHAR = "•";
-	private static String DEFAULT_NAME = "Simple_Default_Bullet_List";
+	private static final String DEFAULT_TEXT_MIN_LABEL_WIDTH = "0.4cm";
+	private static final String DEFAULT_FONT_NAME = "Tahoma";
+	protected static final String DEFAULT_BULLET_CHAR = "\u25e6";
+//	private static String DEFAULT_NAME = "Simple_Default_Bullet_List";
 
 	private OdfTextListStyle listStyle;
 	private OdfStyle paragraphStyle;
@@ -62,28 +61,31 @@ public class BulletDecorator implements ListDecorator {
 
 	/**
 	 * Constructor with Document.
-	 * 
+	 *
 	 * @param doc
 	 *            the Document which this BulletDecorator will be used on.
+	 * @param styleName style name: (i.e. BulletDecorator:  BulletDecorator.DEFAULT_NAME)
+	 * @param styleNameIntern intern style name:  (i.e. BulletDecorator:  "Bullet_20_Symbols")
+	 * @param listCharacter listing character: (i.e. BulletDecorator:  BulletDecorator.DEFAULT_BULLET_CHAR)
 	 */
-	public BulletDecorator(Document doc) {
+	public BulletDecoratorBase(Document doc, String styleName, String styleNameIntern, String listCharacter) {
 		OdfContentDom contentDocument;
 		try {
 			contentDocument = doc.getContentDom();
 			styles = contentDocument.getAutomaticStyles();
 			OdfOfficeStyles documentStyles = doc.getDocumentStyles();
-			listStyle = styles.getListStyle(DEFAULT_NAME);
+			listStyle = styles.getListStyle(styleName);
 			// create bullet style
 			if (listStyle == null) {
 				listStyle = styles.newListStyle();
 				// <style:style style:name="Numbering_20_Symbols"
 				// style:display-name="Numbering Symbols" style:family="text" />
-				getOrCreateStyleByName(documentStyles, styles, "Bullet_20_Symbols", OdfStyleFamily.Text);
+				getOrCreateStyleByName(documentStyles, styles, styleNameIntern, OdfStyleFamily.Text);
 				for (int i = 0; i < 10; i++) {
 					TextListLevelStyleBulletElement listLevelElement = listStyle.newTextListLevelStyleBulletElement(
-							DEFAULT_BULLET_CHAR, i + 1);
+						listCharacter, i + 1);
 					// get from default style element
-					listLevelElement.setTextStyleNameAttribute("Bullet_20_Symbols");
+					listLevelElement.setTextStyleNameAttribute(styleNameIntern);
 					StyleListLevelPropertiesElement styleListLevelPropertiesElement = listLevelElement
 							.newStyleListLevelPropertiesElement();
 					if (DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES[i] != null) {
@@ -112,10 +114,10 @@ public class BulletDecorator implements ListDecorator {
 			paragraphStyle.setStyleParentStyleNameAttribute("Default_20_Text");
 			paragraphStyle.setStyleListStyleNameAttribute(listStyle.getStyleNameAttribute());
 		} catch (Exception e) {
-			Logger.getLogger(BulletDecorator.class.getName()).log(Level.SEVERE, null, e);
+			Logger.getLogger(BulletDecoratorBase.class.getName()).log(Level.SEVERE, null, e);
 		}
 	}
-	
+
 	public void decorateList(List list) {
 		TextListElement listElement = list.getOdfElement();
 		listElement.setTextStyleNameAttribute(listStyle.getStyleNameAttribute());
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/DiscDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/DiscDecorator.java
new file mode 100644
index 0000000..32e68c9
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/DiscDecorator.java
@@ -0,0 +1,47 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * BulletDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as bullet list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A BulletDecorator can be reused in the same Document.
+ *
+ * @since 0.4
+ */
+public class DiscDecorator extends BulletDecoratorBase {
+	private static String DEFAULT_NAME = "Simple_Default_Disc_List";
+
+	/**
+	 * Constructor with Document.
+	 *
+	 * @param doc
+	 *            the Document which this BulletDecorator will be used on.
+	 */
+	public DiscDecorator(Document doc) {
+	    super(doc, DEFAULT_NAME, "Bullet_20_Symbols", DEFAULT_BULLET_CHAR);
+	}
+
+}
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java
index cdced8b..e1eaab8 100644
--- a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java
@@ -19,23 +19,7 @@ under the License.
 
 package org.odftoolkit.simple.text.list;
 
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.odftoolkit.odfdom.dom.OdfContentDom;
-import org.odftoolkit.odfdom.dom.element.style.StyleListLevelPropertiesElement;
-import org.odftoolkit.odfdom.dom.element.style.StyleTextPropertiesElement;
-import org.odftoolkit.odfdom.dom.element.text.TextListElement;
-import org.odftoolkit.odfdom.dom.element.text.TextListItemElement;
-import org.odftoolkit.odfdom.dom.element.text.TextListLevelStyleNumberElement;
-import org.odftoolkit.odfdom.dom.element.text.TextPElement;
-import org.odftoolkit.odfdom.dom.style.OdfStyleFamily;
-import org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeAutomaticStyles;
-import org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles;
-import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle;
-import org.odftoolkit.odfdom.incubator.doc.text.OdfTextListStyle;
 import org.odftoolkit.simple.Document;
-import org.w3c.dom.Node;
 
 /**
  * NumberDecorator is an implementation of the ListDecorator interface,
@@ -47,109 +31,18 @@ import org.w3c.dom.Node;
  * 
  * @since 0.4
  */
-public class NumberDecorator implements ListDecorator {
+public class NumberDecorator extends NumberDecoratorBase {
 
-	private static String[] DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES = { null, "0.501cm", "1cm", "1.501cm", "2cm",
-			"2.501cm", "3.001cm", "3.502cm", "4.001cm", "4.502cm" };
-	private static String DEFAULT_TEXT_MIN_LABEL_WIDTH = "0.499cm";
-	private static String DEFAULT_FONT_NAME = "Tahoma";
 	private static String DEFAULT_NUM_FORMAT = "1";
 	private static String DEFAULT_NUM_SUFFIX = ".";
 	private static String DEFAULT_NAME = "Simple_Default_Number_List";
 
-	private OdfTextListStyle listStyle;
-	private OdfStyle paragraphStyle;
-	private OdfOfficeAutomaticStyles styles;
-
 	/**
 	 * Constructor with Document.
-	 * 
 	 * @param doc
 	 *            the Document which this NumberDecorator will be used on.
 	 */
 	public NumberDecorator(Document doc) {
-		OdfContentDom contentDocument;
-		try {
-			contentDocument = doc.getContentDom();
-			styles = contentDocument.getAutomaticStyles();
-			OdfOfficeStyles documentStyles = doc.getDocumentStyles();
-			listStyle = styles.getListStyle(DEFAULT_NAME);
-			// create number style
-			if (listStyle == null) {
-				listStyle = styles.newListStyle();
-				// <style:style style:name="Numbering_20_Symbols"
-				// style:display-name="Numbering Symbols" style:family="text" />
-				getOrCreateStyleByName(documentStyles, styles, "Numbering_20_Symbols", OdfStyleFamily.Text);
-				for (int i = 0; i < 10; i++) {
-					TextListLevelStyleNumberElement listLevelElement = listStyle.newTextListLevelStyleNumberElement(
-							DEFAULT_NUM_FORMAT, i + 1);
-					// get from default style element
-					listLevelElement.setTextStyleNameAttribute("Numbering_20_Symbols");
-					listLevelElement.setStyleNumSuffixAttribute(DEFAULT_NUM_SUFFIX);
-					StyleListLevelPropertiesElement styleListLevelPropertiesElement = listLevelElement
-							.newStyleListLevelPropertiesElement();
-					if (DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES[i] != null) {
-						styleListLevelPropertiesElement
-								.setTextSpaceBeforeAttribute(DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES[i]);
-					}
-					styleListLevelPropertiesElement.setTextMinLabelWidthAttribute(DEFAULT_TEXT_MIN_LABEL_WIDTH);
-					StyleTextPropertiesElement styleTextPropertiesElement = listLevelElement
-							.newStyleTextPropertiesElement("true");
-					styleTextPropertiesElement.setStyleFontNameAttribute(DEFAULT_FONT_NAME);
-				}
-				// listStyle.setStyleNameAttribute(DEFAULT_NAME);
-			}
-			// create default paragraph style
-			// <style:style style:name="P3" style:family="paragraph"
-			// style:parent-style-name="Default_20_Text"
-			// style:list-style-name="L1"
-			// />
-			paragraphStyle = styles.newStyle(OdfStyleFamily.Paragraph);
-			// <style:style style:name="Default_20_Text"
-			// style:display-name="Default Text" style:family="paragraph"
-			// style:class="text" />
-			// <style:style style:name="Standard" style:family="paragraph"
-			// style:class="text" />
-			getOrCreateStyleByName(documentStyles, styles, "Default_20_Text", OdfStyleFamily.Paragraph);
-			paragraphStyle.setStyleParentStyleNameAttribute("Default_20_Text");
-			paragraphStyle.setStyleListStyleNameAttribute(listStyle.getStyleNameAttribute());
-		} catch (Exception e) {
-			Logger.getLogger(NumberDecorator.class.getName()).log(Level.SEVERE, null, e);
-		}
-	}
-
-	public void decorateList(List list) {
-		TextListElement listElement = list.getOdfElement();
-		listElement.setTextStyleNameAttribute(listStyle.getStyleNameAttribute());
-	}
-
-	public void decorateListItem(ListItem item) {
-		TextListItemElement listItemElement = item.getOdfElement();
-		Node child = listItemElement.getFirstChild();
-		while (child != null) {
-			if (child instanceof TextPElement) {
-				TextPElement pElement = (TextPElement) child;
-				pElement.setTextStyleNameAttribute(paragraphStyle.getStyleNameAttribute());
-			}
-			child = child.getNextSibling();
-		}
-	}
-
-	public ListType getListType() {
-		return ListType.NUMBER;
-	}
-
-	private OdfStyle getOrCreateStyleByName(OdfOfficeStyles documentStyles, OdfOfficeAutomaticStyles styles,
-			String styleName, OdfStyleFamily styleFamily) {
-		OdfStyle odfStyle = documentStyles.getStyle(styleName, styleFamily);
-		if (odfStyle == null) {
-			styles.getStyle(styleName, styleFamily);
-		}
-		if (odfStyle == null) {
-			odfStyle = styles.newStyle(styleFamily);
-			odfStyle.setStyleNameAttribute(styleName);
-			odfStyle.setStyleDisplayNameAttribute(styleName);
-		}
-		return odfStyle;
+	    	super(doc, DEFAULT_NAME, "Numbering_20_Symbols", DEFAULT_NUM_FORMAT, DEFAULT_NUM_SUFFIX, null);
 	}
 }
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecoratorBase.java
similarity index 78%
copy from simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java
copy to simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecoratorBase.java
index cdced8b..a545d5b 100644
--- a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecorator.java
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberDecoratorBase.java
@@ -47,45 +47,51 @@ import org.w3c.dom.Node;
  * 
  * @since 0.4
  */
-public class NumberDecorator implements ListDecorator {
+public abstract class NumberDecoratorBase implements ListDecorator {
 
 	private static String[] DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES = { null, "0.501cm", "1cm", "1.501cm", "2cm",
 			"2.501cm", "3.001cm", "3.502cm", "4.001cm", "4.502cm" };
 	private static String DEFAULT_TEXT_MIN_LABEL_WIDTH = "0.499cm";
 	private static String DEFAULT_FONT_NAME = "Tahoma";
-	private static String DEFAULT_NUM_FORMAT = "1";
-	private static String DEFAULT_NUM_SUFFIX = ".";
-	private static String DEFAULT_NAME = "Simple_Default_Number_List";
+//	protected static String DEFAULT_NUM_FORMAT = "1";
+//	protected static String DEFAULT_NUM_SUFFIX = ".";
+//	private static String DEFAULT_NAME = "Simple_Custom_Number_List";
 
-	private OdfTextListStyle listStyle;
-	private OdfStyle paragraphStyle;
-	private OdfOfficeAutomaticStyles styles;
+	protected OdfTextListStyle listStyle;
+	protected OdfStyle paragraphStyle;
+	protected OdfOfficeAutomaticStyles styles;
 
 	/**
 	 * Constructor with Document.
 	 * 
 	 * @param doc
 	 *            the Document which this NumberDecorator will be used on.
+	 * @param styleName style name: (i.e. NumberDecorator:  NumberDecorator.DEFAULT_NAME)                 
+	 * @param styleNameIntern intern stylename (i.e. NumberDecorator:  "Numbering_20_Symbols")      
+	 * @param numberingFormat the numbering format (i.e. NumberDecorator:  "1", sonsrt "a", "A", "i", "I", ....)      
+	 * @param suffix  suffix after the number ("." for 1., 2., ... ")" for a) b) c) etc)
+	 * @param prefix  prefix before the number ("(" for (a) (b) (c) etc)
 	 */
-	public NumberDecorator(Document doc) {
+	protected NumberDecoratorBase(Document doc, String styleName, String styleNameIntern, String numberingFormat, String suffix, String prefix) {
 		OdfContentDom contentDocument;
 		try {
 			contentDocument = doc.getContentDom();
 			styles = contentDocument.getAutomaticStyles();
 			OdfOfficeStyles documentStyles = doc.getDocumentStyles();
-			listStyle = styles.getListStyle(DEFAULT_NAME);
+			listStyle = styles.getListStyle(styleName);
 			// create number style
 			if (listStyle == null) {
 				listStyle = styles.newListStyle();
 				// <style:style style:name="Numbering_20_Symbols"
 				// style:display-name="Numbering Symbols" style:family="text" />
-				getOrCreateStyleByName(documentStyles, styles, "Numbering_20_Symbols", OdfStyleFamily.Text);
+				getOrCreateStyleByName(documentStyles, styles, styleNameIntern, OdfStyleFamily.Text);
 				for (int i = 0; i < 10; i++) {
 					TextListLevelStyleNumberElement listLevelElement = listStyle.newTextListLevelStyleNumberElement(
-							DEFAULT_NUM_FORMAT, i + 1);
+						numberingFormat, i + 1);
 					// get from default style element
-					listLevelElement.setTextStyleNameAttribute("Numbering_20_Symbols");
-					listLevelElement.setStyleNumSuffixAttribute(DEFAULT_NUM_SUFFIX);
+					listLevelElement.setTextStyleNameAttribute(styleNameIntern);
+					listLevelElement.setStyleNumSuffixAttribute(suffix);
+					listLevelElement.setStyleNumPrefixAttribute(prefix);
 					StyleListLevelPropertiesElement styleListLevelPropertiesElement = listLevelElement
 							.newStyleListLevelPropertiesElement();
 					if (DEFAULT_TEXT_SPACE_BEFORE_ATTRIBUTES[i] != null) {
@@ -114,7 +120,7 @@ public class NumberDecorator implements ListDecorator {
 			paragraphStyle.setStyleParentStyleNameAttribute("Default_20_Text");
 			paragraphStyle.setStyleListStyleNameAttribute(listStyle.getStyleNameAttribute());
 		} catch (Exception e) {
-			Logger.getLogger(NumberDecorator.class.getName()).log(Level.SEVERE, null, e);
+			Logger.getLogger(NumberDecoratorBase.class.getName()).log(Level.SEVERE, null, e);
 		}
 	}
 
@@ -152,4 +158,14 @@ public class NumberDecorator implements ListDecorator {
 		}
 		return odfStyle;
 	}
+	
+	/**
+	 * only for JUnit Test
+	 * @return
+	 */
+	OdfTextListStyle getListStyle()
+	{
+	    return listStyle;
+	}
+
 }
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedAlphaLowerDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedAlphaLowerDecorator.java
new file mode 100644
index 0000000..5ec2977
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedAlphaLowerDecorator.java
@@ -0,0 +1,44 @@
+/* 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * NumberDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as number list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A NumberDecorator can be reused in the same Document.
+ * 
+ * @since 0.4
+ */
+public class NumberedAlphaLowerDecorator extends NumberDecoratorBase {
+
+	/**
+	 * Constructor with Document.
+	 * @param doc
+	 *            the Document which this NumberDecorator will be used on.
+	 */
+	public NumberedAlphaLowerDecorator(Document doc) {
+	    	super(doc, "Simple_Default_alfa_lower_List", "Numbering_20_Symbols", "a", ")", null);
+	}
+}
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedAlphaUpperDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedAlphaUpperDecorator.java
new file mode 100644
index 0000000..73b24a8
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedAlphaUpperDecorator.java
@@ -0,0 +1,44 @@
+/* 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * NumberDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as number list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A NumberDecorator can be reused in the same Document.
+ * 
+ * @since 0.4
+ */
+public class NumberedAlphaUpperDecorator extends NumberDecoratorBase {
+
+	/**
+	 * Constructor with Document.
+	 * @param doc
+	 *            the Document which this NumberDecorator will be used on.
+	 */
+	public NumberedAlphaUpperDecorator(Document doc) {
+	    	super(doc, "Simple_Default_alfa_upper_List", "Numbering_20_Symbols", "A", ")", null);
+	}
+}
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedGreekLowerDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedGreekLowerDecorator.java
new file mode 100644
index 0000000..3b92648
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedGreekLowerDecorator.java
@@ -0,0 +1,44 @@
+/* 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * NumberDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as number list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A NumberDecorator can be reused in the same Document.
+ * 
+ * @since 0.4
+ */
+public class NumberedGreekLowerDecorator extends NumberDecoratorBase {
+
+	/**
+	 * Constructor with Document.
+	 * @param doc
+	 *            the Document which this NumberDecorator will be used on.
+	 */
+	public NumberedGreekLowerDecorator(Document doc) {
+	    	super(doc, "Simple_Default_greek_lower_List", "Numbering_20_Symbols", "α, β, ... (gr)", ")", null);
+	}
+}
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedRomanLowerDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedRomanLowerDecorator.java
new file mode 100644
index 0000000..7341a61
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedRomanLowerDecorator.java
@@ -0,0 +1,44 @@
+/* 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * NumberDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as number list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A NumberDecorator can be reused in the same Document.
+ * 
+ * @since 0.4
+ */
+public class NumberedRomanLowerDecorator extends NumberDecoratorBase {
+
+	/**
+	 * Constructor with Document.
+	 * @param doc
+	 *            the Document which this NumberDecorator will be used on.
+	 */
+	public NumberedRomanLowerDecorator(Document doc) {
+	    	super(doc, "Simple_Default_roman_lower_List", "Numbering_20_Symbols", "i", ")", null);
+	}
+}
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedRomanUpperDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedRomanUpperDecorator.java
new file mode 100644
index 0000000..899ea05
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/NumberedRomanUpperDecorator.java
@@ -0,0 +1,44 @@
+/* 
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * NumberDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as number list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A NumberDecorator can be reused in the same Document.
+ * 
+ * @since 0.4
+ */
+public class NumberedRomanUpperDecorator extends NumberDecoratorBase {
+
+	/**
+	 * Constructor with Document.
+	 * @param doc
+	 *            the Document which this NumberDecorator will be used on.
+	 */
+	public NumberedRomanUpperDecorator(Document doc) {
+	    	super(doc, "Simple_Default_roman_upper_List", "Numbering_20_Symbols", "I", ")", null);
+	}
+}
diff --git a/simple/src/main/java/org/odftoolkit/simple/text/list/SquareDecorator.java b/simple/src/main/java/org/odftoolkit/simple/text/list/SquareDecorator.java
new file mode 100644
index 0000000..db6c793
--- /dev/null
+++ b/simple/src/main/java/org/odftoolkit/simple/text/list/SquareDecorator.java
@@ -0,0 +1,47 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+package org.odftoolkit.simple.text.list;
+
+import org.odftoolkit.simple.Document;
+
+/**
+ * BulletDecorator is an implementation of the ListDecorator interface,
+ * decorates a given List as bullet list. User can extend this class and realize
+ * their own list and list item style. For example, set a specifies list item
+ * with red color.
+ * <p>
+ * A BulletDecorator can be reused in the same Document.
+ *
+ * @since 0.4
+ */
+public class SquareDecorator extends BulletDecoratorBase {
+	private static String DEFAULT_NAME = "Simple_Default_Square_List";
+
+	/**
+	 * Constructor with Document.
+	 *
+	 * @param doc
+	 *            the Document which this BulletDecorator will be used on.
+	 */
+	public SquareDecorator(Document doc) {
+	    super(doc, DEFAULT_NAME, "Bullet_20_Symbols", DEFAULT_BULLET_CHAR);
+	}
+
+}
diff --git a/simple/src/test/java/org/odftoolkit/simple/text/list/ListTest.java b/simple/src/test/java/org/odftoolkit/simple/text/list/ListTest.java
index d842b14..51ddcab 100644
--- a/simple/src/test/java/org/odftoolkit/simple/text/list/ListTest.java
+++ b/simple/src/test/java/org/odftoolkit/simple/text/list/ListTest.java
@@ -1,4 +1,4 @@
-/* 
+/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
@@ -22,9 +22,7 @@ package org.odftoolkit.simple.text.list;
 import java.util.Iterator;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-
 import junit.framework.Assert;
-
 import org.junit.Test;
 import org.odftoolkit.simple.TextDocument;
 import org.odftoolkit.simple.table.Cell;
@@ -383,7 +381,128 @@ public class ListTest {
 			Assert.assertEquals(ListType.NUMBER, outLineList.getType());
 			outLineList.setDecorator(imageDecorator);
 			Assert.assertEquals(ListType.IMAGE, outLineList.getType());
-			doc.save(ResourceUtilities.getTestOutput("ListOutput.odt"));
+			doc.save(ResourceUtilities.newTestOutputFile("ListOutput.odt"));
+		} catch (Exception e) {
+			Logger.getLogger(ListTest.class.getName()).log(Level.SEVERE, null, e);
+			Assert.fail(e.getMessage());
+		}
+	}
+
+
+	@Test
+	public void testSetExtendedNumberedListDecorator() {
+		try {
+			TextDocument doc = TextDocument.newTextDocument();
+
+			String[] subItemContents = { "sub list item 1", "sub list item 2", "sub list item 3" };
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Alpha lower List Example:");
+			List alphaLwrList = doc.addList(new NumberedAlphaLowerDecorator(doc));
+			alphaLwrList.setHeader("Alpha lower List");
+			for (String listitem : subItemContents)
+			{
+			    alphaLwrList.addItem(listitem);
+			}
+			Assert.assertEquals(ListType.NUMBER, alphaLwrList.getType());
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Alpha upper List Example:");
+			List alphaUprList = doc.addList(new NumberedAlphaUpperDecorator(doc));
+			alphaUprList.setHeader("Alpha upper List");
+			for (String listitem : subItemContents)
+			{
+			    alphaUprList.addItem(listitem);
+			}
+
+			Assert.assertEquals(ListType.NUMBER, alphaUprList.getType());
+
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Greek lower List Example:");
+			List greekLwrList = doc.addList(new NumberedGreekLowerDecorator(doc));
+			greekLwrList.setHeader("Greek lower List");
+			for (String listitem : subItemContents)
+			{
+			    greekLwrList.addItem(listitem);
+			}
+
+			Assert.assertEquals(ListType.NUMBER, greekLwrList.getType());
+
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Roman lower List Example:");
+			List romanLwrList = doc.addList(new NumberedRomanLowerDecorator(doc));
+			romanLwrList.setHeader("Roman lower List");
+			for (String listitem : subItemContents)
+			{
+			    romanLwrList.addItem(listitem);
+			}
+
+			Assert.assertEquals(ListType.NUMBER, romanLwrList.getType());
+
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Roman upper List Example:");
+			List romanUprList = doc.addList(new NumberedRomanUpperDecorator(doc));
+			romanUprList.setHeader("Roman upper List");
+			for (String listitem : subItemContents)
+			{
+			    romanUprList.addItem(listitem);
+			}
+
+			Assert.assertEquals(ListType.NUMBER, romanUprList.getType());
+
+
+			doc.save(ResourceUtilities.newTestOutputFile("NumberedListOutput.odt"));
+		} catch (Exception e) {
+			Logger.getLogger(ListTest.class.getName()).log(Level.SEVERE, null, e);
+			Assert.fail(e.getMessage());
+		}
+	}
+
+
+	@Test
+	public void testSetExtendedBulletListDecorator() {
+		try {
+			TextDocument doc = TextDocument.newTextDocument();
+
+			String[] subItemContents = { "sub list item 1", "sub list item 2", "sub list item 3" };
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Bullet List Example:");
+			List bulletList = doc.addList(new BulletDecorator(doc));
+			bulletList.setHeader("Bullet List");
+			for (String listitem : subItemContents)
+			{
+			    bulletList.addItem(listitem);
+			}
+			Assert.assertEquals(ListType.BULLET, bulletList.getType());
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Disc List Example:");
+			List discList = doc.addList(new DiscDecorator(doc));
+			discList.setHeader("Disc List");
+			for (String listitem : subItemContents)
+			{
+			    discList.addItem(listitem);
+			}
+
+			Assert.assertEquals(ListType.BULLET, discList.getType());
+
+
+			doc.newParagraph(" ");
+			doc.newParagraph("Square List Example:");
+			List squareList = doc.addList(new SquareDecorator(doc));
+			squareList.setHeader("Square List");
+			for (String listitem : subItemContents)
+			{
+			    squareList.addItem(listitem);
+			}
+
+			Assert.assertEquals(ListType.BULLET, squareList.getType());
+
+			doc.save(ResourceUtilities.newTestOutputFile("BulletListOutput.odt"));
 		} catch (Exception e) {
 			Logger.getLogger(ListTest.class.getName()).log(Level.SEVERE, null, e);
 			Assert.fail(e.getMessage());

-- 
To stop receiving notification emails like this one, please contact
svanteschubert@apache.org.