/** *CreatingaTestEnvironmentfortheinterfacestobetested. *Disposesthespreadsheetdocumentsiftheywerecreatedalready. *Createstwospreadsheetdocuments.Retrievesthecurrentcontrollerfor *eachofthem.Obtainsthecollectionofspreadsheets,takesoneofthem *andtakessomecellfromthespreadsheet.Thecreateddocumentsaretheinstances *oftheservice<code>com.sun.star.sheet.SpreadsheetDocument</code>. *Objectrelationscreated: *<ul> *<li><code>'SELSUPP'</code>for *{@linkifc.frame._XModel}(theinterface *<code>XSelectionSupplier</code>thatwasqueriedfromthecurrent *controllerofthespreadsheet)</li> *<li><code>'TOSELECT'</code>for *{@linkifc.frame._XModel}(thecellthatwasretrievedfromthe *spreadsheet)</li> *<li><code>'CONT2'</code>for *{@linkifc.frame._XModel}(thecurrentcontrollerofthesecond *spreadsheet)</li> *</ul>
*/
@Override protected TestEnvironment createTestEnvironment(TestParameters Param,
PrintWriter log) throws Exception { // creation of the testobject here // first we write what we are intend to do to log file
log.println("creating a test environment");
// get a soffice factory object
SOfficeFactory SOF = SOfficeFactory.getFactory(
Param.getMSF());
log.println("Getting a cell from sheet");
toSel = oSheet.getCellByPosition(2, 3); // create a simple formula for XCalculatable
oSheet.getCellByPosition(4, 5).setValue(15);
oSheet.getCellByPosition(5, 5).setValue(10);
oSheet.getCellByPosition(6, 5).setFormula("= E6 * F6");
xCalculatableCells = new XCell[]{
oSheet.getCellByPosition(4, 5),
oSheet.getCellByPosition(5, 5),
oSheet.getCellByPosition(6, 5)
};
// Make sure there are at least two sheets:
oSheets.insertNewByName("Some Sheet", (short) 1);
log.println("Adding SelectionSupplier and Shape to select for XModel");
tEnv.addObjRelation("SELSUPP", sel);
tEnv.addObjRelation("TOSELECT", toSel);
log.println("Adding cells for XCalculatable");
tEnv.addObjRelation("XCalculatable.Cells", xCalculatableCells);
log.println("adding Controller as ObjRelation for XModel");
tEnv.addObjRelation("CONT2", cont2);
// create object relation for XPrintJobBroadcaster
String fileName = utils.getOfficeTempDirSys(Param.getMSF())+"printfile.prt" ;
File f = new File(fileName); if (f.exists()) { boolean bDeleteOk = f.delete(); if (!bDeleteOk) {
System.out.println("delete failed");
}
}
_XPrintJobBroadcaster.MyPrintJobListener listener = new _XPrintJobBroadcaster.MyPrintJobListener(oObj, fileName);
tEnv.addObjRelation("XPrintJobBroadcaster.XPrintJobListener", listener);
return tEnv;
}
} // finish class ScModelObj
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet am 2026-09-12)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.