You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2008/01/04 15:19:19 UTC

svn commit: r608846 [1/2] - in /poi/tags/REL_3_0_2_BETA2: ./ src/documentation/content/xdocs/ src/documentation/content/xdocs/hslf/ src/documentation/content/xdocs/hssf/ src/java/org/apache/poi/hssf/record/ src/java/org/apache/poi/hssf/usermodel/ src/j...

Author: yegor
Date: Fri Jan  4 06:19:14 2008
New Revision: 608846

URL: http://svn.apache.org/viewvc?rev=608846&view=rev
Log:
merged TRUNK changes r608809 into REL_3_0_2_BETA2

Added:
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/DVALRecord.java
      - copied unchanged from r608814, poi/trunk/src/java/org/apache/poi/hssf/record/DVALRecord.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/DVRecord.java
      - copied unchanged from r608814, poi/trunk/src/java/org/apache/poi/hssf/record/DVRecord.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java
      - copied unchanged from r608814, poi/trunk/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/util/HSSFDataValidation.java
      - copied unchanged from r608814, poi/trunk/src/java/org/apache/poi/hssf/util/HSSFDataValidation.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/examples/src/org/apache/poi/hslf/examples/TableDemo.java
      - copied unchanged from r608814, poi/trunk/src/scratchpad/examples/src/org/apache/poi/hslf/examples/TableDemo.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
      - copied unchanged from r608814, poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Table.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java
      - copied unchanged from r608814, poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TableCell.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hslf/data/43781.ppt
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/43781.ppt
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hslf/data/sample.pptx
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/data/sample.pptx
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hwpf/data/AIOOB-Tap.doc
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/AIOOB-Tap.doc
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hwpf/data/IllustrativeCases.docx
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/IllustrativeCases.docx
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hwpf/data/ListEntryNoListTable.doc
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/ListEntryNoListTable.doc
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hwpf/data/sample.docx
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/data/sample.docx
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
      - copied unchanged from r608814, poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestProblems.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/AverageTaxRates.xlsx
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/AverageTaxRates.xlsx
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/SimpleWithColours.xls
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/SimpleWithColours.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/StringContinueRecords.xls
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/StringContinueRecords.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/Tables.xlsx
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/Tables.xlsx
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls
      - copied, changed from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/TestDataValidation.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/TwoSheetsNoneHidden.xls
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/TwoSheetsNoneHidden.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/TwoSheetsOneHidden.xls
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/TwoSheetsOneHidden.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/sample-beta.xlsx
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/sample-beta.xlsx
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/sample.xlsx
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/sample.xlsx
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/templateExcelWithAutofilter.xls
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/data/templateExcelWithAutofilter.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestDataValidation.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
      - copied unchanged from r608814, poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestSheetHiding.java
Modified:
    poi/tags/REL_3_0_2_BETA2/build.xml
    poi/tags/REL_3_0_2_BETA2/poi.pom
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/book.xml
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/changes.xml
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hslf/how-to-shapes.xml
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/eval.xml
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/quick-guide.xml
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/index.xml
    poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/status.xml
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/RecordFactory.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/StringRecord.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/poifs/storage/SmallBlockTableWriter.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/IOUtils.java
    poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/StringUtil.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Date.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Day.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Month.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Replace.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Substitute.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Trim.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Year.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hwpf/sprm/TableSprmUncompressor.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestBugs.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestBlankFileRead.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hsmf/model/TestSimpleFileRead.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hssf/data/FormulaEvalTestData.xls
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/eval/TestEverything.java
    poi/tags/REL_3_0_2_BETA2/src/scratchpad/testcases/org/apache/poi/hssf/record/formula/functions/TestEverything.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/1900DateWindowing.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/data/1904DateWindowing.xls
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/extractor/TestExcelExtractor.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFClientAnchor.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFDateUtil.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFPalette.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/hssf/usermodel/TestReadWriteChart.java
    poi/tags/REL_3_0_2_BETA2/src/testcases/org/apache/poi/poifs/filesystem/TestEmptyDocument.java

Modified: poi/tags/REL_3_0_2_BETA2/build.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/build.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/build.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/build.xml Fri Jan  4 06:19:14 2008
@@ -70,6 +70,7 @@
   <property name="main.output.dir" location="build/classes"/>
   <property name="main.output.test.dir" location="build/test-classes"/>
   <property name="main.lib" location="lib"/>
+  <property name="ooxml.lib" location="ooxml-lib"/>
   <property name="main.reports.test" location="build/test-results"/>
   <property name="main.jar1.dir" location="${main.lib}/commons-logging-1.1.jar"/>
   <property name="main.jar1.url" value="${repository}/commons-logging/jars/commons-logging-1.1.jar"/>
@@ -77,6 +78,9 @@
   <property name="main.jar2.url" value="${repository}/log4j/jars/log4j-1.2.13.jar"/>
   <property name="main.testokfile" location="build/main-testokfile.txt"/>
 
+  <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
+  <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
+
   <!-- Scratchpad: -->
   <property name="scratchpad.src" location="src/scratchpad/src"/>
   <property name="scratchpad.src.test" location="src/scratchpad/testcases"/>
@@ -116,8 +120,33 @@
   <property name="examples.jar3.url" value="${repository}/commons-lang/jars/commons-lang-2.1.jar"/>
   <property name="examples.testokfile" location="build/examples-testokfile.txt"/>
 
-  <property name="junit.jar1.dir" location="${main.lib}/junit-3.8.1.jar"/>
-  <property name="junit.jar1.url" value="${repository}/junit/jars/junit-3.8.1.jar"/>
+  <!-- Experimental OOXML support: -->
+  <property name="ooxml.src" location="src/scratchpad/ooxml-src"/>
+  <property name="ooxml.src.test" location="src/scratchpad/ooxml-testcases"/>
+  <property name="ooxml.reports.test" location="build/ooxml-test-results"/>
+  <property name="ooxml.output.dir" location="build/ooxml-classes"/>
+  <property name="ooxml.output.test.dir" location="build/ooxml-test-classes"/>
+  <property name="ooxml.testokfile" location="build/ooxml-testokfile.txt"/>
+
+  <property name="ooxml.jar1.dir" location="${ooxml.lib}/dom4j-1.6.1.jar"/>
+  <property name="ooxml.jar1.url" value="${repository}/dom4j/jars/dom4j-1.6.1.jar"/>
+  <property name="ooxml.jar2.dir" location="${ooxml.lib}/jaxen-1.1.jar"/>
+  <property name="ooxml.jar2.url" value="${repository}/jaxen/jars/jaxen-1.1.jar"/>
+  <property name="ooxml.jar3.dir" location="${ooxml.lib}/xmlbeans-2.3.0.jar"/>
+  <property name="ooxml.jar3.url" value="${repository}/org.apache.xmlbeans/jars/xmlbeans-2.3.0.jar"/>
+  <property name="ooxml.jar4.dir" location="${ooxml.lib}/jsr173_1.0_api.jar"/>
+  <property name="ooxml.jar4.url" value="${repository}/xmlbeans/jars/jsr173_1.0_api.jar"/>
+  <!-- No official release of openxml4j yet -->
+  <property name="ooxml.jar5.dir" location="${ooxml.lib}/openxml4j-bin-prealpha-071224.jar"/>
+  <property name="ooxml.jar5.url" value="http://people.apache.org/~nick/openxml4j-bin-prealpha-071224.jar"/>
+
+  <!-- See http://www.ecma-international.org/publications/standards/Ecma-376.htm -->
+  <!-- "Copy these file(s), free of charge" -->
+  <property name="ooxml.xsds.ozip" location="${ooxml.lib}/OfficeOpenXML-Part4.zip"/>
+  <property name="ooxml.xsds.izip" location="${ooxml.lib}/OfficeOpenXML-XMLSchema.zip"/>
+  <property name="ooxml.xsds.url" value="http://www.ecma-international.org/publications/files/ECMA-ST/Office%20Open%20XML%20Part%204%20(DOCX).zip" />
+  <property name="ooxml.xsds.jar" location="${ooxml.lib}/ooxml-schemas.jar"/>
+
   <property name="build.site" location="build/tmp/site/build/site"/>
   <property name="build.site.src" location="build/tmp/site"/>
   <property name="junit.report.dir" location="${build.site}/junit"/>
@@ -130,7 +159,7 @@
   <property name="mavendist.poi.dir" location="build/maven-dist/poi"/>
   <property name="mavendist.oap.dir" location="build/maven-dist/org.apache.poi"/>
   <property name="jar.name" value="poi"/>
-  <property name="version.id" value="3.0.2-beta1"/>
+  <property name="version.id" value="3.0.2-beta2"/>
   <property name="halt.on.test.failure" value="true"/>
   <property name="jdk.version.source" value="1.3"
     description="JDK version of source code"/>
@@ -162,6 +191,15 @@
         <pathelement location="${contrib.output.test.dir}"/>
     </path>
 
+    <path id="ooxml.classpath">
+        <path refid="main.classpath"/>
+        <path refid="scratchpad.classpath"/>
+        <fileset dir="${ooxml.lib}">
+			<include name="*.jar" />
+		</fileset>
+    </path>
+
+
   <path id="examples.classpath">
     <path refid="main.classpath"/>
     <pathelement location="${main.output.dir}"/>
@@ -225,12 +263,15 @@
         <mkdir dir="${scratchpad.output.dir}"/>
         <mkdir dir="${contrib.output.dir}"/>
         <mkdir dir="${examples.output.dir}"/>
+        <mkdir dir="${ooxml.output.dir}"/>
         <mkdir dir="${main.output.test.dir}"/>
         <mkdir dir="${contrib.output.test.dir}"/>
         <mkdir dir="${scratchpad.output.test.dir}"/>
+        <mkdir dir="${ooxml.output.test.dir}"/>
         <mkdir dir="${main.reports.test}"/>
         <mkdir dir="${scratchpad.reports.test}"/>
         <mkdir dir="${contrib.reports.test}"/>
+        <mkdir dir="${ooxml.reports.test}"/>
         <mkdir dir="${junit.report.dir}"/>
         <mkdir dir="${jdepend.report.dir}"/>
         <mkdir dir="${jdepend.report.out.dir}"/>
@@ -281,6 +322,57 @@
         <get src="${junit.jar1.url}" dest="${junit.jar1.dir}"/>
     </target>
 
+	<target name="check-ooxml-xsds">
+        <condition property="ooxml-xsds.present">
+            <or>
+                <and>
+                    <available file="${ooxml.xsds.izip}"/>
+                </and>
+                <isset property="disconnected"/>
+            </or>
+        </condition>
+	</target>
+    <target name="fetch-ooxml-xsds" unless="ooxml-xsds.present"
+     description="Fetches needed OOXML xsd files from the Internet">
+        <get src="${ooxml.xsds.url}" dest="${ooxml.xsds.ozip}"/>
+		<unzip src="${ooxml.xsds.ozip}" dest="${ooxml.lib}">
+			<patternset>
+				<include name="OfficeOpenXML-XMLSchema.zip" />
+			</patternset>
+		</unzip>
+	</target>
+	<target name="check-compiled-ooxml-xsds">
+        <condition property="ooxml-compiled-xsds.present">
+            <or>
+                <and>
+                    <available file="${ooxml.xsds.jar}"/>
+                </and>
+                <isset property="disconnected"/>
+            </or>
+        </condition>
+	</target>
+	<target name="compile-ooxml-xsds" unless="ooxml-compiled-xsds.present"
+	 depends="check-jars,fetch-jars,check-ooxml-xsds,fetch-ooxml-xsds,check-compiled-ooxml-xsds"
+	 description="Unpacks the OOXML xsd files, and compiles them into XmlBeans">
+		<taskdef name="xmlbean"
+			classname="org.apache.xmlbeans.impl.tool.XMLBean"
+			classpath="${ooxml.jar3.dir}:${ooxml.jar4.dir}" />
+
+		<unzip src="${ooxml.xsds.izip}" dest="build/ooxml-xsds/" />
+		<!--
+			schema="build/ooxml-xsds/"
+			schema="build/ooxml-xsds/sml-workbook.xsd"
+		-->
+		<xmlbean
+			schema="build/ooxml-xsds/"
+			destfile="${ooxml.xsds.jar}"
+			javasource="1.4"
+			failonerror="false"
+		>
+			<classpath refid="ooxml.classpath"/>
+		</xmlbean>
+	</target>
+
   <target name="compile" depends="init, compile-main, compile-scratchpad,
     compile-contrib, compile-examples"
     description="Compiles the POI main classes, scratchpad, contrib, and examples"/>
@@ -305,7 +397,7 @@
     </javac>
   </target>
 
-  <target name="compile-scratchpad" depends="init">
+  <target name="compile-scratchpad" depends="init,compile-main">
     <javac target="${jdk.version.class}" source="${jdk.version.source}"
       failonerror="true" destdir="${scratchpad.output.dir}" debug="on"
       fork="yes" srcdir="${scratchpad.src}">
@@ -363,6 +455,14 @@
     </javac>
   </target>
 
+  <target name="compile-ooxml" depends="init, check-ooxml-xsds, fetch-ooxml-xsds, compile-ooxml-xsds, compile-main">
+	<!-- openxml4j requires java 1.5, so so must we, for now -->
+    <javac target="1.5" source="1.5"
+      destdir="${ooxml.output.dir}" debug="on" srcdir="${ooxml.src}">
+      <classpath refid="ooxml.classpath"/>
+    </javac>
+  </target>
+
   <target name="test" depends="test-main,test-scratchpad,test-contrib"
     description="Tests main, contrib and scratchpad"/>
 
@@ -590,6 +690,43 @@
         <echo file="${contrib.testokfile}" append="false" message="testok"/>
     </target>
 
+    <target name="-test-ooxml-check">
+        <uptodate property="ooxml.test.notRequired" targetfile="${ooxml.testokfile}">
+            <srcfiles dir="${ooxml.src}"/>
+            <srcfiles dir="${ooxml.src.test}"/>
+        </uptodate>
+    </target>
+
+    <target name="test-ooxml" depends="compile-main,compile-ooxml,-test-ooxml-check" unless="ooxml.test.notRequired">
+        <junit printsummary="yes" fork="no" haltonfailure="${halt.on.test.failure}" failureproperty="ooxml.test.failed">
+            <classpath>
+                <path refid="ooxml.classpath"/>
+                <pathelement location="${main.output.dir}"/>
+                <pathelement location="${ooxml.output.dir}"/>
+                <pathelement location="${ooxml.output.test.dir}"/>
+                <pathelement location="${junit.jar1.dir}"/>
+            </classpath>
+            <sysproperty key="HSSF.testdata.path" file="${main.src.test}/org/apache/poi/hssf/data"/>
+            <sysproperty key="HWPF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hwpf/data"/>
+            <sysproperty key="HSLF.testdata.path" file="${scratchpad.src.test}/org/apache/poi/hslf/data"/>
+            <sysproperty key="java.awt.headless" value="true"/>
+            <formatter type="plain"/>
+            <formatter type="xml"/>
+            <batchtest todir="${ooxml.reports.test}">
+                <fileset dir="${ooxml.src.test}">
+                    <include name="**/Test*.java"/>
+                    <exclude name="**/AllTests.java"/>
+                </fileset>
+            </batchtest>
+        </junit>
+        <delete file="${ooxml.testokfile}"/>
+        <antcall target="-test-ooxml-write-testfile"/>
+    </target>
+
+    <target name="-test-ooxml-write-testfile" unless="ooxml.test.failed">
+        <echo file="${ooxml.testokfile}" append="false" message="testok"/>
+    </target>
+
     <target name="-check-docs">
         <uptodate property="main.docs.notRequired" targetfile="${build.site}/index.html">
             <srcfiles dir="${build.site.src}"/>
@@ -964,6 +1101,21 @@
         </jar>
         <jar destfile="${dist.dir}/${jar.name}-scratchpad-${version.id}-${DSTAMP}.jar">
 			<fileset dir="${scratchpad.output.dir}" />
+			<fileset dir="legal/" />
+            <manifest>
+                <attribute name="Built-By" value="${user.name}"/>
+                <attribute name="Specification-Title" value="Apache POI"/>
+                <attribute name="Specification-Version" value="${version.id}-${DSTAMP}"/>
+                <attribute name="Specification-Vendor" value="Apache"/>
+                <attribute name="Implementation-Title" value="Apache POI"/>
+                <attribute name="Implementation-Version" value="${version.id}-${DSTAMP}"/>
+                <attribute name="Implementation-Vendor" value="Apache"/>
+            </manifest>        
+        </jar>
+    </target>
+    <target name="jar-ooxml" depends="compile-ooxml" description="Creates the ooxml jar files for distribution">
+        <jar destfile="${dist.dir}/${jar.name}-ooxml-${version.id}-${DSTAMP}.jar">
+			<fileset dir="${ooxml.output.dir}" />
 			<fileset dir="legal/" />
             <manifest>
                 <attribute name="Built-By" value="${user.name}"/>

Modified: poi/tags/REL_3_0_2_BETA2/poi.pom
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/poi.pom?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/poi.pom (original)
+++ poi/tags/REL_3_0_2_BETA2/poi.pom Fri Jan  4 06:19:14 2008
@@ -77,8 +77,8 @@
 		</license>
 	</licenses>
 	<scm>
-		<url>http://svn.apache.org/viewvc/jakarta/poi/trunk</url>
-		<connection>scm:svn:http://svn.apache.org/repos/asf/jakarta/poi/trunk</connection>
+		<url>http://svn.apache.org/viewvc/poi/trunk</url>
+		<connection>scm:svn:http://svn.apache.org/repos/asf/poi/trunk</connection>
 	</scm>
 	<issueManagement>
 		<system>bugzilla</system>

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/book.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/book.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/book.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/book.xml Fri Jan  4 06:19:14 2008
@@ -57,6 +57,7 @@
         <menu-item label="History and Future" href="historyandfuture.html"/>
         <menu-item label="Who We Are" href="who.html"/>
         <menu-item label="Resolutions" href="resolutions/index.html"/>
+        <menu-item label="Sponsors" href="http://www.apache.org/foundation/thanks.html" />
     </menu>
 
     <menu label="Docs">

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/changes.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/changes.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/changes.xml Fri Jan  4 06:19:14 2008
@@ -35,8 +35,19 @@
     </devs>
 
 		<!-- Don't forget to update status.xml too! -->
-        <release version="3.0.2-FINAL" date="2007-??-??">
-          <action dev="POI-DEVELOPERS" type="fix">43877 and 39512 - Fix for handling mixed OBJ and CONTINUE records.</action>
+        <release version="3.0.2-FINAL" date="2008-??-??">
+            <action dev="POI-DEVELOPERS" type="add">Support for tables in HSLF</action>
+            <action dev="POI-DEVELOPERS" type="fix">43781 - Fix for extracting text from TextBoxes HSLF in</action>
+            <action dev="POI-DEVELOPERS" type="fix">Improve JavaDocs relating to hssf font and fill colourings</action>
+            <action dev="POI-DEVELOPERS" type="add">44095, 44097, 44099 - [PATCH] Support for Mid, Replace and Substitute excel functions</action>
+            <action dev="POI-DEVELOPERS" type="add">44055 - [PATCH] Support for getting the from field from HSMF messages</action>
+            <action dev="POI-DEVELOPERS" type="add">43551 - [PATCH] Support for 1904 date windowing in HSSF (previously only supported 1900 date windowing)</action>
+            <action dev="POI-DEVELOPERS" type="add">41064 - [PATCH] Support for String continue records</action>
+            <action dev="POI-DEVELOPERS" type="add">27511 - [PATCH] Support for data validation, via DVRecord and DVALRecord</action>
+        </release>
+
+        <release version="3.0.2-BETA1" date="2007-12-04">
+            <action dev="POI-DEVELOPERS" type="fix">43877 and 39512 - Fix for handling mixed OBJ and CONTINUE records.</action>
             <action dev="POI-DEVELOPERS" type="fix">43807 - Throw an IllegalArgumentException if asked to create a merged region with invalid columns or rows, rather than writing out a corrupt file</action>
             <action dev="POI-DEVELOPERS" type="fix">43837 - [PATCH] Support for unicode NameRecords</action>
             <action dev="POI-DEVELOPERS" type="add">43721 - [PATCH] Support for Chart Title Format records</action>

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hslf/how-to-shapes.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hslf/how-to-shapes.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hslf/how-to-shapes.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hslf/how-to-shapes.xml Fri Jan  4 06:19:14 2008
@@ -39,6 +39,7 @@
                     <li><link href="#Fill">How to work with slide/shape background</link></li>
                     <li><link href="#Bullets">How to create bulleted lists</link></li>
                     <li><link href="#Hyperlinks">Hyperlinks</link></li>
+                    <li><link href="#Tables">Tables</link></li>
                 </ul>
             </section>
             <section><title>Features</title>
@@ -386,6 +387,57 @@
         }
     }
                 </source>
+                </section>
+                <anchor id="Tables"/>
+                <section><title>How to create tables</title>
+                  <source>
+      //table data              
+      String[][] data = {
+          {"INPUT FILE", "NUMBER OF RECORDS"},
+          {"Item File", "11,559"},
+          {"Vendor File", "300"},
+          {"Purchase History File", "10,000"},
+          {"Total # of requisitions", "10,200,038"}
+      };
+
+      SlideShow ppt = new SlideShow();
+
+      Slide slide = ppt.createSlide();
+      //create a table of 5 rows and 2 columns
+      Table table = new Table(5, 2);
+      for (int i = 0; i &lt; data.length; i++) {
+          for (int j = 0; j &lt; data[i].length; j++) {
+              TableCell cell = table.getCell(i, j);
+              cell.setText(data[i][j]);
+
+              RichTextRun rt = cell.getTextRun().getRichTextRuns()[0];
+              rt.setFontName("Arial");
+              rt.setFontSize(10);
+
+              cell.setVerticalAlignment(TextBox.AnchorMiddle);
+              cell.setHorizontalAlignment(TextBox.AlignCenter);
+          }
+      }
+
+      //set table borders
+      Line border = table.createBorder();
+      border.setLineColor(Color.black);
+      border.setLineWidth(1.0);
+      table.setAllBorders(border);
+
+      //set width of the 1st column
+      table.setColumnWidth(0, 300);
+      //set width of the 2nd column
+      table.setColumnWidth(1, 150);
+
+      slide.addShape(table);
+      table.moveTo(100, 100);
+
+      FileOutputStream out = new FileOutputStream("hslf-table.ppt");
+      ppt.write(out);
+      out.close();
+    
+                    </source>
                 </section>
                   
             </section>

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/eval.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/eval.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/eval.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/eval.xml Fri Jan  4 06:19:14 2008
@@ -63,6 +63,8 @@
 CellReference cellReference = new CellReference("B3"); 
 HSSFRow row = sheet.getRow(cellReference.getRow());
 HSSFCell cell = row.getCell(cellReference.getCol()); 
+
+evaluator.setCurrentRow(row);
 HSSFFormulaEvaluator.CellValue cellValue = evaluator.evaluate(cell);
 
 switch (cellValue.getCellType()) {
@@ -106,7 +108,7 @@
 CellReference cellReference = new CellReference("B3"); 
 HSSFRow row = sheet.getRow(cellReference.getRow());
 HSSFCell cell = row.getCell(cellReference.getCol()); 
-
+evaluator.setCurrentRow(row);
 
 if (cell!=null) {
 	switch (<strong>evaluator.evaluateInCell</strong>(cell).getCellType()) {

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/quick-guide.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/quick-guide.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/quick-guide.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/hssf/quick-guide.xml Fri Jan  4 06:19:14 2008
@@ -41,6 +41,7 @@
                     <li><link href="#CreateCells">How to create cells</link></li>
                     <li><link href="#CreateDateCells">How to create date cells</link></li>
                     <li><link href="#CellTypes">Working with different types of cells</link></li>
+                    <li><link href="#Iterator">Iterate over rows and cells</link></li>
                     <li><link href="#TextExtraction">Text Extraction</link></li>
                     <li><link href="#Alignment">Aligning cells</link></li>
                     <li><link href="#Borders">Working with borders</link></li>
@@ -233,6 +234,26 @@
     wb.write(fileOut);
     fileOut.close();
                     </source>
+                </section>
+                <anchor id="Iterator"/>
+                <section><title>Iterate over rows and cells (including Java 5 foreach loops)</title>
+				<p>Sometimes, you'd like to just iterate over all the rows in
+				a sheet, or all the cells in a row. If you are using Java
+				5 or later, then this is especially handy, as it'll allow the
+				new foreach loop support to work.</p>
+				<p>Luckily, this is very easy. HSSFRow defines a 
+				<em>CellIterator</em> inner class to handle iterating over 
+				the cells (get one with a call to <em>row.cellIterator()</em>),
+				and HSSFSheet provides a <em>rowIterator()</em> method to
+				give an iterator over all the rows.</p>
+				<source>
+	HSSFSheet sheet = wb.getSheetAt(0);
+	for (HSSFRow row : sheet.rowIterator()) {
+		for (HSSFCell cell : row.cellIterator()) {
+			// Do something here
+		}
+	}
+				</source>
                 </section>
                 <anchor id="TextExtraction"/>
                 <section><title>Text Extraction</title>

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/index.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/index.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/index.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/index.xml Fri Jan  4 06:19:14 2008
@@ -31,7 +31,19 @@
   </header>
 
   <body>
-	<section><title>POI 3.0.1 Release</title>
+    <section><title>POI 3.0.2 BETA1 Release</title>
+ 	  <p>The latest release of Apache POI is 3.0.2 BETA1 which was promoted to "Beta" on 04 December 2007. It contains a mixture of
+		new features and bug fixes, compared to 3.0.1. A full list of changes
+		is available in 
+		<link href="./changes.html">the changelog</link>, and 
+		<link href="http://www.apache.org/dyn/closer.cgi/poi/release/">download</link>
+		the source and binaries from your
+    <link href="http://www.apache.org/dyn/closer.cgi/poi/release/">local mirror</link>.
+     The release is also available from the central Maven repository under Group ID "org.apache.poi".
+  </p>
+  </section>
+
+  <section><title>POI 3.0.1 Release</title>
 	  <p>The latest release of Apache POI (formerly Apache Jakarta POI),
 		version 3.0.1, has now been released. It contains a mixture of
 		new features and bug fixes, compared to 3.0. A full list of changes

Modified: poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/status.xml?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/status.xml (original)
+++ poi/tags/REL_3_0_2_BETA2/src/documentation/content/xdocs/status.xml Fri Jan  4 06:19:14 2008
@@ -32,7 +32,17 @@
 
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
-        <release version="3.0.2-FINAL" date="2007-??-??">
+        <release version="3.0.2-FINAL" date="2008-??-??">
+            <action dev="POI-DEVELOPERS" type="add">Support for tables in HSLF</action>
+            <action dev="POI-DEVELOPERS" type="fix">43781 - Fix for extracting text from TextBoxes HSLF in</action>
+            <action dev="POI-DEVELOPERS" type="fix">Improve JavaDocs relating to hssf font and fill colourings</action>
+            <action dev="POI-DEVELOPERS" type="add">44095, 44097, 44099 - [PATCH] Support for Mid, Replace and Substitute excel functions</action>
+            <action dev="POI-DEVELOPERS" type="add">44055 - [PATCH] Support for getting the from field from HSMF messages</action>
+            <action dev="POI-DEVELOPERS" type="add">43551 - [PATCH] Support for 1904 date windowing in HSSF (previously only supported 1900 date windowing)</action>
+            <action dev="POI-DEVELOPERS" type="add">41064 - [PATCH] Support for String continue records</action>
+            <action dev="POI-DEVELOPERS" type="add">27511 - [PATCH] Support for data validation, via DVRecord and DVALRecord</action>
+        </release>
+        <release version="3.0.2-BETA1" date="2007-12-04">
             <action dev="POI-DEVELOPERS" type="fix">43877 - Fix for handling mixed OBJ and CONTINUE records</action>
             <action dev="POI-DEVELOPERS" type="fix">39512 - Fix for handling mixed OBJ and CONTINUE records</action>
             <action dev="POI-DEVELOPERS" type="fix">43837 - [PATCH] Support for unicode NameRecords</action>

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/RecordFactory.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/RecordFactory.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/RecordFactory.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/RecordFactory.java Fri Jan  4 06:19:14 2008
@@ -75,7 +75,8 @@
                 HorizontalPageBreakRecord.class, VerticalPageBreakRecord.class, 
                 WriteProtectRecord.class, FilePassRecord.class, PaneRecord.class,
                 NoteRecord.class, ObjectProtectRecord.class, ScenarioProtectRecord.class, 
-                FileSharingRecord.class, ChartTitleFormatRecord.class
+                FileSharingRecord.class, ChartTitleFormatRecord.class,
+                DVRecord.class, DVALRecord.class
             };
     }
     private static Map           recordsMap  = recordsToMap(records);
@@ -146,6 +147,9 @@
                         } else if (record.getSid() == ContinueRecord.sid &&
                                    (lastRecord instanceof DrawingGroupRecord)) {
                             ((DrawingGroupRecord)lastRecord).processContinueRecord(((ContinueRecord)record).getData());
+                        } else if (record.getSid() == ContinueRecord.sid &&
+                        			(lastRecord instanceof StringRecord)) {
+                        	((StringRecord)lastRecord).processContinueRecord(((ContinueRecord)record).getData());
                         } else if (record.getSid() == ContinueRecord.sid) {
                           if (lastRecord instanceof UnknownRecord) {
                             //Gracefully handle records that we dont know about,

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/StringRecord.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/StringRecord.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/StringRecord.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/record/StringRecord.java Fri Jan  4 06:19:14 2008
@@ -83,6 +83,14 @@
             field_3_string = StringUtil.getFromCompressedUnicode(data, 0, field_1_string_length);
         }
     }
+    
+    public void processContinueRecord(byte[] data) {
+    	if(isUnCompressedUnicode()) {
+    		field_3_string += StringUtil.getFromUnicodeLE(data, 0, field_1_string_length - field_3_string.length());
+    	} else {
+    		field_3_string += StringUtil.getFromCompressedUnicode(data, 0, field_1_string_length - field_3_string.length());
+    	}
+    }
 
     public boolean isInValueSection()
     {

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java Fri Jan  4 06:19:14 2008
@@ -521,7 +521,7 @@
      */
     public void setCellValue(Date value)
     {
-        setCellValue(HSSFDateUtil.getExcelDate(value));
+        setCellValue(HSSFDateUtil.getExcelDate(value, this.book.isUsing1904DateWindowing()));
     }
 
     /**

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFCellStyle.java Fri Jan  4 06:19:14 2008
@@ -294,10 +294,24 @@
         format.setFontIndex(fontindex);
     }
 
+    /**
+     * gets the index of the font for this style
+     * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
+     */
     public short getFontIndex()
     {
         return format.getFontIndex();
     }
+    
+    /**
+     * gets the font for this style
+     * @param parentWorkbook The HSSFWorkbook that this style belongs to
+     * @see org.apache.poi.hssf.usermodel.HSSFCellStyle#getFontIndex()
+     * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#getFontAt(short)
+     */
+    public HSSFFont getFont(HSSFWorkbook parentWorkbook) {
+    	return parentWorkbook.getFontAt(getFontIndex());
+    }
 
     /**
      * set the cell's using this style to be hidden
@@ -689,7 +703,6 @@
      * @see #BORDER_MEDIUM_DASH_DOT_DOT
      * @see #BORDER_SLANTED_DASH_DOT
      */
-
     public short getBorderBottom()
     {
         return format.getBorderBottom();
@@ -697,9 +710,8 @@
 
     /**
      * set the color to use for the left border
-     * @param color
+     * @param color The index of the color definition
      */
-
     public void setLeftBorderColor(short color)
     {
         format.setLeftBorderPaletteIdx(color);
@@ -707,9 +719,9 @@
 
     /**
      * get the color to use for the left border
-     * @return color
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
+     * @param color The index of the color definition
      */
-
     public short getLeftBorderColor()
     {
         return format.getLeftBorderPaletteIdx();
@@ -717,9 +729,8 @@
 
     /**
      * set the color to use for the right border
-     * @param color
+     * @param color The index of the color definition
      */
-
     public void setRightBorderColor(short color)
     {
         format.setRightBorderPaletteIdx(color);
@@ -727,9 +738,9 @@
 
     /**
      * get the color to use for the left border
-     * @return color
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
+     * @param color The index of the color definition
      */
-
     public short getRightBorderColor()
     {
         return format.getRightBorderPaletteIdx();
@@ -737,9 +748,8 @@
 
     /**
      * set the color to use for the top border
-     * @param color
+     * @param color The index of the color definition
      */
-
     public void setTopBorderColor(short color)
     {
         format.setTopBorderPaletteIdx(color);
@@ -747,9 +757,9 @@
 
     /**
      * get the color to use for the top border
-     * @return color
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
+     * @param color The index of the color definition
      */
-
     public short getTopBorderColor()
     {
         return format.getTopBorderPaletteIdx();
@@ -757,9 +767,8 @@
 
     /**
      * set the color to use for the bottom border
-     * @param color
+     * @param color The index of the color definition
      */
-
     public void setBottomBorderColor(short color)
     {
         format.setBottomBorderPaletteIdx(color);
@@ -767,9 +776,9 @@
 
     /**
      * get the color to use for the left border
-     * @return color
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
+     * @param color The index of the color definition
      */
-
     public short getBottomBorderColor()
     {
         return format.getBottomBorderPaletteIdx();
@@ -871,9 +880,9 @@
 
     /**
      * get the background fill color
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
      * @return fill color
      */
-
     public short getFillBackgroundColor()
     {
     	short result = format.getFillBackground();
@@ -889,7 +898,6 @@
      * <i>Note: Ensure Foreground color is set prior to background color.</i>
      * @param bg  color
      */
-
     public void setFillForegroundColor(short bg)
     {
         format.setFillForeground(bg);
@@ -898,12 +906,11 @@
 
     /**
      * get the foreground fill color
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
      * @return fill color
      */
-
     public short getFillForegroundColor()
     {
         return format.getFillForeground();
     }
-
 }

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFClientAnchor.java Fri Jan  4 06:19:14 2008
@@ -82,8 +82,8 @@
      */
     public float getAnchorHeightInPoints(HSSFSheet sheet )
     {
-        int y1 = Math.min( getDy1(), getDy2() );
-        int y2 = Math.max( getDy1(), getDy2() );
+        int y1 = getDy1();
+        int y2 = getDy2();
         int row1 = Math.min( getRow1(), getRow2() );
         int row2 = Math.max( getRow1(), getRow2() );
 

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFDateUtil.java Fri Jan  4 06:19:14 2008
@@ -35,6 +35,8 @@
  * @author  Glen Stampoultzis (glens at apache.org)
  * @author  Dan Sherman (dsherman at isisph.com)
  * @author  Hack Kampbjorn (hak at 2mba.dk)
+ * @author  Alex Jacoby (ajacoby at gmail.com)
+ * @author  Pavel Krupets (pkrupets at palmtreebusiness dot com)
  */
 
 public class HSSFDateUtil
@@ -54,19 +56,26 @@
      * @return Excel representation of Date (-1 if error - test for error by checking for less than 0.1)
      * @param  date the Date
      */
-
-    public static double getExcelDate(Date date)
-    {
+    public static double getExcelDate(Date date) {
+    	return getExcelDate(date, false);
+    }
+    /**
+     * Given a Date, converts it into a double representing its internal Excel representation,
+     *   which is the number of days since 1/1/1900. Fractional days represent hours, minutes, and seconds.
+     *
+     * @return Excel representation of Date (-1 if error - test for error by checking for less than 0.1)
+     * @param date the Date
+     * @param use1904windowing Should 1900 or 1904 date windowing be used?
+     */
+    public static double getExcelDate(Date date, boolean use1904windowing) {
         Calendar calStart = new GregorianCalendar();
-
-        calStart.setTime(
-            date);   // If date includes hours, minutes, and seconds, set them to 0
-        if (calStart.get(Calendar.YEAR) < 1900)
+        calStart.setTime(date);   // If date includes hours, minutes, and seconds, set them to 0
+        
+        if ((!use1904windowing && calStart.get(Calendar.YEAR) < 1900) || 
+            (use1904windowing && calStart.get(Calendar.YEAR) < 1904)) 
         {
             return BAD_DATE;
-        }
-        else
-        {
+        } else {
 	    // Because of daylight time saving we cannot use
 	    //     date.getTime() - calStart.getTimeInMillis()
 	    // as the difference in milliseconds between 00:00 and 04:00
@@ -80,32 +89,39 @@
                                ) * 1000 + calStart.get(Calendar.MILLISECOND)
                               ) / ( double ) DAY_MILLISECONDS;
             calStart = dayStart(calStart);
-
-            double value = fraction + absoluteDay(calStart);
             
-            if (value >= 60) {
-                value += 1;
+            double value = fraction + absoluteDay(calStart, use1904windowing);
+            
+            if (!use1904windowing && value >= 60) {
+                value++;
+            } else if (use1904windowing) {
+                value--;
             }
             
             return value;
         }
     }
-
+    
     /**
-     * Given a excel date, converts it into a Date.
-     * Assumes 1900 date windowing.
+     *  Given an Excel date with using 1900 date windowing, and
+     *   converts it to a java.util.Date.
      *
-     * @param  date the Excel Date
-     *
-     * @return Java representation of a date (null if error)
-     * @see #getJavaDate(double,boolean)
+     *  NOTE: If the default <code>TimeZone</code> in Java uses Daylight
+     *  Saving Time then the conversion back to an Excel date may not give
+     *  the same value, that is the comparison
+     *  <CODE>excelDate == getExcelDate(getJavaDate(excelDate,false))</CODE>
+     *  is not always true. For example if default timezone is
+     *  <code>Europe/Copenhagen</code>, on 2004-03-28 the minute after
+     *  01:59 CET is 03:00 CEST, if the excel date represents a time between
+     *  02:00 and 03:00 then it is converted to past 03:00 summer time
+     *  
+     *  @param date  The Excel date.
+     *  @return Java representation of the date, or null if date is not a valid Excel date
+     *  @see java.util.TimeZone
      */
-
-    public static Date getJavaDate(double date)
-    {
-        return getJavaDate(date,false);
+    public static Date getJavaDate(double date) {
+    	return getJavaDate(date, false);
     }
-    
     /**
      *  Given an Excel date with either 1900 or 1904 date windowing,
      *  converts it to a java.util.Date.
@@ -142,7 +158,7 @@
             GregorianCalendar calendar = new GregorianCalendar(startYear,0,
                                                      wholeDays + dayAdjust);
             int millisecondsInDay = (int)((date - Math.floor(date)) * 
-                                          (double) DAY_MILLISECONDS + 0.5);
+                                          DAY_MILLISECONDS + 0.5);
             calendar.set(GregorianCalendar.MILLISECOND, millisecondsInDay);
             return calendar.getTime();
         }
@@ -238,7 +254,7 @@
      *  Check if a cell contains a date
      *  Since dates are stored internally in Excel as double values 
      *  we infer it is a date if it is formatted as such. 
-     *  @see #isADateFormat(int,string)
+     *  @see #isADateFormat(int, String)
      *  @see #isInternalDateFormat(int)
      */
     public static boolean isCellDateFormatted(HSSFCell cell) {
@@ -259,7 +275,7 @@
      *   excel date formats.
      *  As Excel stores a great many of its dates in "non-internal"
      *   date formats, you will not normally want to use this method.
-     *  @see #isADateFormat(int,string)
+     *  @see #isADateFormat(int,String)
      *  @see #isInternalDateFormat(int)
      */
     public static boolean isCellInternalDateFormatted(HSSFCell cell) {
@@ -296,10 +312,10 @@
      * @exception IllegalArgumentException if date is invalid
      */
 
-    private static int absoluteDay(Calendar cal)
+    static int absoluteDay(Calendar cal, boolean use1904windowing)
     {
         return cal.get(Calendar.DAY_OF_YEAR)
-               + daysInPriorYears(cal.get(Calendar.YEAR));
+               + daysInPriorYears(cal.get(Calendar.YEAR), use1904windowing);
     }
 
     /**
@@ -307,14 +323,14 @@
      *
      * @return    days  number of days in years prior to yr.
      * @param     yr    a year (1900 < yr < 4000)
+     * @param use1904windowing 
      * @exception IllegalArgumentException if year is outside of range.
      */
 
-    private static int daysInPriorYears(int yr)
+    private static int daysInPriorYears(int yr, boolean use1904windowing)
     {
-        if (yr < 1900) {
-            throw new IllegalArgumentException(
-                "'year' must be 1900 or greater");
+        if ((!use1904windowing && yr < 1900) || (use1904windowing && yr < 1900)) {
+            throw new IllegalArgumentException("'year' must be 1900 or greater");
         }
         
         int yr1  = yr - 1;
@@ -323,7 +339,7 @@
                        + yr1 / 400 // plus years divisible by 400 
                        - 460;      // leap days in previous 1900 years
         
-        return 365 * (yr - 1900) + leapDays;
+        return 365 * (yr - (use1904windowing ? 1904 : 1900)) + leapDays;
     }
     
     // set HH:MM:SS fields of cal to 00:00:00:000

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFFont.java Fri Jan  4 06:19:14 2008
@@ -281,8 +281,8 @@
      * @return color to use
      * @see #COLOR_NORMAL
      * @see #COLOR_RED
+     * @see org.apache.poi.hssf.usermodel.HSSFPalette#getColor(short)
      */
-
     public short getColor()
     {
         return font.getColorPaletteIndex();

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java Fri Jan  4 06:19:14 2008
@@ -23,9 +23,13 @@
 package org.apache.poi.hssf.usermodel;
 
 import org.apache.poi.ddf.EscherRecord;
+import org.apache.poi.hssf.model.FormulaParser;
 import org.apache.poi.hssf.model.Sheet;
 import org.apache.poi.hssf.model.Workbook;
 import org.apache.poi.hssf.record.*;
+import org.apache.poi.hssf.record.formula.Ptg;
+import org.apache.poi.hssf.util.HSSFCellRangeAddress;
+import org.apache.poi.hssf.util.HSSFDataValidation;
 import org.apache.poi.hssf.util.Region;
 import org.apache.poi.hssf.util.PaneInformation;
 import org.apache.poi.util.POILogFactory;
@@ -35,6 +39,7 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Stack;
 import java.util.TreeMap;
 import java.text.AttributedString;
 import java.text.NumberFormat;
@@ -352,6 +357,94 @@
     public int getLastRowNum()
     {
         return lastrow;
+    }
+    
+    /**
+     * Creates a data validation object
+     * @param obj_validation The Data validation object settings
+     */
+    public void addValidationData(HSSFDataValidation obj_validation)
+    {
+       if ( obj_validation == null )
+       {
+         return;
+       }
+       DVALRecord dvalRec = (DVALRecord)sheet.findFirstRecordBySid( DVALRecord.sid );
+       int eofLoc = sheet.findFirstRecordLocBySid( EOFRecord.sid );
+       if ( dvalRec == null )
+       {
+          dvalRec = new DVALRecord();
+          sheet.getRecords().add( eofLoc, dvalRec );
+       }
+       int curr_dvRecNo = dvalRec.getDVRecNo();
+       dvalRec.setDVRecNo(curr_dvRecNo+1);
+
+       //create dv record
+       DVRecord dvRecord = new DVRecord();
+
+       //dv record's option flags
+       dvRecord.setDataType( obj_validation.getDataValidationType() );
+       dvRecord.setErrorStyle(obj_validation.getErrorStyle());
+       dvRecord.setEmptyCellAllowed(obj_validation.getEmptyCellAllowed());
+       dvRecord.setSurppresDropdownArrow(obj_validation.getSurppressDropDownArrow());
+       dvRecord.setShowPromptOnCellSelected(obj_validation.getShowPromptBox());
+       dvRecord.setShowErrorOnInvalidValue(obj_validation.getShowErrorBox());
+       dvRecord.setConditionOperator(obj_validation.getOperator());
+
+       //string fields
+       dvRecord.setStringField( DVRecord.STRING_PROMPT_TITLE,obj_validation.getPromptBoxTitle());
+       dvRecord.setStringField( DVRecord.STRING_PROMPT_TEXT, obj_validation.getPromptBoxText());
+       dvRecord.setStringField( DVRecord.STRING_ERROR_TITLE, obj_validation.getErrorBoxTitle());
+       dvRecord.setStringField( DVRecord.STRING_ERROR_TEXT, obj_validation.getErrorBoxText());
+
+       //formula fields ( size and data )
+       String str_formula = obj_validation.getFirstFormula();
+       FormulaParser fp = new FormulaParser(str_formula+";",book);
+       fp.parse();
+       Stack ptg_arr = new Stack();
+       Ptg[] ptg  = fp.getRPNPtg();
+       int size = 0;
+       for (int k = 0; k < ptg.length; k++)
+       {
+           if ( ptg[k] instanceof org.apache.poi.hssf.record.formula.AreaPtg )
+           {
+              //we should set ptgClass to Ptg.CLASS_REF and explicit formula string to false
+              ptg[k].setClass(Ptg.CLASS_REF);
+              obj_validation.setExplicitListFormula(false);
+           }
+           size += ptg[k].getSize();
+           ptg_arr.push(ptg[k]);
+       }
+       dvRecord.setFirstFormulaRPN(ptg_arr);
+       dvRecord.setFirstFormulaSize((short)size);
+
+       dvRecord.setListExplicitFormula(obj_validation.getExplicitListFormula());
+
+       if ( obj_validation.getSecondFormula() != null )
+       {
+         str_formula = obj_validation.getSecondFormula();
+         fp = new FormulaParser(str_formula+";",book);
+         fp.parse();
+         ptg_arr = new Stack();
+         ptg  = fp.getRPNPtg();
+         size = 0;
+         for (int k = 0; k < ptg.length; k++)
+         {
+             size += ptg[k].getSize();
+             ptg_arr.push(ptg[k]);
+         }
+         dvRecord.setSecFormulaRPN(ptg_arr);
+         dvRecord.setSecFormulaSize((short)size);
+       }
+
+       //dv records cell range field
+       HSSFCellRangeAddress cell_range = new HSSFCellRangeAddress();
+       cell_range.addADDRStructure(obj_validation.getFirstRow(), obj_validation.getFirstColumn(), obj_validation.getLastRow(), obj_validation.getLastColumn());
+       dvRecord.setCellRangeAddress(cell_range);
+
+       //add dv record
+       eofLoc = sheet.findFirstRecordLocBySid( EOFRecord.sid );
+       sheet.getRecords().add( eofLoc, dvRecord );
     }
 
     /**

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/poifs/storage/SmallBlockTableWriter.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/poifs/storage/SmallBlockTableWriter.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/poifs/storage/SmallBlockTableWriter.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/poifs/storage/SmallBlockTableWriter.java Fri Jan  4 06:19:14 2008
@@ -19,6 +19,7 @@
 
 package org.apache.poi.poifs.storage;
 
+import org.apache.poi.poifs.common.POIFSConstants;
 import org.apache.poi.poifs.filesystem.BATManaged;
 import org.apache.poi.poifs.filesystem.POIFSDocument;
 import org.apache.poi.poifs.property.RootProperty;
@@ -69,6 +70,8 @@
                 {
                     _small_blocks.add(blocks[ j ]);
                 }
+            } else {
+            	doc.setStartBlock(POIFSConstants.END_OF_CHAIN);
             }
         }
         _sbat.simpleCreateBlocks();

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/IOUtils.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/IOUtils.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/IOUtils.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/IOUtils.java Fri Jan  4 06:19:14 2008
@@ -19,6 +19,7 @@
 
 package org.apache.poi.util;
 
+import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -26,6 +27,25 @@
 {
     private IOUtils()
     {
+    }
+
+    /**
+     * Reads all the data from the input stream, and returns
+     *  the bytes read.
+     */
+    public static byte[] toByteArray(InputStream stream) throws IOException {
+    	ByteArrayOutputStream baos = new ByteArrayOutputStream();
+    	
+    	byte[] buffer = new byte[4096];
+    	int read = 0;
+    	while(read != -1) {
+    		read = stream.read(buffer);
+    		if(read > 0) {
+    			baos.write(buffer, 0, read);
+    		}
+    	}
+    	
+    	return baos.toByteArray();
     }
 
     /**

Modified: poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/StringUtil.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/StringUtil.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/StringUtil.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/java/org/apache/poi/util/StringUtil.java Fri Jan  4 06:19:14 2008
@@ -161,7 +161,8 @@
 		final int offset,
 		final int len) {
 		try {
-			return new String(string, offset, len, "ISO-8859-1");
+			int len_to_use = Math.min(len, string.length - offset);
+			return new String(string, offset, len_to_use, "ISO-8859-1");
 		} catch (UnsupportedEncodingException e) {
 			throw new InternalError(); /* unreachable */
 		}

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/examples/src/org/apache/poi/hssf/eventusermodel/examples/XLS2CSVmra.java Fri Jan  4 06:19:14 2008
@@ -283,7 +283,7 @@
         		format = format.replaceAll("\\\\-","-");
         		
         		// Format as a date
-        		Date d = HSSFDateUtil.getJavaDate(value);
+        		Date d = HSSFDateUtil.getJavaDate(value, false);
         		DateFormat df = new SimpleDateFormat(format);
 	            return df.format(d);
         	} else {

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java Fri Jan  4 06:19:14 2008
@@ -150,10 +150,12 @@
         EscherOptRecord opt = (EscherOptRecord)Shape.getEscherChild(shape.getSpContainer(), EscherOptRecord.RECORD_ID);
         if (color == null) {
             Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, -1);
+            Shape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150010);
         }
         else {
             int rgb = new Color(color.getBlue(), color.getGreen(), color.getRed(), 0).getRGB();
             Shape.setEscherProperty(opt, EscherProperties.FILL__FILLCOLOR, rgb);
+            Shape.setEscherProperty(opt, EscherProperties.FILL__NOFILLHITTEST, 0x150011);
         }
     }
 

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/Sheet.java Fri Jan  4 06:19:14 2008
@@ -153,7 +153,7 @@
      */
     protected static void findTextRuns(Record[] records, Vector found) {
         // Look for a TextHeaderAtom
-        for (int i = 0; i < (records.length - 1); i++) {
+        for (int i = 0, slwtIndex=0; i < (records.length - 1); i++) {
             if (records[i] instanceof TextHeaderAtom) {
                 TextRun trun = null;
                 TextHeaderAtom tha = (TextHeaderAtom) records[i];
@@ -179,7 +179,6 @@
                     // TextSpecInfoAtom - Safe to ignore
                 } else {
                     System.err.println("Found a TextHeaderAtom not followed by a TextBytesAtom or TextCharsAtom: Followed by " + records[i + 1].getRecordType());
-                    continue;
                 }
 
                 if (trun != null) {
@@ -191,12 +190,14 @@
                     Record[] recs = new Record[lst.size()];
                     lst.toArray(recs);
                     trun._records = recs;
+                    trun.setIndex(slwtIndex);
                     
                     found.add(trun);
                     i++;
                 } else {
                     // Not a valid one, so skip on to next and look again
                 }
+                slwtIndex++;
             }
         }
     }

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java Fri Jan  4 06:19:14 2008
@@ -124,8 +124,10 @@
             int rgb = p1.getPropertyValue();
             if (rgb >= 0x8000000) {
                 int idx = rgb % 0x8000000;
-                ColorSchemeAtom ca = getSheet().getColorScheme();
-                if(idx >= 0 && idx <= 7) rgb = ca.getColor(idx);
+                if(getSheet() != null) {
+                    ColorSchemeAtom ca = getSheet().getColorScheme();
+                    if(idx >= 0 && idx <= 7) rgb = ca.getColor(idx);
+                }
             }
             Color tmp = new Color(rgb, true);
             clr = new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());
@@ -192,8 +194,10 @@
             int rgb = p1.getPropertyValue();
             if (rgb >= 0x8000000) {
                 int idx = rgb % 0x8000000;
-                ColorSchemeAtom ca = getSheet().getColorScheme();
-                rgb = ca.getColor(idx);
+                if(getSheet() != null) {
+                    ColorSchemeAtom ca = getSheet().getColorScheme();
+                    rgb = ca.getColor(idx);
+                }
             }
             Color tmp = new Color(rgb, true);
             clr = new Color(tmp.getBlue(), tmp.getGreen(), tmp.getRed());

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java Fri Jan  4 06:19:14 2008
@@ -196,7 +196,7 @@
         } catch (IOException e){
             throw new HSLFException(e);
         }
-        if(getAnchor().equals(new java.awt.Rectangle())) resizeToFitText();
+        if(getAnchor().equals(new java.awt.Rectangle()) && !"".equals(getText())) resizeToFitText();
     }
 
     /**
@@ -264,6 +264,14 @@
         EscherOptRecord opt = (EscherOptRecord)getEscherChild(_escherContainer, EscherOptRecord.RECORD_ID);
         setEscherProperty(opt, EscherProperties.TEXT__ANCHORTEXT, align);
     }
+
+    public void setHorizontalAlignment(int align){
+        _txtrun.getRichTextRuns()[0].setAlignment(align);
+    }
+    public int getHorizontalAlignment(){
+        return _txtrun.getRichTextRuns()[0].getAlignment();
+    }
+
     /**
      * Returns the distance (in points) between the bottom of the text frame
      * and the bottom of the inscribed rectangle of the shape that contains the text.
@@ -466,7 +474,11 @@
         TextRun[] runs = sheet.getTextRuns();
         if (ota != null) {
             int idx = ota.getTextIndex();
-            if(idx < runs.length) _txtrun = runs[idx];
+            for (int i = 0; i < runs.length; i++) {
+                if(runs[i].getIndex() == idx){
+                    _txtrun = runs[i];
+                }
+            }
             if(_txtrun == null) {
                 logger.log(POILogger.WARN, "text run not found for OutlineTextRefAtom.TextIndex=" + idx);
             }
@@ -477,9 +489,6 @@
                     _txtrun = runs[i];
                     break;
                 }
-            }
-            if(_txtrun == null) {
-                logger.log(POILogger.WARN, "text run not found for shapeId=" + shapeId);
             }
         }
 

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java Fri Jan  4 06:19:14 2008
@@ -50,6 +50,7 @@
 	private SlideShow slideShow;
     private Sheet sheet;
     private int shapeId;
+    private int slwtIndex; //position in the owning SlideListWithText
     /**
      * all text run records that follow TextHeaderAtom.
      * (there can be misc InteractiveInfo, TxInteractiveInfo and other records)
@@ -535,6 +536,20 @@
      */
     protected void setShapeId(int id){
         shapeId = id;
+    }
+
+    /**
+     * @return  0-based index of the text run in the SLWT container
+     */
+    protected int getIndex(){
+        return slwtIndex;
+    }
+
+    /**
+     *  @param id 0-based index of the text run in the SLWT container
+     */
+    protected void setIndex(int id){
+        slwtIndex = id;
     }
 
     /**

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hslf/usermodel/RichTextRun.java Fri Jan  4 06:19:14 2008
@@ -198,7 +198,7 @@
         setFlag(true, index, value);
 	}
 
-    private void setFlag(boolean isCharacter, int index, boolean value) {
+    public void setFlag(boolean isCharacter, int index, boolean value) {
         TextPropCollection props;
         String propname;
         if (isCharacter){
@@ -282,7 +282,7 @@
 	 * @param propName The name of the Character TextProp
 	 * @param val The value to set for the TextProp
 	 */
-	private void setParaTextPropVal(String propName, int val) {
+	public void setParaTextPropVal(String propName, int val) {
 		// Ensure we have the StyleTextProp atom we're going to need
 		if(paragraphStyle == null) {
 			parentRun.ensureStyleAtomPresent();
@@ -297,7 +297,7 @@
 	 * @param propName The name of the Paragraph TextProp
 	 * @param val The value to set for the TextProp
 	 */
-	private void setCharTextPropVal(String propName, int val) {
+	public void setCharTextPropVal(String propName, int val) {
 		// Ensure we have the StyleTextProp atom we're going to need
 		if(characterStyle == null) {
 			parentRun.ensureStyleAtomPresent();

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/MAPIMessage.java Fri Jan  4 06:19:14 2008
@@ -48,15 +48,24 @@
 	
 	
 	/**
-	 * Constructor for reading MSG Files.
+	 * Constructor for reading MSG Files from the file system.
 	 * @param filename
 	 * @throws IOException
 	 */
 	public MAPIMessage(String filename) throws IOException {
-		InputStream in = new FileInputStream(new File(filename));
+		this(new FileInputStream(new File(filename)));
+	}
+	
+	/**
+	 * Constructor for reading MSG Files from an input stream.
+	 * @param in
+	 * @throws IOException
+	 */
+	public MAPIMessage(InputStream in) throws IOException {
 		this.fs = new POIFSFileSystem(in);
 		chunkParser = new POIFSChunkParser(this.fs);
 	}
+	
 
 	/**
 	 * Gets a string value based on the passed chunk.
@@ -99,6 +108,16 @@
 	 */
 	public String getDisplayTo() throws ChunkNotFoundException {
 		return getStringFromChunk(Chunks.getInstance().displayToChunk);
+	}
+	
+	/**
+	 * Gets the display value of the "FROM" line of the outlook message
+	 * This is not the actual address that was sent from but the formated display of the user name.
+	 * @return
+	 * @throws ChunkNotFoundException
+	 */
+	public String getDisplayFrom() throws ChunkNotFoundException {
+		return getStringFromChunk(Chunks.getInstance().displayFromChunk);
 	}
 	
 	/**

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hsmf/datatypes/Chunks.java Fri Jan  4 06:19:14 2008
@@ -29,6 +29,7 @@
 	public StringChunk textBodyChunk = new StringChunk(0x1000);		//BODY Chunk, for plain/text messages
 	public StringChunk subjectChunk = new StringChunk(0x0037);  	//Subject link chunk, in plain/text
 	public StringChunk displayToChunk = new StringChunk(0x0E04);	//Value that is in the TO field (not actually the addresses as they are stored in recip directory nodes
+	public StringChunk displayFromChunk = new StringChunk(0x0C1A);	//Value that is in the FROM field
 	public StringChunk displayCCChunk = new StringChunk(0x0E03);	//value that shows in the CC field
 	public StringChunk displayBCCChunk = new StringChunk(0x0E02);	//Value that shows in the BCC field
 	public StringChunk conversationTopic = new StringChunk(0x0070); //Sort of like the subject line, but without the RE: and FWD: parts.

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Date.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Date.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Date.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Date.java Fri Jan  4 06:19:14 2008
@@ -70,7 +70,7 @@
                 c.set(year, month, day, 0, 0, 0);
                 c.set(Calendar.MILLISECOND, 0);
                 
-                return new NumberEval(HSSFDateUtil.getExcelDate(c.getTime()));
+                return new NumberEval(HSSFDateUtil.getExcelDate(c.getTime(), false)); // XXX fix 1900/1904 problem
             }
         }
         

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Day.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Day.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Day.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Day.java Fri Jan  4 06:19:14 2008
@@ -46,7 +46,7 @@
             if (ve instanceof NumericValueEval) {
                 NumericValueEval ne = (NumericValueEval) ve;
                 if (HSSFDateUtil.isValidExcelDate(ne.getNumberValue())) {
-                    java.util.Date d = HSSFDateUtil.getJavaDate(ne.getNumberValue());
+                    java.util.Date d = HSSFDateUtil.getJavaDate(ne.getNumberValue(), false); // XXX fix 1900/1904 problem
                     java.util.Calendar c = java.util.Calendar.getInstance();
                     c.setTime(d);
                     retval = new NumberEval(c.get(java.util.Calendar.DAY_OF_MONTH));

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Mid.java Fri Jan  4 06:19:14 2008
@@ -20,6 +20,80 @@
  */
 package org.apache.poi.hssf.record.formula.functions;
 
-public class Mid extends NotImplementedFunction {
+import org.apache.poi.hssf.record.formula.eval.BlankEval;
+import org.apache.poi.hssf.record.formula.eval.ErrorEval;
+import org.apache.poi.hssf.record.formula.eval.Eval;
+import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
+import org.apache.poi.hssf.record.formula.eval.StringEval;
+import org.apache.poi.hssf.record.formula.eval.StringValueEval;
+import org.apache.poi.hssf.record.formula.eval.ValueEval;
+
+/**
+ * An implementation of the MID function:
+ * Returns a specific number of characters from a text string, 
+ * starting at the position you specify, based on the number 
+ * of characters you specify.
+ * @author Manda Wilson &lt; wilson at c bio dot msk cc dot org &gt;
+ */
+public class Mid extends TextFunction {
+	/**
+	 * Returns a specific number of characters from a text string, 
+	 * starting at the position you specify, based on the number 
+	 * of characters you specify.
+	 * 
+	 * @see org.apache.poi.hssf.record.formula.eval.Eval
+	 */
+    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {		
+    	Eval retval = null;
+        String str = null;
+        int startNum = 0;
+        int numChars = 0;
+        
+        switch (operands.length) {
+	        default:
+	            retval = ErrorEval.VALUE_INVALID;
+	        case 3:
+	        	// first operand is text string containing characters to extract
+	            // second operand is position of first character to extract
+	            // third operand is the number of characters to return
+	            ValueEval firstveval = singleOperandEvaluate(operands[0], srcCellRow, srcCellCol);
+	            ValueEval secondveval = singleOperandEvaluate(operands[1], srcCellRow, srcCellCol);
+	            ValueEval thirdveval = singleOperandEvaluate(operands[2], srcCellRow, srcCellCol);
+	            if (firstveval instanceof StringValueEval
+	            	&& secondveval instanceof NumericValueEval
+	            	&& thirdveval instanceof NumericValueEval) {
+	            	
+	                StringValueEval strEval = (StringValueEval) firstveval;
+	                str = strEval.getStringValue();
+	                
+	                NumericValueEval startNumEval = (NumericValueEval) secondveval;
+	                // NOTE: it is safe to cast to int here
+	                // because in Excel =MID("test", 1, 1.7) returns t 
+	                // so 1.7 must be truncated to 1
+	                // and =MID("test", 1.9, 2) returns te 
+	                // so 1.9 must be truncated to 1
+	                startNum = (int) startNumEval.getNumberValue();
+	                
+	                NumericValueEval numCharsEval = (NumericValueEval) thirdveval;
+	                numChars = (int) numCharsEval.getNumberValue();
+	                
+	            } else {
+	            	retval = ErrorEval.VALUE_INVALID;
+	            }
+	    }
+	        
+        if (retval == null) {
+			if (startNum < 1 || numChars < 0) {
+				retval = ErrorEval.VALUE_INVALID;
+			} else if (startNum > str.length() || numChars == 0) {
+				retval = BlankEval.INSTANCE;
+			} else if (startNum + numChars > str.length()) {
+				retval = new StringEval(str.substring(startNum - 1));
+			} else {
+				retval = new StringEval(str.substring(startNum - 1, numChars));
+			} 
+        } 
+		return retval;
+    }
 
 }

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Month.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Month.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Month.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Month.java Fri Jan  4 06:19:14 2008
@@ -50,7 +50,7 @@
             if (ve instanceof NumericValueEval) {
                 NumericValueEval ne = (NumericValueEval) ve;
                 if (HSSFDateUtil.isValidExcelDate(ne.getNumberValue())) {
-                    java.util.Date d = HSSFDateUtil.getJavaDate(ne.getNumberValue());
+                    java.util.Date d = HSSFDateUtil.getJavaDate(ne.getNumberValue(), false); // XXX fix 1900/1904 problem
                     retval = new NumberEval(d.getMonth()+1);
                 } else {
                     retval = ErrorEval.NUM_ERROR;

Modified: poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Replace.java
URL: http://svn.apache.org/viewvc/poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Replace.java?rev=608846&r1=608845&r2=608846&view=diff
==============================================================================
--- poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Replace.java (original)
+++ poi/tags/REL_3_0_2_BETA2/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/Replace.java Fri Jan  4 06:19:14 2008
@@ -20,6 +20,93 @@
  */
 package org.apache.poi.hssf.record.formula.functions;
 
-public class Replace extends NotImplementedFunction {
+import org.apache.poi.hssf.record.formula.eval.ErrorEval;
+import org.apache.poi.hssf.record.formula.eval.Eval;
+import org.apache.poi.hssf.record.formula.eval.NumericValueEval;
+import org.apache.poi.hssf.record.formula.eval.StringEval;
+import org.apache.poi.hssf.record.formula.eval.StringValueEval;
+import org.apache.poi.hssf.record.formula.eval.ValueEval;
+
+/**
+ * An implementation of the REPLACE function:
+ * Replaces part of a text string based on the number of characters 
+ * you specify, with another text string.
+ * @author Manda Wilson &lt; wilson at c bio dot msk cc dot org &gt;
+ */
+public class Replace extends TextFunction {
+
+	/**
+	 * Replaces part of a text string based on the number of characters 
+	 * you specify, with another text string.
+	 * 
+	 * @see org.apache.poi.hssf.record.formula.eval.Eval
+	 */
+    public Eval evaluate(Eval[] operands, int srcCellRow, short srcCellCol) {		
+    	Eval retval = null;
+        String oldStr = null;
+        String newStr = null;
+        int startNum = 0;
+        int numChars = 0;
+        
+        switch (operands.length) {
+	        default:
+	            retval = ErrorEval.VALUE_INVALID;
+	        case 4:	        
+	        	// first operand is text string containing characters to replace
+	            // second operand is position of first character to replace
+	            // third operand is the number of characters in the old string
+	            // you want to replace with new string
+	            // fourth operand is the new string
+	            ValueEval firstveval = singleOperandEvaluate(operands[0], srcCellRow, srcCellCol);
+	            ValueEval secondveval = singleOperandEvaluate(operands[1], srcCellRow, srcCellCol);
+	            ValueEval thirdveval = singleOperandEvaluate(operands[2], srcCellRow, srcCellCol);
+	            ValueEval fourthveval = singleOperandEvaluate(operands[3], srcCellRow, srcCellCol);
+	            if (firstveval instanceof StringValueEval
+	            	&& secondveval instanceof NumericValueEval
+	            	&& thirdveval instanceof NumericValueEval
+	            	&& fourthveval instanceof StringValueEval) {
+	            	
+	                StringValueEval oldStrEval = (StringValueEval) firstveval;
+	                oldStr = oldStrEval.getStringValue();
+	                
+	                NumericValueEval startNumEval = (NumericValueEval) secondveval;
+	                // NOTE: it is safe to cast to int here
+	                // because in Excel =REPLACE("task", 2.7, 3, "est") 
+	                // returns test 
+	                // so 2.7 must be truncated to 2
+	                // and =REPLACE("task", 1, 1.9, "") returns ask 
+	                // so 1.9 must be truncated to 1
+	                startNum = (int) startNumEval.getNumberValue();
+	                
+	                NumericValueEval numCharsEval = (NumericValueEval) thirdveval;
+	                numChars = (int) numCharsEval.getNumberValue();
+	                             
+	                StringValueEval newStrEval = (StringValueEval) fourthveval;
+	                newStr = newStrEval.getStringValue();
+	            } else {
+	            	retval = ErrorEval.VALUE_INVALID;
+	            }
+	    }
+	        
+        if (retval == null) {
+			if (startNum < 1 || numChars < 0) {
+				retval = ErrorEval.VALUE_INVALID;
+			} else {
+				StringBuffer strBuff = new StringBuffer(oldStr);
+				// remove any characters that should be replaced
+				if (startNum <= oldStr.length() && numChars != 0) {
+					strBuff.delete(startNum - 1, startNum - 1 + numChars);
+				} 
+				// now insert (or append) newStr
+				if (startNum > strBuff.length()) {
+					strBuff.append(newStr);
+				} else {
+					strBuff.insert(startNum - 1, newStr);
+				}
+				retval = new StringEval(strBuff.toString());
+			}
+        } 
+		return retval;
+    }
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org