include/test/sheet/xmultipleoperation.hxx                       |   39 ++
 qadevOOo/Jar_OOoRunner.mk                                       |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv  |    1 
 qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv |    1 
 qadevOOo/tests/java/ifc/sheet/_XMultipleOperation.java          |  175 
----------
 sc/qa/extras/sccellcursorobj.cxx                                |    7 
 sc/qa/extras/sccellrangeobj.cxx                                 |   42 +-
 sc/qa/extras/sctablesheetobj.cxx                                |   48 ++
 test/Library_subsequenttest.mk                                  |    1 
 test/source/sheet/xmultipleoperation.cxx                        |   96 +++++
 11 files changed, 207 insertions(+), 205 deletions(-)

New commits:
commit 350eec67a5989365560e38e9270990dcd0a019e8
Author: Jens Carl <j.car...@gmx.de>
Date:   Fri Dec 1 01:00:41 2017 +0000

    tdf#45904 Move _XMultipleOperation Java tests to C++
    
    Change-Id: I102b726e673f69bfe64eff7e28e380dd6f15f1f8
    Reviewed-on: https://gerrit.libreoffice.org/45629
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Jens Carl <j.car...@gmx.de>

diff --git a/include/test/sheet/xmultipleoperation.hxx 
b/include/test/sheet/xmultipleoperation.hxx
new file mode 100644
index 000000000000..50d4d144edc1
--- /dev/null
+++ b/include/test/sheet/xmultipleoperation.hxx
@@ -0,0 +1,39 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_TEST_SHEET_XMULTIPLEOPERATION_HXX
+#define INCLUDED_TEST_SHEET_XMULTIPLEOPERATION_HXX
+
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XMultipleOperation
+{
+public:
+    virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+    virtual css::uno::Reference<css::uno::XInterface> getXSpreadsheet() = 0;
+
+    void testSetTableOperation();
+
+protected:
+    ~XMultipleOperation() {}
+
+private:
+    void fillCells(css::uno::Reference<css::sheet::XSpreadsheet>&);
+};
+}
+
+#endif // INCLUDED_TEST_SHEET_XMULTIPLEOPERATION_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index ca7efb955432..d7476b028d5a 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -604,7 +604,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
     qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \
     qadevOOo/tests/java/ifc/sheet/_XFormulaQuery \
     qadevOOo/tests/java/ifc/sheet/_XFunctionDescriptions \
-    qadevOOo/tests/java/ifc/sheet/_XMultipleOperation \
     qadevOOo/tests/java/ifc/sheet/_XRangeSelection \
     qadevOOo/tests/java/ifc/sheet/_XRecentFunctions \
     qadevOOo/tests/java/ifc/sheet/_XScenario \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv 
b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
index 0e5e6448c72b..e6b2ef052fd0 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellCursorObj.csv
@@ -123,7 +123,6 @@
 
"ScCellCursorObj";"com::sun::star::sheet::XCellRangeFormula#optional";"setFormulaArray()"
 "ScCellCursorObj";"com::sun::star::util::XIndent";"decrementIndent()"
 "ScCellCursorObj";"com::sun::star::util::XIndent";"incrementIndent()"
-"ScCellCursorObj";"com::sun::star::sheet::XMultipleOperation";"setTableOperation()"
 "ScCellCursorObj";"com::sun::star::table::XAutoFormattable";"autoFormat()"
 
"ScCellCursorObj";"com::sun::star::sheet::XCellRangesQuery";"queryVisibleCells()"
 "ScCellCursorObj";"com::sun::star::sheet::XCellRangesQuery";"queryEmptyCells()"
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv 
b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
index 95186af1d9a2..deddc503556a 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScCellRangeObj.csv
@@ -118,7 +118,6 @@
 
"ScCellRangeObj";"com::sun::star::sheet::XCellRangeFormula#optional";"setFormulaArray()"
 "ScCellRangeObj";"com::sun::star::util::XIndent";"decrementIndent()"
 "ScCellRangeObj";"com::sun::star::util::XIndent";"incrementIndent()"
-"ScCellRangeObj";"com::sun::star::sheet::XMultipleOperation";"setTableOperation()"
 "ScCellRangeObj";"com::sun::star::table::XAutoFormattable";"autoFormat()"
 
"ScCellRangeObj";"com::sun::star::sheet::XCellRangesQuery";"queryVisibleCells()"
 "ScCellRangeObj";"com::sun::star::sheet::XCellRangesQuery";"queryEmptyCells()"
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv 
b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
index 4438b3b4d7c9..5356fe01fc80 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScTableSheetObj.csv
@@ -129,7 +129,6 @@
 
"ScTableSheetObj";"com::sun::star::sheet::XCellRangeFormula#optional";"setFormulaArray()"
 "ScTableSheetObj";"com::sun::star::util::XIndent";"decrementIndent()"
 "ScTableSheetObj";"com::sun::star::util::XIndent";"incrementIndent()"
-"ScTableSheetObj";"com::sun::star::sheet::XMultipleOperation";"setTableOperation()"
 "ScTableSheetObj";"com::sun::star::table::XAutoFormattable";"autoFormat()"
 "ScTableSheetObj";"com::sun::star::sheet::Spreadsheet";"IsVisible"
 "ScTableSheetObj";"com::sun::star::sheet::Spreadsheet";"PageStyle"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XMultipleOperation.java 
b/qadevOOo/tests/java/ifc/sheet/_XMultipleOperation.java
deleted file mode 100644
index 4f51db581af4..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XMultipleOperation.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- *   Licensed to the Apache Software Foundation (ASF) under one or more
- *   contributor license agreements. See the NOTICE file distributed
- *   with this work for additional information regarding copyright
- *   ownership. The ASF licenses this file to you under the Apache
- *   License, Version 2.0 (the "License"); you may not use this file
- *   except in compliance with the License. You may obtain a copy of
- *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-package ifc.sheet;
-
-import com.sun.star.awt.Point;
-import com.sun.star.sheet.TableOperationMode;
-import com.sun.star.sheet.XCellAddressable;
-import com.sun.star.sheet.XCellRangeAddressable;
-import com.sun.star.sheet.XMultipleOperation;
-import com.sun.star.sheet.XSpreadsheet;
-import com.sun.star.table.XCell;
-import com.sun.star.table.XCellRange;
-import com.sun.star.uno.UnoRuntime;
-
-import lib.MultiMethodTest;
-import lib.Status;
-import lib.StatusException;
-
-
-public class _XMultipleOperation extends MultiMethodTest {
-    public XMultipleOperation oObj = null;
-    protected XSpreadsheet oSheet = null;
-    boolean both = true;
-
-    @Override
-    protected void before() {
-        oSheet = (XSpreadsheet) tEnv.getObjRelation("SHEET");
-
-        if (oSheet == null) {
-            throw new StatusException(Status.failed(
-                                              "Object relation oSheet is 
missing"));
-        }
-
-        if (UnoRuntime.queryInterface(XSpreadsheet.class, 
tEnv.getTestObject()) != null) {
-            log.println("We have a sheet and won't do 
TableOperationMode.BOTH");
-            both = false;
-        }
-    }
-
-    public void _setTableOperation() {
-        boolean res = true;
-        XCellRange cellRange = oSheet.getCellRangeByName("$A$17:$A$17");
-        XCellRangeAddressable CRA = UnoRuntime.queryInterface(
-                                            XCellRangeAddressable.class,
-                                            cellRange);
-        XCell cell = null;
-        XCell cell2 = null;
-
-        try {
-            cell = oSheet.getCellByPosition(0, 16);
-            cell.setFormula("=a15+a16");
-            cell = oSheet.getCellByPosition(0, 14);
-            cell2 = oSheet.getCellByPosition(0, 15);
-        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
-            log.println("Exception while getting Cell " + e.getMessage());
-        }
-
-        XCellAddressable CA = UnoRuntime.queryInterface(
-                                      XCellAddressable.class, cell);
-        XCellAddressable CA2 = UnoRuntime.queryInterface(
-                                       XCellAddressable.class, cell2);
-        Point[] cellCoords = new Point[3];
-        double[] cellValues = new double[3];
-
-        log.println("filling cells");
-        fillCells();
-        log.println("setting TableOperation with parameter ROW");
-        oObj.setTableOperation(CRA.getRangeAddress(), TableOperationMode.ROW,
-                               CA.getCellAddress(), CA2.getCellAddress());
-        log.println("checking values");
-        cellCoords = new Point[] {
-            new Point(1, 1), new Point(2, 1), new Point(3, 1)
-        };
-        cellValues = new double[] { 5, 10, 15 };
-        res &= checkValues(cellCoords, cellValues);
-
-        log.println("filling cells");
-        fillCells();
-        log.println("setting TableOperation with parameter COLUMN");
-        oObj.setTableOperation(CRA.getRangeAddress(),
-                               TableOperationMode.COLUMN, CA.getCellAddress(),
-                               CA2.getCellAddress());
-        log.println("checking values");
-        cellCoords = new Point[] {
-            new Point(1, 1), new Point(1, 2), new Point(1, 3)
-        };
-        cellValues = new double[] { 12, 24, 36 };
-        res &= checkValues(cellCoords, cellValues);
-
-        if (both) {
-            log.println("filling cells");
-            fillCells();
-            log.println("setting TableOperation with parameter BOTH");
-            oObj.setTableOperation(CRA.getRangeAddress(),
-                                   TableOperationMode.BOTH,
-                                   CA.getCellAddress(), CA2.getCellAddress());
-            log.println("checking values");
-            cellCoords = new Point[] {
-                new Point(1, 1), new Point(2, 2), new Point(3, 3)
-            };
-            cellValues = new double[] { 17, 34, 51 };
-            res &= checkValues(cellCoords, cellValues);
-        }
-
-        tRes.tested("setTableOperation()", res);
-    }
-
-    protected void fillCells() {
-        XCell cell = null;
-
-        try {
-            for (int k = 1; k < 5; k++) {
-                cell = oSheet.getCellByPosition(0, k);
-                cell.setValue(k * 12);
-                cell = oSheet.getCellByPosition(k, 0);
-                cell.setValue(k * 5);
-            }
-        } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
-            log.println("Exception while filling Cells " + e.getMessage());
-        }
-    }
-
-    protected boolean checkValues(Point[] cellCoords, double[] cellValues) {
-        boolean res = true;
-
-        for (int i = 0; i < cellValues.length; i++) {
-            try {
-                boolean locres = oSheet.getCellByPosition(cellCoords[i].X,
-                                                          cellCoords[i].Y)
-                                       .getValue() == cellValues[i];
-                res &= locres;
-
-                if (!locres) {
-                    log.println("Result differs for cell (" +
-                                cellCoords[i].X + "," + cellCoords[i].Y +
-                                ")");
-                    log.println("Expected: " + cellValues[i]);
-                    log.println("Getting: " +
-                                oSheet.getCellByPosition(cellCoords[i].X,
-                                                         cellCoords[i].Y)
-                                      .getValue());
-                }
-            } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
-                log.println("Exception while checking Values " +
-                            e.getMessage());
-                res &= false;
-            }
-        }
-
-        return res;
-    }
-
-    /**
-     * Restores initial component text.
-     */
-    @Override
-    protected void after() {
-        disposeEnvironment();
-    }
-}
\ No newline at end of file
diff --git a/sc/qa/extras/sccellcursorobj.cxx b/sc/qa/extras/sccellcursorobj.cxx
index 26dcb3f86bc4..543b32123ba9 100644
--- a/sc/qa/extras/sccellcursorobj.cxx
+++ b/sc/qa/extras/sccellcursorobj.cxx
@@ -9,6 +9,7 @@
 
 #include <test/calc_unoapi_test.hxx>
 #include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xmultipleoperation.hxx>
 #include <test/sheet/xsheetcellrange.hxx>
 #include <test/sheet/xsheetfilterable.hxx>
 #include <test/sheet/xsheetfilterableex.hxx>
@@ -26,9 +27,10 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 13
+#define NUMBER_OF_TESTS 14
 
 class ScCellCursorObj : public CalcUnoApiTest, public apitest::XCellSeries,
+                                               public 
apitest::XMultipleOperation,
                                                public apitest::XSheetCellRange,
                                                public 
apitest::XSheetFilterable,
                                                public 
apitest::XSheetFilterableEx,
@@ -51,6 +53,9 @@ public:
     CPPUNIT_TEST(testGotoStartOfUsedArea);
     CPPUNIT_TEST(testGotoEndOfUsedArea);
 
+    // XMultipleOperation
+    CPPUNIT_TEST(testSetTableOperation);
+
     // XCellSeries
     CPPUNIT_TEST(testFillAuto);
     CPPUNIT_TEST(testFillSeries);
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index d3735b6ad518..8732137d447a 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -12,6 +12,7 @@
 #include <test/sheet/xcellrangedata.hxx>
 #include <test/sheet/xcellrangesquery.hxx>
 #include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xmultipleoperation.hxx>
 #include <test/sheet/xsheetcellrange.hxx>
 #include <test/sheet/xsheetfilterable.hxx>
 #include <test/sheet/xsheetfilterableex.hxx>
@@ -43,12 +44,13 @@ using namespace css::uno;
 
 namespace sc_apitest {
 
-#define NUMBER_OF_TESTS 26
+#define NUMBER_OF_TESTS 27
 
 class ScCellRangeObj : public CalcUnoApiTest, public apitest::CellProperties,
                                               public apitest::XCellRangeData,
                                               public apitest::XCellRangesQuery,
                                               public apitest::XCellSeries,
+                                              public 
apitest::XMultipleOperation,
                                               public apitest::XReplaceable,
                                               public apitest::XSearchable,
                                               public apitest::XSheetCellRange,
@@ -70,47 +72,47 @@ public:
 
     CPPUNIT_TEST_SUITE(ScCellRangeObj);
 
+    // CellProperties
+    CPPUNIT_TEST(testVertJustify);
+    CPPUNIT_TEST(testRotateReference);
+
+    // XCellSeries
+    CPPUNIT_TEST(testFillAuto);
+    CPPUNIT_TEST(testFillSeries);
+
+    // XCellRangeData
+    CPPUNIT_TEST(testGetDataArray);
+    CPPUNIT_TEST(testSetDataArray);
+
     // XCellRangesQuery
     CPPUNIT_TEST(testQueryColumnDifference);
     CPPUNIT_TEST(testQueryContentDifference);
     CPPUNIT_TEST(testQueryEmptyCells);
-
     //CPPUNIT_TEST(testQueryFormulaCells);
     CPPUNIT_TEST(testQueryIntersection);
     CPPUNIT_TEST(testQueryRowDifference);
     CPPUNIT_TEST(testQueryVisibleCells);
 
-    // CellProperties
-    CPPUNIT_TEST(testVertJustify);
-    CPPUNIT_TEST(testRotateReference);
-
     // XSearchable
     CPPUNIT_TEST(testFindAll);
     CPPUNIT_TEST(testFindFirst);
 
+    // XMultipleOperation
+    CPPUNIT_TEST(testSetTableOperation);
+
     // XSheetCellRange
     CPPUNIT_TEST(testGetSpreadsheet);
 
-    // XSheetFilterableEx
-    CPPUNIT_TEST(testCreateFilterDescriptorByObject);
-
     // XReplaceable
     CPPUNIT_TEST(testReplaceAll);
     CPPUNIT_TEST(testCreateReplaceDescriptor);
 
-    // XCellRangeData
-    CPPUNIT_TEST(testGetDataArray);
-    CPPUNIT_TEST(testSetDataArray);
-
-    CPPUNIT_TEST(testSortOOB);
-
-    // XCellSeries
-    CPPUNIT_TEST(testFillAuto);
-    CPPUNIT_TEST(testFillSeries);
-
     // XUniqueCellFormatRangesSupplier
     CPPUNIT_TEST(testGetUniqueCellFormatRanges);
 
+    // XSheetFilterableEx
+    CPPUNIT_TEST(testCreateFilterDescriptorByObject);
+
     // XSheetOperation
     CPPUNIT_TEST(testComputeFunction);
     CPPUNIT_TEST(testClearContents);
@@ -119,6 +121,8 @@ public:
     CPPUNIT_TEST(testCreateSubTotalDescriptor);
     CPPUNIT_TEST(testApplyRemoveSubTotals);
 
+    CPPUNIT_TEST(testSortOOB);
+
     // XSheetFilterable (has to be last tests; otherwise it'll crash)
     CPPUNIT_TEST(testCreateFilterDescriptor);
     CPPUNIT_TEST(testFilter);
diff --git a/sc/qa/extras/sctablesheetobj.cxx b/sc/qa/extras/sctablesheetobj.cxx
index b06765b539c8..b0839a691f55 100644
--- a/sc/qa/extras/sctablesheetobj.cxx
+++ b/sc/qa/extras/sctablesheetobj.cxx
@@ -9,6 +9,7 @@
 
 #include <test/calc_unoapi_test.hxx>
 #include <test/sheet/xcellseries.hxx>
+#include <test/sheet/xmultipleoperation.hxx>
 #include <test/sheet/xprintareas.hxx>
 #include <test/sheet/xscenarioenhanced.hxx>
 #include <test/sheet/xscenariossupplier.hxx>
@@ -40,6 +41,7 @@ namespace sc_apitest
 #define NUMBER_OF_TESTS 31
 
 class ScTableSheetObj : public CalcUnoApiTest, public apitest::XCellSeries,
+                                               public 
apitest::XMultipleOperation,
                                                public apitest::XPrintAreas,
                                                public apitest::XReplaceable,
                                                public 
apitest::XScenarioEnhanced,
@@ -75,6 +77,16 @@ public:
     CPPUNIT_TEST(testFillAuto);
     CPPUNIT_TEST(testFillSeries);
 
+    // XSearchable
+    CPPUNIT_TEST(testFindAll);
+    CPPUNIT_TEST(testFindNext);
+    CPPUNIT_TEST(testFindFirst);
+
+    // XMultipleOperation
+#if 0 // disable, because test never finishes (see i87863)
+    CPPUNIT_TEST(testSetTableOperation);
+#endif
+
     // XPrintAreas
     CPPUNIT_TEST(testSetAndGetPrintTitleColumns);
     CPPUNIT_TEST(testSetAndGetPrintTitleRows);
@@ -89,11 +101,6 @@ public:
     // XScenariosSupplier
     CPPUNIT_TEST(testGetScenarios);
 
-    // XSearchable
-    CPPUNIT_TEST(testFindAll);
-    CPPUNIT_TEST(testFindNext);
-    CPPUNIT_TEST(testFindFirst);
-
     // XSheetAnnotationsSupplier
     CPPUNIT_TEST(testGetAnnotations);
 
@@ -112,7 +119,7 @@ public:
     CPPUNIT_TEST(testFilter);
 
     // XSheetFilterableEx
-#if 0 // temporarily disabled, takes too long
+#if 0 // temporarily disabled, takes too long (see i87876)
     CPPUNIT_TEST(testCreateFilterDescriptorByObject);
 #endif
 
@@ -170,6 +177,10 @@ uno::Reference< uno::XInterface > ScTableSheetObj::init()
     uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), 
UNO_QUERY_THROW);
     uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), 
UNO_QUERY_THROW);
 
+    xSheet->getCellByPosition(5 ,5)->setValue(15);
+    xSheet->getCellByPosition(2 ,0)->setValue(-5.15);
+    xSheet->getCellByPosition(2 ,0)->setFormula("= B5 + C1");
+
     xSheet->getCellByPosition(6, 6)->setValue(3);
     xSheet->getCellByPosition(7, 6)->setValue(3);
     xSheet->getCellByPosition(8, 6)->setFormula("= SUM(G7:H7)");
@@ -197,6 +208,15 @@ uno::Reference<uno::XInterface> 
ScTableSheetObj::getScenarioSpreadsheet()
     uno::Reference<container::XIndexAccess> xIndex (xDoc->getSheets(), 
UNO_QUERY_THROW);
     uno::Reference<sheet::XSpreadsheet> xSheet(xIndex->getByIndex(0), 
UNO_QUERY_THROW);
 
+    xSheet->getCellByPosition(5 ,5)->setValue(15);
+    xSheet->getCellByPosition(2 ,0)->setValue(-5.15);
+    xSheet->getCellByPosition(2 ,0)->setFormula("= B5 + C1");
+
+    xSheet->getCellByPosition(6, 6)->setValue(3);
+    xSheet->getCellByPosition(7, 6)->setValue(3);
+    xSheet->getCellByPosition(8, 6)->setFormula("= SUM(G7:H7)");
+    xSheet->getCellByPosition(9, 6)->setFormula("= G7*I7");
+
     uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1);
     aCellRangeAddr[0] = table::CellRangeAddress(0, 0, 0, 10, 10);
 
@@ -215,9 +235,25 @@ uno::Reference< uno::XInterface > 
ScTableSheetObj::getXSpreadsheet()
     CPPUNIT_ASSERT_MESSAGE("no calc document", mxComponent.is());
 
     uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, 
UNO_QUERY_THROW);
+    uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), 
UNO_QUERY_THROW);
+
     uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), 
UNO_QUERY_THROW);
     uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), 
UNO_QUERY_THROW);
 
+    xSheet->getCellByPosition(5 ,5)->setValue(15);
+    xSheet->getCellByPosition(2 ,0)->setValue(-5.15);
+    xSheet->getCellByPosition(2 ,0)->setFormula("= B5 + C1");
+
+    xSheet->getCellByPosition(6, 6)->setValue(3);
+    xSheet->getCellByPosition(7, 6)->setValue(3);
+    xSheet->getCellByPosition(8, 6)->setFormula("= SUM(G7:H7)");
+    xSheet->getCellByPosition(9, 6)->setFormula("= G7*I7");
+
+    uno::Sequence<table::CellRangeAddress> aCellRangeAddr(1);
+    aCellRangeAddr[0] = table::CellRangeAddress(0, 0, 0, 10, 10);
+    uno::Reference<sheet::XScenariosSupplier> xScence(xSheet, UNO_QUERY_THROW);
+    xScence->getScenarios()->addNewByName("Scenario", aCellRangeAddr, 
"Comment");
+    xSheets->getByName("Scenario");
     return xSheet;
 }
 
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 803f18303799..c398bb0cf10b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -65,6 +65,7 @@ $(eval $(call 
gb_Library_add_exception_objects,subsequenttest,\
        test/source/sheet/xlabelranges \
        test/source/sheet/xnamedrange \
        test/source/sheet/xnamedranges \
+       test/source/sheet/xmultipleoperation \
        test/source/sheet/xprintareas \
        test/source/sheet/xscenarioenhanced \
        test/source/sheet/xscenarios \
diff --git a/test/source/sheet/xmultipleoperation.cxx 
b/test/source/sheet/xmultipleoperation.cxx
new file mode 100644
index 000000000000..5f5f100ea247
--- /dev/null
+++ b/test/source/sheet/xmultipleoperation.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/sheet/xmultipleoperation.hxx>
+
+#include <com/sun/star/sheet/TableOperationMode.hpp>
+#include <com/sun/star/sheet/XCellAddressable.hpp>
+#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
+#include <com/sun/star/sheet/XMultipleOperation.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/table/XCellRange.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace css;
+using namespace css::uno;
+
+namespace apitest
+{
+void XMultipleOperation::testSetTableOperation()
+{
+    uno::Reference<sheet::XMultipleOperation> xMultipleOperation(init(), 
UNO_QUERY_THROW);
+
+    uno::Reference<sheet::XSpreadsheet> xSheet(getXSpreadsheet(), 
UNO_QUERY_THROW);
+    uno::Reference<table::XCellRange> 
xCellRange(xSheet->getCellRangeByName("$A$20:$A$20"),
+                                                 UNO_QUERY_THROW);
+    uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddr(xCellRange, 
UNO_QUERY_THROW);
+
+    uno::Reference<table::XCell> xCell = xSheet->getCellByPosition(0, 19);
+    xCell->setFormula("=a18+a19");
+
+    uno::Reference<table::XCell> xCell1 = xSheet->getCellByPosition(0, 17);
+    uno::Reference<sheet::XCellAddressable> xCellAddr1(xCell1, 
UNO_QUERY_THROW);
+
+    uno::Reference<table::XCell> xCell2 = xSheet->getCellByPosition(0, 18);
+    uno::Reference<sheet::XCellAddressable> xCellAddr2(xCell2, 
UNO_QUERY_THROW);
+
+    fillCells(xSheet);
+    xMultipleOperation->setTableOperation(
+        xCellRangeAddr->getRangeAddress(), sheet::TableOperationMode_ROW,
+        xCellAddr1->getCellAddress(), xCellAddr2->getCellAddress());
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,1 (OpMode: ROW)", 
5.0,
+                                 xSheet->getCellByPosition(1, 1)->getValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 2,1 (OpMode: ROW)", 
10.0,
+                                 xSheet->getCellByPosition(2, 1)->getValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 3,1 (OpMode: ROW)", 
15.0,
+                                 xSheet->getCellByPosition(3, 1)->getValue());
+
+    fillCells(xSheet);
+    xMultipleOperation->setTableOperation(
+        xCellRangeAddr->getRangeAddress(), sheet::TableOperationMode_COLUMN,
+        xCellAddr1->getCellAddress(), xCellAddr2->getCellAddress());
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,1 (OpMode: 
COLUMN)", 12.0,
+                                 xSheet->getCellByPosition(1, 1)->getValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,2 (OpMode: 
COLUMN)", 24.0,
+                                 xSheet->getCellByPosition(1, 2)->getValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,3 (OpMode: 
COLUMN)", 36.0,
+                                 xSheet->getCellByPosition(1, 3)->getValue());
+
+    fillCells(xSheet);
+    xMultipleOperation->setTableOperation(
+        xCellRangeAddr->getRangeAddress(), sheet::TableOperationMode_BOTH,
+        xCellAddr1->getCellAddress(), xCellAddr2->getCellAddress());
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 1,1 (OpMode: BOTH)", 
17.0,
+                                 xSheet->getCellByPosition(1, 1)->getValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 2,2 (OpMode: BOTH)", 
34.0,
+                                 xSheet->getCellByPosition(2, 2)->getValue());
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Check cell at position 3,3 (OpMode: BOTH)", 
51.0,
+                                 xSheet->getCellByPosition(3, 3)->getValue());
+}
+
+void XMultipleOperation::fillCells(uno::Reference<sheet::XSpreadsheet>& xSheet)
+{
+    for (unsigned int i = 1; i < 5; i++)
+    {
+        uno::Reference<table::XCell> xCellFill = xSheet->getCellByPosition(0, 
i);
+        xCellFill->setValue(i * 12);
+        xCellFill = xSheet->getCellByPosition(i, 0);
+        xCellFill->setValue(i * 5);
+    }
+}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to