summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/mod/_sc
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/mod/_sc')
-rw-r--r--qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java220
-rw-r--r--qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java193
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java200
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java208
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java202
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java229
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleDocument.java172
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java242
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java282
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java233
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java208
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java293
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java222
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java168
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java178
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java213
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java152
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java175
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java152
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java150
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java106
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java109
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java158
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java326
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java196
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java167
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java157
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java141
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellObj.java216
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java312
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java264
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java151
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java195
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java172
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScCellsObj.java167
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScChartObj.java289
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScChartsObj.java273
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScConsolidationDescriptor.java116
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java245
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java208
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java371
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java369
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java367
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java396
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java183
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java414
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java402
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java355
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java195
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java258
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java154
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java90
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java162
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScDrawPagesObj.java135
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java159
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java118
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java130
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java241
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java221
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java190
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java228
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java278
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java149
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java138
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java131
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java187
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java165
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java408
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java166
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java134
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java113
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java126
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java133
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java145
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java167
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java148
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java116
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetsEnumeration.java97
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java141
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java105
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java238
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java129
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java207
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java128
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java166
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java154
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java147
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScModelObj.java232
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java177
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java178
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java133
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScScenariosObj.java174
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScShapeObj.java117
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java193
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java167
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java151
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java84
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettingsObj.java110
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScStyleFamiliesObj.java121
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java216
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScStyleObj.java270
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java154
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java169
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTabViewObj.java283
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java176
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java153
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java230
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java208
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableRowObj.java161
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java148
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java421
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableSheetsObj.java171
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java164
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java145
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java139
-rw-r--r--qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java209
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLContentExporter.java216
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLContentImporter.java198
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLExporter.java224
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLImporter.java195
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java205
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java197
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java206
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java219
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java211
-rw-r--r--qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java215
-rw-r--r--qadevOOo/tests/java/mod/_sc/package.html6
127 files changed, 24760 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java
new file mode 100644
index 000000000000..b7018b7691f7
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_HeaderFooter.java
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleEditableText;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+
+public class AccessibleEditableTextPara_HeaderFooter extends TestCase {
+ protected static XComponent xCalcDoc = null;
+ protected static XMultiServiceFactory msf = null;
+ protected static XAccessibleAction action = null;
+
+ protected TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XAccessibleContext oObj = null;
+ Object toolkit = null;
+
+ try {
+ toolkit = msf.createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, toolkit);
+
+ util.utils.shortWait(Param.getInt("ShortWait"));
+
+ DiagThread psDiag = new DiagThread(xCalcDoc, msf);
+ psDiag.start();
+
+ util.utils.shortWait(Param.getInt("ShortWait")*5);
+
+ Object atw = tk.getActiveTopWindow();
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ atw);
+
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+
+ util.utils.shortWait(Param.getInt("ShortWait"));
+
+ AccessibilityTools.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ XAccessibleContext ok_button = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.PUSH_BUTTON,
+ "Cancel");
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PARAGRAPH);
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+ log.println("AccessibleName " + oObj.getAccessibleName());
+ log.println("ParentDescription " +
+ oObj.getAccessibleParent().getAccessibleContext()
+ .getAccessibleDescription());
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ action = (XAccessibleAction) UnoRuntime.queryInterface(
+ XAccessibleAction.class, ok_button);
+
+ XAccessibleText text = (XAccessibleText) UnoRuntime.queryInterface(
+ XAccessibleText.class, oObj);
+
+ XAccessibleEditableText eText = (XAccessibleEditableText) UnoRuntime.queryInterface(
+ XAccessibleEditableText.class,
+ oObj);
+
+ eText.setText("LEFT");
+
+ tEnv.addObjRelation("XAccessibleText.Text", text.getText());
+
+ tEnv.addObjRelation("Destroy", "AccessibleEditableTextPara_PreviewCell");
+
+ final XAccessibleEditableText editText = eText;
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ editText.setText("LEFT_EVENT");
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Closes the dialog using accessible button 'OK' found in
+ * <code>createTestEnvironment()</code>.
+ */
+ protected void cleanup(TestParameters Param, PrintWriter log) {
+ log.println(" disposing xCalcDoc ");
+
+ try {
+ action.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ioe) {
+ log.println("Couldn't close dialog");
+ } catch (com.sun.star.lang.DisposedException de) {
+ log.println("Dialog already disposed");
+ }
+
+ util.DesktopTools.closeDoc(xCalcDoc);
+ }
+
+ /**
+ * Opens new writer document.
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ msf = (XMultiServiceFactory) Param.getMSF();
+
+ try {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(msf);
+ xCalcDoc = (XComponent) UnoRuntime.queryInterface(XComponent.class,
+ SOF.createCalcDoc(
+ null));
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Can't create document", e);
+ }
+ }
+
+
+ /**
+ * Thread for opening modal dialog 'Print Settings'.
+ */
+ public class DiagThread extends Thread {
+ public XComponent xCalcDoc = null;
+ public XMultiServiceFactory msf = null;
+
+ public DiagThread(XComponent xCalcDoc, XMultiServiceFactory msf) {
+ this.xCalcDoc = xCalcDoc;
+ this.msf = msf;
+ }
+
+ public void run() {
+ XModel aModel = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xCalcDoc);
+
+ XController xController = aModel.getCurrentController();
+
+ //Opening HeaderFooterDialog
+ try {
+ String aSlotID = ".uno:EditHeaderAndFooter";
+ XDispatchProvider xDispProv = (XDispatchProvider) UnoRuntime.queryInterface(
+ XDispatchProvider.class,
+ xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(
+ XURLTransformer.class,
+ msf.createInstance(
+ "com.sun.star.util.URLTransformer"));
+
+ // Because it's an in/out parameter
+ // we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = aSlotID;
+ xParser.parseStrict(aParseURL);
+
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+
+ if (xDispatcher != null) {
+ xDispatcher.dispatch(aURL, null);
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't open dialog");
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java
new file mode 100644
index 000000000000..4e0276304743
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/AccessibleEditableTextPara_PreviewCell.java
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+
+public class AccessibleEditableTextPara_PreviewCell extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Obtains the accessible object for a one of cell in preview mode.
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XAccessibleContext oObj = null;
+ XCell xCell = null;
+
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ log.println("Getting a cell from sheet") ;
+ xCell = oSheet.getCellByPosition(0, 0);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+ xCell.setFormula("Value");
+
+ XModel xModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSheetDoc);
+
+ XController xController = xModel.getCurrentController();
+
+ //switch to 'Print Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ( (XMultiServiceFactory) Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+ if(xDispatcher != null)
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ shortWait();
+
+
+ XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), xModel);
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+ //AccessibilityTools.printAccessibleTree(log,xRoot);
+ AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE_CELL,true);
+
+ xRoot = AccessibilityTools.SearchedAccessible;
+
+ //AccessibilityTools.printAccessibleTree(log,xRoot);
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot,AccessibleRole.PARAGRAPH);
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+ log.println("AccessibleName " + oObj.getAccessibleName());
+ log.println("Parent " + utils.getImplName(oObj.getAccessibleParent()));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("EditOnly", "AccessibleEditableTextPara_PreviewCell");
+ tEnv.addObjRelation("Destroy", "AccessibleEditableTextPara_PreviewCell");
+
+ final XCell cell_to_change = xCell;
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ cell_to_change.setFormula("NewString");
+ }
+ });
+
+ return tEnv;
+ }
+
+ protected void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java
new file mode 100644
index 000000000000..c295e7197eb1
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCell.java
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by accessible component of
+ * a cell in the spreadsheet. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleSelection</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleTable</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleTable
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.n.star.accessibility._XAccessibleSelection
+ * @see ifc.n.star.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.n.star.accessibility._XAccessibleComponent
+ * @see ifc.n.star.accessibility._XAccessibleTable
+ * @see ifc.n.star.accessibility._XAccessibleContext
+ */
+public class ScAccessibleCell extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code>
+ * with an object to test and related objects.
+ * Switchs the document to Print Preview mode.
+ * Obtains accissible object for the page view.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+
+ XInterface oObj = null;
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+
+ XWindow xWindow = AccessibilityTools.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), aModel);
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.TABLE_CELL, "B1");
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ // relation for XAccessibleEventBroadcaster
+ XCell xCell = null;
+ final String text = "XAccessibleText";
+ try {
+ XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ throw new StatusException("couldn't get sheet",iae);
+ }
+ xCell = oSheet.getCellByPosition(1, 0) ;
+ xCell.setFormula(text);
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, oSheet);
+ XTableColumns oColumns = (XTableColumns) oColumnRowRange.getColumns();
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oColumns);
+ XPropertySet column = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class,oIndexAccess.getByIndex(1));
+ column.setPropertyValue("OptimalWidth", new Boolean(true));
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ }
+
+ tEnv.addObjRelation("EditOnly",
+ "This method is only supported if the Cell is in edit mode");
+
+ final XCell fCell = xCell ;
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ fCell.setFormula("firing event");
+ fCell.setFormula(text);
+ }
+ });
+
+ tEnv.addObjRelation("XAccessibleText.Text", text);
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java
new file mode 100644
index 000000000000..3a18fce51185
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvCell.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScAccessibleCsvCell extends TestCase {
+
+ Thread lThread = null;
+ static XAccessibleAction accAction = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+ XInterface oObj = null;
+
+ shortWait();
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)tParam.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit") ;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,oObj);
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow());
+
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+
+ AccessibilityTools.printAccessibleTree(log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ oObj = AccessibilityTools.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.PUSH_BUTTON, "Cancel");
+
+ accAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class, oObj);
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.TABLE, true);
+
+ //util.dbg.printInterfaces(oObj);
+
+ XAccessibleContext cont = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
+
+ String name = "";
+ try {
+ XAccessible acc = cont.getAccessibleChild(3);
+ name = acc.getAccessibleContext().getAccessibleName();
+ log.println("Child: "+ name);
+ log.println("ImplementationName " + utils.getImplName(acc));
+ oObj = acc;
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e) {}
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EditOnly",
+ "This method isn't supported in this dialog");
+
+ tEnv.addObjRelation("XAccessibleText.Text", name);
+
+ return tEnv;
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " closing Dialog " );
+ try {
+ accAction.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException iae) {
+ log.println("Couldn't close dialog");
+ }
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ log.println("opening dialog");
+
+ PropertyValue[] args = new PropertyValue[1];
+ try {
+ args[0] = new PropertyValue();
+ args[0].Name = "InteractionHandler";
+ args[0].Value = ((XMultiServiceFactory)Param.getMSF()).createInstance(
+ "com.sun.star.comp.uui.UUIInteractionHandler");
+ } catch(com.sun.star.uno.Exception e) {
+ }
+
+ lThread = new loadThread(SOF, args);
+ lThread.start();
+ shortWait();
+ }
+
+ /**
+ * Sleeps for 2 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(2000) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ public class loadThread extends Thread {
+
+ private SOfficeFactory SOF = null ;
+ private PropertyValue[] args = null;
+ public XComponent xSpreadSheedDoc = null;
+
+ public loadThread(SOfficeFactory SOF, PropertyValue[] Args) {
+ this.SOF = SOF;
+ this.args = Args;
+ }
+
+ public void run() {
+ try {
+ String url= utils.getFullTestURL("10test.csv");
+ log.println("loading "+url);
+ SOF.loadDocument(url,args);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+ }
+
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java
new file mode 100644
index 000000000000..15c81df729af
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvGrid.java
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScAccessibleCsvGrid extends TestCase {
+
+ Thread lThread = null;
+ static XAccessibleAction accAction = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ shortWait();
+
+ try {
+ oObj = (XInterface) ((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.awt.Toolkit") ;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e );
+ }
+
+
+ XExtendedToolkit tk = (XExtendedToolkit)
+ UnoRuntime.queryInterface(XExtendedToolkit.class,oObj);
+
+
+ XWindow xWindow = (XWindow)
+ UnoRuntime.queryInterface(XWindow.class,tk.getActiveTopWindow());
+
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.PUSH_BUTTON, "Cancel");
+
+ accAction = (XAccessibleAction) UnoRuntime.queryInterface(XAccessibleAction.class, oObj);
+
+ /*int count = accAction.getAccessibleActionCount();
+
+ for (int i = 0; i<count; i++) {
+ try {
+ System.out.println(i+": "+accAction.getAccessibleActionDescription(i));
+ } catch (com.sun.star.lang.IndexOutOfBoundsException iae) {}
+ }*/
+
+ //util.dbg.printInterfaces(oObj);
+
+ //AccessibilityTools.printAccessibleTree(log, xRoot);
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.TABLE, true);
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " closing Dialog " );
+ try {
+ accAction.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException iae) {
+ log.println("Couldn't close dialog");
+ }
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ log.println("opening dialog");
+
+ PropertyValue[] args = new PropertyValue[1];
+ try {
+ args[0] = new PropertyValue();
+ args[0].Name = "InteractionHandler";
+ args[0].Value = ((XMultiServiceFactory)Param.getMSF()).createInstance(
+ "com.sun.star.comp.uui.UUIInteractionHandler");
+ } catch(com.sun.star.uno.Exception e) {
+ }
+
+ lThread = new loadThread(SOF, args);
+ lThread.start();
+ shortWait();
+
+ }
+
+ /**
+ * Sleeps for 2 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(2000) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ public class loadThread extends Thread {
+
+ private SOfficeFactory SOF = null ;
+ private PropertyValue[] args = null;
+ public XComponent xSpreadSheedDoc = null;
+
+ public loadThread(SOfficeFactory SOF, PropertyValue[] Args) {
+ this.SOF = SOF;
+ this.args = Args;
+ }
+
+ public void run() {
+ try {
+ String url= utils.getFullTestURL("10test.csv");
+ log.println("loading "+url);
+ SOF.loadDocument(url,args);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java
new file mode 100644
index 000000000000..08b7b85b0fdb
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleCsvRuler.java
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleText;
+import com.sun.star.awt.XExtendedToolkit;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScAccessibleCsvRuler extends TestCase {
+
+ Thread lThread = null;
+ static XAccessibleAction accAction = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code> with an
+ * object to test and related objects. Subclasses should implement this
+ * method to provide the implementation and related objects. The method is
+ * called from <code>getTestEnvironment()</code>.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+ shortWait();
+
+ XMultiServiceFactory msf = (XMultiServiceFactory) Param.getMSF();
+
+ try {
+ oObj = (XInterface) msf.createInstance("com.sun.star.awt.Toolkit");
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't get toolkit");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get toolkit", e);
+ }
+
+ XExtendedToolkit tk = (XExtendedToolkit) UnoRuntime.queryInterface(
+ XExtendedToolkit.class, oObj);
+
+ XWindow xWindow = (XWindow) UnoRuntime.queryInterface(XWindow.class,
+ tk.getActiveTopWindow());
+
+ XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);
+
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.PUSH_BUTTON,
+ "Cancel");
+
+ accAction = (XAccessibleAction) UnoRuntime.queryInterface(
+ XAccessibleAction.class, oObj);
+
+ XAccessibleContext acc = AccessibilityTools.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.RADIO_BUTTON);
+
+ log.println("Click on: " + acc.getAccessibleName());
+
+ XAccessibleAction accAction2 = (XAccessibleAction) UnoRuntime.queryInterface(
+ XAccessibleAction.class, acc);
+
+ try {
+ accAction2.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException iae) {
+ }
+
+
+ //util.dbg.printInterfaces(oObj);
+ AccessibilityTools.printAccessibleTree(log, xRoot);
+ oObj = AccessibilityTools.getAccessibleObjectForRole(xRoot, AccessibleRole.TEXT,
+ "Ruler", true);
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EditOnly",
+ "This method isn't supported in this dialog");
+
+ XAccessibleText text = (XAccessibleText) UnoRuntime.queryInterface(
+ XAccessibleText.class, oObj);
+
+ int lastone = 100;
+
+ for (int i = 0; i < 1000; i++) {
+ try {
+ text.getCharacterBounds(i);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ lastone = i - 1;
+
+ break;
+ }
+ }
+
+ tEnv.addObjRelation("LimitedBounds", new Integer(lastone));
+ tEnv.addObjRelation("PreviousUsed",new int[]{11,22,33,44,55,66,77,88,99});
+
+ return tEnv;
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+/* log.println( " closing Dialog " );
+ try {
+ accAction.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException iae) {
+ log.println("Couldn't close dialog");
+ } */
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ log.println("opening dialog");
+
+ PropertyValue[] args = new PropertyValue[1];
+ try {
+ args[0] = new PropertyValue();
+ args[0].Name = "InteractionHandler";
+ args[0].Value = ((XMultiServiceFactory)Param.getMSF()).createInstance(
+ "com.sun.star.comp.uui.UUIInteractionHandler");
+ } catch(com.sun.star.uno.Exception e) {
+ }
+
+ lThread = new loadThread(SOF, args);
+ lThread.start();
+ shortWait();
+
+ }
+
+ /**
+ * Sleeps for 2 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(2000) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+ public class loadThread extends Thread {
+
+ private SOfficeFactory SOF = null ;
+ private PropertyValue[] args = null;
+ public XComponent xSpreadSheedDoc = null;
+
+ public loadThread(SOfficeFactory SOF, PropertyValue[] Args) {
+ this.SOF = SOF;
+ this.args = Args;
+ }
+
+ public void run() {
+ try {
+ String url= utils.getFullTestURL("10test.csv");
+ log.println("loading "+url);
+ SOF.loadDocument(url,args);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleDocument.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleDocument.java
new file mode 100644
index 000000000000..fd930eedaf01
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleDocument.java
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.XWindow;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+/**
+ * Test for object which is represented by accessible component of
+ * a spreadsheet document.
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleEventBroadcaster</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleSelection</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility.XAccessibleEventBroadcaster
+ * @see ifc.accessibility.XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleContext
+ */
+public class ScAccessibleDocument extends TestCase {
+
+ static XComponent xSpreadsheetDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code>
+ * with an object to test and related objects.
+ * Obtains accissible object for the spreadsheet document.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpages" );
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow((XMultiServiceFactory)Param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.DOCUMENT, "");
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ final XWindow xDocWin = xWindow;
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ Rectangle rect = xDocWin.getPosSize();
+ xDocWin.setPosSize(rect.X,rect.Y,rect.Height,rect.Width-10,com.sun.star.awt.PosSize.POSSIZE);
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " disposing xSheetDoc " );
+ util.DesktopTools.closeDoc(xSpreadsheetDoc);
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ String url = utils.getFullTestURL("calcshapes.sxc");
+ log.println("loading document "+url);
+ xSpreadsheetDoc = SOF.loadDocument(url);
+ shortWait();
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.sleep(500) ;
+ } catch (InterruptedException e) {
+ log.println("While waiting :" + e) ;
+ }
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java
new file mode 100644
index 000000000000..ff6328dc1b92
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleDocumentPagePreview.java
@@ -0,0 +1,242 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.Rectangle;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+/**
+ * Test for object which is represented by accessible component of
+ * a spreadsheet page in 'Page Preview' mode.
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.n.star.accessibility._XAccessibleComponent
+ * @see ifc.n.star.accessibility._XAccessibleContext
+ */
+public class ScAccessibleDocumentPagePreview extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code>
+ * with an object to test and related objects.
+ * Switchs the document to Print Preview mode.
+ * Obtains accissible object for the page view.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // inserting some content to have non-empty page preview
+ XCell xCell = null;
+ try {
+ XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(1));
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ throw new StatusException("couldn't get sheet",iae);
+ }
+ xCell = oSheet.getCellByPosition(0, 0) ;
+ xCell.setFormula("ScAccessibleDocumentPagePreview - Page 2");
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(2));
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ throw new StatusException("couldn't get sheet",iae);
+ }
+ xCell = oSheet.getCellByPosition(0, 0) ;
+ xCell.setFormula("ScAccessibleDocumentPagePreview - Page 3");
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ throw new StatusException("couldn't get sheet",iae);
+ }
+ xCell = oSheet.getCellByPosition(0, 0) ;
+ xCell.setFormula("ScAccessibleDocumentPagePreview");
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+
+ XController xController = aModel.getCurrentController();
+
+ // switching to 'Page Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+ if(xDispatcher != null)
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException ex) {}
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentContainerWindow((XMultiServiceFactory)Param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ oObj = at.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.DOCUMENT, "");
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ XDesktop desk = (XDesktop) UnoRuntime.queryInterface(
+ XDesktop.class,util.DesktopTools.createDesktop((XMultiServiceFactory)Param.getMSF()));
+ final XWindow win = desk.getCurrentFrame().getComponentWindow();
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ Rectangle rec = win.getPosSize();
+ win.setPosSize(rec.X,rec.Y,rec.Height-10,rec.Width, com.sun.star.awt.PosSize.POSSIZE);
+ win.setPosSize(rec.X,rec.Y,rec.Height,rec.Width,com.sun.star.awt.PosSize.POSSIZE );
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ String url = utils.getFullTestURL("calcshapes.sxc");
+ log.println("loading document "+url);
+ xSpreadsheetDoc = (XSpreadsheetDocument)UnoRuntime.queryInterface(
+ XSpreadsheetDocument.class,SOF.loadDocument(url));
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException ex) {}
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java
new file mode 100644
index 000000000000..599f8a097ad6
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeader.java
@@ -0,0 +1,282 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XHeaderFooterContent;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.table.XCell;
+import com.sun.star.text.XText;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XURLTransformer;
+
+/**
+ * Test for object which is represented by accessible component of
+ * a printed header in 'Page Preview' mode.
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.n.star.accessibility._XAccessibleComponent
+ * @see ifc.n.star.accessibility._XAccessibleContext
+ */
+public class ScAccessiblePageHeader extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code>
+ * with an object to test and related objects.
+ * Switchs the document to Print Preview mode.
+ * Obtains accissible object for the page view.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // inserting some content to have non-empty page preview
+ XCell xCell = null;
+ try {
+ XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ throw new StatusException("couldn't get sheet",iae);
+ }
+ xCell = oSheet.getCellByPosition(0, 0) ;
+ xCell.setFormula("ScAccessiblePageHeader");
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+
+ XController xController = aModel.getCurrentController();
+
+ // switching to 'Page Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ( (XMultiServiceFactory) Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+ if(xDispatcher != null)
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException ex) {}
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.HEADER, "");
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class,
+ xSpreadsheetDoc );
+ XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
+ XStyle StdStyle = null;
+
+ try{
+ XNameAccess PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),
+ StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class), PageStyles.getByName("Default"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ throw new StatusException("Couldn't convert any", iae);
+ }
+
+ //get the property-set
+ final XPropertySet PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
+
+ XHeaderFooterContent RPHC = null;
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ }
+
+ final XHeaderFooterContent RPHC2 = RPHC;
+
+ final XText center = RPHC2.getCenterText();
+ final XText left = RPHC2.getLeftText();
+ final XText right = RPHC2.getRightText();
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ center.setString("CENTER");
+ left.setString("LEFT");
+ right.setString("RIGHT");
+ try {
+ PropSet.setPropertyValue("RightPageHeaderContent",RPHC2);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ } catch (com.sun.star.lang.WrappedTargetException e) {}
+ }
+ });
+
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " disposing xSheetDoc " );
+ try {
+ XCloseable oComp = (XCloseable)
+ UnoRuntime.queryInterface (XCloseable.class, xSpreadsheetDoc) ;
+ oComp.close(true);
+ } catch(com.sun.star.util.CloseVetoException e) {
+ log.println("Couldn't close document: "+e.getMessage());
+ }
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java
new file mode 100644
index 000000000000..3e387afeb8d3
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePageHeaderArea.java
@@ -0,0 +1,233 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.accessibility.XAccessibleStateSet;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XURLTransformer;
+
+/**
+ * Test for object which is represented by accessible component of
+ * a printed header in 'Page Preview' mode.
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code></li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see ifc.n.star.accessibility._XAccessibleComponent
+ * @see ifc.n.star.accessibility._XAccessibleContext
+ */
+public class ScAccessiblePageHeaderArea extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Called to create an instance of <code>TestEnvironment</code>
+ * with an object to test and related objects.
+ * Switchs the document to Print Preview mode.
+ * Obtains accissible object for the page view.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see TestEnvironment
+ * @see #getTestEnvironment()
+ */
+ protected TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // inserting some content to have non-empty page preview
+ XCell xCell = null;
+ try {
+ XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ xCell = oSheet.getCellByPosition(0, 0) ;
+ xCell.setFormula("ScAccessiblePageHeaderArea");
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ }
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+
+ XController xController = aModel.getCurrentController();
+
+ // switching to 'Page Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ( (XMultiServiceFactory) Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+ if(xDispatcher != null)
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException ex) {}
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentContainerWindow( (XMultiServiceFactory) Param.getMSF(), aModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ try {
+ oObj = at.getAccessibleObjectForRole
+ (xRoot, AccessibleRole.HEADER, "").getAccessibleChild(0);
+ XAccessibleContext cont = (XAccessibleContext)
+ UnoRuntime.queryInterface(XAccessibleContext.class, oObj);
+ XAccessibleStateSet StateSet = cont.getAccessibleStateSet();
+ if (StateSet.contains((short)27)) {
+ log.println("Object is transient");
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException iabe) {
+ throw new StatusException("Couldn't find needed Child",iabe);
+ }
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+ at.printAccessibleTree(log, xRoot, Param.getBool(util.PropertyName.DEBUG_IS_ACTIVE));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ XAccessibleContext zoomIn =
+ at.getAccessibleObjectForRole(xRoot,AccessibleRole.PUSH_BUTTON, "Zoom In");
+
+ final XAccessibleAction pressZoom = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, zoomIn);
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ try {
+ pressZoom.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ibe) {}
+ }
+ });
+
+ return tEnv;
+
+ }
+
+ /**
+ * Called while disposing a <code>TestEnvironment</code>.
+ * Disposes calc document.
+ * @param tParam test parameters
+ * @param tEnv the environment to cleanup
+ * @param log writer to log information while testing
+ */
+ protected void cleanup( TestParameters Param, PrintWriter log) {
+ log.println( " disposing xSheetDoc " );
+ try {
+ XCloseable oComp = (XCloseable)
+ UnoRuntime.queryInterface (XCloseable.class, xSpreadsheetDoc) ;
+ oComp.close(true);
+ }catch(com.sun.star.util.CloseVetoException e) {
+ log.println("Couldn't close document: "+e.getMessage());
+ }
+ }
+
+ /**
+ * Called while the <code>TestCase</code> initialization. In the
+ * implementation does nothing. Subclasses can override to initialize
+ * objects shared among all <code>TestEnvironment</code>s.
+ *
+ * @param tParam test parameters
+ * @param log writer to log information while testing
+ *
+ * @see #initializeTestCase()
+ */
+ protected void initialize(TestParameters Param, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java
new file mode 100644
index 000000000000..d6f93c401c77
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewCell.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+/**
+ * Object implements the following interfaces:
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleSelection
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleValue</code>
+ * </li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </code></li>
+ * </ul>
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleValue
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleTable
+ */
+public class ScAccessiblePreviewCell extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Obtains the accessible object for a one of cell in preview mode.
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XCell xCell = null;
+
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ log.println("Getting a cell from sheet") ;
+ xCell = oSheet.getCellByPosition(0, 0);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+ xCell.setFormula("Value");
+
+ XModel xModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSheetDoc);
+
+ XController xController = xModel.getCurrentController();
+
+ //switch to 'Print Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+ if(xDispatcher != null)
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ shortWait();
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow((XMultiServiceFactory)Param.getMSF(), xModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE_CELL, true);
+
+ oObj = AccessibilityTools.SearchedContext;
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ System.out.println("Fire Event");
+ }
+ });
+
+ return tEnv;
+ }
+
+ protected void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java
new file mode 100644
index 000000000000..d57690852dc9
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewHeaderCell.java
@@ -0,0 +1,293 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XCloseable;
+import com.sun.star.util.XURLTransformer;
+
+
+/**
+ * Object implements the following interfaces:
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleSelection
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleValue</code>
+ * </li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </code></li>
+ * </ul>
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleValue
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleTable
+ */
+public class ScAccessiblePreviewHeaderCell extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ if (xSheetDoc != null) {
+ try {
+ XCloseable oComp = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, xSheetDoc);
+ oComp.close(true);
+ xSheetDoc = null;
+ } catch (com.sun.star.util.CloseVetoException e) {
+ e.printStackTrace(log);
+ } catch (com.sun.star.lang.DisposedException e) {
+ log.println("document already disposed");
+ xSheetDoc = null;
+ }
+ }
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Sets a value of the cell 'A1'. Sets the property 'PrintHeaders'
+ * of the style 'Default' of the family 'PageStyles' to true.
+ * Switchs the document to preview mode and then obtains the
+ * accessible object for the header cell.
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+ if (xSheetDoc != null) {
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) Param.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+
+ XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xSheetDoc);
+
+ XController xController = xModel.getCurrentController();
+
+ //setting value of cell A1
+ XCell xCell = null;
+
+ try {
+ log.println("Getting spreadsheet");
+
+ XSpreadsheets oSheets = xSheetDoc.getSheets();
+ XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexSheets.getByIndex(0));
+
+ log.println("Getting a cell from sheet");
+ xCell = oSheet.getCellByPosition(0, 0);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+ xCell.setFormula("Value");
+
+ //setting property 'PrintHeaders' of the style 'Default'
+ XStyleFamiliesSupplier xSFS = (XStyleFamiliesSupplier) UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class,
+ xSheetDoc);
+ XNameAccess xNA = xSFS.getStyleFamilies();
+ XPropertySet xPropSet = null;
+
+ try {
+ Object oPageStyles = xNA.getByName("PageStyles");
+ xNA = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
+ oPageStyles);
+
+ Object oDefStyle = xNA.getByName("Default");
+ xPropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oDefStyle);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't get element"));
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed("Couldn't get element"));
+ }
+
+ try {
+ xPropSet.setPropertyValue("PrintHeaders", new Boolean(true));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(
+ "Couldn't set property 'PrintHeaders'"));
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(
+ "Couldn't set property 'PrintHeaders'"));
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(
+ "Couldn't set property 'PrintHeaders'"));
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException(Status.failed(
+ "Couldn't set property 'PrintHeaders'"));
+ }
+
+ //switching to 'Print Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider) UnoRuntime.queryInterface(
+ XDispatchProvider.class,
+ xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer) UnoRuntime.queryInterface(
+ XURLTransformer.class,
+ ( (XMultiServiceFactory) Param.getMSF())
+ .createInstance("com.sun.star.util.URLTransformer"));
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+
+ if (xDispatcher != null) {
+ xDispatcher.dispatch(aURL, null);
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ shortWait();
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow( (XMultiServiceFactory) Param.getMSF(), xModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ oObj = at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE, "A");
+
+ if (oObj == null) {
+ log.println("Version with a fixed #103863#");
+ oObj = at.getAccessibleObjectForRole(xRoot,
+ AccessibleRole.TABLE_CELL,
+ true);
+ }
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ }
+ });
+
+ return tEnv;
+ }
+
+ /**
+ * Sleeps for 0.5 sec. to allow StarOffice to react on <code>
+ * reset</code> call.
+ */
+ private void shortWait() {
+ try {
+ Thread.currentThread().sleep(500);
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java
new file mode 100644
index 000000000000..2c7271f50e86
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessiblePreviewTable.java
@@ -0,0 +1,222 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.Status;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.accessibility.XAccessibleAction;
+import com.sun.star.accessibility.XAccessibleContext;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+import util.PropertyName;
+
+/**
+ * Object implements the following interfaces:
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleSelection
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleTable</code>
+ * </li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleEventBroadcaster
+ * </code></li>
+ * </ul>
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleTable
+ * @see com.sun.star.accessibility.XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleEventBroadcaster
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleTable
+ */
+public class ScAccessiblePreviewTable extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Obtains the accessible object for a table in preview mode.
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XCell xCell = null;
+
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ log.println("Getting a cell from sheet") ;
+ xCell = oSheet.getCellByPosition(0, 0);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+ xCell.setFormula("Value");
+
+ XModel xModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSheetDoc);
+
+ XController xController = xModel.getCurrentController();
+
+ //switch to 'Print Preview' mode
+ try {
+ XDispatchProvider xDispProv = (XDispatchProvider)
+ UnoRuntime.queryInterface(XDispatchProvider.class, xController);
+ XURLTransformer xParser = (com.sun.star.util.XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ ((XMultiServiceFactory)Param.getMSF()).createInstance("com.sun.star.util.URLTransformer"));
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = ".uno:PrintPreview";
+ xParser.parseStrict(aParseURL);
+ URL aURL = aParseURL[0];
+ XDispatch xDispatcher = xDispProv.queryDispatch(aURL, "", 0);
+ if(xDispatcher != null)
+ xDispatcher.dispatch( aURL, null );
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Couldn't change mode");
+ throw new StatusException(Status.failed("Couldn't change mode"));
+ }
+
+ shortWait();
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentContainerWindow((XMultiServiceFactory)Param.getMSF(), xModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.printAccessibleTree(log,xRoot, Param.getBool(PropertyName.DEBUG_IS_ACTIVE));
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE);
+
+ oObj = AccessibilityTools.SearchedContext;
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ XAccessibleContext zoomIn =
+ at.getAccessibleObjectForRole(xRoot,AccessibleRole.PUSH_BUTTON, "Zoom In");
+
+ log.println("Getting "+ zoomIn.getAccessibleName());
+
+ final XAccessibleAction pressZoom = (XAccessibleAction)
+ UnoRuntime.queryInterface(XAccessibleAction.class, zoomIn);
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {
+ public void fireEvent() {
+ try {
+ pressZoom.doAccessibleAction(0);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ibe) {}
+ }
+ });
+
+ return tEnv;
+ }
+
+ protected void shortWait() {
+ try {
+ Thread.sleep(1000) ;
+ } catch (InterruptedException e) {
+ System.out.println("While waiting :" + e);
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java b/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java
new file mode 100644
index 000000000000..0d5fd6c1bb86
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAccessibleSpreadsheet.java
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.AccessibilityTools;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.accessibility.AccessibleRole;
+import com.sun.star.accessibility.XAccessible;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for accessible object of spreadsheet document.<p>
+ * Object implements the following interfaces:
+ * <ul>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleComponent</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleContext</code>
+ * </li>
+ * <li> <code>::com::sun::star::accessibility::XAccessibleSelection
+ * </code></li>
+ * <li><code>::com::sun::star::accessibility::XAccessibleTable</code>
+ * </li>
+ * </ul>
+ * @see com.sun.star.accessibility.XAccessibleComponent
+ * @see com.sun.star.accessibility.XAccessibleContext
+ * @see com.sun.star.accessibility.XAccessibleSelection
+ * @see com.sun.star.accessibility.XAccessibleTable
+ * @see ifc.accessibility._XAccessibleComponent
+ * @see ifc.accessibility._XAccessibleContext
+ * @see ifc.accessibility._XAccessibleSelection
+ * @see ifc.accessibility._XAccessibleTable
+ */
+public class ScAccessibleSpreadsheet extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Obtains the accessible object for the spreadsheet.
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ ( TestParameters Param, PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+
+ XModel xModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSheetDoc);
+
+ AccessibilityTools at = new AccessibilityTools();
+
+ XWindow xWindow = at.getCurrentWindow((XMultiServiceFactory)Param.getMSF(), xModel);
+ XAccessible xRoot = at.getAccessibleObject(xWindow);
+
+ at.getAccessibleObjectForRole(xRoot, AccessibleRole.TABLE );
+
+ oObj = AccessibilityTools.SearchedContext;
+
+ log.println("ImplementationName " + utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // relation for XAccessibleEventBroadcaster
+ XCell xCell = null;
+ final String text = "Text for testing of the interface XAccessibleText";
+ try {
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ xCell = oSheet.getCellByPosition(5, 5) ;
+ xCell.setFormula(text);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception ceating relation :");
+ e.printStackTrace(log);
+ }
+
+ final XCell fCell = xCell ;
+
+ tEnv.addObjRelation("EventProducer",
+ new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer(){
+ public void fireEvent() {
+ fCell.setFormula("firing event");
+ fCell.setFormula(text);
+ }
+ });
+
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java
new file mode 100644
index 000000000000..aa43190a6a42
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationObj.java
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetAnnotation;
+import com.sun.star.sheet.XSheetAnnotationAnchor;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which represents some text annotation
+* anchored to some cell in spreadsheet (implement
+* <code>com.sun.star.sheet.CellAnnotation</code>).<p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::text::XSimpleText</code></li>
+* <li> <code>com::sun::star::text::XTextRange</code></li>
+* <li> <code>com::sun::star::sheet::XSheetAnnotation</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.sheet.CellAnnotation
+* @see com.sun.star.text.XSimpleText
+* @see com.sun.star.text.XTextRange
+* @see com.sun.star.sheet.XSheetAnnotation
+* @see ifc.text._XSimpleText
+* @see ifc.text._XTextRange
+* @see ifc.sheet._XSheetAnnotation
+*/
+public class ScAnnotationObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one them. Then a single cell is retrieved, and
+ * using its <code>com.sun.star.sheet.XSheetAnnotationAnchor</code>
+ * interface an annotation is got.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'CELLPOS'</code> for
+ * {@link ifc.sheet._XSheetAnnotation} (of <code>
+ * com.sun.star.table.CellAddress</code> type) which
+ * contains the annotation cell address.</li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ ( TestParameters Param, PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ CellAddress cellPos = new CellAddress((short)0, 1, 2);
+
+ log.println("Getting test object ") ;
+
+ XSpreadsheetDocument xArea = (XSpreadsheetDocument)
+ UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc);
+ XSpreadsheets oSheets = (XSpreadsheets) xArea.getSheets();
+
+ XIndexAccess XAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XCell oCell = null;
+ try {
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),XAccess.getByIndex(cellPos.Sheet));
+ XCellRange oCRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ }
+
+ XSheetAnnotationAnchor oAnnoA = (XSheetAnnotationAnchor)
+ UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell);
+ XSheetAnnotation oAnno = oAnnoA.getAnnotation();
+
+ oObj = oAnno;
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("CELLPOS", cellPos);
+
+ // Other parameters required for interface tests
+
+ return tEnv;
+ }
+
+} // finish class ScAnnotationObj
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java
new file mode 100644
index 000000000000..723163c13989
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationShapeObj.java
@@ -0,0 +1,213 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetAnnotation;
+import com.sun.star.sheet.XSheetAnnotationAnchor;
+import com.sun.star.sheet.XSheetAnnotationShapeSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+import util.utils;
+
+import java.io.PrintWriter;
+import util.DefaultDsc;
+import util.InstCreator;
+
+
+/**
+* Test for object which represents some text annotation
+* anchored to some cell in spreadsheet (implement
+* <code>com.sun.star.sheet.CellAnnotation</code>).<p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::text::XSimpleText</code></li>
+* <li> <code>com::sun::star::text::XTextRange</code></li>
+* <li> <code>com::sun::star::sheet::XSheetAnnotation</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.sheet.CellAnnotation
+* @see com.sun.star.text.XSimpleText
+* @see com.sun.star.text.XTextRange
+* @see com.sun.star.sheet.XSheetAnnotation
+* @see ifc.text._XSimpleText
+* @see ifc.text._XTextRange
+* @see ifc.sheet._XSheetAnnotation
+*/
+public class ScAnnotationShapeObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates a spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF =
+ SOfficeFactory.getFactory((XMultiServiceFactory) tParam
+ .getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ log.println("Loading: "+utils.getFullTestURL(
+ "ScAnnotationShapeObj.sxc"));
+ xSheetDoc =
+ (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class,
+ SOF.loadDocument(utils.getFullTestURL(
+ "ScAnnotationShapeObj.sxc")));
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes a spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp =
+ (XComponent) UnoRuntime.queryInterface(XComponent.class,
+ xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one them. Then a single cell is retrieved, and
+ * using its <code>com.sun.star.sheet.XSheetAnnotationAnchor</code>
+ * interface an annotation is got.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'CELLPOS'</code> for
+ * {@link ifc.sheet._XSheetAnnotation} (of <code>
+ * com.sun.star.table.CellAddress</code> type) which
+ * contains the annotation cell address.</li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ CellAddress cellPos = new CellAddress((short) 0, 1, 2);
+
+ log.println("Getting test object ");
+
+ XSpreadsheetDocument xArea =
+ (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class,
+ xSheetDoc);
+ XSpreadsheets oSheets = (XSpreadsheets) xArea.getSheets();
+
+ XIndexAccess XAccess =
+ (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class,
+ oSheets);
+ XCell oCell = null;
+
+ try {
+ XSpreadsheet oSheet =
+ (XSpreadsheet) AnyConverter.toObject(new Type(
+ XSpreadsheet.class),
+ XAccess.getByIndex(cellPos.Sheet));
+ XCellRange oCRange =
+ (XCellRange) UnoRuntime.queryInterface(XCellRange.class,
+ oSheet);
+ oCell =
+ oCRange.getCellByPosition(cellPos.Column, cellPos.Row);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Error getting test object from spreadsheet document",
+ e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Error getting test object from spreadsheet document",
+ e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Error getting test object from spreadsheet document",
+ e);
+ }
+
+ XSheetAnnotationAnchor oAnnoA =
+ (XSheetAnnotationAnchor) UnoRuntime.queryInterface(XSheetAnnotationAnchor.class,
+ oCell);
+ XSheetAnnotation oAnno = oAnnoA.getAnnotation();
+
+ XSimpleText xAnnoText =
+ (XSimpleText) UnoRuntime.queryInterface(XSimpleText.class,
+ oAnno);
+ xAnnoText.setString("ScAnnotationShapeObj");
+
+ XSheetAnnotationShapeSupplier xSheetAnnotationShapeSupplier =
+ (XSheetAnnotationShapeSupplier) UnoRuntime.queryInterface(XSheetAnnotationShapeSupplier.class,
+ oAnno);
+
+ oObj = xSheetAnnotationShapeSupplier.getAnnotationShape();
+
+ log.println("ImplementationName: "
+ + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ //adding ObjRelation for RotationDescriptor
+ tEnv.addObjRelation("NoShear", Boolean.TRUE);
+
+ //adding ObjRelation for XText
+ DefaultDsc tDsc = new DefaultDsc("com.sun.star.text.XTextContent",
+ "com.sun.star.text.TextField.DateTime");
+
+ log.println( "adding InstCreator object" );
+ tEnv.addObjRelation(
+ "XTEXTINFO", new InstCreator( xSheetDoc, tDsc ) );
+
+ return tEnv;
+ }
+}
+ // finish class ScAnnotationShapeObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java
new file mode 100644
index 000000000000..94dd58a9c7ff
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationTextCursor.java
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetAnnotation;
+import com.sun.star.sheet.XSheetAnnotationAnchor;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+/**
+ *
+ * initial description
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.beans.XPropertyState
+ * @see com.sun.star.document.XDocumentInsertable
+ * @see com.sun.star.style.CharacterProperties
+ * @see com.sun.star.style.ParagraphProperties
+ * @see com.sun.star.text.XParagraphCursor
+ * @see com.sun.star.text.XSentenceCursor
+ * @see com.sun.star.text.XTextCursor
+ * @see com.sun.star.text.XTextRange
+ * @see com.sun.star.text.XWordCursor
+ * @see com.sun.star.util.XSortable
+ *
+ */
+public class ScAnnotationTextCursor extends TestCase {
+
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * creating a Testenvironment for the interfaces to be tested
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ ( TestParameters Param, PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ CellAddress cellPos = new CellAddress((short)0, 1, 2);
+
+ try {
+ log.println("Getting test object ") ;
+
+ XSpreadsheetDocument xArea = (XSpreadsheetDocument)
+ UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc);
+
+ XSpreadsheets oSheets = (XSpreadsheets) xArea.getSheets();
+
+ XIndexAccess XAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+
+ XSpreadsheet oSheet = (XSpreadsheet)XAccess.getByIndex(cellPos.Sheet);
+
+ XCellRange oCRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+
+ XCell oCell = oCRange.getCellByPosition(cellPos.Column, cellPos.Row);
+
+ XSheetAnnotationAnchor oAnnoA = (XSheetAnnotationAnchor)
+ UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell);
+
+ XSheetAnnotation oAnno = oAnnoA.getAnnotation();
+ XSimpleText aText = (XSimpleText)
+ UnoRuntime.queryInterface(XSimpleText.class,oAnno);
+ aText.setString("A nice little Test");
+ oObj = aText.createTextCursor();
+
+ } catch (Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+
+ return tEnv;
+ }
+
+} // finish class ScAnnotationTextCursor
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java b/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java
new file mode 100644
index 000000000000..0ce18e51d13f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAnnotationsObj.java
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetAnnotation;
+import com.sun.star.sheet.XSheetAnnotationAnchor;
+import com.sun.star.sheet.XSheetAnnotationsSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XSimpleText;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which represents a collection of annotations
+* for a spreadsheet document (implements
+* <code>com.sun.star.sheet.CellAnnotations</code>). <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::sheet::XSheetAnnotations</code></li>
+* </ul> <p>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.sheet.CellAnnotations
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.sheet.XSheetAnnotations
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.sheet._XSheetAnnotations
+*/
+public class ScAnnotationsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * From a document collection of spreadsheets a single one is
+ * retrieved and one annotation is added to it. Then a collection
+ * of annotations is retrieved using spreadsheet's
+ * <code>com.sun.star.sheet.XSheetAnnotationsSupplier</code> interface.
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ") ;
+
+ XSpreadsheetDocument xSpreadsheetDoc = (XSpreadsheetDocument)
+ UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc);
+ XSpreadsheets sheets = (XSpreadsheets) xSpreadsheetDoc.getSheets();
+
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, sheets );
+ XCell oCell = null;
+ XSpreadsheet oSheet = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+ // adding an annotation...
+ XCellRange oCRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ oCell = oCRange.getCellByPosition(10,10);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ }
+
+ XSheetAnnotationAnchor oAnnoA = (XSheetAnnotationAnchor)
+ UnoRuntime.queryInterface(XSheetAnnotationAnchor.class, oCell);
+ XSheetAnnotation oAnno = oAnnoA.getAnnotation();
+ XSimpleText sText = ((XSimpleText)
+ UnoRuntime.queryInterface(XSimpleText.class, oAnno));
+ sText.setString("ScAnnotationsObj");
+
+ XSheetAnnotationsSupplier supp = (XSheetAnnotationsSupplier)
+ UnoRuntime.queryInterface(
+ XSheetAnnotationsSupplier.class, oSheet);
+ oObj = supp.getAnnotations();
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ }
+
+} // finish class ScAnnotationsObj
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java b/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java
new file mode 100644
index 000000000000..9ecf4045bfb8
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAreaLinkObj.java
@@ -0,0 +1,152 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XAreaLinks;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.CellAreaLink</code>.
+* This object reflects some cell range (this range
+* can also be from another saved document) in
+* any range (of the same size) of the current
+* document.<p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XAreaLink</code></li>
+* <li> <code>com::sun::star::util::XRefreshable</code></li>
+* <li> <code>com::sun::star::sheet::CellAreaLink</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.sheet.XAreaLink
+* @see com.sun.star.util.XRefreshable
+* @see com.sun.star.sheet.CellAreaLink
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._XAreaLink
+* @see ifc.util._XRefreshable
+* @see ifc.sheet._CellAreaLink
+* @see ifc.beans._XPropertySet
+*/
+public class ScAreaLinkObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of Area Links using the 'AreaLinks'
+ * property of the Spreadsheet document. Adds a new link to this
+ * collection, which has a source in the same document. This
+ * link is passed as a tested object.
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ ( TestParameters Param, PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+
+ try {
+
+ // creation of testobject here
+ XPropertySet props = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, xSheetDoc);
+ XAreaLinks links = (XAreaLinks) AnyConverter.toObject(
+ new Type(XAreaLinks.class),props.getPropertyValue("AreaLinks")) ;
+ CellAddress addr = new CellAddress ((short) 1,2,3) ;
+ String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc");
+ links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ;
+
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class), links.getByIndex(0)) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+
+ return tEnv;
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java b/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java
new file mode 100644
index 000000000000..1c3c64e25b98
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAreaLinksObj.java
@@ -0,0 +1,150 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XAreaLinks;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.CellAreaLinks</code>.
+* This is a collection aff all links present
+* in a Spreadsheet document.
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::sheet::XAreaLinks</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.sheet.XAreaLinks
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.sheet._XAreaLinks
+* @see com.sun.star.sheet.CellAreaLinks
+*/
+public class ScAreaLinksObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of Area Links using the 'AreaLinks'
+ * property of the Spreadsheet document. Adds a new link to this
+ * collection, which has a source in the same document. The
+ * link collection is passed as a tested object.
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log){
+
+ XInterface oObj = null;
+ TestEnvironment tEnv = null ;
+
+ try {
+
+ // creation of testobject here
+ XPropertySet props = (XPropertySet)UnoRuntime.queryInterface
+ (XPropertySet.class, xSheetDoc);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),props.getPropertyValue("AreaLinks")) ;
+ XAreaLinks links = null ;
+
+ // adding one link into collection (for best testing)
+ links = (XAreaLinks) UnoRuntime.queryInterface(XAreaLinks.class, oObj) ;
+ CellAddress addr = new CellAddress ((short) 1,2,3) ;
+ String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc");
+ links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ;
+
+ // creating test environment
+ tEnv = new TestEnvironment(oObj);
+
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ return tEnv ;
+ }
+
+} // finish class ScAreaLinksObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java
new file mode 100644
index 000000000000..32f1158bf42c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAutoFormatFieldObj.java
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.TableAutoFormatField</code>.
+* In StarCalc application there is a collection of autoformats
+* for tables (you can select a predefined format for a
+* table or create your own). Each autoformat has a number
+* of fields with definitions of font parameters, number
+* formats etc. for different parts of a table (column and
+* row names, footers, data). This object represents the
+* field of the same kind. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::TableAutoFormatField</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.sheet.TableAutoFormatField
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._TableAutoFormatField
+* @see ifc.beans._XPropertySet
+*/
+public class ScAutoFormatFieldObj extends TestCase {
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Using SOffice ServiceManager an instance of
+ * <code>com.sun.star.sheet.TableAutoFormatField</code> service
+ * is created. From this collection one Format is retrieved
+ * and then from this format one of its compound fields is
+ * retrieved.
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ ( TestParameters Param, PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+
+ try {
+
+ log.println ("create Object ...") ;
+ // creation of testobject here
+ XInterface formats = (XInterface)((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.sheet.TableAutoFormats");
+ XIndexAccess formatsIndex = (XIndexAccess)UnoRuntime.queryInterface
+ (XIndexAccess.class, formats);
+ XInterface format = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),formatsIndex.getByIndex(0));
+ XIndexAccess formatIndex = (XIndexAccess) UnoRuntime.queryInterface
+ (XIndexAccess.class, format);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),formatIndex.getByIndex(0));
+
+ } catch (com.sun.star.uno.Exception e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+
+ return tEnv;
+ }
+
+} // finish class ScAutoFormatFieldObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java b/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java
new file mode 100644
index 000000000000..840f2e600cda
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAutoFormatObj.java
@@ -0,0 +1,109 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.TableAutoFormat</code>. <p>
+* In StarCalc application there is a collection of autoformats
+* for tables (you can select a predefined format for a
+* table or create your own). This object represents
+* one of these autoformats. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::sheet::TableAutoFormat</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.sheet.TableAutoFormat
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.sheet._TableAutoFormat
+* @see ifc.beans._XPropertySet
+*/
+public class ScAutoFormatObj extends TestCase {
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Using SOffice ServiceManager an instance of
+ * <code>com.sun.star.sheet.TableAutoFormatField</code> service
+ * is created. From this collection one Format is retrieved as
+ * object tested.
+ */
+ public TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+
+ XInterface oObj = null;
+ XMultiServiceFactory oMSF = (XMultiServiceFactory)(XMultiServiceFactory)tParam.getMSF();
+ try {
+ XInterface formats = (XInterface)oMSF.createInstance
+ ("com.sun.star.sheet.TableAutoFormats");
+ XIndexAccess formatsIndex = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, formats);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),formatsIndex.getByIndex
+ (formatsIndex.getCount() - 1));
+
+ XNamed objNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, oObj) ;
+ log.println("AutoFormat name is '" + objNamed.getName() + "'") ;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Unexpected exception", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java b/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java
new file mode 100644
index 000000000000..21590965fbdf
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScAutoFormatsObj.java
@@ -0,0 +1,158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.TableAutoFormats</code>. <p>
+* In StarCalc application there is a collection of autoformats
+* for tables (you can select a predefined format for a
+* table or create your own). The object represents
+* this collection. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XNameReplace</code></li>
+* <li> <code>com::sun::star::container::XNameContainer</code></li>
+* </ul>
+* This object test <b> is NOT </b> designed to be run in several
+* threads concurently.
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XNameReplace
+* @see com.sun.star.container.XNameContainer
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XNameReplace
+* @see ifc.container._XNameContainer
+*/
+public class ScAutoFormatsObj extends TestCase{
+ static XSpreadsheetDocument xSheetDoc = null;
+ static SOfficeFactory SOF = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.sheet.TableAutoFormats</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
+ * {@link ifc.container._XNameContainer},
+ * {@link ifc.container._XNameReplace} N relations
+ * which represents objects to be inserted - one
+ * object for each interface thread. </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+
+ try {
+ // creation of testobject here
+ // get AutoFormats
+ XComponent xComp = (XComponent)UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.sheet.TableAutoFormats"));
+ Object secondInstance = SOF.createInstance
+ (xComp, "com.sun.star.sheet.TableAutoFormat");
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+
+ //adding ObjRelation for XNameContainer
+ tEnv.addObjRelation("SecondInstance",secondInstance);
+
+ // INSTANCEn : _XNameContainer; _XNameReplace
+ log.println( "adding INSTANCEn as mod relation to environment" );
+ int THRCNT = 1;
+ if ((String)Param.get("THRCNT") != null) {
+ Integer.parseInt((String)Param.get("THRCNT"));
+ }
+ for (int n = 1; n < (THRCNT+1) ;n++ ) {
+ log.println( "adding INSTANCE" + n
+ +" as mod relation to environment" );
+ tEnv.addObjRelation("INSTANCE" + n, SOF.createInstance(xComp,
+ "com.sun.star.sheet.TableAutoFormat"));
+ }
+
+ return tEnv;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+ }
+
+} // finish class ScAutoFormatsObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java b/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java
new file mode 100644
index 000000000000..55ed9e3c3b73
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellCursorObj.java
@@ -0,0 +1,326 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.ValueComparer;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetCellRange;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import ifc.sheet._XCellRangesQuery;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetCellCursor</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::style::ParagraphProperties</code></li>
+* <li> <code>com::sun::star::sheet::XUsedAreaCursor</code></li>
+* <li> <code>com::sun::star::table::CellProperties</code></li>
+* <li> <code>com::sun::star::table::XCellRange</code></li>
+* <li> <code>com::sun::star::sheet::XCellRangeAddressable</code></li>
+* <li> <code>com::sun::star::table::XCellCursor</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCellCursor</code></li>
+* <li> <code>com::sun::star::style::CharacterProperties</code></li>
+* <li> <code>com::sun::star::sheet::XSheetOperation</code></li>
+* <li> <code>com::sun::star::sheet::XArrayFormulaRange</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCellRange</code></li>
+* <li> <code>com::sun::star::sheet::SheetCellRange</code></li>
+* <li> <code>com::sun::star::chart::XChartData</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::util::XMergeable</code></li>
+* <li> <code>com::sun::star::table::XColumnRowRange</code></li>
+* </ul>
+* @see com.sun.star.sheet.SheetCellCursor
+* @see com.sun.star.style.ParagraphProperties
+* @see com.sun.star.sheet.XUsedAreaCursor
+* @see com.sun.star.table.CellProperties
+* @see com.sun.star.table.XCellRange
+* @see com.sun.star.sheet.XCellRangeAddressable
+* @see com.sun.star.table.XCellCursor
+* @see com.sun.star.sheet.XSheetCellCursor
+* @see com.sun.star.style.CharacterProperties
+* @see com.sun.star.sheet.XSheetOperation
+* @see com.sun.star.sheet.XArrayFormulaRange
+* @see com.sun.star.sheet.XSheetCellRange
+* @see com.sun.star.sheet.SheetCellRange
+* @see com.sun.star.chart.XChartData
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.util.XMergeable
+* @see com.sun.star.table.XColumnRowRange
+* @see ifc.style._ParagraphProperties
+* @see ifc.sheet._XUsedAreaCursor
+* @see ifc.table._CellProperties
+* @see ifc.table._XCellRange
+* @see ifc.sheet._XCellRangeAddressable
+* @see ifc.table._XCellCursor
+* @see ifc.sheet._XSheetCellCursor
+* @see ifc.style._CharacterProperties
+* @see ifc.sheet._XSheetOperation
+* @see ifc.sheet._XArrayFormulaRange
+* @see ifc.sheet._XSheetCellRange
+* @see ifc.sheet._SheetCellRange
+* @see ifc.chart._XChartData
+* @see ifc.beans._XPropertySet
+* @see ifc.util._XMergeable
+* @see ifc.table._XColumnRowRange
+*/
+public class ScCellCursorObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them, retrieves some cell range and creates cursor range
+ * that is instance of the service
+ * <code>com.sun.star.sheet.SheetCellCursor</code>,
+ * fills some cells in the cell range.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SHEET'</code> for
+ * {@link ifc.table._XCellCursor},
+ * {@link ifc.sheet._XArrayFormulaRange} (the spreadsheet that was
+ * retieved from collection)</li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+ TestEnvironment tEnv = null;
+ XSpreadsheet oSheet = null;
+ XCellRange testRange = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ XSpreadsheets oSpreadsheets = ((XSpreadsheetDocument) UnoRuntime.queryInterface(
+ XSpreadsheetDocument.class,
+ xSheetDoc)).getSheets();
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oSpreadsheets.getByName(
+ oSpreadsheets.getElementNames()[0]));
+
+ testRange = oSheet.getCellRangeByName("$A$1:$D$4");
+
+ XSheetCellRange testSheetRange = (XSheetCellRange) UnoRuntime.queryInterface(
+ XSheetCellRange.class,
+ testRange);
+ oObj = oSheet.createCursorByRange(testSheetRange);
+ oSheet.getCellByPosition(1, 1).setValue(1);
+ oSheet.getCellByPosition(4, 5).setValue(1);
+ oSheet.getCellByPosition(3, 2).setFormula("xTextDoc");
+ oSheet.getCellByPosition(3, 3).setFormula("xTextDoc");
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception occured while creating test object:");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("Exception occured while creating test object:");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occured while creating test object:");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception occured while creating test object:");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ log.println("Test object successfully created.");
+
+ tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("CRDESC",
+ "Column and RowDescriptions can't be changed for this Object");
+
+ tEnv.addObjRelation("SHEET", oSheet);
+ // add expected results for the XCellRangesQuery interface test
+ String[]expectedResults = new String[7];
+ expectedResults[_XCellRangesQuery.QUERYCOLUMNDIFFERENCES] = "Sheet1.B1";
+ expectedResults[_XCellRangesQuery.QUERYCONTENTCELLS] = "Sheet1.B2";
+ expectedResults[_XCellRangesQuery.QUERYEMPTYCELLS] = "Sheet1.A1 ... Sheet1.B1 ... Sheet1.B3 ... Sheet1.C1 ... Sheet1.D1";
+ expectedResults[_XCellRangesQuery.QUERYFORMULACELLS] = "";
+ expectedResults[_XCellRangesQuery.QUERYINTERSECTION] = "Sheet1.D4";
+ expectedResults[_XCellRangesQuery.QUERYROWDIFFERENCES] = "Sheet1.A2;Sheet1.C2";
+ expectedResults[_XCellRangesQuery.QUERYVISIBLECELLS] = "Sheet1.A2";
+ tEnv.addObjRelation("XCellRangesQuery.EXPECTEDRESULTS", expectedResults);
+
+ tEnv.addObjRelation("NewData",
+ new Object[][]
+ {
+ { "", "", "", "" },
+ { "", "2", "3", "4" },
+ { "", "2", "3", "4" },
+ { "", "2", "3", "4" }
+ });
+
+ XPropertySet PropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oObj);
+ tEnv.addObjRelation("PropSet", PropSet);
+
+ //Adding relation for util.XSortable
+ final PrintWriter finalLog = log;
+ final XCellRange oTable = testRange;
+ tEnv.addObjRelation("SORTCHECKER",
+ new ifc.util._XSortable.XSortChecker() {
+ PrintWriter out = finalLog;
+
+ public void setPrintWriter(PrintWriter log) {
+ out = log;
+ }
+
+ public void prepareToSort() {
+ try {
+ oTable.getCellByPosition(0, 0).setValue(4);
+ oTable.getCellByPosition(0, 1).setFormula("b");
+ oTable.getCellByPosition(0, 2).setValue(3);
+ oTable.getCellByPosition(0, 3).setValue(23);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ out.println("Exception while checking sort");
+ }
+ }
+
+ public boolean checkSort(boolean isSortNumbering,
+ boolean isSortAscending) {
+ out.println("Sort checking...");
+
+ boolean res = false;
+ String[] value = new String[4];
+
+ for (int i = 0; i < 4; i++) {
+ try {
+ XCell cell = oTable.getCellByPosition(0, i);
+ value[i] = cell.getFormula();
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ out.println("Exception while checking sort");
+ }
+ }
+
+ if (isSortNumbering) {
+ if (isSortAscending) {
+ out.println("Sorting ascending");
+
+ String[] rightVal = { "3", "4", "23", "b" };
+ String[] vals = { value[0], value[1], value[2], value[3] };
+ res = ValueComparer.equalValue(vals, rightVal);
+ out.println("Expected 3, 4, 23, b");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ } else {
+ String[] rightVal = { "b", "23", "4", "3" };
+ String[] vals = { value[0], value[1], value[2], value[3] };
+ res = ValueComparer.equalValue(vals, rightVal);
+ out.println("Expected b, 23, 4, 3");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ }
+ } else {
+ if (isSortAscending) {
+ String[] rightVal = { "3", "4", "23", "b" };
+ res = ValueComparer.equalValue(value, rightVal);
+ out.println("Expected 3, 4, 23, b");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ } else {
+ String[] rightVal = { "b", "23", "4", "3" };
+ res = ValueComparer.equalValue(value, rightVal);
+ out.println("Expected b, 23, 4, 3");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ }
+ }
+
+ if (res) {
+ out.println("Sorted correctly");
+ } else {
+ out.println("Sorted uncorrectly");
+ }
+
+ return res;
+ }
+ });
+
+ return tEnv;
+ }
+} // finish class ScCellCursorObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java
new file mode 100644
index 000000000000..a2f0d11e3bb5
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellFieldObj.java
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object that represents a text field (implements
+* <code>com.sun.star.text.TextField</code>) which inserted in a cell of
+* the spreadsheet. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::text::XTextField</code></li>
+* <li> <code>com::sun::star::text::XTextContent</code></li>
+* <li> <code>com::sun::star::text::TextContent</code></li>
+* </ul>
+* @see com.sun.star.text.TextField
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.text.XTextField
+* @see com.sun.star.text.XTextContent
+* @see com.sun.star.text.TextContent
+* @see ifc.lang._XComponent
+* @see ifc.beans._XPropertySet
+* @see ifc.text._XTextField
+* @see ifc.text._XTextContent
+* @see ifc.text._TextContent
+*/
+public class ScCellFieldObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.text.TextField.URL</code>, inserts it to the content
+ * of the cell in the spreadsheet, retrieves a text content
+ * <code>com.sun.star.text.XTextContent</code> from the cell.<p>
+ * Object relations created :
+ * <ul>
+ * <li> <code>'TRO'</code> for
+ * {@link ifc.text._TextContent} </li>
+ * <li> <code>'CONTENT'</code> for
+ * {@link ifc.text._XTextContent} (type of
+ * <code>com.sun.star.text.XTextContent</code> that was queried from
+ * the newly created service <code>com.sun.star.text.TextField.URL</code>)</li>
+ * <li> <code>'TEXT'</code> for
+ * {@link ifc.text._XTextContent} (the text of the cell)</li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XText oText = null;
+ XTextContent oContent = null;
+ XInterface aField = null;
+
+ try {
+ // we want to create an instance of ScCellFieldObj.
+ // to do this we must get an MultiServiceFactory.
+
+ XMultiServiceFactory _oMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc);
+
+ // Now create the instance of com.sun.star.text.TextField.
+ // This object has type ScCellFieldObj.
+
+ oObj = (XInterface)
+ _oMSF.createInstance("com.sun.star.text.TextField.URL");
+
+ aField = (XInterface)
+ _oMSF.createInstance("com.sun.star.text.TextField.URL");
+ oContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, aField);
+
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ XCell oCell = oSheet.getCellByPosition(2,3);
+ oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);
+
+ XTextContent oTextContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, oObj);
+
+ oText.insertTextContent(
+ oText.createTextCursor(), oTextContent, true);
+
+ oCell = oSheet.getCellByPosition(1,4);
+ oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+
+ log.println ("Object created.") ;
+ tEnv.addObjRelation("TRO", new Boolean(true));
+
+ tEnv.addObjRelation("CONTENT",oContent);
+ tEnv.addObjRelation("TEXT",oText);
+
+ return tEnv;
+ }
+
+} // finish class ScCellFieldObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java
new file mode 100644
index 000000000000..f91389211354
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellFieldsObj.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextFieldsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object that represents a colection of text fields
+ * in a cell of a spreadsheet. <p>
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
+ * <li> <code>com::sun::star::util::XRefreshable</code></li>
+ * <li> <code>com::sun::star::container::XElementAccess</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.container.XEnumerationAccess
+ * @see com.sun.star.util.XRefreshable
+ * @see com.sun.star.container.XElementAccess
+ * @see ifc.container._XEnumerationAccess
+ * @see ifc.util._XRefreshable
+ * @see ifc.container._XElementAccess
+ */
+public class ScCellFieldsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.text.TextField.URL</code>, inserts it to the content
+ * of the cell in the spreadsheet. Then the component is obtained
+ * by <code>XTextFieldsSupplier</code> interface of a cell.<p>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XText oText = null;
+ XTextContent oContent = null;
+ XInterface aField = null;
+
+ try {
+ // we want to create an instance of ScCellFieldObj.
+ // to do this we must get an MultiServiceFactory.
+
+ XMultiServiceFactory _oMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc);
+
+ aField = (XInterface)
+ _oMSF.createInstance("com.sun.star.text.TextField.URL");
+ oContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, aField);
+
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ XCell oCell = oSheet.getCellByPosition(2,3);
+ oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);
+
+ oText.insertTextContent(
+ oText.createTextCursor(), oContent, true);
+
+ XTextFieldsSupplier xTextFieldsSupp = (XTextFieldsSupplier)
+ UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell);
+
+ oObj = xTextFieldsSupp.getTextFields();
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+
+ return tEnv;
+ }
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java
new file mode 100644
index 000000000000..c78ac67cf64f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellFormatsEnumeration.java
@@ -0,0 +1,157 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellFormatRangesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.CellFormatRangesEnumeration</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XEnumeration</code></li>
+* </ul>
+* @see com.sun.star.sheet.CellFormatRangesEnumeration
+* @see com.sun.star.container.XEnumeration
+* @see ifc.container._XEnumeration
+*/
+public class ScCellFormatsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them. Then retrieves a collection of cell format range
+ * using the interface <code>XCellFormatRangesSupplier</code>, creates the
+ * enumeration of this collection using interface <code>XEnumerationAccess</code>.
+ * This enumeration is the instance of the service
+ * <code>com.sun.star.sheet.CellFormatRangesEnumeration</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'ENUM'</code> for
+ * {@link ifc.container._XEnumeration} (type of
+ * <code>XEnumerationAccess</code> that was queried from the collection
+ * of cell format range)</li>
+ * </ul>
+ * @see com.sun.star.sheet.CellFormatRangesEnumeration
+ * @see com.sun.star.sheet.XCellFormatRangesSupplier
+ * @see com.sun.star.container.XEnumerationAccess
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("getting CellFormats");
+
+ XCellFormatRangesSupplier xCFRS = (XCellFormatRangesSupplier)
+ UnoRuntime.queryInterface(XCellFormatRangesSupplier.class,oSheet);
+ XIndexAccess formats = xCFRS.getCellFormatRanges();
+
+ log.println("getting Enumeration");
+ XEnumerationAccess oEnum = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,formats);
+ oObj = oEnum.createEnumeration();
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("ENUM", oEnum);
+
+ return tEnv;
+ }
+
+} // finish class ScCellFormatsEnumeration
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java b/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java
new file mode 100644
index 000000000000..68396cbb37de
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellFormatsObj.java
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellFormatRangesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.CellFormatRanges</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.CellFormatRanges
+* @see com.sun.star.container.XEnumerationAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XEnumerationAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScCellFormatsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them. Then retrieves a collection of format cell
+ * range using the interface <code>XCellFormatRangesSupplier</code> that is
+ * instance of service <code>com.sun.star.sheet.CellFormatRanges</code>.
+ * @see com.sun.star.sheet.CellFormatRanges
+ * @see com.sun.star.sheet.XCellFormatRangesSupplier
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("getting CellFormats");
+ XCellFormatRangesSupplier xCFRS = (XCellFormatRangesSupplier)
+ UnoRuntime.queryInterface(XCellFormatRangesSupplier.class, oSheet);
+ XIndexAccess formats = xCFRS.getCellFormatRanges();
+
+ oObj = formats;
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ }
+} // finish class ScCellFormatsObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellObj.java b/qadevOOo/tests/java/mod/_sc/ScCellObj.java
new file mode 100644
index 000000000000..7711676f41a3
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellObj.java
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DefaultDsc;
+import util.InstCreator;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import ifc.sheet._XCellRangesQuery;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetCell</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::table::CellProperties</code></li>
+* <li> <code>com::sun::star::text::XSimpleText</code></li>
+* <li> <code>com::sun::star::table::XCell</code></li>
+* <li> <code>com::sun::star::text::XTextRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::style::CharacterProperties</code></li>
+* <li> <code>com::sun::star::document::XActionLockable</code></li>
+* <li> <code>com::sun::star::style::ParagraphProperties</code></li>
+* <li> <code>com::sun::star::text::XText</code></li>
+* <li> <code>com::sun::star::sheet::XCellAddressable</code></li>
+* </ul>
+* @see com.sun.star.sheet.SheetCell
+* @see com.sun.star.table.CellProperties
+* @see com.sun.star.text.XSimpleText
+* @see com.sun.star.table.XCell
+* @see com.sun.star.text.XTextRange
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.style.CharacterProperties
+* @see com.sun.star.document.XActionLockable
+* @see com.sun.star.style.ParagraphProperties
+* @see com.sun.star.text.XText
+* @see com.sun.star.sheet.XCellAddressable
+* @see ifc.table._CellProperties
+* @see ifc.text._XSimpleText
+* @see ifc.table._XCell
+* @see ifc.text._XTextRange
+* @see ifc.beans._XPropertySet
+* @see ifc.style._CharacterProperties
+* @see ifc.document._XActionLockable
+* @see ifc.style._ParagraphProperties
+* @see ifc.text._XText
+* @see ifc.sheet._XCellAddressable
+*/
+public class ScCellObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "Creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them. Retrieves some cell from the spreadsheet
+ * that is instance of the service <code>com.sun.star.sheet.SheetCell</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XTEXTINFO',</code> for
+ * {@link ifc.text._XText} </li>
+ * </ul>
+ * @see com.sun.star.sheet.SheetCell
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ XSpreadsheet oSheet = null;
+ XCell cell = null;
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ log.println("Getting a cell from sheet") ;
+ oObj = oSheet.getCellByPosition(2, 3) ;
+ cell = (XCell)UnoRuntime.queryInterface(XCell.class, oObj);
+
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+ log.println( "creating a new environment for ScCellObj object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Object relations for interface tests
+ DefaultDsc tDsc = new DefaultDsc(
+ "com.sun.star.text.XTextContent", "com.sun.star.text.TextField.URL");
+ log.println( " adding InstCreator object" );
+ tEnv.addObjRelation( "XTEXTINFO", new InstCreator( xSheetDoc, tDsc ) );
+ // add the sheet
+ tEnv.addObjRelation("SHEET", oSheet);
+ // add expected results for the XCellRangesQuery interface test
+ String[]expectedResults = new String[7];
+
+ expectedResults[_XCellRangesQuery.QUERYCOLUMNDIFFERENCES] = "Sheet1.C4";
+ expectedResults[_XCellRangesQuery.QUERYCONTENTCELLS] = "";
+ expectedResults[_XCellRangesQuery.QUERYEMPTYCELLS] = "Sheet1.C4";
+ expectedResults[_XCellRangesQuery.QUERYFORMULACELLS] = "";
+ expectedResults[_XCellRangesQuery.QUERYINTERSECTION] = "";
+ expectedResults[_XCellRangesQuery.QUERYROWDIFFERENCES] = "Sheet1.C4";
+ expectedResults[_XCellRangesQuery.QUERYVISIBLECELLS] = "Sheet1.C4";
+ tEnv.addObjRelation("XCellRangesQuery.EXPECTEDRESULTS", expectedResults);
+ tEnv.addObjRelation("XCellRangesQuery.CREATEENTRIES", Boolean.TRUE);
+
+ // make entries in this cell at the interface test
+ tEnv.addObjRelation("XTextFieldsSupplier.MAKEENTRY", Boolean.TRUE);
+ tEnv.addObjRelation("MAKEENTRYINCELL", cell);
+
+ // for XSearchable amd XReplaceable interface test
+ tEnv.addObjRelation("XSearchable.MAKEENTRYINCELL", cell);
+ tEnv.addObjRelation("EXCLUDEFINDNEXT", Boolean.TRUE);
+
+ // for XFormulaQuery interface test
+ tEnv.addObjRelation("EXPECTEDDEPENDENTVALUES", new int[]{2,2,3,3});
+ tEnv.addObjRelation("EXPECTEDPRECEDENTVALUES", new int[]{0,3,0,0});
+ tEnv.addObjRelation("RANGEINDICES", new int[]{0,0});
+
+ // XTextFieldsSupplier
+ tEnv.addObjRelation("SPREADSHEET", xSheetDoc);
+
+ XPropertySet PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oObj);
+ tEnv.addObjRelation("PropSet",PropSet);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScCellObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java
new file mode 100644
index 000000000000..5d4fdcaae4e4
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellRangeObj.java
@@ -0,0 +1,312 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.ValueComparer;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import ifc.sheet._XCellRangesQuery;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetCellRange</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::table::CellProperties</code></li>
+* <li> <code>com::sun::star::util::XMergeable</code></li>
+* <li> <code>com::sun::star::sheet::XCellRangeAddressable</code></li>
+* <li> <code>com::sun::star::sheet::XArrayFormulaRange</code></li>
+* <li> <code>com::sun::star::chart::XChartData</code></li>
+* <li> <code>com::sun::star::table::XColumnRowRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::style::CharacterProperties</code></li>
+* <li> <code>com::sun::star::sheet::XSheetOperation</code></li>
+* <li> <code>com::sun::star::table::XCellRange</code></li>
+* <li> <code>com::sun::star::style::ParagraphProperties</code></li>
+* <li> <code>com::sun::star::sheet::SheetCellRange</code></li>
+* </ul>
+* @see com.sun.star.sheet.SheetCellRange
+* @see com.sun.star.table.CellProperties
+* @see com.sun.star.util.XMergeable
+* @see com.sun.star.sheet.XCellRangeAddressable
+* @see com.sun.star.sheet.XArrayFormulaRange
+* @see com.sun.star.chart.XChartData
+* @see com.sun.star.table.XColumnRowRange
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.style.CharacterProperties
+* @see com.sun.star.sheet.XSheetOperation
+* @see com.sun.star.table.XCellRange
+* @see com.sun.star.style.ParagraphProperties
+* @see com.sun.star.sheet.SheetCellRange
+* @see ifc.table._CellProperties
+* @see ifc.util._XMergeable
+* @see ifc.sheet._XCellRangeAddressable
+* @see ifc.sheet._XArrayFormulaRange
+* @see ifc.chart._XChartData
+* @see ifc.table._XColumnRowRange
+* @see ifc.beans._XPropertySet
+* @see ifc.style._CharacterProperties
+* @see ifc.sheet._XSheetOperation
+* @see ifc.table._XCellRange
+* @see ifc.style._ParagraphProperties
+* @see ifc.sheet._SheetCellRange
+*/
+public class ScCellRangeObj extends TestCase {
+ XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them. Retrieves some cell range from the spreadsheet.
+ * The retrieved cell range is instance of the service
+ * <code>com.sun.star.sheet.SheetCellRange</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SHEET'</code> for
+ * {@link ifc.sheet._XArrayFormulaRange} (the spreadsheet which the cell
+ * range was retrieved from)</li>
+ * </ul>
+ * @see com.sun.star.sheet.XSpreadsheet
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+ XCellRange testRange;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ XSpreadsheets oSpreadsheets = ((XSpreadsheetDocument) UnoRuntime.queryInterface(
+ XSpreadsheetDocument.class,
+ xSheetDoc)).getSheets();
+ XNameAccess oNames = (XNameAccess) UnoRuntime.queryInterface(
+ XNameAccess.class, oSpreadsheets);
+
+ XSpreadsheet oSheet = null;
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+
+ oObj = oSheet.getCellRangeByPosition(0, 0, 3, 4);
+ testRange = (XCellRange) UnoRuntime.queryInterface(
+ XCellRange.class, oObj);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("SHEET", oSheet);
+ // add expected results for the XCellRangesQuery interface test
+ String[]expectedResults = new String[7];
+ expectedResults[_XCellRangesQuery.QUERYCOLUMNDIFFERENCES] = "Sheet1.B1:C1;Sheet1.B3";
+ expectedResults[_XCellRangesQuery.QUERYCONTENTCELLS] = "Sheet1.B2:B3";
+ expectedResults[_XCellRangesQuery.QUERYEMPTYCELLS] = "Sheet1.A1 ... Sheet1.B1 ... Sheet1.B5 ... Sheet1.C3 ... Sheet1.D1";
+ expectedResults[_XCellRangesQuery.QUERYFORMULACELLS] = "Sheet1.C2";
+ expectedResults[_XCellRangesQuery.QUERYINTERSECTION] = "Sheet1.D4";
+ expectedResults[_XCellRangesQuery.QUERYROWDIFFERENCES] = "Sheet1.A2:A4;Sheet1.C2:D4";
+ expectedResults[_XCellRangesQuery.QUERYVISIBLECELLS] = "Sheet1.A2";
+ tEnv.addObjRelation("XCellRangesQuery.EXPECTEDRESULTS", expectedResults);
+ tEnv.addObjRelation("XCellRangesQuery.CREATEENTRIES", Boolean.TRUE);
+
+ XPropertySet PropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oObj);
+ tEnv.addObjRelation("PropSet", PropSet);
+
+ // XSearchable: Add a cell to make a seacrchable entry
+ try {
+ tEnv.addObjRelation("XSearchable.MAKEENTRYINCELL", new XCell[] {
+ testRange.getCellByPosition(0,0), testRange.getCellByPosition(0,1)});
+ }
+ catch(com.sun.star.lang.IndexOutOfBoundsException e){
+ e.printStackTrace((PrintWriter)log);
+ log.println("Cannot make required object relation 'XSearchable.MAKEENTRYINCELL'.");
+ }
+
+ // XCellRangeData
+/* Object[][] newData = new Object[5][4];
+ for (int i=0; i<newData.length; i++) {
+ for (int j=0; j<newData[i].length; j++) {
+ newData[i][j] = new Double(i*10+j);
+ }
+ }
+ tEnv.addObjRelation("NewData", newData); */
+
+ //Adding relation for util.XSortable
+ final PrintWriter finalLog = log;
+ final XCellRange oTable = testRange;
+ tEnv.addObjRelation("SORTCHECKER",
+ new ifc.util._XSortable.XSortChecker() {
+ PrintWriter out = finalLog;
+
+ public void setPrintWriter(PrintWriter log) {
+ out = log;
+ }
+
+ public void prepareToSort() {
+ try {
+ oTable.getCellByPosition(0, 0).setValue(4);
+ oTable.getCellByPosition(0, 1).setFormula("b");
+ oTable.getCellByPosition(0, 2).setValue(3);
+ oTable.getCellByPosition(0, 3).setValue(23);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ out.println("Exception while checking sort");
+ }
+ }
+
+ public boolean checkSort(boolean isSortNumbering,
+ boolean isSortAscending) {
+ out.println("Sort checking...");
+
+ boolean res = false;
+ String[] value = new String[4];
+
+ for (int i = 0; i < 4; i++) {
+ try {
+ XCell cell = oTable.getCellByPosition(0, i);
+ value[i] = cell.getFormula();
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ out.println("Exception while checking sort");
+ }
+ }
+
+ if (isSortNumbering) {
+ if (isSortAscending) {
+ out.println("Sorting ascending");
+
+ String[] rightVal = { "3", "4", "23", "b" };
+ String[] vals = { value[0], value[1], value[2], value[3] };
+ res = ValueComparer.equalValue(vals, rightVal);
+ out.println("Expected 3, 4, 23, b");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ } else {
+ String[] rightVal = { "b", "23", "4", "3" };
+ String[] vals = { value[0], value[1], value[2], value[3] };
+ res = ValueComparer.equalValue(vals, rightVal);
+ out.println("Expected b, 23, 4, 3");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ }
+ } else {
+ if (isSortAscending) {
+ String[] rightVal = { "3", "4", "23", "b" };
+ res = ValueComparer.equalValue(value, rightVal);
+ out.println("Expected 3, 4, 23, b");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ } else {
+ String[] rightVal = { "b", "23", "4", "3" };
+ res = ValueComparer.equalValue(value, rightVal);
+ out.println("Expected b, 23, 4, 3");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ }
+ }
+
+ if (res) {
+ out.println("Sorted correctly");
+ } else {
+ out.println("Sorted uncorrectly");
+ }
+
+ return res;
+ }
+ });
+
+ return tEnv;
+ }
+} // finish class ScCellRangeObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java
new file mode 100644
index 000000000000..b3c3e4e66e1d
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellRangesObj.java
@@ -0,0 +1,264 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import ifc.sheet._XCellRangesQuery;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetCellRanges</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::table::CellProperties</code></li>
+* <li> <code>com::sun::star::container::XNameReplace</code></li>
+* <li> <code>com::sun::star::container::XNameContainer</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCellRangeContainer</code></li>
+* <li> <code>com::sun::star::sheet::XSheetOperation</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCellRanges</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.SheetCellRanges
+* @see com.sun.star.table.CellProperties
+* @see com.sun.star.container.XNameReplace
+* @see com.sun.star.container.XNameContainer
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XEnumerationAccess
+* @see com.sun.star.sheet.XSheetCellRangeContainer
+* @see com.sun.star.sheet.XSheetOperation
+* @see com.sun.star.sheet.XSheetCellRanges
+* @see com.sun.star.container.XNameAccess
+* @see ifc.table._CellProperties
+* @see ifc.container._XNameReplace
+* @see ifc.container._XNameContainer
+* @see ifc.beans._XPropertySet
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XEnumerationAccess
+* @see ifc.sheet._XSheetCellRangeContainer
+* @see ifc.sheet._XSheetOperation
+* @see ifc.sheet._XSheetCellRanges
+* @see ifc.container._XNameAccess
+*/
+public class ScCellRangesObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp =
+ (XComponent) UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.sheet.SheetCellRanges</code> and fills some cells.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
+ * {@link ifc.container._XNameReplace},
+ * {@link ifc.container._XNameContainer} (type of
+ * <code>XCellRange</code>)</li>
+ * <li> <code>'THRCNT'</code> for
+ * {@link ifc.container._XNameReplace}(the number of the running threads
+ * that was retrieved from the method parameter <code>Param</code>)</li>
+ * <li> <code>'NameReplaceIndex'</code> for
+ * {@link ifc.container._XNameReplace} </li>
+ * </ul>
+ * @see com.sun.star.table.XCellRange
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ Object oRange = null ;
+
+ // creation of 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( (XMultiServiceFactory)Param.getMSF() );
+
+ log.println("Getting test object ");
+
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+
+ oObj = (XInterface)
+ SOF.createInstance(oComp, "com.sun.star.sheet.SheetCellRanges");
+
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndSheets = (XIndexAccess)
+ UnoRuntime.queryInterface (XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class), oIndSheets.getByIndex(0));
+ XNameContainer oRanges = (XNameContainer)
+ UnoRuntime.queryInterface(XNameContainer.class, oObj);
+
+ oRange = oSheet.getCellRangeByName("C1:D4");
+ oRanges.insertByName("Range1", oRange);
+ oRange = oSheet.getCellRangeByName("E2:F5");
+ oRanges.insertByName("Range2", oRange);
+ oRange = oSheet.getCellRangeByName("G2:H3");
+ oRanges.insertByName("Range3", oRange);
+ oRange = oSheet.getCellRangeByName("I7:J8");
+ oRanges.insertByName("Range4", oRange);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.container.ElementExistException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 5; j++) {
+ oSheet.getCellByPosition(i, j).setFormula("a");
+ }
+ }
+ for (int i = 0; i < 10; i++) {
+ for (int j = 5; j < 10; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i + j);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException (
+ "Exception occurred while filling cells", e);
+ }
+
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // NameReplaceIndex : _XNameReplace
+ log.println( "adding NameReplaceIndex as mod relation to environment" );
+ tEnv.addObjRelation("NameReplaceIndex", "0");
+
+ // INSTANCEn : _XNameContainer; _XNameReplace
+ log.println( "adding INSTANCEn as mod relation to environment" );
+
+ int THRCNT = 1;
+ if ((String)Param.get("THRCNT") != null) {
+ THRCNT= Integer.parseInt((String)Param.get("THRCNT"));
+ }
+ int a = 0;
+ int b = 0;
+ for (int n = 1; n < (THRCNT + 1) ; n++) {
+ a = n * 2;
+ b = a + 1;
+ oRange = oSheet.getCellRangeByName("A" + a + ":B" + b);
+ log.println(
+ "adding INSTANCE" + n + " as mod relation to environment" );
+
+ tEnv.addObjRelation("INSTANCE" + n, oRange);
+ }
+
+ 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.I7:J8";
+ expectedResults[_XCellRangesQuery.QUERYCONTENTCELLS] = "";
+ expectedResults[_XCellRangesQuery.QUERYEMPTYCELLS] = "";
+ expectedResults[_XCellRangesQuery.QUERYFORMULACELLS] = "";
+ expectedResults[_XCellRangesQuery.QUERYINTERSECTION] = "Sheet1.D4";
+ expectedResults[_XCellRangesQuery.QUERYROWDIFFERENCES] = "Sheet1.I7:J8";
+ expectedResults[_XCellRangesQuery.QUERYVISIBLECELLS] = "Sheet1.C2:D4"; // first range, first line invisible
+ tEnv.addObjRelation("XCellRangesQuery.EXPECTEDRESULTS", expectedResults);
+
+ // for XSearchable and XReplaceable interface test
+ tEnv.addObjRelation("SEARCHSTRING", "15");
+
+ // for XFormulaQuery interface test
+ tEnv.addObjRelation("EXPECTEDDEPENDENTVALUES", new int[]{4,5,1,4});
+ tEnv.addObjRelation("EXPECTEDPRECEDENTVALUES", new int[]{4,5,1,4});
+ return tEnv ;
+ }
+
+} // finish class ScCellRangesObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java b/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java
new file mode 100644
index 000000000000..5e1f6153eb07
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellSearchObj.java
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XSearchable;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.util.SearchDescriptor</code> that was implemented by
+* a spreadsheet. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::util::XSearchDescriptor</code></li>
+* <li> <code>com::sun::star::util::SearchDescriptor</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::util::XReplaceDescriptor</code></li>
+* </ul>
+* @see com.sun.star.util.SearchDescriptor
+* @see com.sun.star.util.XSearchDescriptor
+* @see com.sun.star.util.SearchDescriptor
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.util.XReplaceDescriptor
+* @see ifc.util._XSearchDescriptor
+* @see ifc.util._SearchDescriptor
+* @see ifc.beans._XPropertySet
+* @see ifc.util._XReplaceDescriptor
+*/
+public class ScCellSearchObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them. Creates search descriptor using the interface
+ * <code>XSearchable</code>. The created search descriptor is instance of
+ * the service <code>com.sun.star.util.SearchDescriptor</code> that
+ * implemented by a spreasheet.
+ * @see com.sun.star.util.XSearchable
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ XSearchable xSearch = (XSearchable)
+ UnoRuntime.queryInterface(XSearchable.class,oSheet);
+
+ oObj = xSearch.createSearchDescriptor();
+ // create testobject here
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+} // finish class ScCellSearchObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java b/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java
new file mode 100644
index 000000000000..05313f90cb00
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellTextCursor.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.text.XText;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.text.TextCursor</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::text::XTextCursor</code></li>
+* <li> <code>com::sun::star::text::XWordCursor</code></li>
+* <li> <code>com::sun::star::style::CharacterPropertiesComplex</code></li>
+* <li> <code>com::sun::star::text::XTextRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::container::XContentEnumerationAccess</code></li>
+* <li> <code>com::sun::star::beans::XPropertyState</code></li>
+* <li> <code>com::sun::star::style::CharacterProperties</code></li>
+* <li> <code>com::sun::star::text::XSentenceCursor</code></li>
+* <li> <code>com::sun::star::style::ParagraphProperties</code></li>
+* <li> <code>com::sun::star::text::XParagraphCursor</code></li>
+* <li> <code>com::sun::star::document::XDocumentInsertable</code></li>
+* <li> <code>com::sun::star::util::XSortable</code></li>
+* <li> <code>com::sun::star::style::CharacterPropertiesAsian</code></li>
+* </ul>
+* @see com.sun.star.text.TextCursor
+* @see com.sun.star.text.XTextCursor
+* @see com.sun.star.text.XWordCursor
+* @see com.sun.star.style.CharacterPropertiesComplex
+* @see com.sun.star.text.XTextRange
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.container.XContentEnumerationAccess
+* @see com.sun.star.beans.XPropertyState
+* @see com.sun.star.style.CharacterProperties
+* @see com.sun.star.text.XSentenceCursor
+* @see com.sun.star.style.ParagraphProperties
+* @see com.sun.star.text.XParagraphCursor
+* @see com.sun.star.document.XDocumentInsertable
+* @see com.sun.star.util.XSortable
+* @see com.sun.star.style.CharacterPropertiesAsian
+* @see ifc.text._XTextCursor
+* @see ifc.text._XWordCursor
+* @see ifc.style._CharacterPropertiesComplex
+* @see ifc.text._XTextRange
+* @see ifc.beans._XPropertySet
+* @see ifc.container._XContentEnumerationAccess
+* @see ifc.beans._XPropertyState
+* @see ifc.style._CharacterProperties
+* @see ifc.text._XSentenceCursor
+* @see ifc.style._ParagraphProperties
+* @see ifc.text._XParagraphCursor
+* @see ifc.document._XDocumentInsertable
+* @see ifc.util._XSortable
+* @see ifc.style._CharacterPropertiesAsian
+*/
+public class ScCellTextCursor extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Retrieves the cell from the spreadsheet
+ * and creates text cursor of the cell using the interface
+ * <code>XText</code>. This text cursor is the instance of
+ * the service <code>com.sun.star.text.TextCursor</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XTEXT'</code> for
+ * {@link ifc.text._XTextRange} (type of
+ * <code>XEnumerationAccess</code> that was retrieved from the
+ * collection of visible cells)</li>
+ * </ul>
+ * @see com.sun.star.text.XText
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XCell aCell = null;
+
+ // creation of 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
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ log.println("Getting a cell from sheet") ;
+ aCell = oSheet.getCellByPosition(1,1) ;
+
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document",e) ;
+ }
+
+ XText aText = (XText) UnoRuntime.queryInterface(XText.class, aCell);
+ aText.setString("ScCellTextCursor");
+ oObj = aText.createTextCursor();
+
+ log.println( "creating a new environment for ScCellTextCursor object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Object relations for interface tests
+ tEnv.addObjRelation("XTEXT", aText);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScCellTextCursor
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java
new file mode 100644
index 000000000000..5b41b5bb2928
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellsEnumeration.java
@@ -0,0 +1,172 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangesQuery;
+import com.sun.star.sheet.XSheetCellRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.CellsEnumeration</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XEnumeration</code></li>
+* </ul>
+* @see com.sun.star.sheet.CellsEnumeration
+* @see com.sun.star.container.XEnumeration
+* @see ifc.container._XEnumeration
+*/
+public class ScCellsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Replaces text of some cells.
+ * Retrives a cell range of the visible cells using the interface
+ * <code>XCellRangesQuery</code>. Retrieves a collection of cells from
+ * this cell range and creates it's enumeration using the interface
+ * <code>XEnumerationAccess</code>.The created enumeration is the instance
+ * of the service <code>com.sun.star.sheet.CellsEnumeration</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'ENUM'</code> for
+ * {@link ifc.container._XEnumeration} (type of
+ * <code>XEnumerationAccess</code> that was retrieved from the
+ * collection of visible cells)</li>
+ * </ul>
+ * @see com.sun.star.sheet.XCellRangesQuery
+ * @see com.sun.star.container.XEnumerationAccess
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ Object cellArr[] = new Object[3] ;
+ XEnumerationAccess oEnum = null;
+
+ // creation of testobject here
+ XSpreadsheets oSheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XCellRange oSheet = null;
+ try {
+ oSheet = (XCellRange) AnyConverter.toObject(
+ new Type(XCellRange.class),oIndexAccess.getByIndex(0));
+
+ XCell oCell_1 = (XCell)oSheet.getCellByPosition(0, 0);
+ XTextRange oTextRange = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, oCell_1);
+ oTextRange.setString("Test string 1");
+
+ XCell oCell_2 = (XCell)oSheet.getCellByPosition(5, 1);
+ oCell_2.setValue(15);
+
+ XCell oCell_3 = (XCell)oSheet.getCellByPosition(3, 9);
+ oTextRange = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, oCell_3);
+ oTextRange.setString("test 2");
+ cellArr[0] = oCell_1;
+ cellArr[1] = oCell_2;
+ cellArr[2] = oCell_3;
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ XCellRangesQuery oCellRangesQuery = (XCellRangesQuery)
+ UnoRuntime.queryInterface(XCellRangesQuery.class, oSheet);
+ XSheetCellRanges oSheetCellRanges = oCellRangesQuery.queryVisibleCells();
+ oEnum = (XEnumerationAccess) oSheetCellRanges.getCells();
+ oObj = oSheetCellRanges.getCells().createEnumeration();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ // ENUM: XEnumeration
+ tEnv.addObjRelation("ENUM", oEnum);
+
+ return tEnv;
+ }
+
+} // finish class ScCellsEnumeration
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScCellsObj.java b/qadevOOo/tests/java/mod/_sc/ScCellsObj.java
new file mode 100644
index 000000000000..4e83d890427e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScCellsObj.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangesQuery;
+import com.sun.star.sheet.XSheetCellRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.Cells</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.Cells
+* @see com.sun.star.container.XEnumerationAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XEnumerationAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScCellsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document,
+ * and takes one of them. Replaces text of some cells.
+ * Retrives a cell range of the visible cells using the interface
+ * <code>XCellRangesQuery</code>. Retrieves a collection of cells from
+ * this cell range, this collection is instance of the service
+ * <code>com.sun.star.sheet.Cells</code>.
+ * @see com.sun.star.sheet.XCellRangesQuery
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ Object cellArr[] = new Object[3];
+
+ // creation of testobject here
+ XSpreadsheets oSheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XCellRange oSheet = null;
+ try {
+ oSheet = (XCellRange) AnyConverter.toObject(
+ new Type(XCellRange.class),oIndexAccess.getByIndex(0));
+
+ XCell oCell_1 = (XCell)oSheet.getCellByPosition(0, 0);
+ XTextRange oTextRange = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, oCell_1);
+
+ oTextRange.setString("ScCellsObj test 1");
+
+ XCell oCell_2 = (XCell)oSheet.getCellByPosition(5, 1);
+ oCell_2.setValue(15);
+
+ XCell oCell_3 = (XCell)oSheet.getCellByPosition(3, 9);
+ oTextRange = (XTextRange)
+ UnoRuntime.queryInterface(XTextRange.class, oCell_3);
+
+ oTextRange.setString("ScCellsObj test 2");
+
+ cellArr[0] = oCell_1;
+ cellArr[2] = oCell_2;
+ cellArr[1] = oCell_3;
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ XCellRangesQuery oCellRangesQuery = (XCellRangesQuery)
+ UnoRuntime.queryInterface(XCellRangesQuery.class, oSheet);
+ XSheetCellRanges oSheetCellRanges = oCellRangesQuery.queryVisibleCells();
+
+ oObj = oSheetCellRanges.getCells();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ log.println ("Object created.") ;
+
+ return tEnv;
+ }
+
+} // finish class ScCellsObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScChartObj.java b/qadevOOo/tests/java/mod/_sc/ScChartObj.java
new file mode 100644
index 000000000000..4c0e38aeaab3
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScChartObj.java
@@ -0,0 +1,289 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableChart;
+import com.sun.star.table.XTableCharts;
+import com.sun.star.table.XTableChartsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.table.TableChart</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::table::XTableChart</code></li>
+* <li> <code>com::sun::star::document::XEmbeddedObjectSupplier</code></li>
+* </ul>
+* @see com.sun.star.table.TableChart
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.table.XTableChart
+* @see com.sun.star.document.XEmbeddedObjectSupplier
+* @see ifc.container._XNamed
+* @see ifc.table._XTableChart
+* @see ifc.document._XEmbeddedObjectSupplier
+*/
+public class ScChartObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Inserts some values into the cells of the some cell
+ * range address. Adds the chart that using the data from the cells of this
+ * cell range address. New chart is the instance of
+ * the service <code>com.sun.star.table.TableChart</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'setName'</code> for
+ * {@link ifc.container._XNamed}(the method <code>setName</code> must
+ * not be tested)</li>
+ * </ul>
+ * @see com.sun.star.container.XNamed
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XSpreadsheet oSheet=null;
+
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ }
+
+ log.println("Creating the Header") ;
+
+ insertIntoCell(1,0,"JAN",oSheet,"");
+ insertIntoCell(2,0,"FEB",oSheet,"");
+ insertIntoCell(3,0,"MAR",oSheet,"");
+ insertIntoCell(4,0,"APR",oSheet,"");
+ insertIntoCell(5,0,"MAI",oSheet,"");
+ insertIntoCell(6,0,"JUN",oSheet,"");
+ insertIntoCell(7,0,"JUL",oSheet,"");
+ insertIntoCell(8,0,"AUG",oSheet,"");
+ insertIntoCell(9,0,"SEP",oSheet,"");
+ insertIntoCell(10,0,"OCT",oSheet,"");
+ insertIntoCell(11,0,"NOV",oSheet,"");
+ insertIntoCell(12,0,"DEC",oSheet,"");
+ insertIntoCell(13,0,"SUM",oSheet,"");
+
+ log.println("Fill the lines");
+
+ insertIntoCell(0,1,"Smith",oSheet,"");
+ insertIntoCell(1,1,"42",oSheet,"V");
+ insertIntoCell(2,1,"58.9",oSheet,"V");
+ insertIntoCell(3,1,"-66.5",oSheet,"V");
+ insertIntoCell(4,1,"43.4",oSheet,"V");
+ insertIntoCell(5,1,"44.5",oSheet,"V");
+ insertIntoCell(6,1,"45.3",oSheet,"V");
+ insertIntoCell(7,1,"-67.3",oSheet,"V");
+ insertIntoCell(8,1,"30.5",oSheet,"V");
+ insertIntoCell(9,1,"23.2",oSheet,"V");
+ insertIntoCell(10,1,"-97.3",oSheet,"V");
+ insertIntoCell(11,1,"22.4",oSheet,"V");
+ insertIntoCell(12,1,"23.5",oSheet,"V");
+ insertIntoCell(13,1,"=SUM(B2:M2)",oSheet,"");
+
+ insertIntoCell(0,2,"Jones",oSheet,"");
+ insertIntoCell(1,2,"21",oSheet,"V");
+ insertIntoCell(2,2,"40.9",oSheet,"V");
+ insertIntoCell(3,2,"-57.5",oSheet,"V");
+ insertIntoCell(4,2,"-23.4",oSheet,"V");
+ insertIntoCell(5,2,"34.5",oSheet,"V");
+ insertIntoCell(6,2,"59.3",oSheet,"V");
+ insertIntoCell(7,2,"27.3",oSheet,"V");
+ insertIntoCell(8,2,"-38.5",oSheet,"V");
+ insertIntoCell(9,2,"43.2",oSheet,"V");
+ insertIntoCell(10,2,"57.3",oSheet,"V");
+ insertIntoCell(11,2,"25.4",oSheet,"V");
+ insertIntoCell(12,2,"28.5",oSheet,"V");
+ insertIntoCell(13,2,"=SUM(B3:M3)",oSheet,"");
+
+ insertIntoCell(0,3,"Brown",oSheet,"");
+ insertIntoCell(1,3,"31.45",oSheet,"V");
+ insertIntoCell(2,3,"-20.9",oSheet,"V");
+ insertIntoCell(3,3,"-117.5",oSheet,"V");
+ insertIntoCell(4,3,"23.4",oSheet,"V");
+ insertIntoCell(5,3,"-114.5",oSheet,"V");
+ insertIntoCell(6,3,"115.3",oSheet,"V");
+ insertIntoCell(7,3,"-171.3",oSheet,"V");
+ insertIntoCell(8,3,"89.5",oSheet,"V");
+ insertIntoCell(9,3,"41.2",oSheet,"V");
+ insertIntoCell(10,3,"71.3",oSheet,"V");
+ insertIntoCell(11,3,"25.4",oSheet,"V");
+ insertIntoCell(12,3,"38.5",oSheet,"V");
+ insertIntoCell(13,3,"=SUM(A4:L4)",oSheet,"");
+
+ // insert a chart
+
+ Rectangle oRect = new Rectangle(500, 3000, 25000, 11000);
+
+ XCellRange oRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ XCellRange myRange = oRange.getCellRangeByName("A1:N4");
+ XCellRangeAddressable oRangeAddr = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
+ CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
+
+ CellRangeAddress[] oAddr = new CellRangeAddress[1];
+ oAddr[0] = myAddr;
+ XTableChartsSupplier oSupp = (XTableChartsSupplier)
+ UnoRuntime.queryInterface(XTableChartsSupplier.class, oSheet);
+
+ log.println("Insert Chart");
+
+ XTableCharts oCharts = oSupp.getCharts();
+ oCharts.addNewByName("ScChartObj", oRect, oAddr, true, true);
+
+ // get the TableChart
+ XTableChart oChart = null;
+ try {
+ XNameAccess names = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),UnoRuntime.queryInterface(
+ XNameAccess.class, oCharts));
+
+ oChart = (XTableChart) AnyConverter.toObject(
+ new Type(XTableChart.class),names.getByName("ScChartObj"));
+
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't get TableChart");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get TableChart", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("Couldn't get TableChart");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get TableChart", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't get TableChart");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get TableChart", e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oChart);
+
+ //adding ObjRelation 'setName' for 'XNamed'
+ tEnv.addObjRelation("setName", new Boolean(true));
+
+ return tEnv;
+ }
+
+ /**
+ * Inserts a value or a formula in the cell of the spreasheet.
+ * @param CellX is the column index of the cell
+ * @param CellY is the row index of the cell
+ * @param theValue string representation of the value
+ * @param TT1 specify the spreadsheet, the interface
+ * <code>com.sun.star.sheet.XSpreadsheet</code>
+ * @param flag if it's equal to <code>'V'</code> then the method inserts
+ * a double-value in the cell else it inserts a formula in the cell
+ */
+ public static void insertIntoCell(
+ int CellX, int CellY, String theValue, XSpreadsheet TT1, String flag)
+ {
+ XCell oCell = null;
+
+ try {
+ oCell = TT1.getCellByPosition(CellX, CellY);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
+ System.out.println("Could not get Cell");
+ }
+
+ if (flag.equals("V")) {
+ oCell.setValue(new Float(theValue).floatValue());
+ } else {
+ oCell.setFormula(theValue);
+ }
+ } // end of insertIntoCell
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScChartsObj.java b/qadevOOo/tests/java/mod/_sc/ScChartsObj.java
new file mode 100644
index 000000000000..ffce67b4f173
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScChartsObj.java
@@ -0,0 +1,273 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableCharts;
+import com.sun.star.table.XTableChartsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.table.TableCharts</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::table::XTableCharts</code></li>
+* </ul>
+* @see com.sun.star.table.TableCharts
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.table.XTableCharts
+* @see ifc.container._XNameAccess
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.table._XTableCharts
+*/
+public class ScChartsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Inserts some values into the cells of the some cell
+ * range address. Obtains the collection of the charts using the interface
+ * <code>XTableChartsSupplier</code>. Creates and adds the chart that using
+ * the data from the cells of this cell range address. Collection of
+ * the charts is the instance of the service
+ * <code>com.sun.star.table.TableCharts</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'RECT'</code> for
+ * {@link ifc.table._XTableCharts}(of type <code>Rectangle</code>
+ * the position of the chart)</li>
+ * <li> <code>'ADDR'</code> for
+ * {@link ifc.table._XTableCharts}(of type
+ * <code>com.sun.star.table.CellRangeAddress[]</code> data source ranges
+ * for chart creating)</li>
+ * </ul>
+ * @see com.sun.star.container.XNamed
+ * @see com.sun.star.table.XTableChartsSupplier
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XSpreadsheet oSheet=null;
+
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ }
+
+ log.println("Creating the Header") ;
+
+ insertIntoCell(1,0,"JAN",oSheet,"");
+ insertIntoCell(2,0,"FEB",oSheet,"");
+ insertIntoCell(3,0,"MAR",oSheet,"");
+ insertIntoCell(4,0,"APR",oSheet,"");
+ insertIntoCell(5,0,"MAI",oSheet,"");
+ insertIntoCell(6,0,"JUN",oSheet,"");
+ insertIntoCell(7,0,"JUL",oSheet,"");
+ insertIntoCell(8,0,"AUG",oSheet,"");
+ insertIntoCell(9,0,"SEP",oSheet,"");
+ insertIntoCell(10,0,"OCT",oSheet,"");
+ insertIntoCell(11,0,"NOV",oSheet,"");
+ insertIntoCell(12,0,"DEC",oSheet,"");
+ insertIntoCell(13,0,"SUM",oSheet,"");
+
+ log.println("Fill the lines");
+
+ insertIntoCell(0,1,"Smith",oSheet,"");
+ insertIntoCell(1,1,"42",oSheet,"V");
+ insertIntoCell(2,1,"58.9",oSheet,"V");
+ insertIntoCell(3,1,"-66.5",oSheet,"V");
+ insertIntoCell(4,1,"43.4",oSheet,"V");
+ insertIntoCell(5,1,"44.5",oSheet,"V");
+ insertIntoCell(6,1,"45.3",oSheet,"V");
+ insertIntoCell(7,1,"-67.3",oSheet,"V");
+ insertIntoCell(8,1,"30.5",oSheet,"V");
+ insertIntoCell(9,1,"23.2",oSheet,"V");
+ insertIntoCell(10,1,"-97.3",oSheet,"V");
+ insertIntoCell(11,1,"22.4",oSheet,"V");
+ insertIntoCell(12,1,"23.5",oSheet,"V");
+ insertIntoCell(13,1,"=SUM(B2:M2)",oSheet,"");
+
+ insertIntoCell(0,2,"Jones",oSheet,"");
+ insertIntoCell(1,2,"21",oSheet,"V");
+ insertIntoCell(2,2,"40.9",oSheet,"V");
+ insertIntoCell(3,2,"-57.5",oSheet,"V");
+ insertIntoCell(4,2,"-23.4",oSheet,"V");
+ insertIntoCell(5,2,"34.5",oSheet,"V");
+ insertIntoCell(6,2,"59.3",oSheet,"V");
+ insertIntoCell(7,2,"27.3",oSheet,"V");
+ insertIntoCell(8,2,"-38.5",oSheet,"V");
+ insertIntoCell(9,2,"43.2",oSheet,"V");
+ insertIntoCell(10,2,"57.3",oSheet,"V");
+ insertIntoCell(11,2,"25.4",oSheet,"V");
+ insertIntoCell(12,2,"28.5",oSheet,"V");
+ insertIntoCell(13,2,"=SUM(B3:M3)",oSheet,"");
+
+ insertIntoCell(0,3,"Brown",oSheet,"");
+ insertIntoCell(1,3,"31.45",oSheet,"V");
+ insertIntoCell(2,3,"-20.9",oSheet,"V");
+ insertIntoCell(3,3,"-117.5",oSheet,"V");
+ insertIntoCell(4,3,"23.4",oSheet,"V");
+ insertIntoCell(5,3,"-114.5",oSheet,"V");
+ insertIntoCell(6,3,"115.3",oSheet,"V");
+ insertIntoCell(7,3,"-171.3",oSheet,"V");
+ insertIntoCell(8,3,"89.5",oSheet,"V");
+ insertIntoCell(9,3,"41.2",oSheet,"V");
+ insertIntoCell(10,3,"71.3",oSheet,"V");
+ insertIntoCell(11,3,"25.4",oSheet,"V");
+ insertIntoCell(12,3,"38.5",oSheet,"V");
+ insertIntoCell(13,3,"=SUM(A4:L4)",oSheet,"");
+
+ // insert a chart
+ Rectangle oRect = new Rectangle(500, 3000, 25000, 11000);
+
+ XCellRange oRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ XCellRange myRange = oRange.getCellRangeByName("A1:N4");
+ XCellRangeAddressable oRangeAddr = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
+ CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
+
+ CellRangeAddress[] oAddr = new CellRangeAddress[1];
+ oAddr[0] = myAddr;
+ XTableChartsSupplier oSupp = (XTableChartsSupplier)
+ UnoRuntime.queryInterface(XTableChartsSupplier.class, oSheet);
+
+
+ log.println("Insert Chart");
+ XTableCharts oCharts = oSupp.getCharts();
+ oCharts.addNewByName("ScChartObj", oRect, oAddr, true, true);
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oCharts);
+
+ tEnv.addObjRelation("RECT", oRect);
+ tEnv.addObjRelation("ADDR", oAddr);
+
+ return tEnv;
+ }
+
+ /**
+ * Inserts a value or a formula in the cell of the spreasheet.
+ * @param CellX is the column index of the cell
+ * @param CellY is the row index of the cell
+ * @param theValue string representation of the value
+ * @param TT1 specify the spreadsheet, the interface
+ * <code>com.sun.star.sheet.XSpreadsheet</code>
+ * @param flag if it's equal to <code>'V'</code> then the method inserts
+ * a double-value in the cell else it inserts a formula in the cell
+ */
+ public static void insertIntoCell(
+ int CellX, int CellY, String theValue, XSpreadsheet TT1, String flag) {
+
+ XCell oCell = null;
+
+ try {
+ oCell = TT1.getCellByPosition(CellX, CellY);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
+ System.out.println("Could not get Cell");
+ }
+
+ if (flag.equals("V")) {
+ oCell.setValue(new Float(theValue).floatValue());
+ } else {
+ oCell.setFormula(theValue);
+ }
+
+ } // end of insertIntoCell
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScConsolidationDescriptor.java b/qadevOOo/tests/java/mod/_sc/ScConsolidationDescriptor.java
new file mode 100644
index 000000000000..9ca1dfb9c448
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScConsolidationDescriptor.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XConsolidatable;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.ConsolidationDescriptor</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XConsolidationDescriptor</code></li>
+* </ul>
+* @see com.sun.star.sheet.ConsolidationDescriptor
+* @see com.sun.star.sheet.XConsolidationDescriptor
+* @see ifc.sheet._XConsolidationDescriptor
+*/
+public class ScConsolidationDescriptor extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Creates consolidation description using
+ * the interface <code>XConsolidatable</code>.
+ * This description is the instance of the service
+ * <code>com.sun.star.sheet.ConsolidationDescriptor</code>.
+ * @see com.sun.star.sheet.ConsolidationDescriptor
+ * @see com.sun.star.sheet.XConsolidatable
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XConsolidatable xConsolidate = (XConsolidatable)
+ UnoRuntime.queryInterface(XConsolidatable.class, xSheetDoc);
+
+ oObj = xConsolidate.createConsolidationDescriptor(true);
+ // create testobject here
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScConsolidationDescriptor
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java b/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java
new file mode 100644
index 000000000000..a1f3dfb433f4
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDDELinkObj.java
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DDELink</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::util::XRefreshable</code></li>
+* <li> <code>com::sun::star::sheet::XDDELink</code></li>
+* </ul>
+* The following files used by this test :
+* <ul>
+* <li><b> ScDDELinksObj.sdc </b> : the predefined testdocument </li>
+* </ul> <p>
+* @see com.sun.star.sheet.DDELink
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.util.XRefreshable
+* @see com.sun.star.sheet.XDDELink
+* @see ifc.container._XNamed
+* @see ifc.util._XRefreshable
+* @see ifc.sheet._XDDELink
+*/
+public class ScDDELinkObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+ static XComponent oDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document and testdocument if it was loaded already.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ if (oDoc != null) {
+ util.DesktopTools.closeDoc(oDoc);
+ }
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Disposes the testdocument if it was loaded already.
+ * Creates an instance of the <code>com.sun.star.frame.Desktop</code>
+ * and loads the predefined testdocument. Retrieves a collection of
+ * spreadsheets from a document and takes one of them. Sets specific formula
+ * to some cells in the spreadsheet(the formula specify DDE links to the
+ * testdocument). Retrieves the collection of DDE links in the document and
+ * retrives first DDE link from the collection.
+ * The retrived DDE link is the instance of the service
+ * <code>com.sun.star.sheet.DDELink</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'setName'</code> for
+ * {@link ifc.container._XNamed}(specify that the method
+ * <code>setName</code> must not be tested)</li>
+ * <li> <code>'APPLICATION'</code> for
+ * {@link ifc.sheet._XDDELink}(the name of the current application)</li>
+ * <li> <code>'ITEM'</code> for
+ * {@link ifc.sheet._XDDELink}(the DDE item that was set in the formula)</li>
+ * <li> <code>'TOPIC'</code> for
+ * {@link ifc.sheet._XDDELink}(the full testdocument name)</li>
+ * </ul>
+ * @see com.sun.star.frame.Desktop
+ * @see com.sun.star.sheet.DDELink
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ if (oDoc != null) {
+ util.DesktopTools.closeDoc(oDoc);
+ }
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ XMultiServiceFactory oMSF = (XMultiServiceFactory)Param.getMSF();
+
+ // load the predefined testdocument
+ String testdoc = util.utils.getFullTestURL("ScDDELinksObj.sdc");
+ try {
+ oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ } catch (com.sun.star.io.IOException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ }
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ String sAppl = "soffice";
+ String sItem = "Sheet1.A1";
+ testdoc = util.utils.getFullTestDocName("ScDDELinksObj.sdc");
+ try {
+ oSheet.getCellByPosition(5, 5).setFormula(
+ "=DDE(\""+ sAppl +"\";\""+testdoc+"\";\""+ sItem +"\"");
+ oSheet.getCellByPosition(1, 4).setFormula(
+ "=DDE(\""+ sAppl +"\";\""+testdoc+"\";\""+ sItem +"\"");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while filling cells", e);
+ }
+
+ try {
+ log.println("Getting test object ") ;
+
+ // Getting named ranges.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ XNameAccess links = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class), UnoRuntime.queryInterface(
+ XNameAccess.class, docProps.getPropertyValue("DDELinks")));
+
+ String[] linkNames = links.getElementNames();
+
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),links.getByName(linkNames[0]));
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("APPLICATION", sAppl);
+ tEnv.addObjRelation("ITEM", sItem);
+ tEnv.addObjRelation("TOPIC", testdoc);
+ tEnv.addObjRelation("setName", new Boolean(true));
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java b/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java
new file mode 100644
index 000000000000..fbcb724c27fd
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDDELinksObj.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DDELinks</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* The following files used by this test :
+* <ul>
+* <li><b> ScDDELinksObj.sdc </b> : the predefined testdocument </li>
+* </ul> <p>
+* @see com.sun.star.sheet.DDELinks
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScDDELinksObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+ static XComponent oDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document and testdocument.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.
+ queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ util.DesktopTools.closeDoc(oDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Disposes the testdocument if it was loaded already.
+ * Creates an instance of the <code>com.sun.star.frame.Desktop</code>
+ * and loads the predefined testdocument. Retrieves a collection of
+ * spreadsheets from a document and takes one of them. Sets specific formula
+ * to some cells in the spreadsheet(the formula specify DDE links to the
+ * testdocument). Retrieves the collection of DDE links in the document.
+ * The retrived collection of DDE link is the instance of the service
+ * <code>com.sun.star.sheet.DDELinks</code>.
+ * @see com.sun.star.frame.Desktop
+ * @see com.sun.star.sheet.DDELinks
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ XMultiServiceFactory oMSF = (XMultiServiceFactory)Param.getMSF();
+
+ // load the predefined testdocument
+ String testdoc = utils.getFullTestURL("ScDDELinksObj.sdc");
+ try {
+ oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ } catch (com.sun.star.io.IOException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ }
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ testdoc = utils.getFullTestDocName("ScDDELinksObj.sdc");
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setFormula(
+ "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
+ oSheet.getCellByPosition(1, 4).setFormula(
+ "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
+ oSheet.getCellByPosition(2, 0).setFormula(
+ "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while filling cells", e);
+ }
+
+ try {
+ log.println("Getting test object ") ;
+
+ // Getting named ranges.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ oObj = (XInterface)AnyConverter.toObject(
+ new Type(XInterface.class),docProps.getPropertyValue("DDELinks"));
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java
new file mode 100644
index 000000000000..7ef352c94d2a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupItemObj.java
@@ -0,0 +1,371 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldGroupInfo;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotFieldGrouping;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+
+public class ScDataPilotFieldGroupItemObj extends TestCase
+{
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize (TestParameters tParam, PrintWriter log)
+ {
+ SOfficeFactory SOF = SOfficeFactory.getFactory (
+ (XMultiServiceFactory) tParam.getMSF ());
+
+ try
+ {
+ log.println ("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc (null);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // Some exception occures.FAILED
+ e.printStackTrace (log);
+ throw new StatusException ("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup (TestParameters tParam, PrintWriter log)
+ {
+ log.println (" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface (
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc (oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment (TestParameters Param,
+ PrintWriter log)
+ {
+ XInterface oObj = null;
+ XInterface datapilotfield = null;
+ XInterface groups = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println ("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress ();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress ();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println ("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets ();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface (
+ XIndexAccess.class, xSpreadsheets);
+
+ try
+ {
+ oSheet = (XSpreadsheet) AnyConverter.toObject (
+ new Type (XSpreadsheet.class),
+ oIndexAccess.getByIndex (0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject (
+ new Type (XSpreadsheet.class),
+ oIndexAccess.getByIndex (1));
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+
+ try
+ {
+ log.println ("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ {
+ oSheet.getCellByPosition (i, 0).setFormula ("Col" + i);
+ oSheet.getCellByPosition (0, i).setFormula ("Row" + i);
+ oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i);
+ oSheet2.getCellByPosition (0, i).setFormula ("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ {
+ for (int j = 1; j < mMaxFieldIndex; j++)
+ {
+ oSheet.getCellByPosition (i, j).setValue (i * (j + 1));
+ oSheet2.getCellByPosition (i, j).setValue (i * (j + 2));
+ }
+ }
+
+ oSheet.getCellByPosition (1, 1).setFormula ("aName");
+ oSheet.getCellByPosition (1, 2).setFormula ("otherName");
+ oSheet.getCellByPosition (1, 3).setFormula ("una");
+ oSheet.getCellByPosition (1, 4).setFormula ("otherName");
+ oSheet.getCellByPosition (1, 5).setFormula ("somethingelse");
+
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try
+ {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition (1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition (x, y);
+ aChangeValue = new Integer (27);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println ("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface (
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables ();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor ();
+ DPDsc.setSourceRange (sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try
+ {
+ Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.ROW);
+ oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.COLUMN);
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.beans.PropertyVetoException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+
+ log.println ("Insert the DataPilotTable");
+
+ if (DPT.hasByName ("DataPilotTable"))
+ {
+ DPT.removeByName ("DataPilotTable");
+ }
+
+ DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc);
+ XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
+ XIndexAccess IA = null;
+ try
+ {
+ XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
+ IA = xDPT.getRowFields ();
+ //getSRange(IA);
+ System.out.println ("COUNT: "+IA.getCount ());
+ datapilotfield = (XInterface) AnyConverter.toObject (
+ new Type (XInterface.class), IA.getByIndex (0));
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+
+ try
+ {
+ XDataPilotFieldGrouping dpfg = (XDataPilotFieldGrouping) UnoRuntime.queryInterface (XDataPilotFieldGrouping.class, datapilotfield);
+ String[] elements = new String[]{"aName","otherName"};
+ dpfg.createNameGroup (elements);
+ DataPilotFieldGroupInfo dpgi=null;
+ xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
+ try
+ {
+ XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
+ IA = xDPT.getRowFields ();
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ for (int i=0;i<IA.getCount ();i++)
+ {
+ datapilotfield = (XInterface) AnyConverter.toObject (
+ new Type (XInterface.class), IA.getByIndex (i));
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, IA.getByIndex (i));
+ if (((Boolean)xPropertySet.getPropertyValue ("IsGroupField")).booleanValue ())
+ {
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, datapilotfield);
+ XNamed xNamed = (XNamed) UnoRuntime.queryInterface (XNamed.class, IA.getByIndex (i));
+ System.out.println ("name: "+xNamed.getName ());
+ dpgi = (DataPilotFieldGroupInfo) xPropertySet.getPropertyValue ("GroupInfo");
+ }
+ }
+ groups = dpgi.Groups;
+ XIndexAccess groupAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, groups);
+ XNameAccess groupNames = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, groupAccess.getByIndex(0));
+ oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class, groupNames.getByName("aName"));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace ();
+ }
+
+ log.println ("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment (oObj);
+
+ log.println ("Implementationname: " + util.utils.getImplName (oObj));
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java
new file mode 100644
index 000000000000..71a699175c85
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupObj.java
@@ -0,0 +1,369 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldGroupInfo;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotFieldGrouping;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+
+public class ScDataPilotFieldGroupObj extends TestCase
+{
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize (TestParameters tParam, PrintWriter log)
+ {
+ SOfficeFactory SOF = SOfficeFactory.getFactory (
+ (XMultiServiceFactory) tParam.getMSF ());
+
+ try
+ {
+ log.println ("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc (null);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // Some exception occures.FAILED
+ e.printStackTrace (log);
+ throw new StatusException ("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup (TestParameters tParam, PrintWriter log)
+ {
+ log.println (" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface (
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc (oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment (TestParameters Param,
+ PrintWriter log)
+ {
+ XInterface oObj = null;
+ XInterface datapilotfield = null;
+ XInterface groups = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println ("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress ();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress ();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println ("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets ();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface (
+ XIndexAccess.class, xSpreadsheets);
+
+ try
+ {
+ oSheet = (XSpreadsheet) AnyConverter.toObject (
+ new Type (XSpreadsheet.class),
+ oIndexAccess.getByIndex (0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject (
+ new Type (XSpreadsheet.class),
+ oIndexAccess.getByIndex (1));
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+
+ try
+ {
+ log.println ("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ {
+ oSheet.getCellByPosition (i, 0).setFormula ("Col" + i);
+ oSheet.getCellByPosition (0, i).setFormula ("Row" + i);
+ oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i);
+ oSheet2.getCellByPosition (0, i).setFormula ("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ {
+ for (int j = 1; j < mMaxFieldIndex; j++)
+ {
+ oSheet.getCellByPosition (i, j).setValue (i * (j + 1));
+ oSheet2.getCellByPosition (i, j).setValue (i * (j + 2));
+ }
+ }
+
+ oSheet.getCellByPosition (1, 1).setFormula ("aName");
+ oSheet.getCellByPosition (1, 2).setFormula ("otherName");
+ oSheet.getCellByPosition (1, 3).setFormula ("una");
+ oSheet.getCellByPosition (1, 4).setFormula ("otherName");
+ oSheet.getCellByPosition (1, 5).setFormula ("somethingelse");
+
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try
+ {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition (1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition (x, y);
+ aChangeValue = new Integer (27);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println ("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface (
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables ();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor ();
+ DPDsc.setSourceRange (sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try
+ {
+ Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.ROW);
+ oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.COLUMN);
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.beans.PropertyVetoException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+
+ log.println ("Insert the DataPilotTable");
+
+ if (DPT.hasByName ("DataPilotTable"))
+ {
+ DPT.removeByName ("DataPilotTable");
+ }
+
+ DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc);
+ XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
+ XIndexAccess IA = null;
+ try
+ {
+ XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
+ IA = xDPT.getRowFields ();
+ //getSRange(IA);
+ System.out.println ("COUNT: "+IA.getCount ());
+ datapilotfield = (XInterface) AnyConverter.toObject (
+ new Type (XInterface.class), IA.getByIndex (0));
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+
+ try
+ {
+ XDataPilotFieldGrouping dpfg = (XDataPilotFieldGrouping) UnoRuntime.queryInterface (XDataPilotFieldGrouping.class, datapilotfield);
+ String[] elements = new String[]{"aName","otherName"};
+ dpfg.createNameGroup (elements);
+ DataPilotFieldGroupInfo dpgi=null;
+ xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
+ try
+ {
+ XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
+ IA = xDPT.getRowFields ();
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ for (int i=0;i<IA.getCount ();i++)
+ {
+ datapilotfield = (XInterface) AnyConverter.toObject (
+ new Type (XInterface.class), IA.getByIndex (i));
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, IA.getByIndex (i));
+ if (((Boolean)xPropertySet.getPropertyValue ("IsGroupField")).booleanValue ())
+ {
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, datapilotfield);
+ XNamed xNamed = (XNamed) UnoRuntime.queryInterface (XNamed.class, IA.getByIndex (i));
+ System.out.println ("name: "+xNamed.getName ());
+ dpgi = (DataPilotFieldGroupInfo) xPropertySet.getPropertyValue ("GroupInfo");
+ }
+ }
+ groups = dpgi.Groups;
+ XIndexAccess groupAccess = (XIndexAccess) UnoRuntime.queryInterface(XIndexAccess.class, groups);
+ oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class, groupAccess.getByIndex(0));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace ();
+ }
+
+ log.println ("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment (oObj);
+
+ log.println ("Implementationname: " + util.utils.getImplName (oObj));
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java
new file mode 100644
index 000000000000..152c1d82a09a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldGroupsObj.java
@@ -0,0 +1,367 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldGroupInfo;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotFieldGrouping;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+
+public class ScDataPilotFieldGroupsObj extends TestCase
+{
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize (TestParameters tParam, PrintWriter log)
+ {
+ SOfficeFactory SOF = SOfficeFactory.getFactory (
+ (XMultiServiceFactory) tParam.getMSF ());
+
+ try
+ {
+ log.println ("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc (null);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ // Some exception occures.FAILED
+ e.printStackTrace (log);
+ throw new StatusException ("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup (TestParameters tParam, PrintWriter log)
+ {
+ log.println (" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface (
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc (oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment (TestParameters Param,
+ PrintWriter log)
+ {
+ XInterface oObj = null;
+ XInterface datapilotfield = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println ("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress ();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress ();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println ("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets ();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface (
+ XIndexAccess.class, xSpreadsheets);
+
+ try
+ {
+ oSheet = (XSpreadsheet) AnyConverter.toObject (
+ new Type (XSpreadsheet.class),
+ oIndexAccess.getByIndex (0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject (
+ new Type (XSpreadsheet.class),
+ oIndexAccess.getByIndex (1));
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get a spreadsheet", e);
+ }
+
+ try
+ {
+ log.println ("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ {
+ oSheet.getCellByPosition (i, 0).setFormula ("Col" + i);
+ oSheet.getCellByPosition (0, i).setFormula ("Row" + i);
+ oSheet2.getCellByPosition (i, 0).setFormula ("Col" + i);
+ oSheet2.getCellByPosition (0, i).setFormula ("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ {
+ for (int j = 1; j < mMaxFieldIndex; j++)
+ {
+ oSheet.getCellByPosition (i, j).setValue (i * (j + 1));
+ oSheet2.getCellByPosition (i, j).setValue (i * (j + 2));
+ }
+ }
+
+ oSheet.getCellByPosition (1, 1).setFormula ("aName");
+ oSheet.getCellByPosition (1, 2).setFormula ("otherName");
+ oSheet.getCellByPosition (1, 3).setFormula ("una");
+ oSheet.getCellByPosition (1, 4).setFormula ("otherName");
+ oSheet.getCellByPosition (1, 5).setFormula ("somethingelse");
+
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try
+ {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition (1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition (x, y);
+ aChangeValue = new Integer (27);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println ("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface (
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables ();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor ();
+ DPDsc.setSourceRange (sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try
+ {
+ Object oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.ROW);
+ oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (1);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ oDataPilotField = DPDsc.getDataPilotFields ().getByIndex (2);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface (
+ XPropertySet.class, oDataPilotField);
+ fieldPropSet.setPropertyValue ("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.COLUMN);
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.beans.PropertyVetoException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.beans.UnknownPropertyException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't create a test environment", e);
+ }
+
+ log.println ("Insert the DataPilotTable");
+
+ if (DPT.hasByName ("DataPilotTable"))
+ {
+ DPT.removeByName ("DataPilotTable");
+ }
+
+ DPT.insertNewByName ("DataPilotTable", sCellAdress, DPDsc);
+ XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
+ XIndexAccess IA = null;
+ try
+ {
+ XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
+ IA = xDPT.getRowFields ();
+ //getSRange(IA);
+ System.out.println ("COUNT: "+IA.getCount ());
+ datapilotfield = (XInterface) AnyConverter.toObject (
+ new Type (XInterface.class), IA.getByIndex (0));
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IllegalArgumentException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+
+ try
+ {
+ XDataPilotFieldGrouping dpfg = (XDataPilotFieldGrouping) UnoRuntime.queryInterface (XDataPilotFieldGrouping.class, datapilotfield);
+ String[] elements = new String[]{"aName","otherName"};
+ dpfg.createNameGroup (elements);
+ DataPilotFieldGroupInfo dpgi=null;
+ xIA = (XIndexAccess) UnoRuntime.queryInterface (XIndexAccess.class,DPTS.getDataPilotTables ());
+ try
+ {
+ XDataPilotDescriptor xDPT = (XDataPilotDescriptor) UnoRuntime.queryInterface (XDataPilotDescriptor.class,xIA.getByIndex (0));
+ IA = xDPT.getRowFields ();
+ }
+ catch (com.sun.star.lang.WrappedTargetException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ catch (com.sun.star.lang.IndexOutOfBoundsException e)
+ {
+ e.printStackTrace ();
+ throw new StatusException ("Couldn't get data pilot field", e);
+ }
+ for (int i=0;i<IA.getCount ();i++)
+ {
+ datapilotfield = (XInterface) AnyConverter.toObject (
+ new Type (XInterface.class), IA.getByIndex (i));
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, IA.getByIndex (i));
+ if (((Boolean)xPropertySet.getPropertyValue ("IsGroupField")).booleanValue ())
+ {
+ xPropertySet = (XPropertySet) UnoRuntime.queryInterface (XPropertySet.class, datapilotfield);
+ XNamed xNamed = (XNamed) UnoRuntime.queryInterface (XNamed.class, IA.getByIndex (i));
+ System.out.println ("name: "+xNamed.getName ());
+ dpgi = (DataPilotFieldGroupInfo) xPropertySet.getPropertyValue ("GroupInfo");
+ }
+ }
+ oObj = dpgi.Groups;
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace ();
+ }
+
+ log.println ("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment (oObj);
+
+ log.println ("Implementationname: " + util.utils.getImplName (oObj));
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java
new file mode 100644
index 000000000000..c19e8dab3b36
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldObj.java
@@ -0,0 +1,396 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldOrientation;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotField</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::DataPilotField</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.sheet._DataPilotField
+* @see ifc.beans._XPropertySet
+*/
+public class ScDataPilotFieldObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table and inserts new data pilot table with this descriptor
+ * to the collection. Obtains the collection of all the data pilot fields
+ * using the interface <code>XDataPilotDescriptor</code>. Retrieves from
+ * the collection the data pilot field with index 0. This data pilot field
+ * is the instance of the service <code>com.sun.star.sheet.DataPilotField</code>.
+ * @see com.sun.star.sheet.DataPilotField
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ * @see com.sun.star.sheet.XDataPilotDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(1));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ oSheet2.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet2.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ for (int j = 1; j < mMaxFieldIndex; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ oSheet2.getCellByPosition(i, j).setValue(i * (j + 2));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition(1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition(x, y);
+ aChangeValue = new Integer(27);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface(
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try {
+ Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oDataPilotField);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ try {
+ fieldPropSet.setPropertyValue("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ log.println("Insert the DataPilotTable");
+
+ if (DPT.hasByName("DataPilotTable")) {
+ DPT.removeByName("DataPilotTable");
+ }
+
+ XIndexAccess IA = DPDsc.getDataPilotFields();
+ getSRange(IA);
+
+ DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc);
+
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class), IA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ }
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+ private void getSRange(XIndexAccess IA) {
+ int fieldsAmount = IA.getCount() + 1;
+
+ String[] fieldsNames = new String[fieldsAmount];
+
+ int i = -1;
+ int cnt = 0;
+
+ while ((++i) < fieldsAmount) {
+ Object field;
+
+ try {
+ field = IA.getByIndex(i);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ XNamed named = (XNamed) UnoRuntime.queryInterface(XNamed.class,
+ field);
+ String name = named.getName();
+
+ log.println("**Field : '" + name + "' ... ");
+
+ if (!name.equals("Data")) {
+ fieldsNames[cnt] = name;
+
+ XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, field);
+
+ try {
+ switch (cnt % 5) {
+ case 0:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.COLUMN);
+ log.println(" Column");
+
+ break;
+
+ case 1:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.ROW);
+ log.println(" Row");
+
+ break;
+
+ case 2:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.DATA);
+ log.println(" Data");
+
+ break;
+
+ case 3:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.HIDDEN);
+ log.println(" Hidden");
+
+ break;
+
+ case 4:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.PAGE);
+ log.println(" Page");
+
+ break;
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ if ((++cnt) > 4) {
+ break;
+ }
+ } else {
+ return;
+ }
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java
new file mode 100644
index 000000000000..a8de7196baba
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotFieldsObj.java
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotFields</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotFields
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScDataPilotFieldsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table and inserts new data pilot table with this descriptor
+ * to the collection. Obtains the collection of all the data pilot fields
+ * using the interface <code>XDataPilotDescriptor</code>. This collection
+ * is the instance of the service <code>com.sun.star.sheet.DataPilotFields</code>.
+ * @see com.sun.star.sheet.DataPilotFields
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ * @see com.sun.star.sheet.XDataPilotDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filing a table");
+ for (int i = 1; i < 4; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < 4; i++)
+ for (int j = 1; j < 4; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
+ UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
+
+ log.println("Getting test object ") ;
+
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(new CellRangeAddress((short)0, 0, 0, 4, 4));
+ DPT.insertNewByName(
+ "DataPilotTable",
+ new CellAddress((short)0, 5, 5),
+ DPDsc);
+
+ oObj = DPDsc.getDataPilotFields();
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java
new file mode 100644
index 000000000000..c50a32775416
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemObj.java
@@ -0,0 +1,414 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldOrientation;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotField;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotField</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::DataPilotField</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.sheet._DataPilotField
+* @see ifc.beans._XPropertySet
+*/
+public class ScDataPilotItemObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table and inserts new data pilot table with this descriptor
+ * to the collection. Obtains the collection of all the data pilot fields
+ * using the interface <code>XDataPilotDescriptor</code>. Retrieves from
+ * the collection the data pilot field with index 0. This data pilot field
+ * is the instance of the service <code>com.sun.star.sheet.DataPilotField</code>.
+ * @see com.sun.star.sheet.DataPilotField
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ * @see com.sun.star.sheet.XDataPilotDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(1));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ oSheet2.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet2.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ for (int j = 1; j < mMaxFieldIndex; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ oSheet2.getCellByPosition(i, j).setValue(i * (j + 2));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition(1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition(x, y);
+ aChangeValue = new Integer(27);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface(
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try {
+ Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oDataPilotField);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ try {
+ fieldPropSet.setPropertyValue("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ log.println("Insert the DataPilotTable");
+
+ if (DPT.hasByName("DataPilotTable")) {
+ DPT.removeByName("DataPilotTable");
+ }
+
+ XIndexAccess IA = DPDsc.getDataPilotFields();
+ getSRange(IA);
+
+ DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc);
+
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class), IA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ }
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ XDataPilotField xDataPilotField = (XDataPilotField) UnoRuntime.queryInterface(
+ XDataPilotField.class, oObj);
+
+ XIndexAccess xIA = xDataPilotField.getItems();
+
+ try {
+ oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class,
+ xIA.getByIndex(0));
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't get DataPilotItemObj");
+ e.printStackTrace(log);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't get DataPilotItemObj");
+ e.printStackTrace(log);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("NoSetName", "ScDataPilotItemObj");
+ return tEnv;
+ }
+
+ private void getSRange(XIndexAccess IA) {
+ int fieldsAmount = IA.getCount() + 1;
+
+ String[] fieldsNames = new String[fieldsAmount];
+
+ int i = -1;
+ int cnt = 0;
+
+ while ((++i) < fieldsAmount) {
+ Object field;
+
+ try {
+ field = IA.getByIndex(i);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ XNamed named = (XNamed) UnoRuntime.queryInterface(XNamed.class,
+ field);
+ String name = named.getName();
+
+ log.println("**Field : '" + name + "' ... ");
+
+ if (!name.equals("Data")) {
+ fieldsNames[cnt] = name;
+
+ XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, field);
+
+ try {
+ switch (cnt % 5) {
+ case 0:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.COLUMN);
+ log.println(" Column");
+
+ break;
+
+ case 1:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.ROW);
+ log.println(" Row");
+
+ break;
+
+ case 2:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.DATA);
+ log.println(" Data");
+
+ break;
+
+ case 3:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.HIDDEN);
+ log.println(" Hidden");
+
+ break;
+
+ case 4:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.PAGE);
+ log.println(" Page");
+
+ break;
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ if ((++cnt) > 4) {
+ break;
+ }
+ } else {
+ return;
+ }
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java
new file mode 100644
index 000000000000..ac9971b3c778
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotItemsObj.java
@@ -0,0 +1,402 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldOrientation;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotField;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotField</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::DataPilotField</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.sheet._DataPilotField
+* @see ifc.beans._XPropertySet
+*/
+public class ScDataPilotItemsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table and inserts new data pilot table with this descriptor
+ * to the collection. Obtains the collection of all the data pilot fields
+ * using the interface <code>XDataPilotDescriptor</code>. Retrieves from
+ * the collection the data pilot field with index 0. This data pilot field
+ * is the instance of the service <code>com.sun.star.sheet.DataPilotField</code>.
+ * @see com.sun.star.sheet.DataPilotField
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ * @see com.sun.star.sheet.XDataPilotDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(1));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ oSheet2.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet2.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ for (int j = 1; j < mMaxFieldIndex; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ oSheet2.getCellByPosition(i, j).setValue(i * (j + 2));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition(1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition(x, y);
+ aChangeValue = new Integer(27);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface(
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try {
+ Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oDataPilotField);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ try {
+ fieldPropSet.setPropertyValue("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ log.println("Insert the DataPilotTable");
+
+ if (DPT.hasByName("DataPilotTable")) {
+ DPT.removeByName("DataPilotTable");
+ }
+
+ XIndexAccess IA = DPDsc.getDataPilotFields();
+ getSRange(IA);
+
+ DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc);
+
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class), IA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ }
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ XDataPilotField xDataPilotField = (XDataPilotField) UnoRuntime.queryInterface(
+ XDataPilotField.class, oObj);
+
+ oObj = xDataPilotField.getItems();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+ private void getSRange(XIndexAccess IA) {
+ int fieldsAmount = IA.getCount() + 1;
+
+ String[] fieldsNames = new String[fieldsAmount];
+
+ int i = -1;
+ int cnt = 0;
+
+ while ((++i) < fieldsAmount) {
+ Object field;
+
+ try {
+ field = IA.getByIndex(i);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ XNamed named = (XNamed) UnoRuntime.queryInterface(XNamed.class,
+ field);
+ String name = named.getName();
+
+ log.println("**Field : '" + name + "' ... ");
+
+ if (!name.equals("Data")) {
+ fieldsNames[cnt] = name;
+
+ XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, field);
+
+ try {
+ switch (cnt % 5) {
+ case 0:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.COLUMN);
+ log.println(" Column");
+
+ break;
+
+ case 1:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.ROW);
+ log.println(" Row");
+
+ break;
+
+ case 2:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.DATA);
+ log.println(" Data");
+
+ break;
+
+ case 3:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.HIDDEN);
+ log.println(" Hidden");
+
+ break;
+
+ case 4:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.PAGE);
+ log.println(" Page");
+
+ break;
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ if ((++cnt) > 4) {
+ break;
+ }
+ } else {
+ return;
+ }
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java
new file mode 100644
index 000000000000..290c2d9c07b2
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTableObj.java
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.TableFilterField;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSheetFilterDescriptor;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotTable</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::XDataPilotTable</code></li>
+* <li> <code>com::sun::star::sheet::XDataPilotDescriptor</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotTable
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.XDataPilotTable
+* @see com.sun.star.sheet.XDataPilotDescriptor
+* @see ifc.container._XNamed
+* @see ifc.sheet._XDataPilotTable
+* @see ifc.sheet._XDataPilotDescriptor
+*/
+public class ScDataPilotTableObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table. Obtains the collection of all the data pilot fields
+ * using the interface <code>XDataPilotDescriptor</code>. Sets field
+ * orientation for every of the data pilot fields. Sets the definitions of
+ * the filter fields for the created description. Inserts new data pilot
+ * table with this descriptor to the collection.
+ * This new data pilot table is the instance of the service
+ * <code>com.sun.star.sheet.DataPilotTable</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'OUTPUTRANGE'</code> for
+ * {@link ifc.sheet._XDataPilotTable}(the cell range address of the
+ * created data pilot table) </li>
+ * <li> <code>'FIELDSAMOUNT'</code> for
+ * {@link ifc.sheet._XDataPilotDescriptor}(the number of filled fields
+ * which descriptor was created for) </li>
+ * <li> <code>'CELLFORCHANGE'</code> for
+ * {@link ifc.sheet._XDataPilotTable}(value of this cell will be changed)</li>
+ * <li> <code>'CELLFORCHECK'</code> for
+ * {@link ifc.sheet._XDataPilotTable}(value of this cell must be changed
+ * after refresh call)</li>
+ * </ul>
+ * @see com.sun.star.sheet.DataPilotTable
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ * @see com.sun.star.sheet.XDataPilotDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ CellAddress sCellAddress = new CellAddress();
+ sCellAddress.Sheet = 0;
+ sCellAddress.Column = 7;
+ sCellAddress.Row = 8;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = xSheetDoc.getSheets();
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ XSpreadsheet oSheet = null;
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ oChangeCell = oSheet.getCellByPosition(1, 5);
+ oCheckCell = oSheet.getCellByPosition(
+ sCellAddress.Column, sCellAddress.Row + 3);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+ log.println("Getting sheet - " + (oSheet == null ? "FAILED" : "OK"));
+ try {
+ log.println("Filing a table");
+ for (int i = 1; i < 6; i++) {
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ }
+
+ for (int i = 1; i < 6; i++)
+ for (int j = 1; j < 6; j++) {
+ oSheet.getCellByPosition(i, j).setValue(2.5 * j + i);
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ CellRangeAddress sCellRangeAddress = new CellRangeAddress();
+ sCellRangeAddress.Sheet = 0;
+ sCellRangeAddress.StartColumn = 1;
+ sCellRangeAddress.StartRow = 0;
+ sCellRangeAddress.EndColumn = 5;
+ sCellRangeAddress.EndRow = 5;
+
+ TableFilterField[] filterFields = new TableFilterField[2];
+ filterFields[0] = new TableFilterField();
+ filterFields[0].Connection = com.sun.star.sheet.FilterConnection.AND;
+ filterFields[0].Field = 1;
+ filterFields[0].IsNumeric = true;
+ filterFields[0].NumericValue = 4;
+ filterFields[0].Operator = com.sun.star.sheet.FilterOperator.GREATER;
+ filterFields[1] = new TableFilterField();
+ filterFields[1].Connection = com.sun.star.sheet.FilterConnection.AND;
+ filterFields[1].Field = 1;
+ filterFields[1].IsNumeric = true;
+ filterFields[1].NumericValue = 12;
+ filterFields[1].Operator = com.sun.star.sheet.FilterOperator.LESS_EQUAL;
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
+ UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
+ log.println("Getting test object");
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(sCellRangeAddress);
+
+ XSheetFilterDescriptor SFD = DPDsc.getFilterDescriptor();
+ SFD.setFilterFields(filterFields);
+
+ XPropertySet fieldPropSet = null;
+ try {
+ Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0);
+ fieldPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oDataPilotField);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ try {
+ fieldPropSet.setPropertyValue("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ if (DPT.hasByName("DataPilotTable")) {
+ DPT.removeByName("DataPilotTable");
+ }
+ DPT.insertNewByName("DataPilotTable", sCellAddress, DPDsc);
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),DPT.getByName(DPT.getElementNames()[0]));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("OUTPUTRANGE", sCellAddress);
+ tEnv.addObjRelation("CELLFORCHANGE", oChangeCell);
+ tEnv.addObjRelation("CELLFORCHECK", oCheckCell);
+ tEnv.addObjRelation("FIELDSAMOUNT", new Integer(5));
+ tEnv.addObjRelation("SHEETDOCUMENT", xSheetDoc);
+
+ createTable2(oSheet, sCellRangeAddress, tEnv);
+
+ return tEnv;
+ }
+
+ /**
+ * Create a new DataPilot table output for use with testing XDataPilotTable2
+ * interface.
+ *
+ * @param oSheet current sheet instance
+ * @param srcRange source range
+ * @param tEnv test environment instance
+ */
+ private void createTable2(XSpreadsheet oSheet, CellRangeAddress srcRange, TestEnvironment tEnv)
+ {
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
+ UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
+ log.println("Creating test table object");
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(srcRange);
+
+ XIndexAccess xIA = DPDsc.getDataPilotFields();
+ int fieldCount = xIA.getCount() - 1; // skip the last field because it's always hidden.
+ try
+ {
+ for (int i = 0; i < fieldCount; ++i)
+ {
+ Object o = xIA.getByIndex(i);
+ XPropertySet fieldPropSet = (XPropertySet)UnoRuntime.queryInterface(
+ XPropertySet.class, o);
+
+ if (i == fieldCount - 1)
+ {
+ // last field
+ fieldPropSet.setPropertyValue(
+ "Function", com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue(
+ "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ }
+ else if (i%2 == 0)
+ {
+ // even number fields
+ fieldPropSet.setPropertyValue(
+ "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.COLUMN);
+ }
+ else if (i%2 == 1)
+ {
+ // odd number fields
+ fieldPropSet.setPropertyValue(
+ "Orientation", com.sun.star.sheet.DataPilotFieldOrientation.ROW);
+ }
+ }
+
+ if (DPT.hasByName("DataPilotTable2"))
+ DPT.removeByName("DataPilotTable2");
+
+ CellAddress destAddr = new CellAddress();
+ destAddr.Sheet = 0;
+ destAddr.Column = 0;
+ destAddr.Row = 14;
+ DPT.insertNewByName("DataPilotTable2", destAddr, DPDsc);
+
+ Object o = DPT.getByName("DataPilotTable2");
+ tEnv.addObjRelation("DATAPILOTTABLE2", o);
+ }
+ catch (com.sun.star.uno.Exception e)
+ {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java b/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java
new file mode 100644
index 000000000000..27ce48595b7c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDataPilotTablesObj.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotTables</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XDataPilotTables</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotTables
+* @see com.sun.star.sheet.XDataPilotTables
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.sheet._XDataPilotTables
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScDataPilotTablesObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table and inserts new data pilot table with this descriptor
+ * to the collection. The collection of data pilot tables is the instance of
+ * the service <code>com.sun.star.sheet.DataPilotTables</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SHEET'</code> for
+ * {@link ifc.sheet._XDataPilotTables}(the spreadsheet which
+ * the collection of data pilot tables was retrieved from) </li>
+ * </ul>
+ * @see com.sun.star.sheet.DataPilotTable
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+
+ try {
+ log.println("Filing a table");
+ for (int i = 1; i < 4; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < 4; i++)
+ for (int j = 1; j < 4; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
+ UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
+
+ log.println("Getting test object ") ;
+
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(new CellRangeAddress((short)0, 0, 0, 4, 4));
+ DPT.insertNewByName(
+ "DataPilotTable",
+ new CellAddress((short)0, 5, 5),
+ DPDsc );
+
+ oObj = DPT;
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("SHEET", oSheet);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java
new file mode 100644
index 000000000000..0b9a71c860a3
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangeObj.java
@@ -0,0 +1,258 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XCellRangeReferrer;
+import com.sun.star.sheet.XDatabaseRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XImportable;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DatabaseRange</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::DatabaseRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::sheet::XDatabaseRange</code></li>
+* <li> <code>com::sun::star::sheet::XCellRangeReferrer</code></li>
+* </ul>
+* @see com.sun.star.sheet.DatabaseRange
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.DatabaseRange
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.sheet.XDatabaseRange
+* @see com.sun.star.sheet.XCellRangeReferrer
+* @see ifc.container._XNamed
+* @see ifc.sheet._DatabaseRange
+* @see ifc.beans._XPropertySet
+* @see ifc.sheet._XDatabaseRange
+* @see ifc.sheet._XCellRangeReferrer
+*/
+public class ScDatabaseRangeObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of database ranges in the document.
+ * If the database range with name <code>'dbRange'</code> exists
+ * in the collection then removes it from the collection.
+ * Creates new database range and adds it to the collection with the name
+ * <code>'dbRange'</code>.The database range that was added to the collection
+ * is the instance of the service <code>com.sun.star.sheet.DatabaseRange</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'DATAAREA'</code> for
+ * {@link ifc.sheet._XCellRangeReferrer}(of type
+ * <code>CellRangeAddress</code>)</li>
+ * <li> <code>'XCELLRANGE'</code> (of type <code>XCellRange</code>):
+ * cell range of the spreadsheet with database range</li>
+ * </ul>
+ * @see com.sun.star.sheet.DatabaseRange
+ * @see com.sun.star.table.CellRangeAddress
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ log.println("Getting test object ");
+
+ XPropertySet docProps = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xSheetDoc);
+
+ XSpreadsheets sheets = xSheetDoc.getSheets();
+ String[] names = sheets.getElementNames();
+ XDatabaseRanges dbRanges = null;
+ XImportable xImp = null;
+
+ try {
+ Object sheet = sheets.getByName(names[0]);
+ xImp = (XImportable) UnoRuntime.queryInterface(XImportable.class,
+ sheet);
+ dbRanges = (XDatabaseRanges) AnyConverter.toObject(
+ new Type(XDatabaseRanges.class),
+ docProps.getPropertyValue("DatabaseRanges"));
+ _doImport(xImp);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a property", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a property", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a property", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e);
+ }
+
+ if (dbRanges.hasByName("dbRange")) {
+ dbRanges.removeByName("dbRange");
+ }
+
+ //CellRangeAddress aRange = new CellRangeAddress((short)0, 0, 0, 0, 13);
+ CellRangeAddress aRange = null;
+
+ //dbRanges.addNewByName("dbRange", aRange);
+ XNameAccess dbrNA = (XNameAccess) UnoRuntime.queryInterface(
+ XNameAccess.class, dbRanges);
+ XNamed xNamed = null;
+
+ try {
+ String[] dbNames = dbrNA.getElementNames();
+ xNamed = (XNamed) UnoRuntime.queryInterface(XNamed.class,
+ dbrNA.getByName(
+ dbNames[0]));
+ xNamed.setName("dbRange");
+
+ XCellRangeReferrer aReferrer = (XCellRangeReferrer) UnoRuntime.queryInterface(
+ XCellRangeReferrer.class,
+ dbrNA.getByName("dbRange"));
+ XCellRangeAddressable aRangeA = (XCellRangeAddressable) UnoRuntime.queryInterface(
+ XCellRangeAddressable.class,
+ aReferrer.getReferredCells());
+ aRange = aRangeA.getRangeAddress();
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),
+ dbrNA.getByName("dbRange"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("DATAAREA", aRange);
+
+ XCellRange xCellRange = null;
+
+ try {
+ Object sheet = sheets.getByName(names[0]);
+ xCellRange = (XCellRange) UnoRuntime.queryInterface(
+ XCellRange.class, sheet);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting of first spreadsheet from spreadsheet" +
+ " document", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting of first spreadsheet from spreadsheet" +
+ " document", e);
+ }
+
+ tEnv.addObjRelation("XCELLRANGE", xCellRange);
+
+ return tEnv;
+ }
+
+ public void _doImport(XImportable imp) {
+ PropertyValue[] descriptor = imp.createImportDescriptor(false);
+
+ log.print("Setting the ImportDescriptor (Bibliograpy, SQL, select Identifier from biblio) -- ");
+ descriptor[0].Value = "Bibliography";
+ descriptor[1].Value = com.sun.star.sheet.DataImportMode.SQL;
+ descriptor[2].Value = "select Identifier from biblio";
+ log.println("done");
+
+ log.print("Importing data (Bibliograpy, Table, biblio) -- ");
+ imp.doImport(descriptor);
+ log.println("done");
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java
new file mode 100644
index 000000000000..1125628c357e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDatabaseRangesObj.java
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XDatabaseRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DatabaseRanges</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XDatabaseRanges</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.DatabaseRanges
+* @see com.sun.star.sheet.XDatabaseRanges
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.sheet._XDatabaseRanges
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScDatabaseRangesObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of database ranges in the document.
+ * If the database range with name <code>'dbRange'</code> doesn't exist
+ * in the collection then creates new database range and adds it to the
+ * collection with the name <code>'dbRange'</code> to have one element
+ * for the test of the interface <code>ElementAccess</code> at least.
+ * The collection of database ranges is the instance of the service
+ * <code>com.sun.star.sheet.DatabaseRanges</code>.
+ * @see com.sun.star.sheet.DatabaseRanges
+ * @see com.sun.star.container.XElementAccess
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ") ;
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+
+ XDatabaseRanges dbRanges = null;
+ try {
+ dbRanges = (XDatabaseRanges) AnyConverter.toObject(
+ new Type(XDatabaseRanges.class),
+ docProps.getPropertyValue("DatabaseRanges"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ }
+
+ log.println("Adding at least one element for ElementAccess interface");
+ CellRangeAddress aRange = new CellRangeAddress((short)0, 2, 4, 5, 6);
+ if (!dbRanges.hasByName("dbRange")) {
+ dbRanges.addNewByName("dbRange", aRange);
+ }
+
+ oObj = dbRanges;
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java b/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java
new file mode 100644
index 000000000000..afcae57deb47
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDocumentConfiguration.java
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.DesktopTools;
+import util.SOfficeFactory;
+
+
+public class ScDocumentConfiguration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a sheetdocument");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+ DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ XMultiServiceFactory docMSF = (XMultiServiceFactory) UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ xSheetDoc);
+ Object oObj = null;
+
+ try {
+ oObj = docMSF.createInstance("com.sun.star.sheet.DocumentSettings");
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Couldn't create document settings", e);
+ }
+
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment((XInterface) oObj);
+
+ return tEnv;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java b/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java
new file mode 100644
index 000000000000..a01dd8441fc9
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDrawPageObj.java
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DrawTools;
+import util.InstCreator;
+import util.SOfficeFactory;
+import util.ShapeDsc;
+
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScDrawPageObj extends TestCase {
+
+ static XSpreadsheetDocument xDoc = null;
+
+ /**
+ * Creates a new Draw document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes the Draw document created before
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent xComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xDoc);
+ util.DesktopTools.closeDoc(xComp);
+ }
+
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * From the Calc document created a collection of its draw
+ * pages is obtained. Two new pages are inserted. And one
+ * page is obtained as a testing component. A shape is added
+ * to this page. <p>
+ *
+ * Object relations created :
+ * <ul>
+ * <li> <code>'DrawPage'</code> for
+ * {@link ifc.drawing._XShapeGrouper} :
+ * the draw page tested. </li>
+ * <li> <code>'Shape'</code> for
+ * {@link ifc.drawing._XShapes} :
+ * the creator which can create instances of
+ * <code>com.sun.star.drawing.Line</code> service </li>
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XShape oShape = null ;
+ XDrawPages oDP = null;
+
+ XComponent xComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xDoc);
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ log.println( "getting Drawpages" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class,xDoc);
+ oDP = (XDrawPages) oDPS.getDrawPages();
+ oDP.insertNewByIndex(1);
+ oDP.insertNewByIndex(2);
+ oObj = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDP.getByIndex(0));
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ oShape = SOF.createShape(xComp,5000,3500,7500,5000,"Rectangle");
+ DrawTools.getShapes((XDrawPage) oObj).add(oShape);
+ XShape oShape1 = SOF.createShape(xComp,
+ 5000,5500,5000,5000,"Rectangle");
+ DrawTools.getShapes((XDrawPage) oObj).add(oShape1);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't create insance");
+ e.printStackTrace(log);
+ throw new StatusException("Can't create enviroment", e) ;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't create insance");
+ e.printStackTrace(log);
+ throw new StatusException("Can't create enviroment", e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't create insance");
+ e.printStackTrace(log);
+ throw new StatusException("Can't create enviroment", e) ;
+ }
+
+ // create test environment here
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // relation for XShapes interface
+ ShapeDsc sDsc = new ShapeDsc(5000,3500,7500,10000,"Line");
+ tEnv.addObjRelation("Shape", new InstCreator(xDoc, sDsc)) ;
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+
+ // adding relation for XShapeGrouper
+ tEnv.addObjRelation("DrawPage", oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScDrawPagesObj.java b/qadevOOo/tests/java/mod/_sc/ScDrawPagesObj.java
new file mode 100644
index 000000000000..ce766e056f66
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScDrawPagesObj.java
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.drawing.DrawPages</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::drawing::XDrawPageExpander</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::drawing::XDrawPageSummarizer</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::drawing::XDrawPages</code></li>
+* </ul>
+* @see com.sun.star.drawing.DrawPages
+* @see com.sun.star.drawing.XDrawPageExpander
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.drawing.XDrawPageSummarizer
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.drawing.XDrawPages
+* @see ifc.drawing._XDrawPageExpander
+* @see ifc.container._XIndexAccess
+* @see ifc.drawing._XDrawPageSummarizer
+* @see ifc.container._XElementAccess
+* @see ifc.drawing._XDrawPages
+*/
+public class ScDrawPagesObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of all drawpages in the document using the
+ * interface <code>XDrawPagesSupplier</code>. Creates and inserts two new
+ * drawPages into this collection. The retrieved collection is the instance
+ * of the service <code>com.sun.star.drawing.DrawPages</code>.
+ * @see com.sun.star.drawing.XDrawPagesSupplier
+ * @see com.sun.star.drawing.DrawPages
+ */
+ public TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+ XDrawPages oDP = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // get the drawpage of drawing here
+ log.println( "getting Drawpages" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class, xSheetDoc);
+ oDP = (XDrawPages) oDPS.getDrawPages();
+ oDP.insertNewByIndex(1);
+ oDP.insertNewByIndex(2);
+ oObj = oDP;
+
+ log.println( "creating a new environment for drawpage object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScDrawPagesObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java
new file mode 100644
index 000000000000..2477eb8230d1
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScFilterDescriptorBase.java
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetFilterable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetFilterDescriptor</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XSheetFilterDescriptor</code></li>
+* <li> <code>com::sun::star::sheet::SheetFilterDescriptor</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.SheetFilterDescriptor
+* @see com.sun.star.sheet.XSheetFilterDescriptor
+* @see com.sun.star.sheet.SheetFilterDescriptor
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._XSheetFilterDescriptor
+* @see ifc.sheet._SheetFilterDescriptor
+* @see ifc.beans._XPropertySet
+*/
+public class ScFilterDescriptorBase extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some cells in the spreadsheet.
+ * Creates the filter descriptor using the interface
+ * <code>XSheetFilterable</code>. This filter descriptor is the instance
+ * of the service <code>com.sun.star.sheet.SheetFilterDescriptor</code>.
+ * @see com.sun.star.sheet.XSheetFilterable
+ * @see com.sun.star.sheet.SheetFilterDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XSheetFilterable SF = null;
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while filling cells", e);
+ }
+
+ SF = (XSheetFilterable)
+ UnoRuntime.queryInterface(XSheetFilterable.class, oSheet);
+
+ oObj = SF.createFilterDescriptor(true);
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScFilterDescriptorBase
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java b/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java
new file mode 100644
index 000000000000..9360a2301205
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScFunctionDescriptionObj.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+import java.util.Random;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScFunctionDescriptionObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.
+ queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ /**
+ * creating a Testenvironment for the interfaces to be tested
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ try {
+ log.println("Getting test object ") ;
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory) Param.getMSF();
+
+ XInterface FDs = (XInterface)oDocMSF.
+ createInstance("com.sun.star.sheet.FunctionDescriptions");
+ XNameAccess NA = (XNameAccess)UnoRuntime.queryInterface
+ (XNameAccess.class, FDs);
+
+ String names[] = NA.getElementNames();
+ Random rnd = new Random();
+ int idx = rnd.nextInt(names.length);
+
+ oObj = (XInterface)NA.getByName(names[idx]);
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ } catch (Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException
+ ("Error getting test object from spreadsheet document",e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java b/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java
new file mode 100644
index 000000000000..19762e3897e3
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScFunctionListObj.java
@@ -0,0 +1,130 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.FunctionDescriptions</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::sheet::XFunctionDescriptions</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.FunctionDescriptions
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.sheet.XFunctionDescriptions
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XIndexAccess
+* @see ifc.sheet._XFunctionDescriptions
+* @see ifc.container._XElementAccess
+*/
+public class ScFunctionListObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.sheet.FunctionDescriptions</code>.
+ * @see com.sun.star.sheet.FunctionDescriptions
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ") ;
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)Param.getMSF();
+ try {
+ oObj = (XInterface)oDocMSF.createInstance(
+ "com.sun.star.sheet.FunctionDescriptions");
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java
new file mode 100644
index 000000000000..e8180fa2f255
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldObj.java
@@ -0,0 +1,241 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XHeaderFooterContent;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.text.TextField</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::text::XTextField</code></li>
+* <li> <code>com::sun::star::text::XTextContent</code></li>
+* <li> <code>com::sun::star::text::TextContent</code></li>
+* </ul>
+* @see com.sun.star.text.TextField
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.text.XTextField
+* @see com.sun.star.text.XTextContent
+* @see com.sun.star.text.TextContent
+* @see ifc.lang._XComponent
+* @see ifc.beans._XPropertySet
+* @see ifc.text._XTextField
+* @see ifc.text._XTextContent
+* @see ifc.text._TextContent
+*/
+public class ScHeaderFieldObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families available in the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains default style from the style family <code>'PageStyles'</code>.
+ * Retrieves the interface <code>XHeaderFooterContent</code> from the style
+ * using the property <code>'RightPageHeaderContent'</code>. Creates the
+ * instance of the service <code>com.sun.star.text.TextField.Time</code> and
+ * the instance of the service <code>com.sun.star.text.TextField.Date</code>
+ * Obtains the text (the interface <code>XText</code>) which is printed in
+ * the left part of the header or footer and inserts in it's content
+ * the second created instance.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'CONTENT'</code> for
+ * {@link ifc.text._XTextContent}(the interface <code>XTextContent</code>
+ * that was queried from the second created instance) </li>
+ * <li> <code>'TEXT'</code> for
+ * {@link ifc.text._XTextContent}(the the text which is printed in the
+ * right part of the header or footer) </li>
+ * </ul>
+ * @see com.sun.star.style.XStyleFamiliesSupplier
+ * @see com.sun.star.sheet.XHeaderFooterContent
+ * @see com.sun.star.text.XText
+ * @see com.sun.star.text.XTextContent
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XPropertySet PropSet;
+ XNameAccess PageStyles = null;
+ XStyle StdStyle = null;
+ XTextContent oContent = null;
+ XInterface aField = null;
+
+ XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class,
+ xSpreadsheetDoc );
+
+ XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
+ try{
+ PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),PageStyles.getByName("Default"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ //get the property-set
+ PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
+
+ XHeaderFooterContent RPHC = null;
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ }
+
+ XText left = RPHC.getLeftText();
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ xSpreadsheetDoc );
+
+ XTextContent the_Field = null;
+ try {
+ oObj = (XInterface)
+ oDocMSF.createInstance( "com.sun.star.text.TextField.Time" );
+
+ the_Field = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class,oObj);
+
+ aField = (XInterface)
+ oDocMSF.createInstance("com.sun.star.text.TextField.Date");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ oContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, aField);
+
+ XTextCursor the_Cursor = left.createTextCursor();
+
+ try {
+ left.insertTextContent(the_Cursor,the_Field, false);
+ PropSet.setPropertyValue("RightPageHeaderContent", RPHC);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("CONTENT",oContent);
+ tEnv.addObjRelation("TEXT", RPHC.getRightText());
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScHeaderFieldObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
new file mode 100644
index 000000000000..25cbc68fa9c4
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFieldsObj.java
@@ -0,0 +1,221 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XHeaderFooterContent;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextFieldsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by collection of
+ * text fields conained in the text of a page header. <p>
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
+ * <li> <code>com::sun::star::util::XRefreshable</code></li>
+ * <li> <code>com::sun::star::container::XElementAccess</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.container.XEnumerationAccess
+ * @see com.sun.star.util.XRefreshable
+ * @see com.sun.star.container.XElementAccess
+ * @see ifc.container._XEnumerationAccess
+ * @see ifc.util._XRefreshable
+ * @see ifc.container._XElementAccess
+ */
+public class ScHeaderFieldsObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families available in the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains default style from the style family <code>'PageStyles'</code>.
+ * Retrieves the interface <code>XHeaderFooterContent</code> from the style
+ * using the property <code>'RightPageHeaderContent'</code>. Creates the
+ * instance of the service <code>com.sun.star.text.TextField.Time</code> .
+ * Obtains the text (the interface <code>XText</code>) which is printed in
+ * the left part of the header or footer and inserts in it's content
+ * the created field instance. Then the tested component is obtained
+ * through <code>XTextFieldsSupplier</code> interface of a text.
+ *
+ * @see com.sun.star.style.XStyleFamiliesSupplier
+ * @see com.sun.star.sheet.XHeaderFooterContent
+ * @see com.sun.star.text.XText
+ * @see com.sun.star.text.XTextContent
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XPropertySet PropSet;
+ XNameAccess PageStyles = null;
+ XStyle StdStyle = null;
+
+ XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(XStyleFamiliesSupplier.class,
+ xSpreadsheetDoc );
+
+ XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
+ try{
+ PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),PageStyles.getByName("Default"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ //get the property-set
+ PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
+
+ XHeaderFooterContent RPHC = null;
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ }
+
+ XText left = RPHC.getLeftText();
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class,
+ xSpreadsheetDoc );
+
+ XTextContent the_Field = null;
+ try {
+ oObj = (XInterface)
+ oDocMSF.createInstance( "com.sun.star.text.TextField.Time" );
+
+ the_Field = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class,oObj);
+
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ XTextCursor the_Cursor = left.createTextCursor();
+
+ try {
+ left.insertTextContent(the_Cursor,the_Field, false);
+ PropSet.setPropertyValue("RightPageHeaderContent", RPHC);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ XTextFieldsSupplier xTFSupp = (XTextFieldsSupplier)
+ UnoRuntime.queryInterface(XTextFieldsSupplier.class, left);
+
+ oObj = xTFSupp.getTextFields();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java
new file mode 100644
index 000000000000..2d3719cf8fa4
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterContentObj.java
@@ -0,0 +1,190 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XHeaderFooterContent;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XText;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.HeaderFooterContent</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XHeaderFooterContent</code></li>
+* </ul>
+* @see com.sun.star.sheet.HeaderFooterContent
+* @see com.sun.star.sheet.XHeaderFooterContent
+* @see ifc.sheet._XHeaderFooterContent
+*/
+public class ScHeaderFooterContentObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families available in the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains default style from the style family <code>'PageStyles'</code>.
+ * Retrieves value of the property <code>'RightPageHeaderContent'</code>.
+ * Sets some text for every part of header or footer using the interface
+ * <code>XHeaderFooterContent</code> and sets new value of the property
+ * <code>'RightPageHeaderContent'</code>. The value of this property is the
+ * instance of the service <code>com.sun.star.sheet.HeaderFooterContent</code>.
+ * @see com.sun.star.style.XStyleFamiliesSupplier
+ * @see com.sun.star.sheet.XHeaderFooterContent
+ * @see com.sun.star.sheet.HeaderFooterContent
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XPropertySet PropSet;
+ XNameAccess PageStyles = null;
+ XStyle StdStyle = null;
+
+ XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class,
+ xSpreadsheetDoc );
+ XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
+ try{
+ PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),PageStyles.getByName("Default"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ //get the property-set
+ PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
+
+ XHeaderFooterContent RPHC = null;
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ }
+
+ XText center = RPHC.getCenterText();
+ XText left = RPHC.getLeftText();
+ XText right = RPHC.getRightText();
+
+ center.setString("CENTER");
+ left.setString("LEFT");
+ right.setString("RIGHT");
+
+ try {
+ PropSet.setPropertyValue("RightPageHeaderContent", RPHC);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ }
+
+ // create testobject here
+ oObj = RPHC;
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScHeaderFooterContentObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java
new file mode 100644
index 000000000000..521d754da79a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextCursor.java
@@ -0,0 +1,228 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XHeaderFooterContent;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.XText;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.text.TextCursor</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::text::XTextCursor</code></li>
+* <li> <code>com::sun::star::text::XWordCursor</code></li>
+* <li> <code>com::sun::star::style::CharacterPropertiesComplex</code></li>
+* <li> <code>com::sun::star::text::XTextRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::container::XContentEnumerationAccess</code></li>
+* <li> <code>com::sun::star::beans::XPropertyState</code></li>
+* <li> <code>com::sun::star::style::CharacterProperties</code></li>
+* <li> <code>com::sun::star::text::XSentenceCursor</code></li>
+* <li> <code>com::sun::star::style::ParagraphProperties</code></li>
+* <li> <code>com::sun::star::text::XParagraphCursor</code></li>
+* <li> <code>com::sun::star::document::XDocumentInsertable</code></li>
+* <li> <code>com::sun::star::util::XSortable</code></li>
+* <li> <code>com::sun::star::style::CharacterPropertiesAsian</code></li>
+* </ul>
+* @see com.sun.star.text.TextCursor
+* @see com.sun.star.text.XTextCursor
+* @see com.sun.star.text.XWordCursor
+* @see com.sun.star.style.CharacterPropertiesComplex
+* @see com.sun.star.text.XTextRange
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.container.XContentEnumerationAccess
+* @see com.sun.star.beans.XPropertyState
+* @see com.sun.star.style.CharacterProperties
+* @see com.sun.star.text.XSentenceCursor
+* @see com.sun.star.style.ParagraphProperties
+* @see com.sun.star.text.XParagraphCursor
+* @see com.sun.star.document.XDocumentInsertable
+* @see com.sun.star.util.XSortable
+* @see com.sun.star.style.CharacterPropertiesAsian
+* @see ifc.text._XTextCursor
+* @see ifc.text._XWordCursor
+* @see ifc.style._CharacterPropertiesComplex
+* @see ifc.text._XTextRange
+* @see ifc.beans._XPropertySet
+* @see ifc.container._XContentEnumerationAccess
+* @see ifc.beans._XPropertyState
+* @see ifc.style._CharacterProperties
+* @see ifc.text._XSentenceCursor
+* @see ifc.style._ParagraphProperties
+* @see ifc.text._XParagraphCursor
+* @see ifc.document._XDocumentInsertable
+* @see ifc.util._XSortable
+* @see ifc.style._CharacterPropertiesAsian
+*/
+public class ScHeaderFooterTextCursor extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families available in the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains default style from the style family <code>'PageStyles'</code>.
+ * Retrieves value of the property <code>'RightPageHeaderContent'</code>.
+ * Sets some string for the text which is printed in the center part of the
+ * header or footer using the interface <code>XHeaderFooterContent</code>
+ * and sets new value of the property <code>'RightPageHeaderContent'</code>.
+ * Creates text cursor for the text which is printed in the center part of
+ * the header or footer. This text cursor is the instance of the service
+ * <code>com.sun.star.text.TextCursor</code>.
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XPropertySet PropSet;
+ XNameAccess PageStyles = null;
+ XStyle StdStyle = null;
+
+ XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class,
+ xSpreadsheetDoc );
+
+ XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
+ try{
+ PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),PageStyles.getByName("Default"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ //get the property-set
+ PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
+
+ XHeaderFooterContent RPHC = null;
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ }
+
+ XText center = RPHC.getCenterText();
+ center.setString("CENTER");
+
+ try {
+ PropSet.setPropertyValue("RightPageHeaderContent",RPHC);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ }
+
+ // create testobject here
+ oObj = center.createTextCursor();
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ // add relation for XTextRange
+ tEnv.addObjRelation("XTEXT",
+ UnoRuntime.queryInterface(XText.class,center));
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScHeaderFooterTextCursor
diff --git a/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java
new file mode 100644
index 000000000000..38495bbc8673
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScHeaderFooterTextObj.java
@@ -0,0 +1,278 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DefaultDsc;
+import util.InstCreator;
+import util.ParagraphDsc;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XHeaderFooterContent;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.text.ControlCharacter;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextCursor;
+import com.sun.star.text.XTextRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.text.Text</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::text::XTextRangeMover</code></li>
+* <li> <code>com::sun::star::text::XSimpleText</code></li>
+* <li> <code>com::sun::star::text::XTextRange</code></li>
+* <li> <code>com::sun::star::text::XRelativeTextContentInsert</code></li>
+* <li> <code>com::sun::star::text::XTextRangeCompare</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XEnumerationAccess</code></li>
+* <li> <code>com::sun::star::text::XText</code></li>
+* </ul>
+* @see com.sun.star.text.Text
+* @see com.sun.star.text.XTextRangeMover
+* @see com.sun.star.text.XSimpleText
+* @see com.sun.star.text.XTextRange
+* @see com.sun.star.text.XRelativeTextContentInsert
+* @see com.sun.star.text.XTextRangeCompare
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XEnumerationAccess
+* @see com.sun.star.text.XText
+* @see ifc.text._XTextRangeMover
+* @see ifc.text._XSimpleText
+* @see ifc.text._XTextRange
+* @see ifc.text._XRelativeTextContentInsert
+* @see ifc.text._XTextRangeCompare
+* @see ifc.container._XElementAccess
+* @see ifc.container._XEnumerationAccess
+* @see ifc.text._XText
+*/
+public class ScHeaderFooterTextObj extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families available in the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains default style from the style family <code>'PageStyles'</code>.
+ * Retrieves value of the property <code>'RightPageHeaderContent'</code>.
+ * Creates text cursor for the text which is printed in the center part of
+ * the header or footer using the interface <code>XHeaderFooterContent</code>.
+ * Insert some lines using the created cursor and sets new value of the
+ * property <code>'RightPageHeaderContent'</code>. The value of the property
+ * <code>'RightPageHeaderContent'</code> is the instance of the service
+ * <code>com.sun.star.text.Text</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'RangeForMove'</code> for
+ * {@link ifc.text._XTextRangeMover} (the range to be moved)</li>
+ * <li> <code>'XTextRange'</code> for
+ * {@link ifc.text._XTextRangeMover} (the range that includes moving
+ * range)</li>
+ * <li> <code>'XTEXTINFO'</code> for
+ * {@link ifc.text._XRelativeTextContentInsert}(the instance creator
+ * which can create instances of some text content service)</li>
+ * <li> <code>'PARA'</code> for
+ * {@link ifc.text._XRelativeTextContentInsert}(the instance creator
+ * which can create instances of <code>com.sun.star.text.Paragraph</code>
+ * service)</li>
+ * </ul>
+ * @see com.sun.star.text.Text
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XPropertySet PropSet;
+ XNameAccess PageStyles = null;
+ XStyle StdStyle = null;
+
+ XStyleFamiliesSupplier StyleFam = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class,
+ xSpreadsheetDoc );
+ XNameAccess StyleFamNames = StyleFam.getStyleFamilies();
+ try{
+ PageStyles = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),StyleFamNames.getByName("PageStyles"));
+ StdStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),PageStyles.getByName("Default"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ //get the property-set
+ PropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, StdStyle);
+
+ XHeaderFooterContent RPHC = null;
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+ try {
+ RPHC = (XHeaderFooterContent) AnyConverter.toObject(
+ new Type(XHeaderFooterContent.class),
+ PropSet.getPropertyValue("RightPageHeaderContent"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get HeaderContent", e);
+ }
+
+ XText center = RPHC.getCenterText();
+
+ XTextRange text_to_move = null;
+
+ log.println( "inserting some lines" );
+ try {
+ XTextCursor oCursor = center.createTextCursor();
+ center.insertControlCharacter(
+ oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
+ center.insertControlCharacter(
+ oCursor, ControlCharacter.LINE_BREAK, false );
+ center.insertString(oCursor,"Paragraph 1", false);
+ center.insertString(oCursor,": ScHeaderFooterTextObj", false);
+ center.insertControlCharacter(
+ oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
+ center.insertString(oCursor, "THE QUICK BROWN FOX JUMPS OVER THE" +
+ " LAZY DOG: ScHeaderFooterTextObj", false );
+ center.insertControlCharacter(
+ oCursor, ControlCharacter.PARAGRAPH_BREAK, false );
+ center.insertControlCharacter(
+ oCursor, ControlCharacter.LINE_BREAK, false );
+ oCursor.setString("TextForMove");
+ text_to_move = oCursor;
+
+ XTextCursor oCursor1 = center.createTextCursorByRange(center.getEnd());
+ center.insertString(oCursor1,"Paragraph 2", false);
+ center.insertString(oCursor1,": ScHeaderFooterTextObj", false);
+ center.insertControlCharacter(
+ oCursor1, ControlCharacter.PARAGRAPH_BREAK, false );
+ center.insertString( oCursor1, "THE QUICK BROWN FOX JUMPS OVER THE" +
+ " LAZY DOG: ScHeaderFooterTextObj", false);
+ center.insertControlCharacter(
+ oCursor1, ControlCharacter.PARAGRAPH_BREAK, false );
+ center.insertControlCharacter(
+ oCursor1, ControlCharacter.LINE_BREAK, false );
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't insert Text ", e);
+ }
+
+ try {
+ PropSet.setPropertyValue("RightPageHeaderContent", RPHC);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set HeaderContent", e);
+ }
+
+ // create testobject here
+ oObj = center;
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ DefaultDsc tDsc = new DefaultDsc(
+ "com.sun.star.text.XTextContent","com.sun.star.text.TextField.Time");
+
+ log.println( "adding InstCreator object" );
+ tEnv.addObjRelation(
+ "XTEXTINFO", new InstCreator( xSpreadsheetDoc, tDsc ) );
+
+ ParagraphDsc pDsc = new ParagraphDsc();
+ tEnv.addObjRelation( "PARA", new InstCreator(xSpreadsheetDoc, pDsc) );
+
+ log.println("adding TextRange for XTextRangeMover" );
+ tEnv.addObjRelation("RangeForMove", text_to_move);
+ tEnv.addObjRelation("XTextRange", RPHC.getCenterText());
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+} // finish class ScHeaderFooterTextObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java
new file mode 100644
index 000000000000..a3bd6160657c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScImportDescriptorBase.java
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XImportable;
+
+/**
+ *
+ * initial description
+ * @see com.sun.star.sheet.DatabaseImportDescriptor
+ *
+ */
+public class ScImportDescriptorBase extends TestCase {
+
+ XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * in general this method creates a testdocument
+ *
+ * @param tParam class which contains additional test parameters
+ * @param log class to log the test state and result
+ *
+ *
+ * @see TestParameters
+ * @see PrintWriter
+ *
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * in general this method disposes the testenvironment and document
+ *
+ * @param tParam class which contains additional test parameters
+ * @param log class to log the test state and result
+ *
+ *
+ * @see TestParameters
+ * @see PrintWriter
+ *
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+
+ /**
+ * creating a Testenvironment for the interfaces to be tested
+ *
+ * @param tParam class which contains additional test parameters
+ * @param log class to log the test state and result
+ *
+ * @return Status class
+ *
+ * @see TestParameters
+ * @see PrintWriter
+ */
+ public TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ XImportable xIMP = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // create testobject here
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+ if (xSpreadsheets == null) log.println("FAILED"); else log.println("OK");
+
+ log.println("getting a sheet");
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class,oIndexAccess.getByIndex(0));
+ } catch (Exception e) {
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ xIMP = (XImportable) UnoRuntime.queryInterface(XImportable.class,oObj);
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ tEnv.addObjRelation("xIMP",xIMP);
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScImportDescriptorBase
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java
new file mode 100644
index 000000000000..33066b04432c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAnnotationsEnumeration.java
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetAnnotations;
+import com.sun.star.sheet.XSheetAnnotationsSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+public class ScIndexEnumeration_CellAnnotationsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while filling cells", e);
+ }
+
+ XSheetAnnotationsSupplier sas = (XSheetAnnotationsSupplier)
+ UnoRuntime.queryInterface(XSheetAnnotationsSupplier.class, oSheet);
+
+ XSheetAnnotations anno = sas.getAnnotations();
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class, anno);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java
new file mode 100644
index 000000000000..787c0e33881d
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_CellAreaLinksEnumeration.java
@@ -0,0 +1,131 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XAreaLinks;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_CellAreaLinksEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+ public synchronized TestEnvironment createTestEnvironment
+ (TestParameters Param, PrintWriter log){
+
+ XInterface oObj = null;
+ TestEnvironment tEnv = null ;
+
+ try {
+
+ // creation of testobject here
+ XPropertySet props = (XPropertySet)UnoRuntime.queryInterface
+ (XPropertySet.class, xSheetDoc);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),props.getPropertyValue("AreaLinks")) ;
+ XAreaLinks links = null ;
+
+ // adding one link into collection (for best testing)
+ links = (XAreaLinks) UnoRuntime.queryInterface(XAreaLinks.class, oObj) ;
+ CellAddress addr = new CellAddress ((short) 1,2,3) ;
+ String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc");
+ links.insertAtPosition (addr, aSourceArea, "a2:b5", "", "") ;
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println ("Exception occured while creating test Object.") ;
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ return tEnv ;
+ }
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java
new file mode 100644
index 000000000000..0406f914622c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DDELinksEnumeration.java
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_DDELinksEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+ static XComponent oDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document and testdocument.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.
+ queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ util.DesktopTools.closeDoc(oDoc);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ XMultiServiceFactory oMSF = (XMultiServiceFactory)Param.getMSF();
+
+ // load the predefined testdocument
+ String testdoc = utils.getFullTestURL("ScDDELinksObj.sdc");
+ try {
+ oDoc = SOfficeFactory.getFactory(oMSF).loadDocument(testdoc);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ } catch (com.sun.star.io.IOException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't load test document", e);
+ }
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ testdoc = utils.getFullTestDocName("ScDDELinksObj.sdc");
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setFormula(
+ "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
+ oSheet.getCellByPosition(1, 4).setFormula(
+ "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
+ oSheet.getCellByPosition(2, 0).setFormula(
+ "=DDE(\"soffice\";\""+testdoc+"\";\"Sheet1.A1\"");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while filling cells", e);
+ }
+
+ try {
+ log.println("Getting test object ") ;
+
+ // Getting named ranges.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ oObj = (XInterface)AnyConverter.toObject(
+ new Type(XInterface.class),docProps.getPropertyValue("DDELinks"));
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e) ;
+ }
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java
new file mode 100644
index 000000000000..955fb407b22e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotFieldsEnumeration.java
@@ -0,0 +1,165 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_DataPilotFieldsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filing a table");
+ for (int i = 1; i < 4; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < 4; i++)
+ for (int j = 1; j < 4; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
+ UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
+
+ log.println("Getting test object ") ;
+
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(new CellRangeAddress((short)0, 0, 0, 4, 4));
+ DPT.insertNewByName(
+ "DataPilotTable",
+ new CellAddress((short)0, 5, 5),
+ DPDsc);
+
+ oObj = DPDsc.getDataPilotFields();
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java
new file mode 100644
index 000000000000..5755966c0ed2
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotItemsEnumeration.java
@@ -0,0 +1,408 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.DataPilotFieldOrientation;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotField;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.DataPilotField</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::DataPilotField</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.DataPilotField
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.sheet._DataPilotField
+* @see ifc.beans._XPropertySet
+*/
+public class ScIndexEnumeration_DataPilotItemsEnumeration
+ extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * A field is filled some values. This integer determines the size of the
+ * field in x and y direction.
+ */
+ private int mMaxFieldIndex = 6;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a Spreadsheet document");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some table in the spreadsheet.
+ * Obtains the collection of data pilot tables using the interface
+ * <code>XDataPilotTablesSupplier</code>. Creates a data pilot descriptor
+ * for the filled table and inserts new data pilot table with this descriptor
+ * to the collection. Obtains the collection of all the data pilot fields
+ * using the interface <code>XDataPilotDescriptor</code>. Retrieves from
+ * the collection the data pilot field with index 0. This data pilot field
+ * is the instance of the service <code>com.sun.star.sheet.DataPilotField</code>.
+ * @see com.sun.star.sheet.DataPilotField
+ * @see com.sun.star.sheet.XDataPilotTablesSupplier
+ * @see com.sun.star.sheet.XDataPilotDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println("Creating a test environment");
+
+ // the cell range
+ CellRangeAddress sCellRangeAdress = new CellRangeAddress();
+ sCellRangeAdress.Sheet = 0;
+ sCellRangeAdress.StartColumn = 1;
+ sCellRangeAdress.StartRow = 0;
+ sCellRangeAdress.EndColumn = mMaxFieldIndex - 1;
+ sCellRangeAdress.EndRow = mMaxFieldIndex - 1;
+
+ // position of the data pilot table
+ CellAddress sCellAdress = new CellAddress();
+ sCellAdress.Sheet = 0;
+ sCellAdress.Column = 7;
+ sCellAdress.Row = 8;
+
+ log.println("Getting a sheet");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets();
+ XSpreadsheet oSheet = null;
+ XSpreadsheet oSheet2 = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(0));
+ oSheet2 = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(1));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filling a table");
+
+ for (int i = 1; i < mMaxFieldIndex; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ oSheet2.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet2.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < mMaxFieldIndex; i++)
+ for (int j = 1; j < mMaxFieldIndex; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ oSheet2.getCellByPosition(i, j).setValue(i * (j + 2));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ // change a value of a cell and check the change in the data pilot
+ // (for the XDataPilotTable.refresh() test)
+ Object oChangeCell = null;
+ Object oCheckCell = null;
+ Integer aChangeValue = null;
+
+ try {
+ // cell of data
+ oChangeCell = oSheet.getCellByPosition(1, 5);
+
+ int x = sCellAdress.Column;
+ int y = sCellAdress.Row + 3;
+
+
+ // cell of the data pilot output
+ oCheckCell = oSheet.getCellByPosition(x, y);
+ aChangeValue = new Integer(27);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get cells for changeing.", e);
+ }
+
+
+ // create the test objects
+ log.println("Getting test objects");
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier) UnoRuntime.queryInterface(
+ XDataPilotTablesSupplier.class,
+ oSheet);
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(sCellRangeAdress);
+
+ XPropertySet fieldPropSet = null;
+
+ try {
+ Object oDataPilotField = DPDsc.getDataPilotFields().getByIndex(0);
+ fieldPropSet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, oDataPilotField);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ try {
+ fieldPropSet.setPropertyValue("Function",
+ com.sun.star.sheet.GeneralFunction.SUM);
+ fieldPropSet.setPropertyValue("Orientation",
+ com.sun.star.sheet.DataPilotFieldOrientation.DATA);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't create a test environment", e);
+ }
+
+ log.println("Insert the DataPilotTable");
+
+ if (DPT.hasByName("DataPilotTable")) {
+ DPT.removeByName("DataPilotTable");
+ }
+
+ XIndexAccess IA = DPDsc.getDataPilotFields();
+ getSRange(IA);
+
+ DPT.insertNewByName("DataPilotTable", sCellAdress, DPDsc);
+
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class), IA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace();
+ throw new StatusException("Couldn't get data pilot field", e);
+ }
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ XDataPilotField xDataPilotField = (XDataPilotField) UnoRuntime.queryInterface(
+ XDataPilotField.class, oObj);
+
+ XEnumerationAccess xEnumerationAccess = (XEnumerationAccess) UnoRuntime.queryInterface(
+ XEnumerationAccess.class,
+ xDataPilotField.getItems());
+
+ oObj = xEnumerationAccess.createEnumeration();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ // Other parameters required for interface tests
+ return tEnv;
+ }
+
+ private void getSRange(XIndexAccess IA) {
+ int fieldsAmount = IA.getCount() + 1;
+
+ String[] fieldsNames = new String[fieldsAmount];
+
+ int i = -1;
+ int cnt = 0;
+
+ while ((++i) < fieldsAmount) {
+ Object field;
+
+ try {
+ field = IA.getByIndex(i);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ XNamed named = (XNamed) UnoRuntime.queryInterface(XNamed.class,
+ field);
+ String name = named.getName();
+
+ log.println("**Field : '" + name + "' ... ");
+
+ if (!name.equals("Data")) {
+ fieldsNames[cnt] = name;
+
+ XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, field);
+
+ try {
+ switch (cnt % 5) {
+ case 0:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.COLUMN);
+ log.println(" Column");
+
+ break;
+
+ case 1:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.ROW);
+ log.println(" Row");
+
+ break;
+
+ case 2:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.DATA);
+ log.println(" Data");
+
+ break;
+
+ case 3:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.HIDDEN);
+ log.println(" Hidden");
+
+ break;
+
+ case 4:
+ props.setPropertyValue("Orientation",
+ DataPilotFieldOrientation.PAGE);
+ log.println(" Page");
+
+ break;
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+
+ return;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+
+ return;
+ }
+
+ if ((++cnt) > 4) {
+ break;
+ }
+ } else {
+ return;
+ }
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java
new file mode 100644
index 000000000000..652623f2ef74
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DataPilotTablesEnumeration.java
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XDataPilotDescriptor;
+import com.sun.star.sheet.XDataPilotTables;
+import com.sun.star.sheet.XDataPilotTablesSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_DataPilotTablesEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ // create testobject here
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ try {
+ log.println("Filing a table");
+ for (int i = 1; i < 4; i++) {
+ oSheet.getCellByPosition(i, 0).setFormula("Col" + i);
+ oSheet.getCellByPosition(0, i).setFormula("Row" + i);
+ }
+
+ for (int i = 1; i < 4; i++)
+ for (int j = 1; j < 4; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i * (j + 1));
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cells", e);
+ }
+
+ XDataPilotTablesSupplier DPTS = (XDataPilotTablesSupplier)
+ UnoRuntime.queryInterface(XDataPilotTablesSupplier.class, oSheet);
+
+ log.println("Getting test object ") ;
+
+ XDataPilotTables DPT = DPTS.getDataPilotTables();
+ XDataPilotDescriptor DPDsc = DPT.createDataPilotDescriptor();
+ DPDsc.setSourceRange(new CellRangeAddress((short)0, 0, 0, 4, 4));
+ DPT.insertNewByName(
+ "DataPilotTable",
+ new CellAddress((short)0, 5, 5),
+ DPDsc );
+
+ oObj = DPT;
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java
new file mode 100644
index 000000000000..314c5884952b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_DatabaseRangesEnumeration.java
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XDatabaseRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+public class ScIndexEnumeration_DatabaseRangesEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ") ;
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+
+ XDatabaseRanges dbRanges = null;
+ try {
+ dbRanges = (XDatabaseRanges) AnyConverter.toObject(
+ new Type(XDatabaseRanges.class),
+ docProps.getPropertyValue("DatabaseRanges"));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ }
+
+ log.println("Adding at least one element for ElementAccess interface");
+ CellRangeAddress aRange = new CellRangeAddress((short)0, 2, 4, 5, 6);
+ if (!dbRanges.hasByName("dbRange")) {
+ dbRanges.addNewByName("dbRange", aRange);
+ }
+
+ oObj = dbRanges;
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java
new file mode 100644
index 000000000000..017920b57d02
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_FunctionDescriptionEnumeration.java
@@ -0,0 +1,113 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_FunctionDescriptionEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ") ;
+
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)Param.getMSF();
+ try {
+ oObj = (XInterface)oDocMSF.createInstance(
+ "com.sun.star.sheet.FunctionDescriptions");
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document", e);
+ }
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java
new file mode 100644
index 000000000000..6a07462a0df9
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_LabelRangesEnumeration.java
@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XLabelRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_LabelRangesEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ try {
+ log.println("Getting test object ") ;
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ Object ranges = docProps.getPropertyValue("ColumnLabelRanges");
+ XLabelRanges lRanges = (XLabelRanges)
+ UnoRuntime.queryInterface(XLabelRanges.class, ranges);
+
+ log.println("Adding at least one element for ElementAccess interface");
+ CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6);
+ CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1);
+ lRanges.addNew(aRange1, aRange2);
+
+ oObj = lRanges;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ }
+
+ log.println("creating a new environment for object");
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java
new file mode 100644
index 000000000000..080a454fac51
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_NamedRangesEnumeration.java
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XNamedRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_NamedRangesEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ");
+
+ // Getting named ranges.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ Object ranges = null;
+ try {
+ ranges = docProps.getPropertyValue("NamedRanges");
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get NamedRanges", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get NamedRanges", e);
+ }
+
+ XNamedRanges xNamedRanges = (XNamedRanges)
+ UnoRuntime.queryInterface(XNamedRanges.class, ranges);
+
+ CellRangeAddress DataArea = new CellRangeAddress((short)0, 0, 0, 2, 2);
+ CellAddress base = new CellAddress(DataArea.Sheet,
+ DataArea.StartColumn,
+ DataArea.StartRow);
+
+ xNamedRanges.addNewByName("ANamedRange", "A1:B2", base, 0);
+
+ CellAddress listOutputPosition = new CellAddress((short)0, 1, 1);
+ xNamedRanges.outputList(listOutputPosition);
+
+ oObj = xNamedRanges;
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java
new file mode 100644
index 000000000000..f8ca5d66c8b3
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_ScenariosEnumeration.java
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XScenariosSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_ScenariosEnumeration extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cell", e);
+ }
+
+ XScenariosSupplier xSupp = (XScenariosSupplier)
+ UnoRuntime.queryInterface(XScenariosSupplier.class, oSheet);
+ XCellRange oRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ XCellRange myRange = oRange.getCellRangeByName("A1:N4");
+ XCellRangeAddressable oRangeAddr = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
+ CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
+
+ CellRangeAddress[] oAddr = new CellRangeAddress[1];
+ oAddr[0] = myAddr;
+
+ xSupp.getScenarios().addNewByName("ScScenarios", oAddr, "Range");
+
+ XInterface oObj = xSupp.getScenarios();
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java
new file mode 100644
index 000000000000..5001a02da185
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetCellRangesEnumeration.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_SheetCellRangesEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp =
+ (XComponent) UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ Object oRange = null ;
+
+ // creation of 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( (XMultiServiceFactory)Param.getMSF() );
+
+ log.println("Getting test object ");
+
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+
+ oObj = (XInterface)
+ SOF.createInstance(oComp, "com.sun.star.sheet.SheetCellRanges");
+
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndSheets = (XIndexAccess)
+ UnoRuntime.queryInterface (XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = null;
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndSheets.getByIndex(0));
+ XNameContainer oRanges = (XNameContainer)
+ UnoRuntime.queryInterface(XNameContainer.class, oObj);
+
+ oRange = oSheet.getCellRangeByName("C1:D4");
+ oRanges.insertByName("Range1", oRange);
+ oRange = oSheet.getCellRangeByName("E2:F5");
+ oRanges.insertByName("Range2", oRange);
+ oRange = oSheet.getCellRangeByName("G2:H3");
+ oRanges.insertByName("Range3", oRange);
+ oRange = oSheet.getCellRangeByName("I7:J8");
+ oRanges.insertByName("Range4", oRange);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.container.ElementExistException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ for (int i = 0; i < 10; i++) {
+ for (int j = 0; j < 5; j++) {
+ oSheet.getCellByPosition(i, j).setFormula("a");
+ }
+ }
+ for (int i = 0; i < 10; i++) {
+ for (int j = 5; j < 10; j++) {
+ oSheet.getCellByPosition(i, j).setValue(i + j);
+ }
+ }
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException (
+ "Exception occurred while filling cells", e);
+ }
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv ;
+ }
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java
new file mode 100644
index 000000000000..e91b153dcbab
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SheetLinksEnumeration.java
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetLinkable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_SheetLinksEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+ XSpreadsheet oSheet = null;
+
+ log.println("Getting test object ") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ XSheetLinkable SL = (XSheetLinkable)
+ UnoRuntime.queryInterface(XSheetLinkable.class, oSheet);
+
+ // creating link.
+ String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc");
+ SL.link(aSourceArea, "Sheet1", "", "",
+ com.sun.star.sheet.SheetLinkMode.VALUE);
+
+ // Getting links.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+
+ Object links = null;
+ try {
+ links = docProps.getPropertyValue("SheetLinks");
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get SheetLinks", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get SheetLinks", e);
+ }
+
+ oObj = (XInterface)UnoRuntime.queryInterface(XInterface.class, links);
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java
new file mode 100644
index 000000000000..d369c81ec336
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetViewPanesEnumeration.java
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_SpreadsheetViewPanesEnumeration extends TestCase {
+ private static XSpreadsheetDocument xSpreadsheetDoc;
+ private static SOfficeFactory SOF;
+ private static XInterface oObj;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+ SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println("disposing xSpreadsheetDocument");
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XModel xm = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+ XController xc = xm.getCurrentController();
+ XIndexAccess xIA = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xc);
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),xIA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,xIA);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetsEnumeration.java
new file mode 100644
index 000000000000..325472ed724a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SpreadsheetsEnumeration.java
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_SpreadsheetsEnumeration extends TestCase {
+ private static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println("disposing xSpreadsheetDocument");
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ XInterface oObj = (XInterface)
+ UnoRuntime.queryInterface(XInterface.class, xSpreadsheets);
+
+ log.println("creating a new environment for object");
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java
new file mode 100644
index 000000000000..83c3b22e9f70
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_SubTotalFieldsEnumeration.java
@@ -0,0 +1,141 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.GeneralFunction;
+import com.sun.star.sheet.SubTotalColumn;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.sheet.XSubTotalCalculatable;
+import com.sun.star.sheet.XSubTotalDescriptor;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_SubTotalFieldsEnumeration extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // 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( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ XSubTotalCalculatable xSTC = (XSubTotalCalculatable)
+ UnoRuntime.queryInterface(XSubTotalCalculatable.class, oSheet);
+
+ XSubTotalDescriptor xSTD = xSTC.createSubTotalDescriptor(true);
+
+ SubTotalColumn[] columns = new SubTotalColumn[1];
+ SubTotalColumn column = new SubTotalColumn();
+ column.Column = 5;
+ column.Function = GeneralFunction.SUM;
+ columns[0] = column;
+ xSTD.addNew(columns, 1);
+
+ XIndexAccess oDescIndex = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSTD);
+
+ XInterface oObj = null;
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oDescIndex);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java
new file mode 100644
index 000000000000..a399e095fed8
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableAutoFormatEnumeration.java
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_TableAutoFormatEnumeration extends TestCase{
+ static XSpreadsheetDocument xSheetDoc = null;
+ static SOfficeFactory SOF = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ try {
+ // creation of testobject here
+ // get AutoFormats
+ oObj = (XInterface)((XMultiServiceFactory)Param.getMSF()).createInstance
+ ("com.sun.star.sheet.TableAutoFormats");
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ } catch (com.sun.star.uno.Exception e) {
+ log.println ("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+ }
+
+} // finish class ScAutoFormatsObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java
new file mode 100644
index 000000000000..f1beaf8ad87b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableChartsEnumeration.java
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.awt.Rectangle;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XTableCharts;
+import com.sun.star.table.XTableChartsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_TableChartsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XSpreadsheet oSheet=null;
+
+ try {
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't get Sheet ");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get sheet", e);
+ }
+
+ log.println("Creating the Header") ;
+
+ insertIntoCell(1,0,"JAN",oSheet,"");
+ insertIntoCell(2,0,"FEB",oSheet,"");
+ insertIntoCell(3,0,"MAR",oSheet,"");
+ insertIntoCell(4,0,"APR",oSheet,"");
+ insertIntoCell(5,0,"MAI",oSheet,"");
+ insertIntoCell(6,0,"JUN",oSheet,"");
+ insertIntoCell(7,0,"JUL",oSheet,"");
+ insertIntoCell(8,0,"AUG",oSheet,"");
+ insertIntoCell(9,0,"SEP",oSheet,"");
+ insertIntoCell(10,0,"OCT",oSheet,"");
+ insertIntoCell(11,0,"NOV",oSheet,"");
+ insertIntoCell(12,0,"DEC",oSheet,"");
+ insertIntoCell(13,0,"SUM",oSheet,"");
+
+ log.println("Fill the lines");
+
+ insertIntoCell(0,1,"Smith",oSheet,"");
+ insertIntoCell(1,1,"42",oSheet,"V");
+ insertIntoCell(2,1,"58.9",oSheet,"V");
+ insertIntoCell(3,1,"-66.5",oSheet,"V");
+ insertIntoCell(4,1,"43.4",oSheet,"V");
+ insertIntoCell(5,1,"44.5",oSheet,"V");
+ insertIntoCell(6,1,"45.3",oSheet,"V");
+ insertIntoCell(7,1,"-67.3",oSheet,"V");
+ insertIntoCell(8,1,"30.5",oSheet,"V");
+ insertIntoCell(9,1,"23.2",oSheet,"V");
+ insertIntoCell(10,1,"-97.3",oSheet,"V");
+ insertIntoCell(11,1,"22.4",oSheet,"V");
+ insertIntoCell(12,1,"23.5",oSheet,"V");
+ insertIntoCell(13,1,"=SUM(B2:M2)",oSheet,"");
+
+ insertIntoCell(0,2,"Jones",oSheet,"");
+ insertIntoCell(1,2,"21",oSheet,"V");
+ insertIntoCell(2,2,"40.9",oSheet,"V");
+ insertIntoCell(3,2,"-57.5",oSheet,"V");
+ insertIntoCell(4,2,"-23.4",oSheet,"V");
+ insertIntoCell(5,2,"34.5",oSheet,"V");
+ insertIntoCell(6,2,"59.3",oSheet,"V");
+ insertIntoCell(7,2,"27.3",oSheet,"V");
+ insertIntoCell(8,2,"-38.5",oSheet,"V");
+ insertIntoCell(9,2,"43.2",oSheet,"V");
+ insertIntoCell(10,2,"57.3",oSheet,"V");
+ insertIntoCell(11,2,"25.4",oSheet,"V");
+ insertIntoCell(12,2,"28.5",oSheet,"V");
+ insertIntoCell(13,2,"=SUM(B3:M3)",oSheet,"");
+
+ insertIntoCell(0,3,"Brown",oSheet,"");
+ insertIntoCell(1,3,"31.45",oSheet,"V");
+ insertIntoCell(2,3,"-20.9",oSheet,"V");
+ insertIntoCell(3,3,"-117.5",oSheet,"V");
+ insertIntoCell(4,3,"23.4",oSheet,"V");
+ insertIntoCell(5,3,"-114.5",oSheet,"V");
+ insertIntoCell(6,3,"115.3",oSheet,"V");
+ insertIntoCell(7,3,"-171.3",oSheet,"V");
+ insertIntoCell(8,3,"89.5",oSheet,"V");
+ insertIntoCell(9,3,"41.2",oSheet,"V");
+ insertIntoCell(10,3,"71.3",oSheet,"V");
+ insertIntoCell(11,3,"25.4",oSheet,"V");
+ insertIntoCell(12,3,"38.5",oSheet,"V");
+ insertIntoCell(13,3,"=SUM(A4:L4)",oSheet,"");
+
+ // insert a chart
+ Rectangle oRect = new Rectangle(500, 3000, 25000, 11000);
+
+ XCellRange oRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ XCellRange myRange = oRange.getCellRangeByName("A1:N4");
+ XCellRangeAddressable oRangeAddr = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
+ CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
+
+ CellRangeAddress[] oAddr = new CellRangeAddress[1];
+ oAddr[0] = myAddr;
+ XTableChartsSupplier oSupp = (XTableChartsSupplier)
+ UnoRuntime.queryInterface(XTableChartsSupplier.class, oSheet);
+
+
+ log.println("Insert Chart");
+ XTableCharts oCharts = oSupp.getCharts();
+ oCharts.addNewByName("ScChartObj", oRect, oAddr, true, true);
+
+ log.println("creating a new environment for object");
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oCharts);
+
+ XInterface oObj = ea.createEnumeration();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+// tEnv.addObjRelation("RECT", oRect);
+// tEnv.addObjRelation("ADDR", oAddr);
+
+ return tEnv;
+ }
+
+ /**
+ * Inserts a value or a formula in the cell of the spreasheet.
+ * @param CellX is the column index of the cell
+ * @param CellY is the row index of the cell
+ * @param theValue string representation of the value
+ * @param TT1 specify the spreadsheet, the interface
+ * <code>com.sun.star.sheet.XSpreadsheet</code>
+ * @param flag if it's equal to <code>'V'</code> then the method inserts
+ * a double-value in the cell else it inserts a formula in the cell
+ */
+ public static void insertIntoCell(
+ int CellX, int CellY, String theValue, XSpreadsheet TT1, String flag) {
+
+ XCell oCell = null;
+
+ try {
+ oCell = TT1.getCellByPosition(CellX, CellY);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
+ System.out.println("Could not get Cell");
+ }
+
+ if (flag.equals("V")) {
+ oCell.setValue(new Float(theValue).floatValue());
+ } else {
+ oCell.setFormula(theValue);
+ }
+
+ } // end of insertIntoCell
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java
new file mode 100644
index 000000000000..d6e3267daf0f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableColumnsEnumeration.java
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_TableColumnsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of the testobject here
+ // first we write what we are intend to do to log file
+ log.println("craeting a test environment");
+
+ log.println("getting column");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets );
+ XSpreadsheet xSpreadsheet = null;
+ try {
+ xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ }
+
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet);
+ XTableColumns oColumns = (XTableColumns) oColumnRowRange.getColumns();
+ oObj = oColumns;
+
+ log.println("creating a new environment for object");
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java
new file mode 100644
index 000000000000..13c5a2939703
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableConditionalEntryEnumeration.java
@@ -0,0 +1,207 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.ConditionOperator;
+import com.sun.star.sheet.XSheetConditionalEntries;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_TableConditionalEntryEnumeration extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occurred while filling cells");
+ e.printStackTrace(log);
+ }
+
+ Object CFormat = null;
+ XPropertySet Props = null;
+
+ try {
+ Props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oSheet);
+ CFormat = Props.getPropertyValue("ConditionalFormat");
+ if (utils.isVoid(CFormat)) {
+ log.println("Property 'ConditionalFormat' is void");
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ try {
+ XSheetConditionalEntries xSCE = (XSheetConditionalEntries)
+ UnoRuntime.queryInterface(XSheetConditionalEntries.class, CFormat);
+ xSCE.addNew(Conditions());
+ Props.setPropertyValue("ConditionalFormat", xSCE);
+ oObj = xSCE;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ }
+
+ log.println("creating a new environment for object");
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+ /**
+ * Returns the array of the property values that was filled by condition
+ * values.
+ */
+ protected PropertyValue[] Conditions() {
+ PropertyValue[] con = new PropertyValue[5];
+ CellAddress ca = new CellAddress();
+ ca.Column = 1;
+ ca.Row = 5;
+ ca.Sheet = 0;
+ con[0] = new PropertyValue();
+ con[0].Name = "StyleName";
+ con[0].Value = "Result2";
+ con[1] = new PropertyValue();
+ con[1].Name = "Formula1";
+ con[1].Value = "$Sheet1.$B$5";
+ con[2] = new PropertyValue();
+ con[2].Name = "Formula2";
+ con[2].Value = "";
+ con[3] = new PropertyValue();
+ con[3].Name = "Operator";
+ con[3].Value = ConditionOperator.EQUAL;
+ con[4] = new PropertyValue();
+ con[4].Name = "SourcePosition";
+ con[4].Value = ca;
+ return con;
+ }
+
+} // finish class ScTableConditionalEntry
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java
new file mode 100644
index 000000000000..52e362fab9aa
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TableRowsEnumeration.java
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableRows;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScIndexEnumeration_TableRowsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting row");
+ XSpreadsheet xSpreadsheet = null;
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets );
+ try {
+ xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch(com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ }
+
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet);
+
+ XTableRows oRows = (XTableRows) oColumnRowRange.getRows();
+ oObj = oRows;
+
+ log.println("creating a new environment for object");
+
+ XEnumerationAccess ea = (XEnumerationAccess)
+ UnoRuntime.queryInterface(XEnumerationAccess.class,oObj);
+
+ oObj = ea.createEnumeration();
+
+ log.println("ImplementationName: "+util.utils.getImplName(oObj));
+ // creating test environment
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("ENUM",ea);
+
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java
new file mode 100644
index 000000000000..6f1c23f614ce
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScIndexEnumeration_TextFieldEnumeration.java
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.text.XText;
+import com.sun.star.text.XTextContent;
+import com.sun.star.text.XTextFieldsSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object that represents enumeration of a colection
+ * of text fields in a cell of a spreadsheet. <p>
+ *
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::container::XEnumeration</code></li>
+ * </ul> <p>
+ *
+ * @see com.sun.star.container.XEnumeration
+ * @see ifc.container._XEnumeration
+ */
+public class ScIndexEnumeration_TextFieldEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.text.TextField.URL</code>, inserts it to the content
+ * of the cell in the spreadsheet. Then the component is obtained
+ * by <code>XTextFieldsSupplier</code> interface of a cell
+ * and <code>XEnumerationSupplier</code> interface .<p>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ XText oText = null;
+ XTextContent oContent = null;
+ XInterface aField = null;
+ XTextFieldsSupplier xTextFieldsSupp = null;
+
+ try {
+ // we want to create an instance of ScCellFieldObj.
+ // to do this we must get an MultiServiceFactory.
+
+ XMultiServiceFactory _oMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(XMultiServiceFactory.class, xSheetDoc);
+
+ aField = (XInterface)
+ _oMSF.createInstance("com.sun.star.text.TextField.URL");
+ oContent = (XTextContent)
+ UnoRuntime.queryInterface(XTextContent.class, aField);
+
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+
+ XCell oCell = oSheet.getCellByPosition(2,3);
+ oText = (XText)UnoRuntime.queryInterface(XText.class, oCell);
+
+ oText.insertTextContent(
+ oText.createTextCursor(), oContent, true);
+
+ xTextFieldsSupp = (XTextFieldsSupplier)
+ UnoRuntime.queryInterface(XTextFieldsSupplier.class, oCell);
+
+ oObj = xTextFieldsSupp.getTextFields().createEnumeration();
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Exception occured while creating test Object.");
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test object", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+
+ tEnv.addObjRelation("ENUM", xTextFieldsSupp.getTextFields());
+
+ return tEnv;
+ }
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java
new file mode 100644
index 000000000000..59e7850f15fc
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScLabelRangeObj.java
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XLabelRange;
+import com.sun.star.sheet.XLabelRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.LabelRange</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XLabelRange</code></li>
+* </ul>
+* @see com.sun.star.sheet.LabelRange
+* @see com.sun.star.sheet.XLabelRange
+* @see ifc.sheet._XLabelRange
+*/
+public class ScLabelRangeObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Obtains the value of the property <code>'ColumnLabelRanges'</code>
+ * from the document. The property value is the collection of label ranges.
+ * Adds new label range to the collection using the interface
+ * <code>XLabelRanges</code> that was queried from the property value.
+ * Retrieved from the collection the label range with index 0.
+ * The retrieved label range is the instance of the service
+ * <code>com.sun.star.sheet.LabelRange</code>.
+ * @see com.sun.star.sheet.LabelRange
+ * @see com.sun.star.sheet.XLabelRanges
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ try {
+ log.println("Getting test object ") ;
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ Object ranges = docProps.getPropertyValue("ColumnLabelRanges");
+ XLabelRanges lRanges = (XLabelRanges)
+ UnoRuntime.queryInterface(XLabelRanges.class, ranges);
+
+ log.println("Adding at least one element for ElementAccess interface");
+ CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6);
+ CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1);
+ lRanges.addNew(aRange1, aRange2);
+
+ oObj = (XLabelRange) AnyConverter.toObject(
+ new Type(XLabelRange.class),lRanges.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e) ;
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("testing...");
+
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScLabelRangeObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java
new file mode 100644
index 000000000000..c1e3b57e2b63
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScLabelRangesObj.java
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XLabelRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.LabelRanges</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XLabelRanges</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.LabelRanges
+* @see com.sun.star.sheet.XLabelRanges
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.sheet._XLabelRanges
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScLabelRangesObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Obtains the value of the property <code>'ColumnLabelRanges'</code>
+ * from the document. The property value is the collection of label ranges.
+ * Adds new label range to the collection using the interface
+ * <code>XLabelRanges</code> that was queried from the property value.
+ * This collection is the instance of the service
+ * <code>com.sun.star.sheet.LabelRanges</code>.
+ * @see com.sun.star.sheet.LabelRanges
+ * @see com.sun.star.sheet.XLabelRanges
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ try {
+ log.println("Getting test object ") ;
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ Object ranges = docProps.getPropertyValue("ColumnLabelRanges");
+ XLabelRanges lRanges = (XLabelRanges)
+ UnoRuntime.queryInterface(XLabelRanges.class, ranges);
+
+ log.println("Adding at least one element for ElementAccess interface");
+ CellRangeAddress aRange2 = new CellRangeAddress((short)0, 0, 1, 0, 6);
+ CellRangeAddress aRange1 = new CellRangeAddress((short)0, 0, 0, 0, 1);
+ lRanges.addNew(aRange1, aRange2);
+
+ oObj = lRanges;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log) ;
+ throw new StatusException(
+ "Error getting test object from spreadsheet document",e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("testing...");
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScLabelRangesObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScModelObj.java b/qadevOOo/tests/java/mod/_sc/ScModelObj.java
new file mode 100644
index 000000000000..6dd93942ff6b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScModelObj.java
@@ -0,0 +1,232 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.view.XSelectionSupplier;
+import ifc.view._XPrintJobBroadcaster;
+import java.io.File;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+import util.utils;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SpreadsheetDocument</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XSpreadsheetDocument</code></li>
+* <li> <code>com::sun::star::sheet::SpreadsheetDocumentSettings</code></li>
+* <li> <code>com::sun::star::lang::XComponent</code></li>
+* <li> <code>com::sun::star::frame::XModel</code></li>
+* <li> <code>com::sun::star::sheet::SpreadsheetDocument</code></li>
+* <li> <code>com::sun::star::util::XNumberFormatsSupplier</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.SpreadsheetDocument
+* @see com.sun.star.sheet.XSpreadsheetDocument
+* @see com.sun.star.sheet.SpreadsheetDocumentSettings
+* @see com.sun.star.lang.XComponent
+* @see com.sun.star.frame.XModel
+* @see com.sun.star.sheet.SpreadsheetDocument
+* @see com.sun.star.util.XNumberFormatsSupplier
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._XSpreadsheetDocument
+* @see ifc.sheet._SpreadsheetDocumentSettings
+* @see ifc.lang._XComponent
+* @see ifc.frame._XModel
+* @see ifc.sheet._SpreadsheetDocument
+* @see ifc.util._XNumberFormatsSupplier
+* @see ifc.beans._XPropertySet
+*/
+public class ScModelObj extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+ public static XSpreadsheetDocument xSecondsheetDoc;
+
+ /**
+ * Disposes Spreadsheet documents.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+
+ oComp = (XComponent) UnoRuntime.queryInterface(XComponent.class,
+ xSecondsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Disposes the spreadsheet documents if they was created already.
+ * Creates two spreadsheet documents. Rertieves the current controller for
+ * each of them. Obtains the collection of spreadsheets, takes one of them
+ * and takes some cell from the spreadsheet. The created documents are the instances
+ * of the service <code>com.sun.star.sheet.SpreadsheetDocument</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SELSUPP'</code> for
+ * {@link ifc.frame._XModel}( the interface
+ * <code>XSelectionSupplier</code> that was queried from the current
+ * controller of the spreadsheet)</li>
+ * <li> <code>'TOSELECT'</code> for
+ * {@link ifc.frame._XModel}( the cell that was retrieved from the
+ * spreadsheet)</li>
+ * <li> <code>'CONT2'</code> for
+ * {@link ifc.frame._XModel}( the current controller of the second
+ * spreadsheet)</li>
+ * </ul>
+ * @see
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ // creation of the testobject here
+ // first we write what we are intend to do to log file
+ log.println("craeting a test environment");
+
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) Param.getMSF());
+
+ if (xSpreadsheetDoc != null) {
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ if (xSecondsheetDoc != null) {
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(
+ XComponent.class, xSecondsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ try {
+ log.println("creating two spreadsheet documents");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ xSecondsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document ", e);
+ }
+
+ XModel model1 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xSpreadsheetDoc);
+ XModel model2 = (XModel) UnoRuntime.queryInterface(XModel.class,
+ xSecondsheetDoc);
+ XInterface oObj = model1;
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ XController cont1 = model1.getCurrentController();
+ XController cont2 = model2.getCurrentController();
+ cont1.getFrame().setName("cont1");
+ cont2.getFrame().setName("cont2");
+
+ XSelectionSupplier sel = (XSelectionSupplier) UnoRuntime.queryInterface(
+ XSelectionSupplier.class, cont1);
+
+ XCell toSel = null;
+ XCell[] xCalculatableCells = null;
+ try {
+ log.println("Getting spreadsheet");
+
+ XSpreadsheets oSheets = xSpreadsheetDoc.getSheets();
+ XIndexAccess oIndexSheets = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, oSheets);
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexSheets.getByIndex(0));
+
+ 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)
+ };
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Error getting cell object from spreadsheet document", e);
+ }
+
+ 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((XMultiServiceFactory) Param.getMSF())+"printfile.prt" ;
+ File f = new File(fileName);
+ if (f.exists()) {
+ f.delete();
+ }
+ _XPrintJobBroadcaster.MyPrintJobListener listener = new _XPrintJobBroadcaster.MyPrintJobListener(oObj, fileName);
+ tEnv.addObjRelation("XPrintJobBroadcaster.XPrintJobListener", listener);
+
+ return tEnv;
+ }
+
+} // finish class ScModelObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java b/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java
new file mode 100644
index 000000000000..9be7b474161a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScNamedRangeObj.java
@@ -0,0 +1,177 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XNamedRanges;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.NamedRange</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::XNamedRange</code></li>
+* <li> <code>com::sun::star::sheet::XCellRangeReferrer</code></li>
+* </ul>
+* @see com.sun.star.sheet.NamedRange
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.XNamedRange
+* @see com.sun.star.sheet.XCellRangeReferrer
+* @see ifc.container._XNamed
+* @see ifc.sheet._XNamedRange
+* @see ifc.sheet._XCellRangeReferrer
+*/
+public class ScNamedRangeObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Obtains the value of the property
+ * <code>'NamedRanges'</code> that is the collection of named ranges.
+ * Creates and adds new range to the collection. This new range is the instance of the
+ * service <code>com.sun.star.sheet.NamedRange</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'DATAAREA'</code> for
+ * {@link ifc.sheet._XCellRangeReferrer} (the cell range address of the
+ * created range) </li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ log.println("Getting test object ") ;
+
+ // Getting named ranges.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+
+ Object ranges = null;
+ try {
+ ranges = docProps.getPropertyValue("NamedRanges");
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get NamedRanges", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get NamedRanges", e);
+ }
+
+ XNamedRanges xNamedRanges = (XNamedRanges)
+ UnoRuntime.queryInterface(XNamedRanges.class, ranges);
+
+ CellRangeAddress DataArea = new CellRangeAddress((short)0, 0, 0, 1, 1);
+ CellAddress base = new CellAddress(DataArea.Sheet,
+ DataArea.StartColumn,
+ DataArea.StartRow);
+
+ if (xNamedRanges.hasByName("ANamedRange")) {
+ xNamedRanges.removeByName("ANamedRange");
+ }
+
+ xNamedRanges.addNewByName("ANamedRange", "A1:B2", base, 0);
+
+ CellAddress listOutputPosition = new CellAddress((short)0, 1, 1);
+ xNamedRanges.outputList(listOutputPosition);
+
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),xNamedRanges.getByName("ANamedRange"));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("DATAAREA", DataArea);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java b/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java
new file mode 100644
index 000000000000..b7ed2add02c6
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScNamedRangesObj.java
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XNamedRanges;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.NamedRanges</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XNamedRanges</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.NamedRanges
+* @see com.sun.star.sheet.XNamedRanges
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.sheet._XNamedRanges
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScNamedRangesObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Obtains the value of the property
+ * <code>'NamedRanges'</code> that is the collection of named ranges.
+ * This collection is the instance of the service
+ * <code>com.sun.star.sheet.NamedRanges</code>. Creates and adds new range to
+ * the collection.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SHEET'</code> for
+ * {@link ifc.sheet._XNamedRanges} (the retrieved spreadsheet) </li>
+ * </ul>
+ * @see com.sun.star.sheet.NamedRanges
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+ XSpreadsheet oSheet = null;
+
+ log.println("Getting test object ");
+ XSpreadsheets oSheets = xSheetDoc.getSheets();
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ // Getting named ranges.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ Object ranges = null;
+ try {
+ ranges = docProps.getPropertyValue("NamedRanges");
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get NamedRanges", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get NamedRanges", e);
+ }
+
+ XNamedRanges xNamedRanges = (XNamedRanges)
+ UnoRuntime.queryInterface(XNamedRanges.class, ranges);
+
+ CellRangeAddress DataArea = new CellRangeAddress((short)0, 0, 0, 2, 2);
+ CellAddress base = new CellAddress(DataArea.Sheet,
+ DataArea.StartColumn,
+ DataArea.StartRow);
+
+ xNamedRanges.addNewByName("ANamedRange", "A1:B2", base, 0);
+
+ CellAddress listOutputPosition = new CellAddress((short)0, 1, 1);
+ xNamedRanges.outputList(listOutputPosition);
+
+ oObj = xNamedRanges;
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ tEnv.addObjRelation("SHEET", oSheet);
+
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java b/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java
new file mode 100644
index 000000000000..30f9de40250f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScRecentFunctionsObj.java
@@ -0,0 +1,133 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.RecentFunctions</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XRecentFunctions</code></li>
+* </ul>
+* @see com.sun.star.sheet.RecentFunctions
+* @see com.sun.star.sheet.XRecentFunctions
+* @see ifc.sheet._XRecentFunctions
+*/
+public class ScRecentFunctionsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.sheet.RecentFunctions</code> and an instance of the
+ * service <code>com.sun.star.sheet.FunctionDescriptions</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'FUNCTIONLIST'</code> for
+ * {@link ifc.sheet._XRecentFunctions}(the second created instance)</li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+ XInterface allFunctions = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ try {
+ log.println("Getting test object ") ;
+ XMultiServiceFactory oDocMSF = (XMultiServiceFactory)Param.getMSF();
+ oObj = (XInterface)oDocMSF.createInstance(
+ "com.sun.star.sheet.RecentFunctions");
+ allFunctions = (XInterface)oDocMSF.createInstance(
+ "com.sun.star.sheet.FunctionDescriptions");
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // Other parameters required for interface tests
+ XNameAccess NA = (XNameAccess)
+ UnoRuntime.queryInterface(XNameAccess.class, allFunctions);
+ tEnv.addObjRelation("FUNCTIONLIST", NA);
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java b/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java
new file mode 100644
index 000000000000..aae4b08ba19e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScScenariosObj.java
@@ -0,0 +1,174 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XScenariosSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.Scenarios</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::sheet::XScenarios</code></li>
+* </ul>
+* @see com.sun.star.sheet.Scenarios
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.sheet.XScenarios
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+* @see ifc.sheet._XScenarios
+*/
+public class ScScenariosObj extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Fills some cells of the spreadsheet.
+ * Retrieves the collection of all scenarios using the interface
+ * <code>XScenariosSupplier</code>. Creates a new scenario and adds it to the
+ * collection. This collection is the instance of the service
+ * <code>com.sun.star.sheet.Scenarios</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'ADDR'</code> for
+ * {@link ifc.sheet._XScenarios}(the array of cell range addresses
+ * of the created scenario)</li>
+ * </ul>
+ * @see com.sun.star.sheet.Scenarios
+ * @see com.sun.star.sheet.XScenariosSupplier
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet)AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't fill some cell", e);
+ }
+
+ XScenariosSupplier xSupp = (XScenariosSupplier)
+ UnoRuntime.queryInterface(XScenariosSupplier.class, oSheet);
+ XCellRange oRange = (XCellRange)
+ UnoRuntime.queryInterface(XCellRange.class, oSheet);
+ XCellRange myRange = oRange.getCellRangeByName("A1:N4");
+ XCellRangeAddressable oRangeAddr = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, myRange);
+ CellRangeAddress myAddr = oRangeAddr.getRangeAddress();
+
+ CellRangeAddress[] oAddr = new CellRangeAddress[1];
+ oAddr[0] = myAddr;
+
+ xSupp.getScenarios().addNewByName("ScScenarios", oAddr, "Range");
+
+ XInterface oObj = xSupp.getScenarios();
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("adding ObjectRelation for XScenarios");
+ tEnv.addObjRelation("ADDR", oAddr);
+
+ return tEnv;
+ }
+
+
+} // finish class ScScenariosObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScShapeObj.java b/qadevOOo/tests/java/mod/_sc/ScShapeObj.java
new file mode 100644
index 000000000000..1257498a53fd
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScShapeObj.java
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.DrawTools;
+import util.SOfficeFactory;
+
+import com.sun.star.drawing.XShape;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+public class ScShapeObj extends TestCase {
+
+ static XComponent xSheetDoc;
+
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a sheetdoc" );
+ xSheetDoc = (XComponent) UnoRuntime.queryInterface(XComponent.class, SOF.createCalcDoc(null));
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.drawing.EllipseShape</code> as tested component
+ * and adds it to the document.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Style1', 'Style2'</code> for
+ * {@link ifc.drawing._Shape} :
+ * two values of 'Style' property. The first is taken
+ * from the shape tested, the second from another
+ * shape added to the draw page. </li>
+ * <li> <code>'XTEXTINFO'</code> for
+ * {@link ifc.text._XText} :
+ * creator which can create instnaces of
+ * <code>com.sun.star.text.TextField.URL</code>
+ * service. </li>
+ * </ul>
+ */
+ protected TestEnvironment createTestEnvironment
+ (TestParameters tParam, PrintWriter log) {
+
+ XInterface oObj = null;
+ XShape oShape = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+ oShape = SOF.createShape(xSheetDoc,5000, 3500, 7500, 5000,"Rectangle");
+ DrawTools.getShapes(DrawTools.getDrawPage(xSheetDoc,0)).add(oShape);
+ oObj = oShape ;
+
+ for (int i=0; i < 10; i++) {
+ DrawTools.getShapes(DrawTools.getDrawPage(xSheetDoc,0)).add(
+ SOF.createShape(xSheetDoc,
+ 5000, 3500, 7510 + 10 * i, 5010 + 10 * i, "Rectangle"));
+ }
+
+ // create test environment here
+ TestEnvironment tEnv = new TestEnvironment( oShape );
+
+ log.println("Implementation name: "+util.utils.getImplName(oObj));
+ tEnv.addObjRelation("DOCUMENT",xSheetDoc);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScShapeObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java b/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java
new file mode 100644
index 000000000000..1a6fa837dbce
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSheetLinkObj.java
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetLinkable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetLink</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::util::XRefreshable</code></li>
+* <li> <code>com::sun::star::sheet::SheetLink</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* The following files used by this test :
+* <ul>
+* <li><b> ScSheetLinksObj.sdc </b> : for creating link </li>
+* </ul> <p>
+* @see com.sun.star.sheet.SheetLink
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.util.XRefreshable
+* @see com.sun.star.sheet.SheetLink
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.util._XRefreshable
+* @see ifc.sheet._SheetLink
+* @see ifc.beans._XPropertySet
+*/
+public class ScSheetLinkObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Links the sheet to another sheet in another
+ * document using the interface <code>XSheetLinkable</code>. Obtains the
+ * value of the property <code>'SheetLinks'</code> that is the collection of
+ * sheet links. Retrieves from the collection one of the sheet link that
+ * is the instance of the service <code>com.sun.star.sheet.SheetLink</code>.
+ * @see com.sun.star.sheet.SheetLink
+ * @see com.sun.star.sheet.XSheetLinkable
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+ XSpreadsheet oSheet = null;
+
+ log.println("Getting test object ") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ XSheetLinkable SL = (XSheetLinkable)
+ UnoRuntime.queryInterface(XSheetLinkable.class, oSheet);
+
+ // creating link. Doesn't matter that it refers to unexistant object.
+ // this is for proper work of XAccess tests.
+ String sURL = utils.getFullTestDocName("ScSheetLinksObj.sdc");
+ SL.link(sURL, "Sheet1", "", "", com.sun.star.sheet.SheetLinkMode.VALUE);
+
+ // Getting links.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+ Object oLinks = null;
+ try {
+ oLinks = docProps.getPropertyValue("SheetLinks");
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get SheetLinks", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get SheetLinks", e);
+ }
+
+ XNameAccess links = (XNameAccess)
+ UnoRuntime.queryInterface(XNameAccess.class, oLinks);
+
+ String[] names = links.getElementNames();
+
+ try {
+ oObj = (XInterface)AnyConverter.toObject(
+ new Type(XInterface.class),links.getByName(names[0]));
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.container.NoSuchElementException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by name", e);
+ }
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ }
+
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java b/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java
new file mode 100644
index 000000000000..ada0b9d5cd1c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSheetLinksObj.java
@@ -0,0 +1,167 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSheetLinkable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SheetLinks</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.SheetLinks
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+*/
+public class ScSheetLinksObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from a document
+ * and takes one of them. Links the sheet to another sheet using the
+ * interface <code>XSheetLinkable</code>. Obtains the
+ * value of the property <code>'SheetLinks'</code> that is the collection of
+ * sheet links. This collection is the instance of the service
+ * <code>com.sun.star.sheet.SheetLinks</code>.
+ * @see com.sun.star.sheet.SheetLink
+ * @see com.sun.star.sheet.XSheetLinkable
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+ XSpreadsheet oSheet = null;
+
+ log.println("Getting test object ") ;
+ XSpreadsheets oSheets = xSheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ XSheetLinkable SL = (XSheetLinkable)
+ UnoRuntime.queryInterface(XSheetLinkable.class, oSheet);
+
+ // creating link. Doesn't matter that it refers to unexistant object.
+ // this is for proper work of X*Access tests.
+ String aSourceArea = util.utils.getFullTestURL("calcshapes.sxc");
+ SL.link(aSourceArea, "Sheet1", "", "",
+ com.sun.star.sheet.SheetLinkMode.VALUE);
+
+ // Getting links.
+ XPropertySet docProps = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xSheetDoc);
+
+ Object links = null;
+ try {
+ links = docProps.getPropertyValue("SheetLinks");
+ } catch(com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get SheetLinks", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get SheetLinks", e);
+ }
+
+ oObj = (XInterface)UnoRuntime.queryInterface(XInterface.class, links);
+
+ log.println("Creating object - " +
+ ((oObj == null) ? "FAILED" : "OK"));
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ }
+
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java
new file mode 100644
index 000000000000..c193eef05d1c
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSortDescriptorBase.java
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XSortable;
+
+
+/**
+ *
+ * initial description
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.sheet.SheetSortDescriptor
+ *
+ */
+public class ScSortDescriptorBase extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * in general this method creates a testdocument
+ *
+ * @param tParam class which contains additional test parameters
+ * @param log class to log the test state and result
+ *
+ *
+ * @see TestParameters
+ * @see PrintWriter
+ *
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * in general this method disposes the testenvironment and document
+ *
+ * @param tParam class which contains additional test parameters
+ * @param log class to log the test state and result
+ *
+ *
+ * @see TestParameters
+ * @see PrintWriter
+ *
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+
+
+ /**
+ * creating a Testenvironment for the interfaces to be tested
+ *
+ * @param tParam class which contains additional test parameters
+ * @param log class to log the test state and result
+ *
+ * @return Status class
+ *
+ * @see TestParameters
+ * @see PrintWriter
+ */
+ public TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ XSortable xSORT = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // create testobject here
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+ if (xSpreadsheets == null) log.println("FAILED"); else log.println("OK");
+
+ log.println("getting a sheet");
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oObj = (XInterface) UnoRuntime.queryInterface(XInterface.class,oIndexAccess.getByIndex(0));
+ } catch (Exception e) {
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ xSORT = (XSortable) UnoRuntime.queryInterface(XSortable.class,oObj);
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ tEnv.addObjRelation("xSORT",xSORT);
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScSortDescriptorBase
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java
new file mode 100644
index 000000000000..eb5b9760a8ee
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettings.java
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.GlobalSheetSettings</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::GlobalSheetSettings</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.GlobalSheetSettings
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._GlobalSheetSettings
+* @see ifc.beans._XPropertySet
+*/
+public class ScSpreadsheetSettings extends TestCase {
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.sheet.GlobalSheetSettings</code>.
+ */
+ public TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ // create testobject here
+ try {
+ oObj = (XInterface)((XMultiServiceFactory)tParam.getMSF()).
+ createInstance("com.sun.star.sheet.GlobalSheetSettings");
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScSpreadsheetSettings
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettingsObj.java b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettingsObj.java
new file mode 100644
index 000000000000..98016c8b5cf9
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSpreadsheetSettingsObj.java
@@ -0,0 +1,110 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SpreadsheetDocumentSettings</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::SpreadsheetDocumentSettings</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.SpreadsheetDocumentSettings
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._SpreadsheetDocumentSettings
+* @see ifc.beans._XPropertySet
+*/
+public class ScSpreadsheetSettingsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * The spreadsheet document is the instance of the service
+ * <code>com.sun.star.sheet.SpreadsheetDocumentSettings</code>.
+ */
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log) throws StatusException {
+
+ XInterface oObj = null;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "Creating a test environment" );
+
+ oObj = xSheetDoc;
+
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ return tEnv;
+ }
+
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScStyleFamiliesObj.java b/qadevOOo/tests/java/mod/_sc/ScStyleFamiliesObj.java
new file mode 100644
index 000000000000..a9601a671554
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScStyleFamiliesObj.java
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.uno.UnoRuntime;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.style.StyleFamilies</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* </ul>
+* @see com.sun.star.style.StyleFamilies
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XIndexAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XIndexAccess
+*/
+public class ScStyleFamiliesObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families from the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * This collection is the instance of the service
+ * <code>com.sun.star.style.StyleFamilies</code>.
+ * @see com.sun.star.style.StyleFamilies
+ * @see com.sun.star.style.XStyleFamiliesSupplier
+ */
+ public TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log) throws StatusException {
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XNameAccess oStyleFamilies=null;
+ // create testobject here
+ log.println("getting style families");
+ XStyleFamiliesSupplier oStyleFamiliesSupplier =(XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class, xSpreadsheetDoc);
+
+ oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies();
+
+ TestEnvironment tEnv = new TestEnvironment(oStyleFamilies);
+ return tEnv;
+
+ } // finish method getTestEnvironment
+} // finish class ScStyleFamiliesObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java b/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java
new file mode 100644
index 000000000000..3c90df65111e
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScStyleFamilyObj.java
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.style.StyleFamily</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameContainer</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XNameReplace</code></li>
+* </ul>
+* @see com.sun.star.style.StyleFamily
+* @see com.sun.star.container.XNameContainer
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XNameReplace
+* @see ifc.container._XNameContainer
+* @see ifc.container._XNameAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XNameReplace
+*/
+public class ScStyleFamilyObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families from the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains style family with index 0 from the collection.
+ * Creates the two instance of the service <code>com.sun.star.style.CellStyle</code>.
+ * One of the instance uses for inserting of new style to the obtained style
+ * family that is the instance of the service
+ * <code>com.sun.star.style.StyleFamily</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SecondInstance'</code> for
+ * {@link ifc.container._XNameContainer}(the second created instance of
+ * the service <code>com.sun.star.style.CellStyle</code>)</li>
+ * <li> <code>'XNameReplaceINDEX'</code> for
+ * {@link ifc.container._XNameContainer}(the number of the current
+ * running threads multiplied by two)</li>
+ * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
+ * {@link ifc.container._XNameContainer}(the created instances of
+ * the service <code>com.sun.star.style.CellStyle</code>)</li>
+ * </ul>
+ * @see com.sun.star.style.CellStyle
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XNameAccess oStyleFamilyNameAccess = null;
+ // create testobject here
+ log.println("getting style");
+ XStyleFamiliesSupplier oStyleFamiliesSupplier = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class, xSpreadsheetDoc);
+
+ XNameAccess oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies();
+ XIndexAccess oStyleFamiliesIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oStyleFamilies);
+ try {
+ oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),
+ oStyleFamiliesIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occured while getting StyleFamily", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occured while getting StyleFamily", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occured while getting StyleFamily", e);
+ }
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+ XComponent xComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
+
+ XInterface oInstance = (XInterface)
+ SOF.createInstance(xComp,"com.sun.star.style.CellStyle");
+
+ // insert a Style which can be replaced by name
+ XNameContainer oContainer = (XNameContainer)
+ UnoRuntime.queryInterface(
+ XNameContainer.class, oStyleFamilyNameAccess);
+ try {
+ oContainer.insertByName("ScStyleFamilyObj", oInstance);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't insert new style family", e);
+ } catch (com.sun.star.container.ElementExistException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't insert new style family", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't insert new style family", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oStyleFamilyNameAccess);
+
+ oInstance = (XInterface)
+ SOF.createInstance(xComp, "com.sun.star.style.CellStyle");
+
+ //second instance for insertByName in XNameContainer
+ tEnv.addObjRelation("SecondInstance", oInstance);
+
+ int THRCNT = 1;
+ if ((String)tParam.get("THRCNT") != null) {
+ THRCNT = Integer.parseInt((String)tParam.get("THRCNT"));
+ }
+
+ log.println( "adding XNameReplaceINDEX as mod relation to environment" );
+ tEnv.addObjRelation("XNameReplaceINDEX", new Integer(2*THRCNT).toString());
+
+ // INSTANCEn : _XNameContainer; _XNameReplace
+ log.println( "adding INSTANCEn as mod relation to environment" );
+ for (int n = 1; n < 2*(THRCNT+1) ;n++ ) {
+ log.println( "adding INSTANCE" + n +
+ " as mod relation to environment" );
+ tEnv.addObjRelation("INSTANCE" + n, SOF.createInstance(
+ xComp,"com.sun.star.style.CellStyle"));
+ }
+ // NAMEREPLACE : _XNameReplace
+ log.println("adding NAMEREPLACE as mod relation to environment");
+ String cName = "ScStyleFamilyObj";
+ tEnv.addObjRelation("NAMEREPLACE", cName);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+} // finish class ScStyleFamilyObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScStyleObj.java b/qadevOOo/tests/java/mod/_sc/ScStyleObj.java
new file mode 100644
index 000000000000..44181500ce9f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScStyleObj.java
@@ -0,0 +1,270 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+import java.util.Vector;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.Property;
+import com.sun.star.beans.PropertyAttribute;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.style.Style</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::style::Style</code></li>
+* <li> <code>com::sun::star::style::XStyle</code></li>
+* </ul>
+* @see com.sun.star.style.Style
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.style.Style
+* @see com.sun.star.style.XStyle
+* @see ifc.container._XNamed
+* @see ifc.style._Style
+* @see ifc.style._XStyle
+*/
+public class ScStyleObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of style families from the document
+ * using the interface <code>XStyleFamiliesSupplier</code>.
+ * Obtains style family with index 0 from the collection and obtains
+ * style with index 0 from this style family. Creates the instance of the
+ * service <code>com.sun.star.style.CellStyle</code>. Inserts the created
+ * style to the obtained style family. Retrieves a collection of spreadsheets
+ * from the document and takes one of them. Gets a cell from the spreadsheet
+ * and sets the value of property <code>'CellStyle'</code> to the created
+ * style. The created style is the instance of the service
+ * <code>com.sun.star.style.Style</code> also.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'PoolStyle'</code> for
+ * {@link ifc.style._XStyle}(the style with index 0 that was obtained
+ * from the collection)</li>
+ * </ul>
+ * @see com.sun.star.style.CellStyle
+ * @see com.sun.star.style.Style
+ * @see com.sun.star.style.XStyleFamiliesSupplier
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+
+ // creation of the testobject here
+ // first we write what we are intend to do to log file
+
+ log.println("creating a test environment");
+
+ log.println("getting style");
+ XStyleFamiliesSupplier oStyleFamiliesSupplier = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class, xSpreadsheetDoc);
+ XNameAccess oStyleFamilies = oStyleFamiliesSupplier.getStyleFamilies();
+ XIndexAccess oStyleFamiliesIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oStyleFamilies);
+ XNameAccess oStyleFamilyNameAccess = null;
+ XStyle oStyle = null;
+ try {
+ oStyleFamilyNameAccess = (XNameAccess) AnyConverter.toObject(
+ new Type(XNameAccess.class),
+ oStyleFamiliesIndexAccess.getByIndex(0));
+
+ XIndexAccess oStyleFamilyIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class,
+ oStyleFamilyNameAccess);
+ oStyle = (XStyle) AnyConverter.toObject(
+ new Type(XStyle.class),oStyleFamilyIndexAccess.getByIndex(0));
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ log.println("Creating a user-defined style");
+ XMultiServiceFactory oMSF = (XMultiServiceFactory)
+ UnoRuntime.queryInterface(
+ XMultiServiceFactory.class, xSpreadsheetDoc);
+
+ XInterface oInt = null;
+ try {
+ oInt = (XInterface)
+ oMSF.createInstance("com.sun.star.style.CellStyle");
+ } catch(com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+ XStyle oMyStyle = (XStyle)UnoRuntime.queryInterface(XStyle.class, oInt);
+
+ XNameContainer oStyleFamilyNameContainer = (XNameContainer)UnoRuntime.
+ queryInterface(XNameContainer.class, oStyleFamilyNameAccess);
+
+ try {
+ if (oStyleFamilyNameContainer.hasByName("My Style")) {
+ oStyleFamilyNameContainer.removeByName("My Style");
+ }
+
+ oStyleFamilyNameContainer.insertByName("My Style", oMyStyle);
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test environment", e);
+ } catch(com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test environment", e);
+ } catch(com.sun.star.container.ElementExistException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test environment", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create test environment", e);
+ }
+
+
+ //using the style
+ log.println("Getting spreadsheet") ;
+ XSpreadsheets oSheets = xSpreadsheetDoc.getSheets() ;
+ XIndexAccess oIndexSheets = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oSheets);
+
+ XCell aCell = null;
+ try {
+ XSpreadsheet oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexSheets.getByIndex(0));
+ log.println("Getting a cell from sheet") ;
+ aCell = oSheet.getCellByPosition(2,3) ;
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet by index", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet by index", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet by index", e);
+ }
+
+ XPropertySet xProp = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, aCell);
+
+ try {
+ xProp.setPropertyValue("CellStyle", oMyStyle.getName());
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set property CellStyle", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set property CellStyle", e);
+ } catch(com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set property CellStyle", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't set property CellStyle", e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oMyStyle);
+
+ tEnv.addObjRelation("PoolStyle", oStyle);
+
+ tEnv.addObjRelation("PropertyNames", getPropertyNames
+ ((XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, oMyStyle)));
+
+ return tEnv;
+ }
+
+ public String[] getPropertyNames(XPropertySet props) {
+ Property[] the_props = props.getPropertySetInfo().getProperties();
+ Vector names = new Vector() ;
+
+ for (int i=0;i<the_props.length;i++) {
+ boolean isWritable =
+ ((the_props[i].Attributes & PropertyAttribute.READONLY) == 0);
+ if (isWritable) {
+ names.add(the_props[i].Name);
+ }
+ }
+ return (String[]) names.toArray(new String[names.size()]) ;
+ }
+} // finish class ScStyleObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java b/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java
new file mode 100644
index 000000000000..f353d6a2f547
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSubTotalDescriptorBase.java
@@ -0,0 +1,154 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.GeneralFunction;
+import com.sun.star.sheet.SubTotalColumn;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.sheet.XSubTotalCalculatable;
+import com.sun.star.sheet.XSubTotalDescriptor;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SubTotalDescriptor</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XSubTotalDescriptor</code></li>
+* <li> <code>com::sun::star::sheet::SubTotalDescriptor</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.sheet.XSubTotalDescriptor
+* @see com.sun.star.sheet.SubTotalDescriptor
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.sheet._XSubTotalDescriptor
+* @see ifc.sheet._SubTotalDescriptor
+* @see ifc.beans._XPropertySet
+*/
+public class ScSubTotalDescriptorBase extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // 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( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Creates a subtotal descriptor using the interface
+ * <code>XSubTotalCalculatable</code>. This descriptor is the instance of the
+ * service <code>com.sun.star.sheet.SubTotalDescriptor</code>.
+ * @see com.sun.star.sheet.XSubTotalCalculatable
+ * @see com.sun.star.sheet.SubTotalDescriptor
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ XSubTotalCalculatable xSTC = (XSubTotalCalculatable)
+ UnoRuntime.queryInterface(XSubTotalCalculatable.class, oSheet);
+
+ SubTotalColumn[] columns = new SubTotalColumn[1];
+ SubTotalColumn column = new SubTotalColumn();
+ column.Column = 3;
+ column.Function = GeneralFunction.SUM;
+ columns[0] = column;
+
+ XSubTotalDescriptor desc = xSTC.createSubTotalDescriptor(true);
+ desc.addNew(columns, 1);
+
+ XInterface oObj = desc;
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScSubTotalDescriptorBase
diff --git a/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java b/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java
new file mode 100644
index 000000000000..ffe5db10607b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScSubTotalFieldObj.java
@@ -0,0 +1,169 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.GeneralFunction;
+import com.sun.star.sheet.SubTotalColumn;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.sheet.XSubTotalCalculatable;
+import com.sun.star.sheet.XSubTotalDescriptor;
+import com.sun.star.sheet.XSubTotalField;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.SubTotalField</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XSubTotalField</code></li>
+* </ul>
+* @see com.sun.star.sheet.SubTotalField
+* @see com.sun.star.sheet.XSubTotalField
+* @see ifc.sheet._XSubTotalField
+*/
+public class ScSubTotalFieldObj extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // 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( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Creates a subtotal descriptor using the interface
+ * <code>XSubTotalCalculatable</code>. Adds a subtotal field definition to
+ * the descriptor. Obtains the subtotal field with index 0 from the
+ * collection. The obtained subtotal field is the instance of the service
+ * <code>com.sun.star.sheet.SubTotalField</code>.
+ * @see com.sun.star.sheet.XSubTotalCalculatable
+ * @see com.sun.star.sheet.SubTotalField
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type (XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ XSubTotalCalculatable xSTC = (XSubTotalCalculatable)
+ UnoRuntime.queryInterface(XSubTotalCalculatable.class, oSheet);
+
+ XSubTotalDescriptor xSTD = xSTC.createSubTotalDescriptor(true);
+
+ SubTotalColumn[] columns = new SubTotalColumn[1];
+ SubTotalColumn column = new SubTotalColumn();
+ column.Column = 5;
+ column.Function = GeneralFunction.SUM;
+ columns[0] = column;
+ xSTD.addNew(columns, 1);
+
+ XIndexAccess oDescIndex = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSTD);
+
+ XInterface oObj = null;
+
+ try {
+ oObj = ( XSubTotalField ) AnyConverter.toObject(
+ new Type(XSubTotalField.class),oDescIndex.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get XSubTotalField", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get XSubTotalField", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get XSubTotalField", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ return tEnv;
+
+ } // finish method getTestEnvironment
+
+} // finish class ScSubTotalFieldObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java b/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java
new file mode 100644
index 000000000000..d90f91b43ab0
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTabViewObj.java
@@ -0,0 +1,283 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import com.sun.star.container.NoSuchElementException;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.form.XForm;
+import com.sun.star.lang.WrappedTargetException;
+import java.io.PrintWriter;
+import java.util.Comparator;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.FormTools;
+import util.SOfficeFactory;
+import util.ValueComparer;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XCellRangeAddressable;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.sheet.SpreadsheetView</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::sheet::XViewSplitable</code></li>
+ * <li> <code>com::sun::star::sheet::XViewFreezable</code></li>
+ * <li> <code>com::sun::star::sheet::SpreadsheetViewSettings</code></li>
+ * <li> <code>com::sun::star::beans::XPropertySet</code></li>
+ * <li> <code>com::sun::star::container::XIndexAccess</code></li>
+ * <li> <code>com::sun::star::container::XElementAccess</code></li>
+ * <li> <code>com::sun::star::sheet::XSpreadsheetView</code></li>
+ * <li> <code>com::sun::star::view::XSelectionSupplier</code></li>
+ * </ul>
+ * @see com.sun.star.sheet.XViewSplitable
+ * @see com.sun.star.sheet.XViewFreezable
+ * @see com.sun.star.sheet.SpreadsheetViewSettings
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.container.XIndexAccess
+ * @see com.sun.star.container.XElementAccess
+ * @see com.sun.star.sheet.XSpreadsheetView
+ * @see com.sun.star.view.XSelectionSupplier
+ * @see ifc.sheet._XViewSplitable
+ * @see ifc.sheet._XViewFreezable
+ * @see ifc.sheet._SpreadsheetViewSettings
+ * @see ifc.beans._XPropertySet
+ * @see ifc.container._XIndexAccess
+ * @see ifc.container._XElementAccess
+ * @see ifc.sheet._XSpreadsheetView
+ * @see ifc.view._XSelectionSupplier
+ */
+public class ScTabViewObj extends TestCase {
+ public static XSpreadsheetDocument xSpreadsheetDoc;
+ public static XSpreadsheetDocument xSpreadsheetDoc2;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating two spreadsheet documents");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ try {
+ Thread.sleep(1000);
+ } catch (java.lang.InterruptedException e) {}
+ xSpreadsheetDoc2 = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ XComponent oComp2 = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc2) ;
+ util.DesktopTools.closeDoc(oComp2);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retieves the current controller of the spreadsheet document using the
+ * interface <code>XModel</code>. The controller is the instance of the
+ * service <code>com.sun.star.sheet.SpreadsheetView</code>. Retrieves
+ * a collection of spreadsheets from the document and takes one of them.
+ * Fills two cells in the spreadsheet.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'Sheet'</code> for
+ * {@link ifc.sheet._XSpreadsheetView}(the retrieved spreadsheet)</li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ * @see com.sun.star.sheet.SpreadsheetView
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ XDrawPage oDrawPage = null;
+
+ XModel aModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+
+ XModel aSecondModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc2);
+
+ XInterface oObj = aModel.getCurrentController();
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class), oIndexAccess.getByIndex(1));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("XDispatchProvider.URL", ".uno:Copy") ;
+
+ log.println("adding 'Sheet' as ObjRelation");
+ tEnv.addObjRelation("Sheet", oSheet);
+ tEnv.addObjRelation("Frame",aModel.getCurrentController().getFrame());
+ tEnv.addObjRelation("SecondModel",aSecondModel);
+ tEnv.addObjRelation("FirstModel",aModel);
+
+ //Relation for XControlAccess
+ tEnv.addObjRelation("DOCUMENT", UnoRuntime.queryInterface(XComponent.class,xSpreadsheetDoc));
+ tEnv.addObjRelation("XControlAccess.isSheet", Boolean.TRUE);
+ //Relations for XSelectionSupplier
+ XCell cell_1 = null;
+ XCell cell_2 = null;
+ Object cellRange = null;
+ try {
+ cellRange = (Object)oSheet.getCellRangeByPosition(0, 0, 3, 3);
+ cell_1 = oSheet.getCellByPosition(5,5);
+ cell_2 = oSheet.getCellByPosition(7,7);
+ cell_2.setValue(17.5);
+ cell_1.setValue(5.5);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get some cell", e);
+ }
+
+ Object[] selections = {oSheet, cellRange, cell_1, cell_2};
+ tEnv.addObjRelation("Selections", selections);
+
+ tEnv.addObjRelation("Comparer", new Comparator() {
+ public int compare(Object o1, Object o2) {
+ XCellRangeAddressable adr1 = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, o1);
+ XCellRangeAddressable adr2 = (XCellRangeAddressable)
+ UnoRuntime.queryInterface(XCellRangeAddressable.class, o2);
+ if (adr1 == null || adr2 == null) return -1;
+ CellRangeAddress range1 = adr1.getRangeAddress();
+ CellRangeAddress range2 = adr2.getRangeAddress();
+ return ValueComparer.equalValue(range1, range2) ? 0 : 1 ;
+ }
+ public boolean equals(Object obj) {
+ return compare(this, obj) == 0;
+ } });
+
+ tEnv.addObjRelation("XUserInputInterception.XModel", aModel);
+
+ // XForm for com.sun.star.view.XFormLayerAccess
+
+ XForm myForm = null;
+ String kindOfControl="CommandButton";
+ XShape aShape = null;
+ try{
+ log.println("adding contol shape '" + kindOfControl + "'");
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ;
+
+ aShape = FormTools.createControlShape(oComp, 3000, 4500, 15000, 10000, kindOfControl);
+
+ } catch (Exception e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create following control shape : '" +
+ kindOfControl + "': ", e);
+ }
+
+ log.println("adding relation for com.sun.star.view.XFormLayerAccess: XForm");
+ try {
+ log.println( "getting Drawpages" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class,xSpreadsheetDoc);
+ XDrawPages oDP = (XDrawPages) oDPS.getDrawPages();
+ oDP.insertNewByIndex(1);
+ oDP.insertNewByIndex(2);
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDP.getByIndex(0));
+ if (oDrawPage == null)
+ log.println("ERROR: could not get DrawPage: null");
+
+ oDrawPage.add(aShape);
+ log.println("getting XForm");
+ XNameContainer xForm = FormTools.getForms(oDrawPage);
+ try {
+ myForm = (XForm) AnyConverter.toObject(new Type(XForm.class),xForm.getByName("Standard"));
+ } catch (WrappedTargetException ex) {
+ log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
+ } catch (NoSuchElementException ex) {
+ log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
+ }
+ if (myForm == null)
+ log.println("ERROR: could not get XForm: null");
+ tEnv.addObjRelation("XFormLayerAccess.XForm", myForm);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
+ log.println("ERROR: could not add ObjectRelation 'XFormLayerAccess.XForm': " + ex.toString());
+ } catch (WrappedTargetException ex) {
+ log.println("ERROR: could not add ObjectRelation 'XFormLayerAccess.XForm': " + ex.toString());
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("ERROR: could not add ObjectRelation 'XFormLayerAccess.XForm': " + ex.toString());
+ }
+ return tEnv;
+ }
+
+} // finish class ScTabViewObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java b/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java
new file mode 100644
index 000000000000..e3f0f54d0e94
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableColumnObj.java
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.table.TableColumn</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::table::TableColumn</code></li>
+* <li> <code>com::sun::star::table::XCellRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.table.TableColumn
+* @see com.sun.star.table.XCellRange
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.container._XNamed
+* @see ifc.table._TableColumn
+* @see ifc.table._XCellRange
+* @see ifc.beans._XPropertySet
+*/
+public class ScTableColumnObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Obtaines the collection of columns in the range using the interface
+ * <code>XColumnRowRange</code>. Retrieves the column with index 10 that is
+ * the instance of the service <code>com.sun.star.table.TableColumn</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'setName'</code> for
+ * {@link ifc.container._XNamed} </li>
+ * <li> <code>'ValidRange'</code> for
+ * {@link ifc.table._XCellRange} </li>
+ * </ul>
+ * @see com.sun.star.table.XColumnRowRange
+ * @see com.sun.star.table.TableColumn
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of the testobject here
+ // first we write what we are intend to do to log file
+ log.println("creating a test environment");
+
+ XSpreadsheet xSpreadsheet = null;
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets );
+ try {
+ xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get element by name", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get element by name", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get element by name", e);
+ }
+
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet);
+ XTableColumns oColumns = (XTableColumns) oColumnRowRange.getColumns();
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oColumns);
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),oIndexAccess.getByIndex(10));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ // a valid Range for XCellRange
+ tEnv.addObjRelation("ValidRange","K1:K1");
+
+ //since TableColumnsNames are fixed XNamed::setName() should always be OK
+ tEnv.addObjRelation("setName",new Boolean(true));
+ return tEnv;
+ }
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java b/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java
new file mode 100644
index 000000000000..6dca3b67d4bb
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableColumnsObj.java
@@ -0,0 +1,153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableColumns;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.table.TableColumns</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::table::XTableColumns</code></li>
+* </ul>
+* @see com.sun.star.table.TableColumns
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.table.XTableColumns
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.table._XTableColumns
+*/
+public class ScTableColumnsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Obtaines the collection of columns in the range using the interface
+ * <code>XColumnRowRange</code>. This collection is the instance of the
+ * service <code>com.sun.star.table.TableColumns</code>.
+ * @see com.sun.star.table.XColumnRowRange
+ * @see com.sun.star.table.TableColumns
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of the testobject here
+ // first we write what we are intend to do to log file
+ log.println("craeting a test environment");
+
+ log.println("getting column");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets );
+ XSpreadsheet xSpreadsheet = null;
+ try {
+ xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ }
+
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet);
+ XTableColumns oColumns = (XTableColumns) oColumnRowRange.getColumns();
+ oObj = oColumns;
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ // adding relation for XTableColumns
+ tEnv.addObjRelation("XTableColumns.XCellRange",
+ UnoRuntime.queryInterface(XCellRange.class, xSpreadsheet));
+
+ return tEnv;
+ }
+} // finish class ScTableColumnsObj
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java b/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java
new file mode 100644
index 000000000000..b427536b3dba
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableConditionalEntry.java
@@ -0,0 +1,230 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.utils;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.ConditionOperator;
+import com.sun.star.sheet.XSheetConditionalEntries;
+import com.sun.star.sheet.XSheetConditionalEntry;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.TableConditionalEntry</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XSheetConditionalEntry</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCondition</code></li>
+* </ul>
+* @see com.sun.star.sheet.TableConditionalEntry
+* @see com.sun.star.sheet.XSheetConditionalEntry
+* @see com.sun.star.sheet.XSheetCondition
+* @see ifc.sheet._XSheetConditionalEntry
+* @see ifc.sheet._XSheetCondition
+*/
+public class ScTableConditionalEntry extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Fills some cells of the spreadsheet. Retrieves value of the property
+ * <code>'ConditionalFormat'</code> that is the collection of the conditions
+ * of a conditional format. Adds new conditional entry to the collection
+ * using the interface <code>XSheetConditionalEntries</code>. Sets new value
+ * of the property <code>'ConditionalFormat'</code>. Obtains the conditional
+ * entry with index 0 that is the instance of the service
+ * <code>com.sun.star.sheet.TableConditionalEntry</code>.
+ * @see com.sun.star.sheet.XSheetConditionalEntries
+ * @see com.sun.star.sheet.TableConditionalEntry
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occurred while filling cells");
+ e.printStackTrace(log);
+ }
+
+ Object CFormat = null;
+ XPropertySet Props = null;
+
+ try {
+ Props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oSheet);
+ CFormat = Props.getPropertyValue("ConditionalFormat");
+ if (utils.isVoid(CFormat)) {
+ log.println("Property 'ConditionalFormat' is void");
+ }
+ } catch (com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instance", e);
+ }
+
+ try {
+ XSheetConditionalEntries xSCE = (XSheetConditionalEntries)
+ UnoRuntime.queryInterface(XSheetConditionalEntries.class, CFormat);
+ xSCE.addNew(Conditions());
+ Props.setPropertyValue("ConditionalFormat", xSCE);
+ oObj = (XSheetConditionalEntry) AnyConverter.toObject(
+ new Type(XSheetConditionalEntry.class),xSCE.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while getting Entry", e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+ /**
+ * Returns the array of the property values that was filled by condition
+ * values.
+ */
+ protected PropertyValue[] Conditions() {
+ PropertyValue[] con = new PropertyValue[5];
+ CellAddress ca = new CellAddress();
+ ca.Column = 1;
+ ca.Row = 5;
+ ca.Sheet = 0;
+ con[0] = new PropertyValue();
+ con[0].Name = "StyleName";
+ con[0].Value = "Result2";
+ con[1] = new PropertyValue();
+ con[1].Name = "Formula1";
+ con[1].Value = "$Sheet1.$B$5";
+ con[2] = new PropertyValue();
+ con[2].Name = "Formula2";
+ con[2].Value = "";
+ con[3] = new PropertyValue();
+ con[3].Name = "Operator";
+ con[3].Value = ConditionOperator.EQUAL;
+ con[4] = new PropertyValue();
+ con[4].Name = "SourcePosition";
+ con[4].Value = ca;
+ return con;
+ }
+
+} // finish class ScTableConditionalEntry
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java b/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java
new file mode 100644
index 000000000000..c873ba5e4367
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableConditionalFormat.java
@@ -0,0 +1,208 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.ConditionOperator;
+import com.sun.star.sheet.XSheetConditionalEntries;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.TableConditionalFormat</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::sheet::XSheetConditionalEntries</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* </ul>
+* @see com.sun.star.sheet.TableConditionalFormat
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.sheet.XSheetConditionalEntries
+* @see com.sun.star.container.XElementAccess
+* @see ifc.container._XNameAccess
+* @see ifc.container._XIndexAccess
+* @see ifc.sheet._XSheetConditionalEntries
+* @see ifc.container._XElementAccess
+*/
+public class ScTableConditionalFormat extends TestCase {
+
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Fills some cells of the spreadsheet. Retrieves value of the property
+ * <code>'ConditionalFormat'</code> that is the collection of the conditions
+ * of a conditional format. Adds new two conditional entries to the
+ * collection using the interface <code>XSheetConditionalEntries</code>.
+ * The retrieved collection is the instance of the service
+ * <code>com.sun.star.sheet.TableConditionalFormat</code>.
+ * @see com.sun.star.sheet.TableConditionalFormat
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ log.println("Exception occurred while filling cells");
+ e.printStackTrace(log);
+ }
+
+ XPropertySet Props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oSheet);
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),
+ Props.getPropertyValue("ConditionalFormat"));
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get ConditionalFromat", e);
+ } catch(com.sun.star.beans.UnknownPropertyException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get ConditionalFromat", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get ConditionalFromat", e);
+ }
+
+ XSheetConditionalEntries xSCE = (XSheetConditionalEntries)
+ UnoRuntime.queryInterface(XSheetConditionalEntries.class, oObj);
+ xSCE.addNew(Conditions(5));
+ xSCE.addNew(Conditions(2));
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+
+ /**
+ * Returns the array of the property values that was filled by condition
+ * values.
+ */
+ public PropertyValue[] Conditions(int nr) {
+ PropertyValue[] con = new PropertyValue[5];
+ CellAddress ca = new CellAddress();
+ ca.Column = 1;
+ ca.Row = 5;
+ ca.Sheet = 0;
+ con[0] = new PropertyValue();
+ con[0].Name = "StyleName";
+ con[0].Value = "Result2";
+ con[1] = new PropertyValue();
+ con[1].Name = "Formula1";
+ con[1].Value = "$Sheet1.$B$"+nr;
+ con[2] = new PropertyValue();
+ con[2].Name = "Formula2";
+ con[2].Value = "";
+ con[3] = new PropertyValue();
+ con[3].Name = "Operator";
+ con[3].Value = ConditionOperator.EQUAL;
+ con[4] = new PropertyValue();
+ con[4].Name = "SourcePosition";
+ con[4].Value = ca;
+ return con;
+ }
+
+} // finish class ScTableConditionalFormat
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java b/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java
new file mode 100644
index 000000000000..077cbf26c4c1
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableRowObj.java
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableRows;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.table.TableRow</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::table::TableRow</code></li>
+* <li> <code>com::sun::star::table::XCellRange</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* </ul>
+* @see com.sun.star.table.TableRow
+* @see com.sun.star.table.XCellRange
+* @see com.sun.star.beans.XPropertySet
+* @see ifc.table._TableRow
+* @see ifc.table._XCellRange
+* @see ifc.beans._XPropertySet
+*/
+public class ScTableRowObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Obtains the collection of rows using the interface
+ * <code>XColumnRowRange</code>. Obtains the row with index 6 from the
+ * collection and this is the instance of the service
+ * <code>com.sun.star.table.TableRow</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'ValidRange'</code> for
+ * {@link ifc.table._XCellRange} </li>
+ * </ul>
+ * @see com.sun.star.table.XColumnRowRange
+ * @see com.sun.star.table.TableRow
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ // creation of the testobject here
+ // first we write what we are intend to do to log file
+ log.println("creating a test environment");
+
+ XSpreadsheet xSpreadsheet = null;
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets );
+ try {
+ xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet);
+ XTableRows oRows = (XTableRows) oColumnRowRange.getRows();
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, oRows);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),oIndexAccess.getByIndex(6));
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception during creating Testenvironment", e);
+ } catch(com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception during creating Testenvironment", e);
+ } catch(com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception during creating Testenvironment", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception during creating Testenvironment", e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+ tEnv.addObjRelation("ValidRange","A7:A7");
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java b/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java
new file mode 100644
index 000000000000..17e45dc1fb59
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableRowsObj.java
@@ -0,0 +1,148 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCellRange;
+import com.sun.star.table.XColumnRowRange;
+import com.sun.star.table.XTableRows;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.table.TableRows</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::table::XTableRows</code></li>
+* </ul>
+* @see com.sun.star.table.TableRows
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.table.XTableRows
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.table._XTableRows
+*/
+public class ScTableRowsObj extends TestCase {
+ XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Obtains the collection of rows using the interface
+ * <code>XColumnRowRange</code>. The obtained collection is the instance of
+ * the service <code>com.sun.star.table.TableRows</code>.
+ * @see com.sun.star.table.XColumnRowRange
+ * @see com.sun.star.table.TableRows
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting row");
+ XSpreadsheet xSpreadsheet = null;
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSheetDoc.getSheets();
+ XNameAccess oNames = (XNameAccess)
+ UnoRuntime.queryInterface( XNameAccess.class, xSpreadsheets );
+ try {
+ xSpreadsheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oNames.getByName(oNames.getElementNames()[0]));
+ } catch(com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch(com.sun.star.container.NoSuchElementException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ } catch(com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get spreadsheet", e);
+ }
+
+ XColumnRowRange oColumnRowRange = (XColumnRowRange)
+ UnoRuntime.queryInterface(XColumnRowRange.class, xSpreadsheet);
+
+ XTableRows oRows = (XTableRows) oColumnRowRange.getRows();
+ oObj = oRows;
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ // adding relation for XTableRows
+ tEnv.addObjRelation("XTableRows.XCellRange",
+ UnoRuntime.queryInterface(XCellRange.class, xSpreadsheet));
+
+ return tEnv;
+ }
+} // finish class ScTableRowsObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java b/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java
new file mode 100644
index 000000000000..f6355fe0de86
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableSheetObj.java
@@ -0,0 +1,421 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XScenariosSupplier;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.CellAddress;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.table.XCell;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.util.XCloseable;
+
+import ifc.sheet._XCellRangesQuery;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+import util.ValueComparer;
+
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.Spreadsheet</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::style::ParagraphProperties</code></li>
+* <li> <code>com::sun::star::table::XTableChartsSupplier</code></li>
+* <li> <code>com::sun::star::sheet::XSpreadsheet</code></li>
+* <li> <code>com::sun::star::table::CellProperties</code></li>
+* <li> <code>com::sun::star::sheet::XSheetAnnotationsSupplier</code></li>
+* <li> <code>com::sun::star::table::XCellRange</code></li>
+* <li> <code>com::sun::star::sheet::XCellRangeAddressable</code></li>
+* <li> <code>com::sun::star::sheet::XDataPilotTablesSupplier</code></li>
+* <li> <code>com::sun::star::sheet::Spreadsheet</code></li>
+* <li> <code>com::sun::star::sheet::XCellRangeMovement</code></li>
+* <li> <code>com::sun::star::style::CharacterProperties</code></li>
+* <li> <code>com::sun::star::sheet::XSheetOperation</code></li>
+* <li> <code>com::sun::star::sheet::XScenariosSupplier</code></li>
+* <li> <code>com::sun::star::sheet::XSheetPageBreak</code></li>
+* <li> <code>com::sun::star::sheet::XArrayFormulaRange</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCellRange</code></li>
+* <li> <code>com::sun::star::container::XNamed</code></li>
+* <li> <code>com::sun::star::sheet::SheetCellRange</code></li>
+* <li> <code>com::sun::star::chart::XChartData</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::util::XMergeable</code></li>
+* <li> <code>com::sun::star::table::XColumnRowRange</code></li>
+* </ul>
+* @see com.sun.star.style.ParagraphProperties
+* @see com.sun.star.table.XTableChartsSupplier
+* @see com.sun.star.sheet.XSpreadsheet
+* @see com.sun.star.table.CellProperties
+* @see com.sun.star.sheet.XSheetAnnotationsSupplier
+* @see com.sun.star.table.XCellRange
+* @see com.sun.star.sheet.XCellRangeAddressable
+* @see com.sun.star.sheet.XDataPilotTablesSupplier
+* @see com.sun.star.sheet.Spreadsheet
+* @see com.sun.star.sheet.XCellRangeMovement
+* @see com.sun.star.style.CharacterProperties
+* @see com.sun.star.sheet.XSheetOperation
+* @see com.sun.star.sheet.XScenariosSupplier
+* @see com.sun.star.sheet.XSheetPageBreak
+* @see com.sun.star.sheet.XArrayFormulaRange
+* @see com.sun.star.sheet.XSheetCellRange
+* @see com.sun.star.container.XNamed
+* @see com.sun.star.sheet.SheetCellRange
+* @see com.sun.star.chart.XChartData
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.util.XMergeable
+* @see com.sun.star.table.XColumnRowRange
+* @see ifc.style._ParagraphProperties
+* @see ifc.table._XTableChartsSupplier
+* @see ifc.sheet._XSpreadsheet
+* @see ifc.table._CellProperties
+* @see ifc.sheet._XSheetAnnotationsSupplier
+* @see ifc.table._XCellRange
+* @see ifc.sheet._XCellRangeAddressable
+* @see ifc.sheet._XDataPilotTablesSupplier
+* @see ifc.sheet._Spreadsheet
+* @see ifc.sheet._XCellRangeMovement
+* @see ifc.style._CharacterProperties
+* @see ifc.sheet._XSheetOperation
+* @see ifc.sheet._XScenariosSupplier
+* @see ifc.sheet._XSheetPageBreak
+* @see ifc.sheet._XArrayFormulaRange
+* @see ifc.sheet._XSheetCellRange
+* @see ifc.container._XNamed
+* @see ifc.sheet._SheetCellRange
+* @see ifc.chart._XChartData
+* @see ifc.beans._XPropertySet
+* @see ifc.util._XMergeable
+* @see ifc.table._XColumnRowRange
+*/
+public class ScTableSheetObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a sheetdocument");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ log.println(" disposing xSheetDoc ");
+
+ try {
+ XCloseable oCloser = (XCloseable) UnoRuntime.queryInterface(
+ XCloseable.class, xSheetDoc);
+ oCloser.close(true);
+ } catch (com.sun.star.util.CloseVetoException e) {
+ log.println("Couldn't close document");
+ } catch (com.sun.star.lang.DisposedException e) {
+ log.println("Document already disposed");
+ } catch (java.lang.NullPointerException e) {
+ log.println("Couldn't get XCloseable");
+ }
+
+ try {
+ log.println("Sleeping 500 Millis");
+ Thread.sleep(500);
+ } catch (InterruptedException ex) {
+ }
+
+ log.println("... Done");
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Fills some cell in the spreadsheet. The retrieved spreadsheet is the
+ * instance of the service <code>com.sun.star.sheet.Spreadsheet</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'noArray'</code> for
+ * {@link ifc.sheet._XArrayFormulaRange}(to avoid the test of
+ * the interface <code>XArrayFormulaRange</code>)</li>
+ * </ul>
+ * @see com.sun.star.sheet.XArrayFormulaRange
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param,
+ PrintWriter log) {
+ XInterface oObj = null;
+
+ log.println("getting sheets");
+
+ XSpreadsheets xSpreadsheets = (XSpreadsheets) xSheetDoc.getSheets();
+
+ log.println("getting a sheet");
+
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSpreadsheets);
+
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),
+ oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ oSheet.getCellByPosition(8, 8).setFormula("= B5 + C1");
+ // fill cells for XSheetOtline::autoutline
+ oSheet.getCellByPosition(6, 6).setValue(3);
+ oSheet.getCellByPosition(7, 6).setValue(3);
+ oSheet.getCellByPosition(8, 6).setFormula("= SUM(G7:H7)");
+ oSheet.getCellByPosition(9, 6).setFormula("= G7*I7");
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Exception occurred while filling cells", e);
+ }
+
+ 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;
+ }
+
+ public void prepareToSort() {
+ try {
+ oTable.getCellByPosition(0, 0).setValue(4);
+ oTable.getCellByPosition(0, 1).setFormula("b");
+ oTable.getCellByPosition(0, 2).setValue(3);
+ oTable.getCellByPosition(0, 3).setValue(23);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ out.println("Exception while checking sort");
+ }
+ }
+
+ public boolean checkSort(boolean isSortNumbering,
+ boolean isSortAscending) {
+ out.println("Sort checking...");
+
+ boolean res = false;
+ String[] value = new String[4];
+
+ for (int i = 0; i < 4; i++) {
+ try {
+ XCell cell = oTable.getCellByPosition(0, i);
+ value[i] = cell.getFormula();
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ out.println("Exception while checking sort");
+ }
+ }
+
+ if (isSortNumbering) {
+ if (isSortAscending) {
+ out.println("Sorting ascending");
+
+ String[] rightVal = { "3", "4", "23", "b" };
+ String[] vals = { value[0], value[1], value[2], value[3] };
+ res = ValueComparer.equalValue(vals, rightVal);
+ out.println("Expected 3, 4, 23, b");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ } else {
+ String[] rightVal = { "b", "23", "4", "3" };
+ String[] vals = { value[0], value[1], value[2], value[3] };
+ res = ValueComparer.equalValue(vals, rightVal);
+ out.println("Expected b, 23, 4, 3");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ }
+ } else {
+ if (isSortAscending) {
+ String[] rightVal = { "3", "4", "23", "b" };
+ res = ValueComparer.equalValue(value, rightVal);
+ out.println("Expected 3, 4, 23, b");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ } else {
+ String[] rightVal = { "b", "23", "4", "3" };
+ res = ValueComparer.equalValue(value, rightVal);
+ out.println("Expected b, 23, 4, 3");
+ out.println("getting: " + value[0] + ", " +
+ value[1] + ", " + value[2] + ", " +
+ value[3]);
+ }
+ }
+
+ if (res) {
+ out.println("Sorted correctly");
+ } else {
+ out.println("Sorted uncorrectly");
+ }
+
+ return res;
+ }
+ });
+
+ return tEnv;
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableSheetsObj.java b/qadevOOo/tests/java/mod/_sc/ScTableSheetsObj.java
new file mode 100644
index 000000000000..c31f692b8e51
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableSheetsObj.java
@@ -0,0 +1,171 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.Spreadsheets</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::XSpreadsheets</code></li>
+* <li> <code>com::sun::star::container::XNameAccess</code></li>
+* <li> <code>com::sun::star::container::XIndexAccess</code></li>
+* <li> <code>com::sun::star::container::XElementAccess</code></li>
+* <li> <code>com::sun::star::container::XNameReplace</code></li>
+* <li> <code>com::sun::star::container::XNameContainer</code></li>
+* </ul>
+* @see com.sun.star.sheet.Spreadsheets
+* @see com.sun.star.sheet.XSpreadsheets
+* @see com.sun.star.container.XNameAccess
+* @see com.sun.star.container.XIndexAccess
+* @see com.sun.star.container.XElementAccess
+* @see com.sun.star.container.XNameReplace
+* @see com.sun.star.container.XNameContainer
+* @see ifc.sheet._XSpreadsheets
+* @see ifc.container._XNameAccess
+* @see ifc.container._XIndexAccess
+* @see ifc.container._XElementAccess
+* @see ifc.container._XNameReplace
+* @see ifc.container._XNameContainer
+*/
+public class ScTableSheetsObj extends TestCase {
+ private static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println("disposing xSpreadsheetDocument");
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves the collection of the spreadsheets using the interface
+ * <code>XSpreadsheetDocument</code>. The retrieved collection is the
+ * instance of the service <code>com.sun.star.sheet.Spreadsheets</code>.
+ * Creates instances of the service <code>com.sun.star.sheet.Spreadsheet</code>.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'SecondInstance'</code> for
+ * {@link ifc.container._XNameContainer} (the created instance of the
+ * service <code>com.sun.star.sheet.Spreadsheet</code>) </li>
+ * <li> <code>'INSTANCE1', ..., 'INSTANCEN'</code> for
+ * {@link ifc.container._XNameContainer} (the created instances of the
+ * service <code>com.sun.star.sheet.Spreadsheet</code>) </li>
+ * </ul>
+ * @see com.sun.star.sheet.Spreadsheets
+ * @see com.sun.star.sheet.XSpreadsheetDocument
+ * @see com.sun.star.sheet.Spreadsheet
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ XInterface oObj = (XInterface)
+ UnoRuntime.queryInterface(XInterface.class, xSpreadsheets);
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ log.println("creating instance of the sheet object to use it in tests");
+ XSpreadsheet oSecondSheet = null;
+
+ try {
+ oSecondSheet = SOF.createSpreadsheet(xSpreadsheetDoc);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create instances", e);
+ }
+
+ //adding Instance for XNameContainer
+ tEnv.addObjRelation("SecondInstance",oSecondSheet);
+
+ // INSTANCEn : _XNameContainer; _XNameReplace
+ log.println( "adding INSTANCEn as mod relation to environment" );
+
+ int THRCNT = 1;
+ if ((String)Param.get("THRCNT") != null) {
+ THRCNT = Integer.parseInt((String)Param.get("THRCNT"));
+ }
+ try {
+ for (int n = 1; n < (THRCNT+1) ;n++ ) {
+ log.println(
+ "adding INSTANCE" + n +" as mod relation to environment" );
+ tEnv.addObjRelation(
+ "INSTANCE" + n,
+ SOF.createSpreadsheet(xSpreadsheetDoc) );
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Couldn't create instances for object relations", e);
+ }
+
+ return tEnv;
+ }
+}
+
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java b/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java
new file mode 100644
index 000000000000..972e1e010f55
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScTableValidationObj.java
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+* Test for object which is represented by service
+* <code>com.sun.star.sheet.TableValidation</code>. <p>
+* Object implements the following interfaces :
+* <ul>
+* <li> <code>com::sun::star::sheet::TableValidation</code></li>
+* <li> <code>com::sun::star::beans::XPropertySet</code></li>
+* <li> <code>com::sun::star::sheet::XSheetCondition</code></li>
+* </ul>
+* @see com.sun.star.sheet.TableValidation
+* @see com.sun.star.beans.XPropertySet
+* @see com.sun.star.sheet.XSheetCondition
+* @see ifc.sheet._TableValidation
+* @see ifc.beans._XPropertySet
+* @see ifc.sheet._XSheetCondition
+*/
+public class ScTableValidationObj extends TestCase {
+ static XSpreadsheetDocument xSpreadsheetDoc = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF());
+
+ try {
+ log.println( "creating a sheetdocument" );
+ xSpreadsheetDoc = SOF.createCalcDoc(null);;
+ } catch (com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xSheetDoc " );
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface (XComponent.class, xSpreadsheetDoc) ;
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retrieves a collection of spreadsheets from the document and takes one of
+ * them. Fills some cell in the spreadsheet. Obtains the property
+ * <code>'Validation'</code> of the spreadsheet. The value of the property
+ * is the instance of the service <code>com.sun.star.sheet.TableValidation</code>.
+ * @see com.sun.star.sheet.TableValidation
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+
+ XInterface oObj = null;
+
+ log.println("getting sheets");
+ XSpreadsheets xSpreadsheets = (XSpreadsheets)xSpreadsheetDoc.getSheets();
+
+ log.println("getting a sheet");
+ XSpreadsheet oSheet = null;
+ XIndexAccess oIndexAccess = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ try {
+ oSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),oIndexAccess.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException( "Couldn't get a spreadsheet", e);
+ }
+
+ log.println("filling some cells");
+ try {
+ oSheet.getCellByPosition(5, 5).setValue(15);
+ oSheet.getCellByPosition(1, 4).setValue(10);
+ oSheet.getCellByPosition(2, 0).setValue(-5.15);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException(
+ "Exception occurred while filling cells", e);
+ }
+
+ XPropertySet Props = null;
+
+ try {
+ Props = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, oSheet);
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),Props.getPropertyValue("Validation"));
+ } catch (com.sun.star.lang.WrappedTargetException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get property 'Validation'", e);
+ } catch (com.sun.star.beans.UnknownPropertyException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get property 'Validation'", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get property 'Validation'", e);
+ }
+
+ log.println("creating a new environment for object");
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ } // finish method getTestEnvironment
+} // finish class ScTableValidationObj
+
diff --git a/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java
new file mode 100644
index 000000000000..1068af55b063
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsEnumeration.java
@@ -0,0 +1,145 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XEnumerationAccess;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XUniqueCellFormatRangesSupplier;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.awt.Color;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+public class ScUniqueCellFormatsEnumeration extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+ static XSpreadsheet oSheet = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a sheetdocument");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ //add this lines after synchronisation
+ //log.println(" disposing xSheetDoc ");
+ //DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("Getting the first sheet");
+
+ XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSheetDoc.getSheets());
+
+ try {
+ oSheet = (XSpreadsheet) UnoRuntime.queryInterface(
+ XSpreadsheet.class, xIA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ changeColor("A1:A5", 0, 255, 0);
+ changeColor("A6:B10", 255, 0, 0);
+ changeColor("B1:B6", 0, 0, 255);
+ changeColor("B7", 0, 255, 0);
+ changeColor("B8:B10", 0, 0, 255);
+ changeColor("C1:C10", 0, 0, 255);
+ changeColor("D1:D10", 0, 255, 0);
+
+ XUniqueCellFormatRangesSupplier xUCRS = (XUniqueCellFormatRangesSupplier) UnoRuntime.queryInterface(
+ XUniqueCellFormatRangesSupplier.class,
+ oSheet);
+
+ XEnumerationAccess xEnum = (XEnumerationAccess) UnoRuntime.queryInterface(
+ XEnumerationAccess.class,
+ xUCRS.getUniqueCellFormatRanges());
+ XInterface oObj = xEnum.createEnumeration();
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ tEnv.addObjRelation("ExpectedCount", new Integer(4));
+
+ return tEnv;
+ }
+
+ protected void changeColor(String RangeName, int r, int g, int b) {
+ XCellRange xRange = oSheet.getCellRangeByName(RangeName);
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xRange);
+ Color c = new Color(r, g, b);
+ int c2int = 16777216 + c.hashCode();
+
+ try {
+ xPropertySet.setPropertyValue("CellBackColor", new Integer(c2int));
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ log.println("Couldn't change CellFormat");
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ log.println("Couldn't change CellFormat");
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't change CellFormat");
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't change CellFormat");
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java
new file mode 100644
index 000000000000..e85fcb2bb4c5
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScUniqueCellFormatsObj.java
@@ -0,0 +1,139 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+package mod._sc;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XUniqueCellFormatRangesSupplier;
+import com.sun.star.table.XCellRange;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+import java.awt.Color;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.SOfficeFactory;
+
+
+public class ScUniqueCellFormatsObj extends TestCase {
+ static XSpreadsheetDocument xSheetDoc = null;
+ static XSpreadsheet oSheet = null;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ protected void initialize(TestParameters tParam, PrintWriter log) {
+ // get a soffice factory object
+ SOfficeFactory SOF = SOfficeFactory.getFactory(
+ (XMultiServiceFactory) tParam.getMSF());
+
+ try {
+ log.println("creating a sheetdocument");
+ xSheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ // Some exception occures.FAILED
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create document", e);
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup(TestParameters tParam, PrintWriter log) {
+ //add this lines after synchronisation
+ //log.println(" disposing xSheetDoc ");
+ //DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ protected TestEnvironment createTestEnvironment(TestParameters tParam,
+ PrintWriter log) {
+ log.println("Getting the first sheet");
+
+ XIndexAccess xIA = (XIndexAccess) UnoRuntime.queryInterface(
+ XIndexAccess.class, xSheetDoc.getSheets());
+
+ try {
+ oSheet = (XSpreadsheet) UnoRuntime.queryInterface(
+ XSpreadsheet.class, xIA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get a spreadsheet", e);
+ }
+
+ changeColor("A1:A5", 0, 255, 0);
+ changeColor("A6:B10", 255, 0, 0);
+ changeColor("B1:B6", 0, 0, 255);
+ changeColor("B7", 0, 255, 0);
+ changeColor("B8:B10", 0, 0, 255);
+ changeColor("C1:C10", 0, 0, 255);
+ changeColor("D1:D10", 0, 255, 0);
+
+ XUniqueCellFormatRangesSupplier xUCRS = (XUniqueCellFormatRangesSupplier) UnoRuntime.queryInterface(
+ XUniqueCellFormatRangesSupplier.class,
+ oSheet);
+
+ XInterface oObj = xUCRS.getUniqueCellFormatRanges();
+ log.println("Implementationname: " + util.utils.getImplName(oObj));
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ return tEnv;
+ }
+
+ protected void changeColor(String RangeName, int r, int g, int b) {
+ XCellRange xRange = oSheet.getCellRangeByName(RangeName);
+ XPropertySet xPropertySet = (XPropertySet) UnoRuntime.queryInterface(
+ XPropertySet.class, xRange);
+ Color c = new Color(r, g, b);
+ int c2int = 16777216 + c.hashCode();
+
+ try {
+ xPropertySet.setPropertyValue("CellBackColor", new Integer(c2int));
+ } catch (com.sun.star.beans.UnknownPropertyException e) {
+ log.println("Couldn't change CellFormat");
+ } catch (com.sun.star.beans.PropertyVetoException e) {
+ log.println("Couldn't change CellFormat");
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Couldn't change CellFormat");
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Couldn't change CellFormat");
+ }
+ }
+}
diff --git a/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java b/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java
new file mode 100644
index 000000000000..cf8bbce0843b
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/ScViewPaneObj.java
@@ -0,0 +1,209 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import com.sun.star.container.NoSuchElementException;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.drawing.XDrawPage;
+import com.sun.star.drawing.XDrawPages;
+import com.sun.star.drawing.XDrawPagesSupplier;
+import com.sun.star.drawing.XShape;
+import com.sun.star.form.XForm;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XViewPane;
+import com.sun.star.table.CellRangeAddress;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import util.FormTools;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.sheet.SpreadsheetViewPane</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li> <code>com::sun::star::sheet::XViewPane</code></li>
+ * <li> <code>com::sun::star::sheet::XCellRangeReferrer</code></li>
+ * </ul>
+ * @see com.sun.star.sheet.SpreadsheetViewPane
+ * @see com.sun.star.sheet.XViewPane
+ * @see com.sun.star.sheet.XCellRangeReferrer
+ * @see ifc.sheet._XViewPane
+ * @see ifc.sheet._XCellRangeReferrer
+ */
+public class ScViewPaneObj extends TestCase {
+ static private XSpreadsheetDocument xSpreadsheetDoc;
+ static private SOfficeFactory SOF;
+ static private XInterface oObj;
+
+ /**
+ * Creates Spreadsheet document.
+ */
+ public void initialize( TestParameters Param, PrintWriter log ) {
+ // get a soffice factory object
+ SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)Param.getMSF());
+
+ try {
+ log.println("creating a spreadsheetdocument");
+ xSpreadsheetDoc = SOF.createCalcDoc(null);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document ", e );
+ }
+ }
+
+ /**
+ * Disposes Spreadsheet document.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println("disposing xSpreadsheetDocument");
+ XComponent oComp = (XComponent)
+ UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc);
+ util.DesktopTools.closeDoc(oComp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Retieves the current controller of the spreadsheet document using the
+ * interface <code>XModel</code>. The controller contains the collection
+ * of the view panes so retrieves the view pane with index 0 from
+ * the collection. The retrived view pane is the instance of the service
+ * <code>com.sun.star.sheet.SpreadsheetViewPane</code>. Retrieves the address
+ * of the cell range that consists of the cells which are visible in the pane.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'DATAAREA'</code> for
+ * {@link ifc.sheet._XViewPane}(the retrieved address)</li>
+ * </ul>
+ * @see com.sun.star.frame.XModel
+ */
+ protected TestEnvironment createTestEnvironment(TestParameters Param, PrintWriter log) {
+ XDrawPage oDrawPage;
+
+ XModel xm = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSpreadsheetDoc);
+ XController xc = xm.getCurrentController();
+ XIndexAccess xIA = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xc);
+ try {
+ oObj = (XInterface) AnyConverter.toObject(
+ new Type(XInterface.class),xIA.getByIndex(0));
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't get by index", e);
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj);
+
+ //Relation for XControlAccess
+ tEnv.addObjRelation("DOCUMENT", UnoRuntime.queryInterface(XComponent.class,xSpreadsheetDoc));
+ tEnv.addObjRelation("XControlAccess.isSheet", Boolean.TRUE);
+
+ XViewPane VP = (XViewPane)
+ UnoRuntime.queryInterface(XViewPane.class, oObj);
+ CellRangeAddress dataArea = VP.getVisibleRange();
+ tEnv.addObjRelation("DATAAREA", dataArea);
+
+ // XForm for com.sun.star.view.XFormLayerAccess
+ log.println("adding relation for com.sun.star.view.XFormLayerAccess: XForm");
+
+ XForm myForm = null;
+ String kindOfControl="CommandButton";
+ XShape aShape = null;
+ try{
+ log.println("adding contol shape '" + kindOfControl + "'");
+ XComponent oComp = (XComponent) UnoRuntime.queryInterface(XComponent.class, xSpreadsheetDoc) ;
+
+ aShape = FormTools.createControlShape(oComp, 3000, 4500, 15000, 10000, kindOfControl);
+
+ } catch (Exception e){
+ e.printStackTrace(log);
+ throw new StatusException("Couldn't create following control shape : '" +
+ kindOfControl + "': ", e);
+ }
+
+ try {
+ log.println( "getting Drawpages" );
+ XDrawPagesSupplier oDPS = (XDrawPagesSupplier)
+ UnoRuntime.queryInterface(XDrawPagesSupplier.class,xSpreadsheetDoc);
+ XDrawPages oDP = (XDrawPages) oDPS.getDrawPages();
+ oDP.insertNewByIndex(1);
+ oDP.insertNewByIndex(2);
+ oDrawPage = (XDrawPage) AnyConverter.toObject(
+ new Type(XDrawPage.class),oDP.getByIndex(0));
+ if (oDrawPage == null)
+ log.println("ERROR: could not get DrawPage: null");
+
+ oDrawPage.add(aShape);
+ log.println("getting XForm");
+ XNameContainer xForm = FormTools.getForms(oDrawPage);
+ try {
+ myForm = (XForm) AnyConverter.toObject(new Type(XForm.class),xForm.getByName("Standard"));
+ } catch (WrappedTargetException ex) {
+ log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
+ } catch (NoSuchElementException ex) {
+ log.println("ERROR: could not XFormm 'Standard': " + ex.toString());
+ }
+ if (myForm == null)
+ log.println("ERROR: could not get XForm: null");
+ tEnv.addObjRelation("XFormLayerAccess.XForm", myForm);
+ } catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
+ log.println("ERROR: could not add ObjectRelation 'XFormLayerAccess.XForm': " + ex.toString());
+ } catch (WrappedTargetException ex) {
+ log.println("ERROR: could not add ObjectRelation 'XFormLayerAccess.XForm': " + ex.toString());
+ } catch (com.sun.star.lang.IllegalArgumentException ex) {
+ log.println("ERROR: could not add ObjectRelation 'XFormLayerAccess.XForm': " + ex.toString());
+ }
+
+ return tEnv;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java b/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java
new file mode 100644
index 000000000000..56a9ec8e6579
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLContentExporter.java
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.document.XExporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.table.XCell;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLContentExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLContentExporter extends TestCase {
+
+ static XComponent xSheetDoc;
+ static ContentFilterChecker Filter;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+ try {
+ log.println( "creating a calc document" );
+ xSheetDoc = SOF.openDoc("scalc","_blank");
+
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xCalcDoc " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLContentExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The calc document is set as a source document for exporter
+ * created. A cell in the sheet is set to some value. This made
+ * for checking if this value is successfully exported within
+ * the document content.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+ final String CELL_TEXT = "XMLContentExporter";
+
+ ContentFilterChecker Filter = new ContentFilterChecker(log);
+
+ Any arg = new Any(new Type(XDocumentHandler.class), Filter);
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Calc.XMLContentExporter",
+ new Object[] {arg} );
+ XExporter xEx = (XExporter) UnoRuntime.queryInterface
+ (XExporter.class,oObj);
+ xEx.setSourceDocument(xSheetDoc);
+
+ // Setting some string to a cell
+ XSpreadsheetDocument xSpreadsheetDoc = (XSpreadsheetDocument)
+ UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc);
+ XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets();
+ XIndexAccess xSheetsIndexArray = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ XSpreadsheet xSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),xSheetsIndexArray.getByIndex(0));
+ XCell xCell = xSheet.getCellByPosition(0, 0);
+ xCell.setFormula(CELL_TEXT);
+
+ log.println("fill sheet 1 with contnet...");
+ util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 1, 1, 1, 5, 5);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ } catch (java.lang.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create environment.", e);
+ }
+
+ // adding tags which must be contained in XML output
+ Filter.addTag("office:document-content");
+ Filter.addTagEnclosed("office:body", "office:document-content");
+ Filter.addTagEnclosed("office:script", "office:document-content");
+ Filter.addTagEnclosed("table:table", "office:body");
+ Filter.addTagEnclosed("table:table-column", "table:table");
+ Filter.addTagEnclosed("table:table-row", "table:table");
+ Filter.addTagEnclosed("table:table-cell", "table:table-row");
+ Filter.addTagEnclosed("text:p", "table:table-cell");
+ Filter.addCharactersEnclosed(CELL_TEXT, "text:p");
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"scalc: StarOffice XML (Calc)"}));
+ tEnv.addObjRelation("SourceDocument",xSheetDoc);
+ tEnv.addObjRelation("XFilter.Checker", Filter);
+ return tEnv;
+
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class ContentFilterChecker extends XMLTools.XMLTagsChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public ContentFilterChecker(PrintWriter log) {
+ super(log) ;
+ }
+
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return checkTags();
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java b/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java
new file mode 100644
index 000000000000..26c8851c741d
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLContentImporter.java
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.document.XImporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLContentImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLContentImporter extends TestCase {
+ static XSpreadsheetDocument xSheetDoc;
+ static XComponent comp ;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc( null );
+ comp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ util.DesktopTools.closeDoc(comp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLContentImporter</code><p>
+ *
+ * The calc document is set as a target document for importer.
+ * Imported XML-data contains only content tags including table
+ * with test table name.
+ * After import table name getting from
+ * target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Calc.XMLContentImporter") ;
+ XImporter imp = (XImporter) UnoRuntime.queryInterface
+ (XImporter.class, oInt) ;
+ imp.setTargetDocument(comp);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relations
+ tEnv.addObjRelation("TargetDocument", comp) ;
+
+ final String impValue = "XMLContentImporter_test" ;
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document-content",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:text", "CDATA", "http://openoffice.org/2000/text",
+ "xmlns:table", "CDATA", "http://openoffice.org/2000/table",
+ "office:class", "CDATA", "spreadsheet"
+ },
+ {"start", "office:body"},
+ {"start", "table:table",
+ "table:name", "CDATA", impValue},
+ {"end", "table:table"},
+ {"end", "office:body"},
+ {"end", "office:document-content"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ //save to log content before import
+ final PrintWriter fLog = log;
+ final XSpreadsheets xSheets = xSheetDoc.getSheets();
+
+ log.println("Sheets before importing :") ;
+ String[] names = xSheets.getElementNames() ;
+ for (int i = 0; i < names.length; i++) {
+ log.println(" " + names[i]) ;
+ }
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ fLog.println("Sheet names :") ;
+ String[] snames = xSheets.getElementNames() ;
+ for (int i = 0; i < snames.length; i++) {
+ fLog.println(" " + snames[i]) ;
+ }
+ return xSheets.hasByName(impValue) ;
+ }
+ }) ;
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLExporter.java b/qadevOOo/tests/java/mod/_sc/XMLExporter.java
new file mode 100644
index 000000000000..f7a038f5dd88
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLExporter.java
@@ -0,0 +1,224 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.container.XIndexAccess;
+import com.sun.star.container.XNamed;
+import com.sun.star.document.XExporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheet;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLExporter extends TestCase {
+ static XComponent xSheetDoc;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+ try {
+ log.println( "creating a calc document" );
+ xSheetDoc = SOF.openDoc("scalc","_blank");
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document disposed
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xCalcDoc " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The calc document is set as a source document for exporter
+ * created. Checking whether tags for table corresponding to some sheet
+ * is exported.<p>
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+ FilterChecker Filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class), Filter);
+ final String SHEET_NAME = "XMLExporter_SheetTestName";
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Calc.XMLExporter", new Object[] {arg} );
+ XExporter xEx = (XExporter) UnoRuntime.queryInterface
+ (XExporter.class,oObj);
+ xEx.setSourceDocument(xSheetDoc);
+
+ //set name of sheet
+ XSpreadsheetDocument xSpreadsheetDoc = (XSpreadsheetDocument)
+ UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc);
+ XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets();
+ XIndexAccess xSheetsIndexArray = (XIndexAccess)
+ UnoRuntime.queryInterface(XIndexAccess.class, xSpreadsheets);
+ XSpreadsheet xSheet = (XSpreadsheet) AnyConverter.toObject(
+ new Type(XSpreadsheet.class),xSheetsIndexArray.getByIndex(0));
+ XNamed xSheetNamed = (XNamed)
+ UnoRuntime.queryInterface(XNamed.class, xSheet);
+ xSheetNamed.setName(SHEET_NAME);
+
+ log.println("fill sheet with contnet...");
+ util.CalcTools.fillCalcSheetWithContent(xSheet, 3, 3, 50, 50);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ } catch (java.lang.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create environment.", e);
+ }
+
+ // adding tags which must be contained in XML output
+ Filter.addTag( new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("office:meta"),
+ new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("office:settings"),
+ new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("office:script"),
+ new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("office:styles"),
+ new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("office:body"),
+ new XMLTools.Tag("office:document") );
+ Filter.addTagEnclosed(
+ new XMLTools.Tag("table:table"),
+ new XMLTools.Tag("office:body") );
+ Filter.addTag(
+ new XMLTools.Tag("table:table", "table:name", SHEET_NAME) );
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"scalc: StarOffice XML (Calc)"}));
+ tEnv.addObjRelation("SourceDocument",xSheetDoc);
+ tEnv.addObjRelation("XFilter.Checker", Filter) ;
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log, false) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLImporter.java b/qadevOOo/tests/java/mod/_sc/XMLImporter.java
new file mode 100644
index 000000000000..64e9225bed02
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLImporter.java
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.document.XImporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.sheet.XSpreadsheets;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLImporter extends TestCase {
+
+ static XComponent xSheetDoc;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ XSpreadsheetDocument xSpreadsheetDoc = SOF.createCalcDoc( null );
+ xSheetDoc = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSpreadsheetDoc);
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLImporter</code><p>
+ *
+ * The calc document is set as a target document for importer.
+ * Imported tags contain new value for table name.
+ * After import table name getting from
+ * target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+ final String impValue = "XMLImporter_test" ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance("com.sun.star.comp.Calc.XMLImporter") ;
+ XImporter imp = (XImporter) UnoRuntime.queryInterface
+ (XImporter.class, oInt) ;
+ imp.setTargetDocument(xSheetDoc);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", xSheetDoc) ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:text", "CDATA", "http://openoffice.org/2000/text",
+ "xmlns:table", "CDATA", "http://openoffice.org/2000/table",
+ "office:class", "CDATA", "spreadsheet"
+ },
+ {"start", "office:body"},
+ {"start", "table:table",
+ "table:name", "CDATA", impValue},
+ {"end", "table:table"},
+ {"end", "office:body"},
+ {"end", "office:document"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ final PrintWriter fLog = log ;
+ XSpreadsheetDocument xSpreadsheetDoc = (XSpreadsheetDocument)
+ UnoRuntime.queryInterface(XSpreadsheetDocument.class, xSheetDoc);
+ final XSpreadsheets sheets = xSpreadsheetDoc.getSheets() ;
+ log.println("Sheets before importing :") ;
+ String[] names = sheets.getElementNames() ;
+ for (int i = 0; i < names.length; i++) {
+ log.println(" " + names[i]) ;
+ }
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ fLog.println("Sheet names :") ;
+ String[] snames = sheets.getElementNames() ;
+ for (int i = 0; i < snames.length; i++) {
+ fLog.println(" " + snames[i]) ;
+ }
+
+ return sheets.hasByName(impValue) ;
+ }
+ }) ;
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java b/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java
new file mode 100644
index 000000000000..02c5cfb566f7
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLMetaExporter.java
@@ -0,0 +1,205 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XDocumentInfoSupplier;
+import com.sun.star.document.XExporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLMetaExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLMetaExporter extends TestCase {
+
+ static XComponent xSheetDoc;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a calc document" );
+ xSheetDoc = SOF.openDoc("scalc","_blank");
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document disposed
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xCalcDoc " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLMetaExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The calc document is set as a source document for exporter
+ * created. A meta property 'Title' is set to some value. This made
+ * for checking if this value is successfully exported within
+ * the document meta information.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+ FilterChecker filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class),filter);
+
+ // Checking tags existance and changed property value
+ filter.addTag(new XMLTools.Tag ("office:document-meta"));
+ filter.addTag(new XMLTools.Tag ("office:meta"));
+ filter.addCharactersEnclosed("TestDocument",
+ new XMLTools.Tag ("dc:title"));
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Calc.XMLMetaExporter", new Object[] {arg});
+ XExporter xEx = (XExporter) UnoRuntime.queryInterface
+ (XExporter.class,oObj);
+ xEx.setSourceDocument(xSheetDoc);
+
+ // Obtaining and changing property values
+ XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
+ UnoRuntime.queryInterface (XDocumentInfoSupplier.class,
+ xSheetDoc) ;
+ XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, infoSup.getDocumentInfo()) ;
+ docInfo.setPropertyValue("Title", "TestDocument");
+
+ log.println("fill sheet 1 with contnet...");
+ util.CalcTools.fillCalcSheetWithContent(xSheetDoc,1, 3, 3, 50, 50);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create environment.", e) ;
+ } catch (java.lang.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create environment.", e);
+ }
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"scalc: StarOffice XML (Calc)"}));
+ tEnv.addObjRelation("SourceDocument",xSheetDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter) ;
+ return tEnv;
+
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log,false) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java b/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java
new file mode 100644
index 000000000000..29deca17e424
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLMetaImporter.java
@@ -0,0 +1,197 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XDocumentInfoSupplier;
+import com.sun.star.document.XImporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLMetaImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLMetaImporter extends TestCase {
+ static XSpreadsheetDocument xSheetDoc;
+ static XComponent comp ;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc( null );
+ comp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ util.DesktopTools.closeDoc(comp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLMetaImporter</code><p>
+ *
+ * The calc document is set as a target document for importer.
+ * Imported XML-data contains only meta tags including title tag
+ * with test title name.
+ * After import title name getting from
+ * target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+ final String impTitle = "XMLMetaImporter" ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Calc.XMLMetaImporter") ;
+ XImporter imp = (XImporter) UnoRuntime.queryInterface
+ (XImporter.class, oInt) ;
+ imp.setTargetDocument(comp) ;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", comp) ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document-meta" ,
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:meta", "CDATA", "http://openoffice.org/2000/meta",
+ "xmlns:dc", "CDATA", "http://purl.org/dc/elements/1.1/"},
+ {"start", "office:meta"} ,
+ {"start", "dc:title"},
+ {"chars", impTitle},
+ {"end", "dc:title"},
+ {"end", "office:meta"},
+ {"end", "office:document-meta"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ XDocumentInfoSupplier infoSup = (XDocumentInfoSupplier)
+ UnoRuntime.queryInterface(XDocumentInfoSupplier.class, xSheetDoc) ;
+ final XPropertySet docInfo = (XPropertySet) UnoRuntime.queryInterface
+ (XPropertySet.class, infoSup.getDocumentInfo()) ;
+ final PrintWriter logF = log ;
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ try {
+ String title = (String) docInfo.getPropertyValue
+ ("Title") ;
+ logF.println("Title returned = '" + title + "'") ;
+ return impTitle.equals(title) ;
+ } catch (com.sun.star.uno.Exception e) {
+ logF.println("Exception occured while checking filter :") ;
+ e.printStackTrace(logF) ;
+ return false ;
+ }
+ }
+ }) ;
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java b/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java
new file mode 100644
index 000000000000..04c3cbc76c2a
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLSettingsExporter.java
@@ -0,0 +1,206 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XExporter;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLSettingsExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLSettingsExporter extends TestCase {
+
+ static XComponent xSheetDoc;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a calc document" );
+ xSheetDoc = SOF.openDoc("scalc","_blank");
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document disposed
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xCalcDoc " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLSettingsExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The calc document is set as a source document for exporter
+ * created. Sets settings' property 'ShowGrid' to 'false', then checks
+ * it in the exported xml document.<p>
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ XInterface oObj = null;
+ SettingsFilterChecker filter = new SettingsFilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class), filter);
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Calc.XMLSettingsExporter",
+ new Object[] {arg} );
+ XExporter xEx = (XExporter) UnoRuntime.queryInterface
+ (XExporter.class,oObj);
+ xEx.setSourceDocument(xSheetDoc);
+
+ //set some settings
+ XModel xSheetModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSheetDoc);
+ XController xController = xSheetModel.getCurrentController();
+ XPropertySet xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xController);
+ xPropSet.setPropertyValue("ShowGrid", "false");
+
+ util.CalcTools.fillCalcSheetWithContent(xSheetDoc,1, 3, 3, 50, 50);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ } catch (java.lang.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create environment.", e);
+ }
+
+ //Create and prepare filter
+ // adding tags which must be contained in XML output
+ filter.addTag(new XMLTools.Tag("office:document-settings") );
+ filter.addTagEnclosed(
+ new XMLTools.Tag("office:settings"),
+ new XMLTools.Tag("office:document-settings") );
+ filter.addCharactersEnclosed(
+ "false",
+ new XMLTools.Tag("config:config-item", "config:name", "ShowGrid") );
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"scalc: StarOffice XML (Calc)"}));
+ tEnv.addObjRelation("SourceDocument",xSheetDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter) ;
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class SettingsFilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public SettingsFilterChecker(PrintWriter log) {
+ super(log, false) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java b/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java
new file mode 100644
index 000000000000..72954a3aa93f
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLSettingsImporter.java
@@ -0,0 +1,219 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.document.XImporter;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XModel;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLSettingsImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLSettingsImporter extends TestCase {
+ static XSpreadsheetDocument xSheetDoc;
+ static XComponent comp ;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc( null );
+ comp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ util.DesktopTools.closeDoc(comp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLSettingsImporter</code><p>
+ *
+ * The calc document is set as a target document for importer.
+ * Imported XML-data contains only settings tags including tag
+ * with new number of iteration steps.
+ * After import 'IterationCount' proeprty getting from
+ * target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+ final XPropertySet xPropSet ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Calc.XMLSettingsImporter") ;
+ XImporter imp = (XImporter) UnoRuntime.queryInterface
+ (XImporter.class, oInt) ;
+ imp.setTargetDocument(comp) ;
+
+ XModel xSheetModel = (XModel)
+ UnoRuntime.queryInterface(XModel.class, xSheetDoc);
+ XController xController = xSheetModel.getCurrentController();
+ xPropSet = (XPropertySet)
+ UnoRuntime.queryInterface(XPropertySet.class, xController);
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", comp) ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document-settings",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:xlink", "CDATA", "http://www.w3.org/1999/xlink",
+ "xmlns:config", "CDATA", "http://openoffice.org/2001/config"},
+ {"start", "office:settings"},
+ {"start", "config:config-item-set",
+ "config:name", "CDATA", "view-settings"},
+ {"start", "config:config-item-map-indexed",
+ "config:name", "CDATA", "Views"},
+ {"start", "config:config-item-map-entry"},
+ {"start", "config:config-item",
+ "config:name", "CDATA", "ShowGrid",
+ "config:type", "CDATA", "boolean"},
+ {"chars", "false"},
+ {"end", "config:config-item"},
+ {"start", "config:config-item",
+ "config:name", "CDATA", "ZoomType",
+ "config:type", "CDATA", "short"},
+ {"chars", "0"},
+ {"start", "config:config-item",
+ "config:name", "CDATA", "ZoomValue",
+ "config:type", "CDATA", "int"},
+ {"chars", "124"},
+ {"end", "config:config-item"},
+ {"end", "config:config-item"},
+ {"end", "config:config-item-map-entry"},
+ {"end", "config:config-item-map-indexed"},
+ {"end", "config:config-item-set"},
+ {"end", "office:settings"},
+ {"end", "office:document-settings"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ final PrintWriter logF = log ;
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ try {
+ Object gVal = xPropSet.getPropertyValue("ShowGrid") ;
+ logF.println("ShowGrid = " + gVal ) ;
+ return "false".equals(gVal) ;
+ } catch (com.sun.star.uno.Exception e) {
+ logF.println("Exception occured while checking filter :") ;
+ e.printStackTrace(logF) ;
+ return false ;
+ }
+ }
+ }) ;
+
+ return tEnv;
+ } // finish method getTestEnvironment
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java b/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java
new file mode 100644
index 000000000000..f0f5f387e0ef
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLStylesExporter.java
@@ -0,0 +1,211 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+import util.XMLTools;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.document.XExporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.style.XStyle;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.uno.Any;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+import com.sun.star.xml.sax.XDocumentHandler;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLStylesExporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::ExportFilter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::XExporter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.ExportFilter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.XExporter
+ * @see com.sun.star.beans.XPropertySet
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._ExportFilter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ */
+public class XMLStylesExporter extends TestCase {
+ static XComponent xSheetDoc;
+ protected int counter = 0;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+
+ try {
+ log.println( "creating a calc document" );
+ xSheetDoc = SOF.openDoc("scalc","_blank");
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document disposed
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing xCalcDoc " );
+ util.DesktopTools.closeDoc(xSheetDoc);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLStylesExporter</code> with
+ * argument which is an implementation of <code>XDocumentHandler</code>
+ * and which can check if required tags and character data is
+ * exported. <p>
+ * The calc document is set as a source document for exporter
+ * created. New style 'NewStyle' added to style family "Cell Styles".
+ * This made for checking if this style is successfully exported within
+ * the document styles information.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'MediaDescriptor'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'XFilter.Checker'</code> for
+ * {@link ifc.document._XFilter} interface </li>
+ * <li> <code>'SourceDocument'</code> for
+ * {@link ifc.document._XExporter} interface </li>
+ * </ul>
+ */
+ protected synchronized TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log) {
+
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory) tParam.getMSF() );
+ XMultiServiceFactory xMSF = (XMultiServiceFactory) tParam.getMSF() ;
+ XInterface oObj = null;
+ FilterChecker filter = new FilterChecker(log);
+ Any arg = new Any(new Type(XDocumentHandler.class),filter);
+
+ String newName = "NewStyle" + counter++;
+ // Adding tags for checking existance of head tag and property value
+ filter.addTag(new XMLTools.Tag("office:document-styles"));
+ filter.addTag(new XMLTools.Tag("style:style","style:name", newName));
+
+ try {
+ oObj = (XInterface) xMSF.createInstanceWithArguments(
+ "com.sun.star.comp.Calc.XMLStylesExporter", new Object[] {arg});
+ XExporter xEx = (XExporter)
+ UnoRuntime.queryInterface(XExporter.class,oObj);
+ xEx.setSourceDocument(xSheetDoc);
+
+ // Obtaining and changing property values
+ XStyleFamiliesSupplier styleSup = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface(
+ XStyleFamiliesSupplier.class, xSheetDoc);
+ XNameAccess StyleFamilies = styleSup.getStyleFamilies();
+ String[] styleFamiliesNames = StyleFamilies.getElementNames();
+ XNameContainer StyleFamilyName = (XNameContainer)
+ AnyConverter.toObject(new Type(XNameContainer.class),
+ StyleFamilies.getByName(styleFamiliesNames[0]));
+ Object SC = SOF.createInstance(
+ xSheetDoc, "com.sun.star.style.CellStyle");
+ XStyle StyleCell = (XStyle)
+ UnoRuntime.queryInterface(XStyle.class,SC);
+ StyleFamilyName.insertByName(newName, StyleCell);
+
+ log.println("fill sheet 1 with contnet...");
+ util.CalcTools.fillCalcSheetWithContent(xSheetDoc, 1, 3, 3, 50, 100);
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create environment.", e);
+ } catch (java.lang.Exception e) {
+ e.printStackTrace(log);
+ throw new StatusException("Can't create environment.", e);
+ }
+
+ // create testobject here
+ log.println( "creating a new environment" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ tEnv.addObjRelation("MediaDescriptor", XMLTools.createMediaDescriptor(
+ new String[] {"FilterName"},
+ new Object[] {"scalc: StarOffice XML (Calc)"}));
+ tEnv.addObjRelation("SourceDocument",xSheetDoc);
+ tEnv.addObjRelation("XFilter.Checker", filter) ;
+ return tEnv;
+ }
+
+ /**
+ * This class checks the XML for tags and data required and returns
+ * checking result to <code>XFilter</code> interface test. All
+ * the information about errors occured in XML data is written
+ * to log specified.
+ * @see ifc.document._XFilter
+ */
+ protected class FilterChecker extends XMLTools.XMLChecker
+ implements ifc.document._XFilter.FilterChecker {
+
+ /**
+ * Creates a class which will write information
+ * into log specified.
+ */
+ public FilterChecker(PrintWriter log) {
+ super(log,false) ;
+ }
+ /**
+ * <code>_XFilter.FilterChecker</code> interface method
+ * which returns the result of XML checking.
+ * @return <code>true</code> if the XML data exported was
+ * valid (i.e. all necessary tags and character data exists),
+ * <code>false</code> if some errors occured.
+ */
+ public boolean checkFilter() {
+ return check();
+ }
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java b/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java
new file mode 100644
index 000000000000..7454ff849e42
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/XMLStylesImporter.java
@@ -0,0 +1,215 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._sc;
+
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.SOfficeFactory;
+
+import com.sun.star.container.XNameAccess;
+import com.sun.star.document.XImporter;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.sheet.XSpreadsheetDocument;
+import com.sun.star.style.XStyleFamiliesSupplier;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XInterface;
+
+/**
+ * Test for object which is represented by service
+ * <code>com.sun.star.comp.Calc.XMLStylesImporter</code>. <p>
+ * Object implements the following interfaces :
+ * <ul>
+ * <li><code>com::sun::star::lang::XInitialization</code></li>
+ * <li><code>com::sun::star::document::XImporter</code></li>
+ * <li><code>com::sun::star::document::XFilter</code></li>
+ * <li><code>com::sun::star::document::ImportFilter</code></li>
+ * <li><code>com::sun::star::beans::XPropertySet</code></li>
+ * <li><code>com::sun::star::xml::sax::XDocumentHandler</code></li>
+
+ * </ul>
+ * @see com.sun.star.lang.XInitialization
+ * @see com.sun.star.document.XImporter
+ * @see com.sun.star.document.XFilter
+ * @see com.sun.star.document.ImportFilter
+ * @see com.sun.star.beans.XPropertySet
+ * @see com.sun.star.xml.sax.XDocumentHandler
+ * @see ifc.lang._XInitialization
+ * @see ifc.document._XImporter
+ * @see ifc.document._XFilter
+ * @see ifc.document._XExporter
+ * @see ifc.beans._XPropertySet
+ * @see ifc.xml.sax._XDocumentHandler
+ */
+public class XMLStylesImporter extends TestCase {
+ static XSpreadsheetDocument xSheetDoc;
+ static XComponent comp ;
+
+ /**
+ * New spreadsheet document created.
+ */
+ protected void initialize( TestParameters tParam, PrintWriter log ) {
+ SOfficeFactory SOF = SOfficeFactory.getFactory( (XMultiServiceFactory)tParam.getMSF() );
+
+ try {
+ log.println( "creating a Spreadsheet document" );
+ xSheetDoc = SOF.createCalcDoc( null );
+ comp = (XComponent) UnoRuntime.queryInterface
+ (XComponent.class, xSheetDoc) ;
+ } catch ( com.sun.star.uno.Exception e ) {
+ // Some exception occures.FAILED
+ e.printStackTrace( log );
+ throw new StatusException( "Couldn't create document", e );
+ }
+ }
+
+ /**
+ * Spreadsheet document destroyed.
+ */
+ protected void cleanup( TestParameters tParam, PrintWriter log ) {
+ log.println( " disposing document " );
+ util.DesktopTools.closeDoc(comp);
+ }
+
+ /**
+ * Creating a Testenvironment for the interfaces to be tested.
+ * Creates an instance of the service
+ * <code>com.sun.star.comp.Calc.XMLStylesImporter</code><p>
+ *
+ * The calc document is set as a target document for importer.
+ * Imported XML-data contains only style tags including tag
+ * with new style name.
+ * After import style names getting from
+ * target document is checked.
+ * Object relations created :
+ * <ul>
+ * <li> <code>'XDocumentHandler.XMLData'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'XDocumentHandler.ImportChecker'</code> for
+ * {@link ifc.xml.sax._XDocumentHandler} interface </li>
+ * <li> <code>'TargetDocument'</code> for
+ * {@link ifc.document._XImporter} interface </li>
+ * </ul>
+ */
+ public synchronized TestEnvironment createTestEnvironment( TestParameters tParam,
+ PrintWriter log )
+ throws StatusException {
+
+ XInterface oObj = null;
+ Object oInt = null ;
+
+ // creation of testobject here
+ // first we write what we are intend to do to log file
+ log.println( "creating a test environment" );
+
+ XMultiServiceFactory xMSF = (XMultiServiceFactory)tParam.getMSF() ;
+
+ try {
+ oInt = xMSF.createInstance
+ ("com.sun.star.comp.Calc.XMLStylesImporter") ;
+ XImporter imp = (XImporter) UnoRuntime.queryInterface
+ (XImporter.class, oInt) ;
+ imp.setTargetDocument(comp) ;
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ throw new StatusException("Can't create component.", e) ;
+ }
+
+ oObj = (XInterface) oInt ;
+
+ // create testobject here
+ log.println( "creating a new environment for Paragraph object" );
+ TestEnvironment tEnv = new TestEnvironment( oObj );
+
+ // adding relation
+ tEnv.addObjRelation("TargetDocument", comp) ;
+
+ final String impStyleName = "XMLStylesImporter" ;
+
+ // adding relation for XDocumentHandler
+ String[][] xml = new String[][] {
+ {"start", "office:document-styles",
+ "xmlns:office", "CDATA", "http://openoffice.org/2000/office",
+ "xmlns:style", "CDATA", "http://openoffice.org/2000/style",
+ "xmlns:fo", "CDATA", "http://www.w3.org/1999/XSL/Format",
+ "xmlns:table", "CDATA", "http://openoffice.org/2000/table"},
+ {"start", "office:styles"},
+ {"start", "style:style",
+ "style:name", "CDATA", impStyleName,
+ "style:family", "CDATA", "table-cell",
+ "style:parent-style-name", "CDATA", "Default"},
+ { "start", "style:properties",
+ "fo:width", "CDATA", "12cm",
+ "fo:background-color", "CDATA", "light-grey"},
+ {"end", "style:properties"},
+ {"end", "style:style"},
+ {"end", "office:styles"},
+ {"end", "office:document-styles"}} ;
+
+ tEnv.addObjRelation("XDocumentHandler.XMLData", xml) ;
+
+ XNameAccess styles = null ;
+ try {
+ XStyleFamiliesSupplier sup = (XStyleFamiliesSupplier)
+ UnoRuntime.queryInterface
+ (XStyleFamiliesSupplier.class, xSheetDoc);
+ XNameAccess oStyleFamilies = sup.getStyleFamilies();
+ Object family = oStyleFamilies.getByName("CellStyles") ;
+ styles = (XNameAccess) UnoRuntime.queryInterface
+ (XNameAccess.class, family) ;
+ log.println("Styles before:") ;
+ String[] names = styles.getElementNames() ;
+ for (int i = 0; i < names.length; i++) {
+ log.println(" " + names[i]) ;
+ }
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace(log) ;
+ }
+ final XNameAccess stylesF = styles ;
+ final PrintWriter logF = log ;
+
+ tEnv.addObjRelation("XDocumentHandler.ImportChecker",
+ new ifc.xml.sax._XDocumentHandler.ImportChecker() {
+ public boolean checkImport() {
+ logF.println("Styles after:") ;
+ String[] names = stylesF.getElementNames() ;
+ for (int i = 0; i < names.length; i++) {
+ logF.println(" " + names[i]) ;
+ }
+ return stylesF.hasByName(impStyleName) ;
+ }
+ }) ;
+
+ return tEnv ;
+ }
+}
+
diff --git a/qadevOOo/tests/java/mod/_sc/package.html b/qadevOOo/tests/java/mod/_sc/package.html
new file mode 100644
index 000000000000..0e25718b7507
--- /dev/null
+++ b/qadevOOo/tests/java/mod/_sc/package.html
@@ -0,0 +1,6 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
+<HTML>
+<BODY>
+<P>Containes all test cases for the module 'sc'.</P>
+</BODY>
+</HTML> \ No newline at end of file