001: /* ====================================================================
002: Licensed to the Apache Software Foundation (ASF) under one or more
003: contributor license agreements. See the NOTICE file distributed with
004: this work for additional information regarding copyright ownership.
005: The ASF licenses this file to You under the Apache License, Version 2.0
006: (the "License"); you may not use this file except in compliance with
007: the License. You may obtain a copy of the License at
008:
009: http://www.apache.org/licenses/LICENSE-2.0
010:
011: Unless required by applicable law or agreed to in writing, software
012: distributed under the License is distributed on an "AS IS" BASIS,
013: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: See the License for the specific language governing permissions and
015: limitations under the License.
016: ==================================================================== */
017:
018: package org.apache.poi.hdf.model;
019:
020: import org.apache.poi.hdf.event.HDFLowLevelParsingListener;
021: import org.apache.poi.hdf.model.util.BTreeSet;
022:
023: import org.apache.poi.hdf.model.hdftypes.ChpxNode;
024: import org.apache.poi.hdf.model.hdftypes.PapxNode;
025: import org.apache.poi.hdf.model.hdftypes.SepxNode;
026: import org.apache.poi.hdf.model.hdftypes.TextPiece;
027: import org.apache.poi.hdf.model.hdftypes.DocumentProperties;
028: import org.apache.poi.hdf.model.hdftypes.FontTable;
029: import org.apache.poi.hdf.model.hdftypes.ListTables;
030: import org.apache.poi.hdf.model.hdftypes.StyleSheet;
031:
032: public class HDFObjectModel implements HDFLowLevelParsingListener {
033:
034: /** "WordDocument" from the POIFS */
035: private byte[] _mainDocument;
036:
037: /** The DOP*/
038: private DocumentProperties _dop;
039: /**the StyleSheet*/
040: private StyleSheet _styleSheet;
041: /**list info */
042: private ListTables _listTables;
043: /** Font info */
044: private FontTable _fonts;
045:
046: /** text offset in main stream */
047: int _fcMin;
048:
049: /** text pieces */
050: BTreeSet _text = new BTreeSet();
051: /** document sections */
052: BTreeSet _sections = new BTreeSet();
053: /** document paragraphs */
054: BTreeSet _paragraphs = new BTreeSet();
055: /** document character runs */
056: BTreeSet _characterRuns = new BTreeSet();
057:
058: public HDFObjectModel() {
059: }
060:
061: public void mainDocument(byte[] mainDocument) {
062: _mainDocument = mainDocument;
063: }
064:
065: public void tableStream(byte[] tableStream) {
066: }
067:
068: public void miscellaneous(int fcMin, int ccpText, int ccpFtn,
069: int fcPlcfhdd, int lcbPlcfhdd) {
070: _fcMin = fcMin;
071: }
072:
073: public void document(DocumentProperties dop) {
074: _dop = dop;
075: }
076:
077: public void bodySection(SepxNode sepx) {
078: _sections.add(sepx);
079: }
080:
081: public void hdrSection(SepxNode sepx) {
082: _sections.add(sepx);
083: }
084:
085: public void endSections() {
086: }
087:
088: public void paragraph(PapxNode papx) {
089: _paragraphs.add(papx);
090: }
091:
092: public void characterRun(ChpxNode chpx) {
093: _characterRuns.add(chpx);
094: }
095:
096: public void text(TextPiece t) {
097: _text.add(t);
098: }
099:
100: public void fonts(FontTable fontTbl) {
101: _fonts = fontTbl;
102: }
103:
104: public void lists(ListTables listTbl) {
105: _listTables = listTbl;
106: }
107:
108: public void styleSheet(StyleSheet stsh) {
109: _styleSheet = stsh;
110: }
111: }
|