1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 package org.openoffice.xmerge.converter.xml.sxw.wordsmith; 25 26 import java.io.IOException; 27 28 import org.w3c.dom.NodeList; 29 import org.w3c.dom.Node; 30 import org.w3c.dom.NamedNodeMap; 31 import org.w3c.dom.Element; 32 33 import org.openoffice.xmerge.Document; 34 import org.openoffice.xmerge.ConverterCapabilities; 35 import org.openoffice.xmerge.converter.xml.OfficeDocument; 36 import org.openoffice.xmerge.converter.xml.sxw.SxwDocument; 37 import org.openoffice.xmerge.converter.xml.*; 38 39 40 /** 41 * This is the superclass for all elements in a WordSmith document. 42 * Elements can be paragraphs, text runs, font tables, or color tables. 43 * 44 * @author David Proulx 45 */ 46 abstract class Wse { 47 48 /** 49 * Return true if <code>dataArray[startIndex]</code> is the start 50 * of a valid element of this type. 51 * 52 * @param dataArray <code>byte</code> array. 53 * @param startIndex The start index. 54 * 55 * @return true if <code>dataArray[startIndex]</code> is the 56 * start of a valid element of this type, false otherwise. 57 */ isValid(byte dataArray[], int startIndex)58 static boolean isValid(byte dataArray[], int startIndex) { 59 return false; 60 } 61 62 63 /** 64 * Compute and return the index of the first <code>byte</code> 65 * following this element. It is assumed that the element 66 * starting at <code>dataArray[startIndex]</code> is valid. 67 * 68 * @param dataArray <code>byte</code> array. 69 * @param startIndex The start index. 70 * 71 * @return The index of the first <code>byte</code> following 72 * this element. 73 */ computeNewIndex(byte dataArray[], int startIndex)74 static int computeNewIndex(byte dataArray[], int startIndex) { 75 return 0; 76 } 77 78 79 /** 80 * Return the total number of bytes needed to represent this 81 * object. 82 * 83 * @return The total number of bytes needed to represent this 84 * object. 85 */ getByteCount()86 abstract int getByteCount(); 87 88 89 /** 90 * Return an <code>byte</code> array representing this element. 91 * 92 * @return An <code>bytes</code> array representing this element. 93 */ getBytes()94 abstract byte[] getBytes(); 95 } 96 97