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.sxc;
25 
26 import java.io.IOException;
27 import java.util.Vector;
28 
29 /**
30  *  <p>This class is a abstract class for encoding an SXC into an
31  *  alternative spreadsheet format.</p>
32  *
33  *  <p>TODO - Add appropriate exceptions to each of the methods.</p>
34  *
35  *  @author  Mark Murnane
36  */
37 public abstract class SpreadsheetEncoder {
38 
39 
40     /**
41      *  Creates new SpreadsheetEncoder.
42      *
43      *  @param  name      The name of the WorkBook to be created.
44      *  @param  password  An optional password for the WorkBook.
45      *
46      *  @throws  IOException  If any I/O error occurs.
47      */
SpreadsheetEncoder(String name, String password)48     public SpreadsheetEncoder(String name, String password) throws IOException { };
49 
50 
51     /**
52      *  Create a new WorkSheet within the WorkBook.
53      *
54      *  @param  sheetName  The name of the WorkSheet.
55      *
56      *  @throws  IOException  If any I/O error occurs.
57      */
createWorksheet(String sheetName)58     public abstract void createWorksheet(String sheetName) throws IOException;
59 
60 
61     /**
62      *  Set a cell's formatting options via a separately create
63      *  <code>Format</code> object.
64      *
65      *  @param  row     The row number of the cell to be changed
66      *  @param  column  The column number of the cell to be changed
67      *  @param  fmt     Object containing formatting settings for this cell.
68      */
setCellFormat(int row, int column, Format fmt)69     public abstract void setCellFormat(int row, int column, Format fmt);
70 
71 
72     /**
73      *  Add a cell to the current WorkSheet.
74      *
75      *  @param  row           The row number of the cell
76      *  @param  column        The column number of the cell
77      *  @param  fmt           The <code>Format</code> object describing the
78      *                        appearance of this cell.
79      *  @param  cellContents  The text or formula of the cell's contents.
80      */
addCell(int row, int column, Format fmt, String cellContents)81     public abstract void addCell(int row, int column,
82                                  Format fmt, String cellContents) throws IOException;
83 
84 
85     /**
86      *  Get the number of sheets in the WorkBook.
87      *
88      *  @return  The number of sheets in the WorkBook.
89      */
getNumberOfSheets()90     public abstract int getNumberOfSheets();
91 
92 
93     /**
94      *  Get the names of the sheets in the WorkBook.
95      *
96      *  @param  sheet  The required sheet.
97      */
getSheetName(int sheet)98     public abstract String getSheetName(int sheet);
99 
100 
101     /**
102      *  Set the width of the columns in the WorkBook.
103      *
104      *  @param  columnWidths  An <code>IntArrayList</code> of column
105      *                        widths.
106      */
setColumnRows(Vector columnWidths)107     public abstract void setColumnRows(Vector columnWidths) throws IOException;
108 
109     /**
110      */
setNameDefinition(NameDefinition nd)111     public abstract void setNameDefinition(NameDefinition nd) throws IOException;
112 
113     /**
114      */
addSettings(BookSettings s)115     public abstract void addSettings(BookSettings s) throws IOException;
116 }
117 
118