]> source.dussan.org Git - poi.git/commitdiff
Start to document the whole FIB stuff better
authorNick Burch <nick@apache.org>
Sat, 9 Aug 2008 16:24:20 +0000 (16:24 +0000)
committerNick Burch <nick@apache.org>
Sat, 9 Aug 2008 16:24:20 +0000 (16:24 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@684287 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/FIBLongHandler.java
src/scratchpad/src/org/apache/poi/hwpf/model/FIBShortHandler.java
src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java
src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java
src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java
src/types/definitions/fib_type.xml

index 7814f049550f4d0d24747d353ac0ca657945853c..8129daaed8ca509879f6114ef9f9fedf01358f43 100644 (file)
@@ -22,8 +22,11 @@ import java.io.IOException;
 
 import org.apache.poi.util.LittleEndian;
 
-public class FIBLongHandler
-{
+/**
+ * Handles the fibRgLw / The FibRgLw97 part of
+ *  the FIB (File Information Block)
+ */
+public class FIBLongHandler {
   public static final int CBMAC = 0;
   public static final int PRODUCTCREATED = 1;
   public static final int PRODUCTREVISED = 2;
index bc7fb4314ce78b3af42b66147388a81dbae85c41..e8c2b20afeda06f64ead96dbe05d6657ca4c47c6 100644 (file)
@@ -22,10 +22,11 @@ import java.io.IOException;
 
 import org.apache.poi.util.LittleEndian;
 
-import org.apache.poi.hwpf.model.io.HWPFOutputStream;
-
-class FIBShortHandler
-{
+/**
+ * Handles the fibRgW / FibRgW97 part of 
+ *  the FIB (File Information Block)
+ */
+public class FIBShortHandler {
   public final static int MAGICCREATED = 0;
   public final static int MAGICREVISED = 1;
   public final static int MAGICCREATEDPRIVATE = 2;
index 887e13d829792a68dde64249b1cb1315625393f1..ea9f1bc39bfea5957f3938ab7a413140e5cc1491 100644 (file)
@@ -28,7 +28,19 @@ import org.apache.poi.hwpf.model.io.*;
 import org.apache.poi.hwpf.model.types.FIBAbstractType;
 
 /**
- *
+ * The File Information Block (FIB). Holds pointers
+ *  to various bits of the file, and lots of flags which
+ *  specify properties of the document.
+ * 
+ * The parent class, {@link FIBAbstractType}, holds the
+ *  first 32 bytes, which make up the FibBase.
+ * The next part, the fibRgW / FibRgW97, is handled
+ *  by {@link FIBShortHandler}.
+ * The next part, the fibRgLw / The FibRgLw97, is
+ *  handled by the {@link FIBLongHandler}.
+ * Finally, the rest of the fields are handled by
+ *  the {@link FIBFieldHandler}.
+ * 
  * @author  andy
  */
 public class FileInformationBlock extends FIBAbstractType
index dc5ffff26967751ec41452d2b3fd357d00148bff..6615823281e10f71396285ac0f677ae0200797e5 100644 (file)
@@ -31,7 +31,7 @@ import org.apache.poi.hdf.model.hdftypes.HDFType;
 import org.apache.poi.hwpf.usermodel.*;
 
 /**
- * File information Block.
+ * Base part of the File information Block (FibBase). Holds the core part of the FIB, from the first 32 bytes.
  * NOTE: This source is automatically generated please do not modify this file.  Either subclass or
  *       remove the record in src/records/definitions.
 
index 1becc234c3aa65b8ab44f45d1928b92050356f0f..8fc0314a3720fd5cdd97416f964c495c4adaebd3 100644 (file)
@@ -67,7 +67,7 @@ public class TestRangeDelete extends TestCase {
 
                HWPFDocument daDoc = new HWPFDocument(new FileInputStream(illustrativeDocFile));
 
-               Range range = daDoc.getRange();
+               Range range = daDoc.getOverallRange();
 
                assertEquals(1, range.numSections());
                Section section = range.getSection(0);
@@ -78,6 +78,20 @@ public class TestRangeDelete extends TestCase {
                assertEquals(5, para.numCharacterRuns());
 
                assertEquals(originalText, para.text());
+               
+               
+               // Now check on just the main text
+               range = daDoc.getRange();
+               
+               assertEquals(1, range.numSections());
+               section = range.getSection(0);
+
+               assertEquals(5, section.numParagraphs());
+               para = section.getParagraph(2);
+
+               assertEquals(5, para.numCharacterRuns());
+
+               assertEquals(originalText, para.text());
        }
 
        /**
@@ -87,7 +101,7 @@ public class TestRangeDelete extends TestCase {
 
                HWPFDocument daDoc = new HWPFDocument(new FileInputStream(illustrativeDocFile));
 
-               Range range = daDoc.getRange();
+               Range range = daDoc.getOverallRange();
                assertEquals(1, range.numSections());
 
                Section section = range.getSection(0);
index fe3f11d9db4395cf362b18e588fcf2fd5e475355..6558ac090c9a89c0643214bb6aa973d853275200 100644 (file)
@@ -20,7 +20,7 @@
 <record fromfile="true" name="FIB" package="org.apache.poi.hwpf.model.types">
     <suffix>AbstractType</suffix>
     <extends>HDFType</extends>
-    <description>File information Block.</description>
+    <description>Base part of the File information Block (FibBase). Holds the core part of the FIB, from the first 32 bytes.</description>
     <author>Andrew C. Oliver</author>
     <fields>
 <!--        <field type="int" size="2" name="format flags">