oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class, oSheet);
log.println("creating a new environment for object");
TestEnvironment tEnv = new TestEnvironment(oObj);
// do not execute com::sun::star::sheets::XCellSeries::fillAuto()
tEnv.addObjRelation("XCELLSERIES_FILLAUTO", new Boolean(false));
// set the adress ranges of the cells (see values set above): for e.g. XSheetOutline test
tEnv.addObjRelation("CellRangeAddress",
new CellRangeAddress((short)0, 6, 6, 8, 8));
tEnv.addObjRelation("CellRangeSubAddress",
new CellRangeAddress((short)0, 6, 6, 7, 8));
// pick a cell with a formula for XSheetAuditing, a dependent cell and a precedent cell
tEnv.addObjRelation("XSheetAuditing.CellAddress", new CellAddress((short)0, 8, 6));
tEnv.addObjRelation("XSheetAuditing.PrecedentCellAddress", new CellAddress((short)0, 7, 6));
tEnv.addObjRelation("XSheetAuditing.DependentCellAddress", new CellAddress((short)0, 9, 6));
// add an existing sheet for linking
tEnv.addObjRelation("XSheetLinkable.LinkSheet", "ScSheetLinksObj.sdc");
//adding Scenario and with that a ScenarioSheet-Relation for Scenario and XScenarioEnhanced
XScenariosSupplier scene = (XScenariosSupplier) UnoRuntime.queryInterface(
XScenariosSupplier.class,
tEnv.getTestObject());
scene.getScenarios()
.addNewByName("Scenario",
new CellRangeAddress[] {
new CellRangeAddress((short) 0, 0, 0, 10, 10)
}, "Comment");
XSpreadsheet sSheet = null;
try {
sSheet = (XSpreadsheet) UnoRuntime.queryInterface(
XSpreadsheet.class,
xSpreadsheets.getByName("Scenario"));
} catch (com.sun.star.container.NoSuchElementException e) {
log.println("Couldn't get Scenario");
} catch (com.sun.star.lang.WrappedTargetException e) {
log.println("Couldn't get Scenario");
}
tEnv.addObjRelation("ScenarioSheet", sSheet);
log.println("adding ObjRelation 'noArray' to avoid the test" +
" 'XArrayFormulaRange'");
tEnv.addObjRelation("noArray", "ScTableSheetObj");
XPropertySet PropSet = (XPropertySet) UnoRuntime.queryInterface(
XPropertySet.class, oObj);
tEnv.addObjRelation("PropSet", PropSet);
tEnv.addObjRelation("SHEET", oSheet);
// add expected results for the XCellRangesQuery interface test
String[] expectedResults = new String[7];
expectedResults[_XCellRangesQuery.QUERYCOLUMNDIFFERENCES] = "Sheet1.B5;Sheet1.C1";
expectedResults[_XCellRangesQuery.QUERYCONTENTCELLS] = "Sheet1.B5;Sheet1.C1;Sheet1.F6";
expectedResults[_XCellRangesQuery.QUERYEMPTYCELLS] = "Sheet1.A1 ... Sheet1.B1 ... Sheet1.B6 ... Sheet1.C2 ... Sheet1.D1 ... Sheet1.F1 ... Sheet1.F7 ... Sheet1.G1";
expectedResults[_XCellRangesQuery.QUERYFORMULACELLS] = "Sheet1.I7:J7;Sheet1.I9";
expectedResults[_XCellRangesQuery.QUERYINTERSECTION] = "Sheet1.D4";
expectedResults[_XCellRangesQuery.QUERYROWDIFFERENCES] = "Sheet1.A5;Sheet1.C1";
expectedResults[_XCellRangesQuery.QUERYVISIBLECELLS] = "Sheet1.A2";
tEnv.addObjRelation("XCellRangesQuery.EXPECTEDRESULTS",
expectedResults);
// for XFormulaQuery interface test
try {
tEnv.addObjRelation("MAKEENTRYINCELL",
oSheet.getCellByPosition(15, 15));
tEnv.addObjRelation("RANGEINDICES", new int[] { 0, 0 });
tEnv.addObjRelation("EXPECTEDDEPENDENTVALUES",
new int[] { 0, 255, 0, 65535 });
tEnv.addObjRelation("EXPECTEDPRECEDENTVALUES",
new int[] { 0, 255, 0, 65535 });
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
log.println(
"Cannot add the necessary object relation for XFormulaQuery test.");
}
// XSearchable interface test
try {
tEnv.addObjRelation("XSearchable.MAKEENTRYINCELL",
new XCell[] {
oSheet.getCellByPosition(15, 15),
oSheet.getCellByPosition(15, 16)
});
} catch (com.sun.star.lang.IndexOutOfBoundsException e) {
e.printStackTrace((PrintWriter) log);
log.println(
"Cannot make required object relation 'XSearchable.MAKEENTRYINCELL'.");
}
//Adding relation for util.XSortable
final PrintWriter finalLog = log;
final XCellRange oTable = oSheet;
tEnv.addObjRelation("SORTCHECKER",
new ifc.util._XSortable.XSortChecker() {
PrintWriter out = finalLog;
public void setPrintWriter(PrintWriter log) {
out = log;