You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by se...@apache.org on 2011/07/05 00:21:11 UTC
svn commit: r1142827 [2/2] - in /poi/trunk/src:
scratchpad/src/org/apache/poi/hwpf/model/types/
scratchpad/src/org/apache/poi/hwpf/sprm/
scratchpad/src/org/apache/poi/hwpf/usermodel/
scratchpad/testcases/org/apache/poi/hwpf/usermodel/ types/definitions/
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java?rev=1142827&r1=1142826&r2=1142827&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableProperties.java Mon Jul 4 22:21:10 2011
@@ -19,59 +19,80 @@ package org.apache.poi.hwpf.usermodel;
import org.apache.poi.hwpf.model.types.TAPAbstractType;
-public final class TableProperties
- extends TAPAbstractType
- implements Cloneable
+public final class TableProperties extends TAPAbstractType implements Cloneable
{
- public TableProperties()
- {
-
- }
- public TableProperties(int columns)
- {
- field_7_itcMac = (short)columns;
- field_10_rgshd = new ShadingDescriptor[columns];
- for (int x = 0; x < columns; x++)
- {
- field_10_rgshd[x] = new ShadingDescriptor();
- }
- field_11_brcBottom = new BorderCode();
- field_12_brcTop = new BorderCode();
- field_13_brcLeft = new BorderCode();
- field_14_brcRight = new BorderCode();
- field_15_brcVertical = new BorderCode();
- field_16_brcHorizontal = new BorderCode();
- field_8_rgdxaCenter = new short[columns];
- field_9_rgtc = new TableCellDescriptor[columns];
- for (int x = 0; x < columns; x++)
+ public TableProperties()
{
- field_9_rgtc[x] = new TableCellDescriptor();
+
}
- }
- public Object clone()
- throws CloneNotSupportedException
- {
- TableProperties tap = (TableProperties)super.clone();
- tap.field_10_rgshd = new ShadingDescriptor[field_10_rgshd.length];
- for (int x = 0; x < field_10_rgshd.length; x++)
+ public TableProperties( short columns )
{
- tap.field_10_rgshd[x] = (ShadingDescriptor)field_10_rgshd[x].clone();
+ setTlp( new TableAutoformatLookSpecifier() );
+ setItcMac( columns );
+ setRgshd( new ShadingDescriptor[columns] );
+
+ for ( int x = 0; x < columns; x++ )
+ {
+ getRgshd()[x] = new ShadingDescriptor();
+ }
+
+ setBrcBottom( new BorderCode() );
+ setBrcHorizontal( new BorderCode() );
+ setBrcLeft( new BorderCode() );
+ setBrcRight( new BorderCode() );
+ setBrcTop( new BorderCode() );
+ setBrcVertical( new BorderCode() );
+
+ setRgbrcInsideDefault_0( new BorderCode() );
+ setRgbrcInsideDefault_1( new BorderCode() );
+
+ TableCellDescriptor[] tableCellDescriptors = new TableCellDescriptor[columns];
+ for ( int x = 0; x < columns; x++ )
+ {
+ tableCellDescriptors[x] = new TableCellDescriptor();
+ }
+ setRgtc( tableCellDescriptors );
+
+ setRgdxaCenter( new short[columns] );
+ setRgdxaCenterPrint( new short[columns] );
}
- tap.field_11_brcBottom = (BorderCode)field_11_brcBottom.clone();
- tap.field_12_brcTop = (BorderCode)field_12_brcTop.clone();
- tap.field_13_brcLeft = (BorderCode)field_13_brcLeft.clone();
- tap.field_14_brcRight = (BorderCode)field_14_brcRight.clone();
- tap.field_15_brcVertical = (BorderCode)field_15_brcVertical.clone();
- tap.field_16_brcHorizontal = (BorderCode)field_16_brcHorizontal.clone();
- tap.field_8_rgdxaCenter = field_8_rgdxaCenter.clone();
- tap.field_9_rgtc = new TableCellDescriptor[field_9_rgtc.length];
- for (int x = 0; x < field_9_rgtc.length; x++)
+
+ public Object clone() throws CloneNotSupportedException
{
- tap.field_9_rgtc[x] = (TableCellDescriptor)field_9_rgtc[x].clone();
+ TableProperties tap = (TableProperties) super.clone();
+
+ tap.setTlp( getTlp().clone() );
+ tap.setRgshd( new ShadingDescriptor[getRgshd().length] );
+ for ( int x = 0; x < getRgshd().length; x++ )
+ {
+ tap.getRgshd()[x] = (ShadingDescriptor) getRgshd()[x].clone();
+ }
+
+ tap.setBrcBottom( (BorderCode) getBrcBottom().clone() );
+ tap.setBrcHorizontal( (BorderCode) getBrcHorizontal().clone() );
+ tap.setBrcLeft( (BorderCode) getBrcLeft().clone() );
+ tap.setBrcRight( (BorderCode) getBrcRight().clone() );
+ tap.setBrcTop( (BorderCode) getBrcTop().clone() );
+ tap.setBrcVertical( (BorderCode) getBrcVertical().clone() );
+
+ tap.setShdTable( (ShadingDescriptor) getShdTable().clone() );
+
+ tap.setRgbrcInsideDefault_0( (BorderCode) getRgbrcInsideDefault_0()
+ .clone() );
+ tap.setRgbrcInsideDefault_1( (BorderCode) getRgbrcInsideDefault_1()
+ .clone() );
+
+ tap.setRgdxaCenter( getRgdxaCenter().clone() );
+ tap.setRgdxaCenterPrint( getRgdxaCenterPrint().clone() );
+
+ tap.setRgtc( new TableCellDescriptor[getRgtc().length] );
+ for ( int x = 0; x < getRgtc().length; x++ )
+ {
+ tap.getRgtc()[x] = (TableCellDescriptor) getRgtc()[x].clone();
+ }
+ return tap;
}
- return tap;
- }
}
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java?rev=1142827&r1=1142826&r2=1142827&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java Mon Jul 4 22:21:10 2011
@@ -82,7 +82,7 @@ public final class TableRow
public void setRowJustification(int jc)
{
- _tprops.setJc(jc);
+ _tprops.setJc((short) jc);
_papx.updateSprm(SPRM_TJC, (short)jc);
}
Modified: poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java?rev=1142827&r1=1142826&r2=1142827&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java (original)
+++ poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java Mon Jul 4 22:21:10 2011
@@ -17,6 +17,9 @@
package org.apache.poi.hwpf.usermodel;
+import java.io.InputStream;
+import java.util.List;
+
import junit.framework.AssertionFailedError;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.poi.EncryptedDocumentException;
@@ -30,9 +33,6 @@ import org.apache.poi.hwpf.extractor.Wor
import org.apache.poi.hwpf.model.StyleSheet;
import org.apache.poi.util.IOUtils;
-import java.io.InputStream;
-import java.util.List;
-
/**
* Test various problem documents
*
@@ -605,7 +605,7 @@ public final class TestProblems extends
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("empty.doc");
Range range = doc.getRange();
- Table table = range.insertBefore(new TableProperties(columns), rows);
+ Table table = range.insertBefore(new TableProperties((short) columns), rows);
for (int rowIdx = 0; rowIdx < table.numRows(); rowIdx++) {
TableRow row = table.getRow(rowIdx);
Modified: poi/trunk/src/types/definitions/tap_type.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/types/definitions/tap_type.xml?rev=1142827&r1=1142826&r2=1142827&view=diff
==============================================================================
--- poi/trunk/src/types/definitions/tap_type.xml (original)
+++ poi/trunk/src/types/definitions/tap_type.xml Mon Jul 4 22:21:10 2011
@@ -26,8 +26,8 @@
<author>S. Ryan Ackley</author>
<fields>
<!-- page 198 -->
- <field type="int" size="4" name="istd" description="Table style for the Table"/>
- <field type="int" size="2" name="jc"
+ <field type="short" size="2" name="istd" description="Table style for the Table"/>
+ <field type="short" size="2" name="jc"
description="Justification code. specifies how table row should be justified within its column. 0 -- left justify, 1 -- center, 2 -- right justify"/>
<field type="int" size="4" name="dxaGapHalf"
description="Measures half of the white space that will be maintained between text in adjacent columns of a table row. A dxaGapHalf width of white space will be maintained on both sides of a column boundary."/>
@@ -39,7 +39,8 @@
description="When 1, table row may not be split across page bounds. Used for Word 2000 and Word 97."/>
<field type="boolean" size="0" name="fTableHeader"
description="When 1, table row is to be used as the header of the table"/>
- <field type="int" size="4" name="tlp" description="Table look specifier (see TLP definition)"/>
+
+ <field type="TableAutoformatLookSpecifier" size="4" name="tlp" description="Table look specifier"/>
<field type="short" size="2" name="wWidth" description="Preferred table width"/>
<field type="short" size="2" name="wWidthIndent" description="Left Indent"/>
@@ -116,7 +117,7 @@
<field type="int" size="4" name="dxaRTEWrapWidth" description="Used internally by Word"/>
<field type="int" size="4" name="dxaColWidthWwd" description="Used internally by Word"/>
- <field type="int" size="2" name="pctWwd"
+ <field type="short" size="2" name="pctWwd"
description="Used internally by Word: percent of Window size for AutoFit in WebView"/>
<field type="int" size="2" name="viewFlags" description="Used internally by Word">
@@ -131,6 +132,12 @@
<bit number="6" mask="0xffe0" name="viewFlags_unused2" description="Not used"/>
</field>
+ <field type="short[]" size="130" name="rgdxaCenter"
+ description="rgdxaCenter[0] is the left boundary of cell 0 measured relative to margin rgdxaCenter[tap.itcMac - 1] is left boundary of last cell rgdxaCenter[tap.itcMac] is right boundary of last cell."/>
+ <field type="short[]" size="130" name="rgdxaCenterPrint" description="Used internally by Word"/>
+
+ <field type="ShadingDescriptor" size="10" name="shdTable" description="Table shading"/>
+
<!-- rgbrcTable[ibrcTableMax]; Array of borders; ibrcTableMax==6 -->
<field type="BorderCode" size="4" name="brcBottom"/>
<field type="BorderCode" size="4" name="brcTop"/>
@@ -141,10 +148,10 @@
<!-- mpibrcwCellPaddingDefault[cbrcTc]; Array of default cell margins. Index into the next four
properties. -->
- <field type="int" size="2" name="wCellPaddingDefaultTop" description="Default top cell margin/padding"/>
- <field type="int" size="2" name="wCellPaddingDefaultLeft" description="Default left cell margin/padding"/>
- <field type="int" size="2" name="wCellPaddingDefaultBottom" description="Default bottom cell margin/padding"/>
- <field type="int" size="2" name="wCellPaddingDefaultRight" description="Default right cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingDefaultTop" description="Default top cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingDefaultLeft" description="Default left cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingDefaultBottom" description="Default bottom cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingDefaultRight" description="Default right cell margin/padding"/>
<!-- mpibrcftsCellPaddingDefault[cbrcTc]; Array of default cell margin units. Index into the
next four properties -->
@@ -159,10 +166,10 @@
<!-- mpibrcwCellSpacingDefault[cbrcTc]; Array of default cell spacing. Index into the next four
properties -->
- <field type="int" size="2" name="wCellSpacingDefaultTop" description="Default top cell spacings"/>
- <field type="int" size="2" name="wCellSpacingDefaultLeft" description="Default left cell spacings"/>
- <field type="int" size="2" name="wCellSpacingDefaultBottom" description="Default bottom cell spacings"/>
- <field type="int" size="2" name="wCellSpacingDefaultRight" description="Default right cell spacings"/>
+ <field type="short" size="2" name="wCellSpacingDefaultTop" description="Default top cell spacings"/>
+ <field type="short" size="2" name="wCellSpacingDefaultLeft" description="Default left cell spacings"/>
+ <field type="short" size="2" name="wCellSpacingDefaultBottom" description="Default bottom cell spacings"/>
+ <field type="short" size="2" name="wCellSpacingDefaultRight" description="Default right cell spacings"/>
<!-- mpibrcftsCellSpacingDefault[cbrcTc]; Array of default cell spacing units. Index into the
next four properties -->
@@ -177,10 +184,10 @@
<!-- mpibrcwCellPaddingOuter[cbrcTc]; Array of default outer cell margins. Index into the next
four properties. -->
- <field type="int" size="2" name="wCellPaddingOuterTop" description="Default outer top cell margin/padding"/>
- <field type="int" size="2" name="wCellPaddingOuterLeft" description="Default outer left cell margin/padding"/>
- <field type="int" size="2" name="wCellPaddingOuterBottom" description="Default outer bottom cell margin/padding"/>
- <field type="int" size="2" name="wCellPaddingOuterRight" description="Default outer right cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingOuterTop" description="Default outer top cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingOuterLeft" description="Default outer left cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingOuterBottom" description="Default outer bottom cell margin/padding"/>
+ <field type="short" size="2" name="wCellPaddingOuterRight" description="Default outer right cell margin/padding"/>
<!-- mpibrcftsCellPaddingOuter[cbrcTc]; Array of default outer cell margin units. Index into
the next four properties -->
@@ -195,10 +202,10 @@
<!-- mpibrcwCellSpacingOuter[cbrcTc]; Array of default outer cell spacing. Index into the next
four properties. -->
- <field type="int" size="2" name="wCellSpacingOuterTop" description="Default outer top cell spacing"/>
- <field type="int" size="2" name="wCellSpacingOuterLeft" description="Default outer left cell spacing"/>
- <field type="int" size="2" name="wCellSpacingOuterBottom" description="Default outer bottom cell spacing"/>
- <field type="int" size="2" name="wCellSpacingOuterRight" description="Default outer right cell spacing"/>
+ <field type="short" size="2" name="wCellSpacingOuterTop" description="Default outer top cell spacing"/>
+ <field type="short" size="2" name="wCellSpacingOuterLeft" description="Default outer left cell spacing"/>
+ <field type="short" size="2" name="wCellSpacingOuterBottom" description="Default outer bottom cell spacing"/>
+ <field type="short" size="2" name="wCellSpacingOuterRight" description="Default outer right cell spacing"/>
<!-- mpibrcftsCellSpacingOuter[cbrcTc]; Array of default outer cell spacing units. Index into
the next four properties. -->
@@ -224,9 +231,10 @@
<!-- TODO: rsid -->
<!-- TODO: tcDefault -->
- <field type="int" size="1" name="cHorzBands"
+ <field type="short" size="1" name="cHorzBands"
description="Size of each horizontal style band, in number of rows"/>
- <field type="int" size="1" name="cVertBands" description="Size of a vertical style band, in number of columns"/>
+ <field type="short" size="1" name="cVertBands"
+ description="Size of a vertical style band, in number of columns"/>
<field type="BorderCode" size="8" name="rgbrcInsideDefault_0"
description="Border definition for inside horizontal borders"/>
Added: poi/trunk/src/types/definitions/tlp_type.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/types/definitions/tlp_type.xml?rev=1142827&view=auto
==============================================================================
--- poi/trunk/src/types/definitions/tlp_type.xml (added)
+++ poi/trunk/src/types/definitions/tlp_type.xml Mon Jul 4 22:21:10 2011
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+ ====================================================================
+ 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.
+ ====================================================================
+-->
+<record fromfile="true" name="TLP" package="org.apache.poi.hwpf.model.types">
+ <suffix>AbstractType</suffix>
+ <extends>HDFType</extends>
+ <description>Table Autoformat Look sPecifier (TLP). <p>Class and fields descriptions are
+ quoted from Microsoft Office Word 97-2007 Binary File Format
+ </description>
+ <author>Sergey Vladimirov; according to Microsoft Office Word 97-2007 Binary File Format
+ Specification [*.doc]
+ </author>
+ <fields>
+ <field type="short" size="2" name="itl"
+ description="Index to Wordâs table of table looks (see itl table below)"/>
+ <field type="byte" size="1" name="tlp_flags">
+ <bit number="0" mask="0x0001" name="fBorders"
+ description="When == 1, use the border properties from the selected table look"/>
+ <bit number="1" mask="0x0002" name="fShading"
+ description="When == 1, use the shading properties from the selected table look"/>
+ <bit number="2" mask="0x0004" name="fFont"
+ description="When == 1, use the font from the selected table look"/>
+ <bit number="3" mask="0x0008" name="fColor"
+ description="When == 1, use the color from the selected table look"/>
+ <bit number="4" mask="0x0010" name="fBestFit"
+ description="When == 1, do best fit from the selected table look"/>
+ <bit number="5" mask="0x0020" name="fHdrRows"
+ description="When == 1, apply properties from the selected table look to the header rows in the table"/>
+ <bit number="6" mask="0x0040" name="fLastRow"
+ description="When == 1, apply properties from the selected table look to the last row in the table"/>
+ </field>
+ </fields>
+</record>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org