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

(-)src/java/org/apache/poi/hssf/model/InternalSheet.java (+4 lines)
Lines 1667-1670 Link Here
1667
        temp.toArray(result);
1667
        temp.toArray(result);
1668
        return result;
1668
        return result;
1669
    }
1669
    }
1670
    
1671
    public int getColumnOutlineLevel(int columnIndex) {
1672
        return _columnInfos.getOutlineLevel(columnIndex);
1673
    }
1670
}
1674
}
(-)src/java/org/apache/poi/hssf/record/aggregates/ColumnInfoRecordsAggregate.java (+8 lines)
Lines 519-523 Link Here
519
			result = Math.max(columnInfoRecord.getOutlineLevel(), result);
519
			result = Math.max(columnInfoRecord.getOutlineLevel(), result);
520
		}
520
		}
521
		return result;
521
		return result;
522
	}	
523
	public int getOutlineLevel(int columnIndex) {
524
	    ColumnInfoRecord ci = findColumnInfo(columnIndex);
525
	    if (ci != null) {
526
            return ci.getOutlineLevel();
527
	    } else {
528
	        return 0;
529
	    }
522
	}
530
	}
523
}
531
}
(-)src/java/org/apache/poi/hssf/usermodel/HSSFRow.java (-2 / +1 lines)
Lines 268-276 Link Here
268
     * Returns the rows outline level. Increased as you
268
     * Returns the rows outline level. Increased as you
269
     *  put it into more groups (outlines), reduced as
269
     *  put it into more groups (outlines), reduced as
270
     *  you take it out of them.
270
     *  you take it out of them.
271
     * TODO - Should this really be public?
272
     */
271
     */
273
    protected int getOutlineLevel() {
272
    public int getOutlineLevel() {
274
        return row.getOutlineLevel();
273
        return row.getOutlineLevel();
275
    }
274
    }
276
275
(-)src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java (-2 / +9 lines)
Lines 2291-2296 Link Here
2291
        }
2291
        }
2292
        return _workbook.getNameRecord(recIndex);
2292
        return _workbook.getNameRecord(recIndex);
2293
    }
2293
    }
2294
2294
    
2295
2295
    /**
2296
     * Returns the column outline level. Increased as you
2297
     *  put it into more groups (outlines), reduced as
2298
     *  you take it out of them.
2299
     */
2300
    public int getColumnOutlineLevel(int columnIndex) {
2301
        return _sheet.getColumnOutlineLevel(columnIndex);
2302
    }
2296
}
2303
}
(-)src/java/org/apache/poi/ss/usermodel/Row.java (+7 lines)
Lines 234-237 Link Here
234
    public static final MissingCellPolicy RETURN_BLANK_AS_NULL = new MissingCellPolicy();
234
    public static final MissingCellPolicy RETURN_BLANK_AS_NULL = new MissingCellPolicy();
235
    /** A new, blank cell is created for missing cells. Blank cells are returned as normal */
235
    /** A new, blank cell is created for missing cells. Blank cells are returned as normal */
236
    public static final MissingCellPolicy CREATE_NULL_AS_BLANK = new MissingCellPolicy();
236
    public static final MissingCellPolicy CREATE_NULL_AS_BLANK = new MissingCellPolicy();
237
    
238
    /**
239
     * Returns the rows outline level. Increased as you
240
     *  put it into more groups (outlines), reduced as
241
     *  you take it out of them.
242
     */
243
    public int getOutlineLevel();
237
}
244
}
(-)src/java/org/apache/poi/ss/usermodel/Sheet.java (-1 / +7 lines)
Lines 1031-1035 Link Here
1031
     *        columns for the Sheet, or null.
1031
     *        columns for the Sheet, or null.
1032
     */
1032
     */
1033
    void setRepeatingColumns(CellRangeAddress columnRangeRef);
1033
    void setRepeatingColumns(CellRangeAddress columnRangeRef);
1034
1034
    
1035
    /**
1036
     * Returns the column outline level. Increased as you
1037
     *  put it into more groups (outlines), reduced as
1038
     *  you take it out of them.
1039
     */
1040
    int getColumnOutlineLevel(int columnIndex);
1035
}
1041
}
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFRow.java (-1 / +1 lines)
Lines 58-64 Link Here
58
        return _height!=-1;
58
        return _height!=-1;
59
    }
59
    }
60
60
61
    int getOutlineLevel(){
61
    public int getOutlineLevel(){
62
        return _outlineLevel;
62
        return _outlineLevel;
63
    }
63
    }
64
    void setOutlineLevel(int level){
64
    void setOutlineLevel(int level){
(-)src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java (+4 lines)
Lines 1457-1460 Link Here
1457
    boolean dispose() {
1457
    boolean dispose() {
1458
        return _writer.dispose();
1458
        return _writer.dispose();
1459
    }
1459
    }
1460
1461
    public int getColumnOutlineLevel(int columnIndex) {
1462
        return _sh.getColumnOutlineLevel(columnIndex);
1463
    }
1460
}
1464
}
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java (+4 lines)
Lines 512-515 Link Here
512
        }
512
        }
513
        setRowNum(rownum);
513
        setRowNum(rownum);
514
    }
514
    }
515
516
    public int getOutlineLevel() {
517
        return _row.getOutlineLevel();
518
    }
515
}
519
}
(-)src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java (+8 lines)
Lines 3686-3689 Link Here
3686
        }
3686
        }
3687
        return tables;
3687
        return tables;
3688
    }
3688
    }
3689
    
3690
    public int getColumnOutlineLevel(int columnIndex) {
3691
        CTCol col = columnHelper.getColumn(columnIndex, false);
3692
        if (col == null) {
3693
            return 0;
3694
        }
3695
        return col.getOutlineLevel();
3696
    }
3689
}
3697
}
(-)src/ooxml/testcases/org/apache/poi/xssf/streaming/TestOutlining.java (+62 lines)
Lines 19-26 Link Here
19
19
20
package org.apache.poi.xssf.streaming;
20
package org.apache.poi.xssf.streaming;
21
21
22
import java.io.IOException;
23
22
import junit.framework.TestCase;
24
import junit.framework.TestCase;
23
25
26
import org.apache.poi.hssf.usermodel.HSSFSheet;
27
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
28
import org.apache.poi.ss.usermodel.Sheet;
29
import org.apache.poi.xssf.usermodel.XSSFSheet;
30
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
31
24
public final class TestOutlining extends TestCase {
32
public final class TestOutlining extends TestCase {
25
	public void testSetRowGroupCollapsed() throws Exception {
33
	public void testSetRowGroupCollapsed() throws Exception {
26
34
Lines 99-102 Link Here
99
		assertNull(r.getHidden());
107
		assertNull(r.getHidden());
100
		wb2.dispose();
108
		wb2.dispose();
101
	}
109
	}
110
	
111
    public void testOutlineGetters() throws IOException {
112
        HSSFWorkbook hssfWorkbook = new HSSFWorkbook();
113
        HSSFSheet hssfSheet = hssfWorkbook.createSheet();
114
        hssfSheet.createRow(0);
115
        hssfSheet.createRow(1);
116
        hssfSheet.createRow(2);
117
        hssfSheet.createRow(3);
118
        hssfSheet.createRow(4);
119
        hssfSheet.groupRow(1, 3);
120
        hssfSheet.groupRow(2, 3);
121
122
        assertEquals(0, hssfSheet.getRow(0).getOutlineLevel());
123
        assertEquals(1, hssfSheet.getRow(1).getOutlineLevel());
124
        assertEquals(2, hssfSheet.getRow(2).getOutlineLevel());
125
        assertEquals(2, hssfSheet.getRow(3).getOutlineLevel());
126
        assertEquals(0, hssfSheet.getRow(4).getOutlineLevel());
127
        hssfWorkbook.close();
128
129
        XSSFWorkbook xssfWorkbook = new XSSFWorkbook();
130
        XSSFSheet xssfSheet = xssfWorkbook.createSheet();
131
        xssfSheet.createRow(0);
132
        xssfSheet.createRow(1);
133
        xssfSheet.createRow(2);
134
        xssfSheet.createRow(3);
135
        xssfSheet.createRow(4);
136
        xssfSheet.groupRow(1, 3);
137
        xssfSheet.groupRow(2, 3);
138
139
        assertEquals(0, xssfSheet.getRow(0).getOutlineLevel());
140
        assertEquals(1, xssfSheet.getRow(1).getOutlineLevel());
141
        assertEquals(2, xssfSheet.getRow(2).getOutlineLevel());
142
        assertEquals(2, xssfSheet.getRow(3).getOutlineLevel());
143
        assertEquals(0, xssfSheet.getRow(4).getOutlineLevel());
144
        xssfWorkbook.close();
145
146
        SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook();
147
        Sheet sxssfSheet = sxssfWorkbook.createSheet();
148
        sxssfSheet.createRow(0);
149
        sxssfSheet.createRow(1);
150
        sxssfSheet.createRow(2);
151
        sxssfSheet.createRow(3);
152
        sxssfSheet.createRow(4);
153
        sxssfSheet.groupRow(1, 3);
154
        sxssfSheet.groupRow(2, 3);
155
156
        assertEquals(0, sxssfSheet.getRow(0).getOutlineLevel());
157
        assertEquals(1, sxssfSheet.getRow(1).getOutlineLevel());
158
        assertEquals(2, sxssfSheet.getRow(2).getOutlineLevel());
159
        assertEquals(2, sxssfSheet.getRow(3).getOutlineLevel());
160
        assertEquals(0, sxssfSheet.getRow(4).getOutlineLevel());
161
        sxssfWorkbook.dispose();
162
        sxssfWorkbook.close();
163
    }
102
}
164
}

Return to bug 46192