diff --git a/fastods-crypto/pom.xml b/fastods-crypto/pom.xml
index 4688796e..c1adb30a 100644
--- a/fastods-crypto/pom.xml
+++ b/fastods-crypto/pom.xml
@@ -54,6 +54,22 @@
1.70
+
+ javax.xml.bind
+ jaxb-api
+ 2.3.0
+
+
+ com.sun.xml.bind
+ jaxb-core
+ 2.3.0
+
+
+ com.sun.xml.bind
+ jaxb-impl
+ 2.3.0
+
+
junit
junit
@@ -90,4 +106,4 @@
-
\ No newline at end of file
+
diff --git a/fastods/src/main/java/com/github/jferard/fastods/PreambleAppender.java b/fastods/src/main/java/com/github/jferard/fastods/PreambleAppender.java
index e3ffe3ab..8c885075 100644
--- a/fastods/src/main/java/com/github/jferard/fastods/PreambleAppender.java
+++ b/fastods/src/main/java/com/github/jferard/fastods/PreambleAppender.java
@@ -72,7 +72,7 @@ public void appendColumns(final XMLUtil xmlUtil, final Appendable appendable)
final Iterator iterator = this.model.getColumns().iterator();
if (!iterator.hasNext()) {
TableColumnImpl.DEFAULT_TABLE_COLUMN
- .appendXMLToTable(xmlUtil, appendable, MAX_COLUMN_COUNT);
+ .appendXMLToTable(xmlUtil, appendable, this.model.getColumnCapacity());
return;
}
@@ -81,7 +81,7 @@ public void appendColumns(final XMLUtil xmlUtil, final Appendable appendable)
appendable.append("");
}
int count = 1;
- int endCount = MAX_COLUMN_COUNT;
+ int endCount = this.model.getColumnCapacity();
TableColumnImpl curColumn = iterator.next(); // will be shifted to prevTCS
if (curColumn == null) {
curColumn = TableColumnImpl.DEFAULT_TABLE_COLUMN;
diff --git a/fastods/src/main/java/com/github/jferard/fastods/TableModel.java b/fastods/src/main/java/com/github/jferard/fastods/TableModel.java
index 424c8797..07a5c27d 100644
--- a/fastods/src/main/java/com/github/jferard/fastods/TableModel.java
+++ b/fastods/src/main/java/com/github/jferard/fastods/TableModel.java
@@ -683,4 +683,8 @@ public void setHeaderColumnsCount(final int headerColumnsCount) {
public int getHeaderColumnsCount() {
return this.headerColumnsCount;
}
+
+ public int getColumnCapacity() {
+ return this.columnCapacity;
+ }
}
diff --git a/fastods/src/test/java/com/github/jferard/fastods/PreambleAppenderTest.java b/fastods/src/test/java/com/github/jferard/fastods/PreambleAppenderTest.java
index e4e8338f..6e9e3784 100644
--- a/fastods/src/test/java/com/github/jferard/fastods/PreambleAppenderTest.java
+++ b/fastods/src/test/java/com/github/jferard/fastods/PreambleAppenderTest.java
@@ -25,16 +25,17 @@
package com.github.jferard.fastods;
-import com.github.jferard.fastods.style.TableColumnStyle;
-import com.github.jferard.fastods.testlib.DomTester;
-import com.github.jferard.fastods.util.FastFullList;
-import com.github.jferard.fastods.util.XMLUtil;
+import java.io.IOException;
+
import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.powermock.api.easymock.PowerMock;
-import java.io.IOException;
+import com.github.jferard.fastods.style.TableColumnStyle;
+import com.github.jferard.fastods.testlib.DomTester;
+import com.github.jferard.fastods.util.FastFullList;
+import com.github.jferard.fastods.util.XMLUtil;
public class PreambleAppenderTest {
private PreambleAppender preambleAppender;
@@ -57,6 +58,7 @@ public void appendTenColumnsTest() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(0);
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList(x, x, x, x, x, y, y, y, x, x));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
@@ -72,7 +74,7 @@ public void appendTenColumnsTest() throws IOException {
"table:number-columns-repeated=\"2\" " +
"table:default-cell-style-name=\"Default\"/>" +
"", sb.toString());
PowerMock.verifyAll();
}
@@ -84,13 +86,15 @@ public void appendEmptyColumnsTest() throws IOException {
PowerMock.resetAll();
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList());
+ EasyMock.expect(this.tm.getColumnCapacity())
+ .andReturn(42);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
this.preambleAppender.appendColumns(this.xmlUtil, sb);
DomTester.assertEquals(
"", sb.toString());
PowerMock.verifyAll();
}
@@ -103,6 +107,7 @@ public void appendMissingColumnsTest() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(0);
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList(null, null, x));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
@@ -114,7 +119,7 @@ public void appendMissingColumnsTest() throws IOException {
"" +
"", sb.toString());
PowerMock.verifyAll();
}
@@ -128,6 +133,7 @@ public void testHeaderColumns() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(2);
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList(x, x, x, x, x, y, y, y, x, x));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
@@ -148,7 +154,7 @@ public void testHeaderColumns() throws IOException {
"table:number-columns-repeated=\"2\" " +
"table:default-cell-style-name=\"Default\"/>" +
"", sb.toString());
PowerMock.verifyAll();
}
@@ -162,6 +168,7 @@ public void testFiveHeaderColumns() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(5);
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList(x, x, x, x, x, y, y, y, x, x));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
@@ -179,7 +186,7 @@ public void testFiveHeaderColumns() throws IOException {
"table:number-columns-repeated=\"2\" " +
"table:default-cell-style-name=\"Default\"/>" +
"", sb.toString());
PowerMock.verifyAll();
}
@@ -193,6 +200,7 @@ public void testTenHeaderColumns() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(10);
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList(x, x, x, x, x, y, y, y, x, x));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
@@ -210,7 +218,7 @@ public void testTenHeaderColumns() throws IOException {
"table:default-cell-style-name=\"Default\"/>" +
"" +
"", sb.toString());
PowerMock.verifyAll();
}
@@ -224,6 +232,7 @@ public void testElevenHeaderColumns() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(11);
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newList(x, x, x, x, x, y, y, y, x, x));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
final StringBuilder sb = new StringBuilder();
@@ -243,7 +252,7 @@ public void testElevenHeaderColumns() throws IOException {
"table:default-cell-style-name=\"Default\"/>" +
"" +
"", sb.toString());
PowerMock.verifyAll();
}
diff --git a/fastods/src/test/java/com/github/jferard/fastods/TableAppenderTest.java b/fastods/src/test/java/com/github/jferard/fastods/TableAppenderTest.java
index 7d71a471..b4c4c2f1 100644
--- a/fastods/src/test/java/com/github/jferard/fastods/TableAppenderTest.java
+++ b/fastods/src/test/java/com/github/jferard/fastods/TableAppenderTest.java
@@ -23,9 +23,23 @@
*/
package com.github.jferard.fastods;
+import java.io.IOException;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Locale;
+import java.util.logging.Logger;
+
+import org.apache.jena.ext.com.google.common.collect.ImmutableMap;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.powermock.api.easymock.PowerMock;
+
import com.github.jferard.fastods.datastyle.DataStyles;
import com.github.jferard.fastods.datastyle.DataStylesBuilder;
-import com.github.jferard.fastods.odselement.OdsEntry;
import com.github.jferard.fastods.odselement.StylesContainer;
import com.github.jferard.fastods.odselement.StylesContainerImpl;
import com.github.jferard.fastods.odselement.UnregisteredOdsEntry;
@@ -38,20 +52,6 @@
import com.github.jferard.fastods.util.SVGRectangle;
import com.github.jferard.fastods.util.XMLUtil;
import com.github.jferard.fastods.util.ZipUTF8Writer;
-import org.apache.jena.ext.com.google.common.collect.ImmutableMap;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.powermock.api.easymock.PowerMock;
-
-import java.io.IOException;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Locale;
-import java.util.logging.Logger;
public class TableAppenderTest {
private DataStyles ds;
@@ -70,7 +70,7 @@ public void setUp()
StylesContainerImpl.class.getDeclaredConstructor(Logger.class);
constructor.setAccessible(true);
this.stylesContainer =
- (StylesContainer) constructor.newInstance(new Object[]{Logger.getLogger("")});
+ (StylesContainer) constructor.newInstance(Logger.getLogger(""));
this.stc = PowerMock.createMock(StylesContainerImpl.class);
this.tm = PowerMock.createMock(TableModel.class);
final XMLUtil xmlUtil = XMLUtil.create();
@@ -98,13 +98,14 @@ public void appendXMLContent(final XMLUtil util, final Appendable appendable)
appendable.append("FOO");
}
}));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
"FOO");
PowerMock.verifyAll();
@@ -125,6 +126,7 @@ public void appendShapesTest() throws IOException {
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newListWithCapacity(1));
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
@@ -136,7 +138,7 @@ public void appendShapesTest() throws IOException {
"xlink:show=\"embed\" xlink:actuate=\"onLoad\"/>" +
"" +
""
);
@@ -156,6 +158,7 @@ public void appendOneElementPreambleTest() throws IOException {
.andReturn(FastFullList.newList(this.newTC("x")));
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
@@ -164,7 +167,7 @@ public void appendOneElementPreambleTest() throws IOException {
"" +
"");
PowerMock.verifyAll();
@@ -183,6 +186,7 @@ public void appendTwoElementsPreambleTest() throws IOException {
.andReturn(FastFullList.newList(this.newTC("x"), this.newTC("x")));
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
@@ -191,7 +195,7 @@ public void appendTwoElementsPreambleTest() throws IOException {
"" + "");
PowerMock.verifyAll();
@@ -212,6 +216,7 @@ public void appendFourElementsPreambleTest() throws IOException {
.andReturn(FastFullList.newList(x, x, this.newTC("y"), x));
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
@@ -225,7 +230,7 @@ public void appendFourElementsPreambleTest() throws IOException {
"table:style-name=\"x\"" + " " +
"table:default-cell-style-name=\"Default\"/>" + "");
PowerMock.verifyAll();
}
@@ -246,6 +251,7 @@ public void appendTenColumnsPreambleTest() throws IOException {
.andReturn(FastFullList.newList(x, x, x, x, x, y, y, y, x, x));
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
@@ -260,7 +266,7 @@ public void appendTenColumnsPreambleTest() throws IOException {
"" + "");
PowerMock.verifyAll();
}
@@ -281,6 +287,7 @@ public final void testName() throws IOException {
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getHeaderRowsCount()).andReturn(0);
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.tableAppender.appendAllAvailableRows(this.xmlUtil, sb);
@@ -289,7 +296,7 @@ public final void testName() throws IOException {
sb.append("");
DomTester.assertEquals("", sb.toString());
}
@@ -313,6 +320,7 @@ public final void testAppendTwoWriters() throws IOException {
EasyMock.expect(this.tm.getForms()).andReturn(
Collections.emptyList()).times(2);
EasyMock.expect(this.tm.getHeaderRowsCount()).andReturn(0).times(2);
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100).times(2);
PowerMock.replayAll();
this.tableAppender.appendXMLToContentEntry(this.xmlUtil, sb1);
@@ -349,6 +357,7 @@ public final void testAppendRows() throws IOException {
EasyMock.expect(this.tm.getTableRow(3)).andReturn(tr3);
EasyMock.expect(this.tm.getTableRow(4)).andReturn(tr4);
EasyMock.expect(this.tm.getTableRowsUsedSize()).andReturn(5);
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.tableAppender.appendXMLToContentEntry(this.xmlUtil, sb);
@@ -358,7 +367,7 @@ public final void testAppendRows() throws IOException {
"table:style-name=\"tb-style\" " +
"table:print=\"false\">" +
"" +
"" +
"" +
@@ -402,6 +411,7 @@ public final void testAppendRowsWithHeaderRows() throws IOException {
EasyMock.expect(this.tm.getTableRow(3)).andReturn(tr3);
EasyMock.expect(this.tm.getTableRow(4)).andReturn(tr4);
EasyMock.expect(this.tm.getTableRowsUsedSize()).andReturn(5);
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.tableAppender.appendXMLToContentEntry(this.xmlUtil, sb);
@@ -411,7 +421,7 @@ public final void testAppendRowsWithHeaderRows() throws IOException {
"table:style-name=\"tb-style\" " +
"table:print=\"false\">" +
"" +
"" +
"" +
@@ -505,6 +515,7 @@ public final void testAppendSomeAvailableRowsFrom() throws IOException {
EasyMock.expect(this.tm.getTableRow(0)).andReturn(tr0);
EasyMock.expect(this.tm.getTableRow(1)).andReturn(tr1);
EasyMock.expect(this.tm.getTableRowsUsedSize()).andReturn(2);
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.tableAppender.appendSomeAvailableRowsFrom(this.xmlUtil, sb, 0);
@@ -515,7 +526,7 @@ public final void testAppendSomeAvailableRowsFrom() throws IOException {
"" +
"" +
"" +
"" +
@@ -549,6 +560,7 @@ public final void testAppendRowsWithHeaderRows2() throws IOException {
EasyMock.expect(this.tm.getTableRow(3)).andReturn(null);
EasyMock.expect(this.tm.getTableRow(4)).andReturn(tr0);
EasyMock.expect(this.tm.getTableRowsUsedSize()).andReturn(5).anyTimes();
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.tableAppender.appendXMLToContentEntry(this.xmlUtil, sb);
@@ -558,7 +570,7 @@ public final void testAppendRowsWithHeaderRows2() throws IOException {
"table:style-name=\"tb-style\" " +
"table:print=\"false\">" +
"" +
"" +
"" +
@@ -619,6 +631,7 @@ public void testHeaderColums() throws IOException {
EasyMock.expect(this.tm.getHeaderColumnsCount()).andReturn(2);
EasyMock.expect(this.tm.getForms()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.assertPreambleXMLEquals(
@@ -638,7 +651,7 @@ public void testHeaderColums() throws IOException {
"" + "");
PowerMock.verifyAll();
}
@@ -658,6 +671,7 @@ public final void testAppendOpenTag() throws IOException {
EasyMock.expect(this.tm.getShapes()).andReturn(Collections.emptyList());
EasyMock.expect(this.tm.getColumns())
.andReturn(FastFullList.newListWithCapacity(1));
+ EasyMock.expect(this.tm.getColumnCapacity()).andReturn(100);
PowerMock.replayAll();
this.tableAppender.appendOpenTagAndPreamble(this.xmlUtil, sb);
@@ -670,7 +684,7 @@ public final void testAppendOpenTag() throws IOException {
"table:protected=\"true\" table:protection-key=\"a\" " +
"table:protection-key-digest-algorithm=\"b\" attr=\"value\">" +
"",
sb.toString());
}
diff --git a/fastods/src/test/java/com/github/jferard/fastods/TableTest.java b/fastods/src/test/java/com/github/jferard/fastods/TableTest.java
index 2e63a2f7..0dd45f05 100644
--- a/fastods/src/test/java/com/github/jferard/fastods/TableTest.java
+++ b/fastods/src/test/java/com/github/jferard/fastods/TableTest.java
@@ -23,6 +23,22 @@
*/
package com.github.jferard.fastods;
+import static com.github.jferard.fastods.odselement.config.ConfigElement.ZOOM_VALUE;
+
+import java.io.IOException;
+import java.security.NoSuchAlgorithmException;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+
+import org.easymock.Capture;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.powermock.api.easymock.PowerMock;
+
import com.github.jferard.fastods.datastyle.BooleanStyle;
import com.github.jferard.fastods.datastyle.DataStyles;
import com.github.jferard.fastods.datastyle.DataStylesBuilder;
@@ -41,21 +57,6 @@
import com.github.jferard.fastods.util.Protection;
import com.github.jferard.fastods.util.SVGRectangle;
import com.github.jferard.fastods.util.XMLUtil;
-import org.easymock.Capture;
-import org.easymock.EasyMock;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.powermock.api.easymock.PowerMock;
-
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import java.text.ParseException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Locale;
-
-import static com.github.jferard.fastods.odselement.config.ConfigElement.ZOOM_VALUE;
public class TableTest {
private DataStyles ds;
@@ -119,7 +120,7 @@ public final void testContentEntry() throws IOException {
"table:style-name=\"test2\" table:default-cell-style-name=\"Default\"/>" +
"" + "" + "" +
"" + "" +
"" +
@@ -197,7 +198,7 @@ public final void testRowsSpanned() throws IOException {
this.assertTableXMLEquals("" +
"" + "" +
"" + "" +
@@ -427,7 +428,7 @@ public final void testFlushSomeAvailableRows() throws IOException {
PowerMock.verifyAll();
DomTester.assertEquals("",
diff --git a/fastods/src/test/java/com/github/jferard/fastods/odselement/ContentElementTest.java b/fastods/src/test/java/com/github/jferard/fastods/odselement/ContentElementTest.java
index ff262a0a..dcc1f35e 100644
--- a/fastods/src/test/java/com/github/jferard/fastods/odselement/ContentElementTest.java
+++ b/fastods/src/test/java/com/github/jferard/fastods/odselement/ContentElementTest.java
@@ -387,7 +387,7 @@ public void testWrite() throws IOException {
"" +
"" +
"" +
"" +