From: Nick Burch Date: Sat, 9 Aug 2008 16:24:20 +0000 (+0000) Subject: Start to document the whole FIB stuff better X-Git-Tag: REL_3_2_FINAL~186 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b2f3ada6ff435829a9003e47ab28693868d1f5eb;p=poi.git Start to document the whole FIB stuff better git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@684287 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FIBLongHandler.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FIBLongHandler.java index 7814f04955..8129daaed8 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FIBLongHandler.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FIBLongHandler.java @@ -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; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FIBShortHandler.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FIBShortHandler.java index bc7fb4314c..e8c2b20afe 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FIBShortHandler.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FIBShortHandler.java @@ -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; diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java index 887e13d829..ea9f1bc39b 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/FileInformationBlock.java @@ -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 diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java index dc5ffff269..6615823281 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/types/FIBAbstractType.java @@ -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. diff --git a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java index 1becc234c3..8fc0314a37 100644 --- a/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java +++ b/src/scratchpad/testcases/org/apache/poi/hwpf/usermodel/TestRangeDelete.java @@ -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); diff --git a/src/types/definitions/fib_type.xml b/src/types/definitions/fib_type.xml index fe3f11d9db..6558ac090c 100644 --- a/src/types/definitions/fib_type.xml +++ b/src/types/definitions/fib_type.xml @@ -20,7 +20,7 @@ AbstractType HDFType - File information Block. + Base part of the File information Block (FibBase). Holds the core part of the FIB, from the first 32 bytes. Andrew C. Oliver