Fix bug #44916 - Allow access to the HSSFPatriarch from HSSFSheet once created

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@948880 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-05-27 16:27:09 +00:00
parent 13bc8e8500
commit a8a9bc2928
3 changed files with 11 additions and 8 deletions

View File

@ -34,6 +34,7 @@
<changes> <changes>
<release version="3.7-SNAPSHOT" date="2010-??-??"> <release version="3.7-SNAPSHOT" date="2010-??-??">
<action dev="POI-DEVELOPERS" type="fix">44916 - Allow access to the HSSFPatriarch from HSSFSheet once created</action>
<action dev="POI-DEVELOPERS" type="add">48779 - Allow you to get straight from a CellStyle to a Color, irrespective of if the Color is indexed or inline-defined</action> <action dev="POI-DEVELOPERS" type="add">48779 - Allow you to get straight from a CellStyle to a Color, irrespective of if the Color is indexed or inline-defined</action>
<action dev="POI-DEVELOPERS" type="add">48924 - Allow access of the HWPF DateAndTime underlying date values</action> <action dev="POI-DEVELOPERS" type="add">48924 - Allow access of the HWPF DateAndTime underlying date values</action>
<action dev="POI-DEVELOPERS" type="add">48926 - Initial support for the HWPF revision marks authors list</action> <action dev="POI-DEVELOPERS" type="add">48926 - Initial support for the HWPF revision marks authors list</action>

View File

@ -95,6 +95,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
private final TreeMap<Integer, HSSFRow> _rows; private final TreeMap<Integer, HSSFRow> _rows;
protected final InternalWorkbook _book; protected final InternalWorkbook _book;
protected final HSSFWorkbook _workbook; protected final HSSFWorkbook _workbook;
private HSSFPatriarch _patriarch;
private int _firstrow; private int _firstrow;
private int _lastrow; private int _lastrow;
@ -1577,11 +1578,11 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
_sheet.aggregateDrawingRecords(_book.getDrawingManager(), true); _sheet.aggregateDrawingRecords(_book.getDrawingManager(), true);
EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid); EscherAggregate agg = (EscherAggregate) _sheet.findFirstRecordBySid(EscherAggregate.sid);
HSSFPatriarch patriarch = new HSSFPatriarch(this, agg); _patriarch = new HSSFPatriarch(this, agg);
agg.clear(); // Initially the behaviour will be to clear out any existing shapes in the sheet when agg.clear(); // Initially the behaviour will be to clear out any existing shapes in the sheet when
// creating a new patriarch. // creating a new patriarch.
agg.setPatriarch(patriarch); agg.setPatriarch(_patriarch);
return patriarch; return _patriarch;
} }
/** /**
@ -1627,11 +1628,13 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
* start from scratch! * start from scratch!
*/ */
public HSSFPatriarch getDrawingPatriarch() { public HSSFPatriarch getDrawingPatriarch() {
if(_patriarch != null) return _patriarch;
EscherAggregate agg = getDrawingEscherAggregate(); EscherAggregate agg = getDrawingEscherAggregate();
if(agg == null) return null; if(agg == null) return null;
HSSFPatriarch patriarch = new HSSFPatriarch(this, agg); _patriarch = new HSSFPatriarch(this, agg);
agg.setPatriarch(patriarch); agg.setPatriarch(_patriarch);
// Have it process the records into high level objects // Have it process the records into high level objects
// as best it can do (this step may eat anything // as best it can do (this step may eat anything
@ -1639,7 +1642,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
agg.convertRecordsToUserModel(); agg.convertRecordsToUserModel();
// Return what we could cope with // Return what we could cope with
return patriarch; return _patriarch;
} }
/** /**

View File

@ -38,8 +38,7 @@ public final class TestHSSFPatriarch extends TestCase {
// assert something more interesting // assert something more interesting
} }
// TODO - fix bug 44916 (1-May-2008) public void test44916() {
public void DISABLED_test44916() {
HSSFWorkbook wb = new HSSFWorkbook(); HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet(); HSSFSheet sheet = wb.createSheet();