View | Details | Raw Unified | Return to bug 45919
Collapse All | Expand All

(-)HSSFSheet.java (-16 / +55 lines)
Line 61 Link Here
61
public final class HSSFSheet {
61
public class HSSFSheet {
Lines 98-99 Link Here
98
     * Creates new HSSFSheet   - called by HSSFWorkbook to create a sheet from
98
     * Creates new HSSFSheet in the given HSSFWorkbook
99
     * scratch.  You should not be calling this from application code (its protected anyhow).
Line 101 Link Here
101
     * @param sheetname - Name of new sheet. If <null> => "Sheet<n>" is used
Line 105 Link Here
105
    protected HSSFSheet(HSSFWorkbook workbook)
105
     public HSSFSheet(HSSFWorkbook p_workbook, String sheetname)
Line 106 Link Here
107
        this.workbook = p_workbook;
108
        this.book = p_workbook.getWorkbook();
109
        if (sheetname != null)
110
          if (book.doesContainsSheetName( sheetname, workbook._sheets.size() ))
111
            throw new IllegalArgumentException( "The workbook already contains a sheet of name " + sheetname );
Lines 108-110 Link Here
108
        rows = new TreeMap();
113
        rows = new TreeMap();   // new ArrayList(INITIAL_CAPACITY);
109
        this.workbook = workbook;
114
        workbook._sheets.add(this);
110
        this.book = workbook.getWorkbook();
115
        workbook.setSheetName(workbook._sheets.size() - 1
116
                             ,sheetname==null ? "Sheet" + (workbook._sheets.size() - 1) 
117
                                              : sheetname);
118
        boolean isOnlySheet = workbook._sheets.size() == 1;
119
        setSelected(isOnlySheet);
120
        setActive(isOnlySheet);
Line 119 Link Here
119
     * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#createSheet()
129
     * @see org.apache.poi.hssf.usermodel.HSSFWorkbook#HSSFWorkbook(DirectoryNode,POIFSFileSystem,boolean)
Line 195 Link Here
206
     * ## Override this in derived classes for custom derived row classes ##
Line 204 Link Here
204
        HSSFRow row = new HSSFRow(workbook, this, rownum);
215
      //   HSSFRow row = new HSSFRow(workbook, this, rownum);
216
      //
217
      //   addRow(row, true);
218
      //   return row;
219
      return new HSSFRow (this, rownum);
220
    }
Lines 206-207 Link Here
206
        addRow(row, true);
222
    /**
207
        return row;
223
     * 
224
     * Second phase of the initialization of a new HSSFRow
225
     * Cannot be done in <initNewRow> because auf necessary intermediate steps
226
     * Could be avoided by giving <addRow> package access, 
227
     * but I didn't want to change that.
228
     * 
229
     * @param newrow the HSSFRow to be added
230
     */
231
    void initNewRow (HSSFRow newrow)
232
    {
233
      addRow(newrow, true);
Line 210 Link Here
237
     * This method is invoked indirectly by all HSSFWorkbook constructors with 
238
     * IO access when a new row must be created.
239
     * ## Override this in derived classes for custom derived row classes ##
240
     * Just pass on the parameters to an HSSFRow-derived-class constructor
241
     * @param pBook - The HSSF Workbook object associated with the row
242
     * @param pSheet - The HSSF Sheet which contains the row
243
     * @param pRow - The low level record from which the row is to be created
244
     * @return a new HSSFRow
245
     */
246
    protected HSSFRow HSSFRowFactory (HSSFWorkbook pBook, HSSFSheet pSheet, RowRecord pRow)
247
    {
248
      return new HSSFRow(pBook, pSheet, pRow);
249
    }
250
    /**
Line 212 Link Here
212
     * USed when reading an existing file
252
     * Used when reading an existing file
Line 216 Link Here
216
Line 219 Link Here
219
        HSSFRow hrow = new HSSFRow(workbook, this, row);
258
        HSSFRow hrow = HSSFRowFactory (workbook, this, row);
Line 1275 Link Here
1275
        sheet.updateFormulasAfterCellShift(shifter, externSheetIndex);
1314
        sheet.getRowsAggregate().updateFormulasAfterRowShift(shifter, externSheetIndex);
Line 1284 Link Here
1284
            otherSheet.updateFormulasAfterCellShift(shifter, otherExtSheetIx);
1323
            otherSheet.getRowsAggregate().updateFormulasAfterRowShift(shifter, otherExtSheetIx);

Return to bug 45919