summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/test/sheet/xdocumentauditing.hxx47
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv1
-rw-r--r--qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing.java219
-rw-r--r--sc/CppunitTest_sc_modelobj.mk47
-rw-r--r--sc/qa/extras/scmodelobj.cxx12
-rw-r--r--test/Library_subsequenttest.mk1
-rw-r--r--test/source/sheet/xdocumentauditing.cxx141
8 files changed, 211 insertions, 258 deletions
diff --git a/include/test/sheet/xdocumentauditing.hxx b/include/test/sheet/xdocumentauditing.hxx
new file mode 100644
index 000000000000..6453c06c8e7b
--- /dev/null
+++ b/include/test/sheet/xdocumentauditing.hxx
@@ -0,0 +1,47 @@
+/* -*- 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_XDOCUMENTAUDITING_HXX
+#define INCLUDED_TEST_SHEET_XDOCUMENTAUDITING_HXX
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <test/testdllapi.hxx>
+
+namespace apitest
+{
+class OOO_DLLPUBLIC_TEST XDocumentAuditing
+{
+public:
+ virtual css::uno::Reference<css::uno::XInterface> init() = 0;
+ virtual css::uno::Reference<css::uno::XInterface> getXMSF() = 0;
+
+ void testRefreshArrows();
+
+protected:
+ ~XDocumentAuditing() {}
+
+private:
+ bool hasRightAmountOfShapes(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage,
+ const sal_Int32& nElementCount, const sal_Int32& nShapes);
+ void dispatch(const css::uno::Reference<css::frame::XFrame>& xFrame,
+ const css::uno::Sequence<css::beans::PropertyValue>& rArguments);
+ css::awt::Point m_Position;
+};
+} // namespace apitest
+
+#endif // INCLUDED_TEST_SHEET_XDOCUMENTAUDITING_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 a7bc5b37b02d..a3188143c9f3 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -566,7 +566,6 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/tests/java/ifc/sheet/_TableAutoFormatField \
qadevOOo/tests/java/ifc/sheet/_XCellRangeData \
qadevOOo/tests/java/ifc/sheet/_XCellRangesQuery \
- qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing \
qadevOOo/tests/java/ifc/sheet/_XEnhancedMouseClickBroadcaster \
qadevOOo/tests/java/ifc/sheet/_XRangeSelection \
qadevOOo/tests/java/ifc/sheet/_XSheetCellCursor \
diff --git a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv
index 7509197e7665..6c6fe08e39c7 100644
--- a/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv
+++ b/qadevOOo/objdsc/sc/com.sun.star.comp.office.ScModelObj.csv
@@ -40,7 +40,6 @@
"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removePropertyChangeListener()"
"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"addVetoableChangeListener()"
"ScModelObj";"com::sun::star::beans::XPropertySet#optional";"removeVetoableChangeListener()"
-"ScModelObj";"com::sun::star::sheet::XDocumentAuditing";"refreshArrows()"
"ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"NamedRanges"
"ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"DatabaseRanges"
"ScModelObj";"com::sun::star::sheet::SpreadsheetDocument";"ColumnLabelRanges"
diff --git a/qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing.java b/qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing.java
deleted file mode 100644
index 2d35679df840..000000000000
--- a/qadevOOo/tests/java/ifc/sheet/_XDocumentAuditing.java
+++ /dev/null
@@ -1,219 +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.beans.PropertyValue;
-import com.sun.star.container.XIndexAccess;
-import com.sun.star.container.XNamed;
-import com.sun.star.drawing.XDrawPage;
-import com.sun.star.drawing.XDrawPagesSupplier;
-import com.sun.star.drawing.XShape;
-import com.sun.star.frame.XDispatchHelper;
-import com.sun.star.frame.XDispatchProvider;
-import com.sun.star.frame.XModel;
-import com.sun.star.lang.XMultiServiceFactory;
-import com.sun.star.sheet.XDocumentAuditing;
-import com.sun.star.sheet.XSheetAuditing;
-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.UnoRuntime;
-import lib.MultiMethodTest;
-import lib.Status;
-import lib.StatusException;
-
-/**
- *
- */
-public class _XDocumentAuditing extends MultiMethodTest {
- public XDocumentAuditing oObj = null;
- XDrawPage xDrawPage = null;
- XSpreadsheet[] xSheet = null;
- int elementCount = 0;
- String sheetName = null;
- Point pos = null;
-
- @Override
- public void before() {
- Exception ex = null;
- // get two sheets
- xSheet = new XSpreadsheet[2];
- try {
- XSpreadsheetDocument xSpreadsheetDocument = UnoRuntime.queryInterface(XSpreadsheetDocument.class, oObj);
- XSpreadsheets oSheets = xSpreadsheetDocument.getSheets();
- XIndexAccess oIndexSheets = UnoRuntime.queryInterface(
- XIndexAccess.class, oSheets);
- XSpreadsheet oSheet = UnoRuntime.queryInterface(
- XSpreadsheet.class, oIndexSheets.getByIndex(0));
- xSheet[0] = oSheet;
- oSheet = UnoRuntime.queryInterface(
- XSpreadsheet.class, oIndexSheets.getByIndex(1));
- xSheet[1] = oSheet;
- }
- catch(com.sun.star.lang.IndexOutOfBoundsException e) {
- ex = e;
- }
- catch(com.sun.star.lang.WrappedTargetException e) {
- ex = e;
- }
- catch(NullPointerException e) {
- ex = e;
- }
- if (ex != null) {
- throw new StatusException("Could not get two sheets.", ex);
- }
-
- // get the draw page for checking the shapes
- xDrawPage = (XDrawPage)tEnv.getObjRelation("XDocumentAuditing.DrawPage");
- if (xDrawPage == null) { // get from object
- try {
- XDrawPagesSupplier oDPS = UnoRuntime.queryInterface(XDrawPagesSupplier.class, oObj);
- Object o = oDPS.getDrawPages().getByIndex(1);
- xDrawPage = UnoRuntime.queryInterface(XDrawPage.class, o);
- }
- catch(com.sun.star.lang.IndexOutOfBoundsException e) {
- } // ignore exceptions, we'll run into next if statement anyway
- catch(com.sun.star.lang.WrappedTargetException e) {
- }
- }
- if (xDrawPage == null) {
- throw new StatusException(Status.failed("'XSheetAuditing.DrawPage' object relation not found."));
- }
- if (xDrawPage.hasElements()) {
- elementCount = xDrawPage.getCount();
- }
-
- // switch off the automatic refresh
- PropertyValue[] props = new PropertyValue[1];
- props[0] = new PropertyValue();
- props[0].Name = "AutoRefreshArrows";
- props[0].Value = Boolean.FALSE;
- XModel xModel = UnoRuntime.queryInterface(XModel.class, oObj);
- dispatch(xModel.getCurrentController().getFrame(), tParam.getMSF(), ".uno:AutoRefreshArrows", props);
-
- // prepare the sheets
- try {
- xSheet[0].getCellByPosition(6, 6).setValue(9);
- XNamed xNamed = UnoRuntime.queryInterface(XNamed.class, xSheet[0]);
- sheetName = xNamed.getName();
- xSheet[1].getCellByPosition(6, 6).setValue(16);
- xSheet[1].getCellByPosition(6, 7).setFormula("= SQRT(G7)");
- XSheetAuditing xSheetAuditing = UnoRuntime.queryInterface(XSheetAuditing.class, xSheet[1]);
- CellAddress add = new CellAddress((short)1, 6, 7);
- xSheetAuditing.showPrecedents(add);
- boolean ok = hasRightAmountOfShapes(1);
- if (!ok)
- throw new StatusException(Status.failed("Wrong amount of shapes on page."));
- }
- catch(com.sun.star.lang.IndexOutOfBoundsException e) {
- throw new StatusException("Could not set formulas on sheets.", e);
- }
- }
-
- @Override
- public void after() {
- // switch the automatic refresh back on
- PropertyValue[] props = new PropertyValue[1];
- props[0] = new PropertyValue();
- props[0].Name = "AutoRefreshArrows";
- props[0].Value = Boolean.TRUE;
- XModel xModel = UnoRuntime.queryInterface(XModel.class, oObj);
- dispatch(xModel.getCurrentController().getFrame(), tParam.getMSF(), ".uno:AutoRefreshArrows", props);
- }
-
- public void _refreshArrows() {
- boolean result = true;
-
- Point p0 = pos;
-
- try {
- result &= xSheet[1].getCellByPosition(6, 7).getValue() == 4;
- xSheet[1].getCellByPosition(6, 7).setFormula("= SQRT(" + sheetName + ".G7)");
- result &= xSheet[1].getCellByPosition(6, 7).getValue() == 3;
- }
- catch(com.sun.star.lang.IndexOutOfBoundsException e) {
- throw new StatusException("Could not set formulas on sheets.", e);
- }
-
- result &= hasRightAmountOfShapes(1);
- Point p1 = pos;
-
- // points have to be the same: if not we have an auto update
- boolean res = (p0.X == p1.X && p0.Y == p1.Y);
- result &= res;
- if (!res)
- log.println("Arrow has been refreshed, but this should have been switched off.");
-
- oObj.refreshArrows();
-
- result &= hasRightAmountOfShapes(1);
- Point p2 = pos;
-
- // points have to differ
- res = (p1.X != p2.X || p1.Y != p2.Y);
- result &= res;
- if (!res)
- log.println("Arrow has not been refreshed.");
-
- tRes.tested("refreshArrows()", result);
- }
-
- /**
- * Check if the amount of shapes is the right one after displaying that stuff
- * 2do improve this: check that the shapes are the correct ones -> convwatch
- * @desiredValue That's the amount of shapes that have to be here.
- * @return True, if the actual count of shapes is the same
- */
- private boolean hasRightAmountOfShapes(int desiredValue) {
- int newCount = xDrawPage.getCount();
- if (newCount != elementCount + desiredValue) {
- return false;
- }
- else {
- if (desiredValue >= 0) {
- for (int i=elementCount; i<newCount; i++) {
- try {
- Object o = xDrawPage.getByIndex(i);
- XShape xShape = UnoRuntime.queryInterface(XShape.class, o);
- pos = xShape.getPosition();
- System.out.println("Shape Type: " + xShape.getShapeType());
- }
- catch(com.sun.star.uno.Exception e) {
- e.printStackTrace();
- }
- }
- }
- }
- return true;
- }
-
- private void dispatch(Object oProvider, XMultiServiceFactory xMSF, String url, PropertyValue[] prop) {
- XDispatchProvider xDispatchProvider = UnoRuntime.queryInterface(XDispatchProvider.class, oProvider);
- Object dispatcher = null;
- try {
- dispatcher = xMSF.createInstance("com.sun.star.frame.DispatchHelper");
- }
- catch(com.sun.star.uno.Exception e) {
- }
-
- XDispatchHelper xDispatchHelper = UnoRuntime.queryInterface(XDispatchHelper.class, dispatcher);
- xDispatchHelper.executeDispatch(xDispatchProvider, url, "", 0, prop);
- }
-}
diff --git a/sc/CppunitTest_sc_modelobj.mk b/sc/CppunitTest_sc_modelobj.mk
index 77bef309eaf1..6ad683c0a793 100644
--- a/sc/CppunitTest_sc_modelobj.mk
+++ b/sc/CppunitTest_sc_modelobj.mk
@@ -14,48 +14,21 @@ $(eval $(call gb_CppunitTest_CppunitTest,sc_modelobj))
$(eval $(call gb_CppunitTest_use_external,sc_modelobj,boost_headers))
$(eval $(call gb_CppunitTest_add_exception_objects,sc_modelobj, \
- sc/qa/extras/scmodelobj \
+ sc/qa/extras/scmodelobj \
))
$(eval $(call gb_CppunitTest_use_libraries,sc_modelobj, \
- basegfx \
- comphelper \
- cppu \
- cppuhelper \
- drawinglayer \
- editeng \
- for \
- forui \
- i18nlangtag \
- msfilter \
- oox \
- sal \
- salhelper \
- sax \
- sb \
- sc \
- sfx \
- sot \
- subsequenttest \
- svl \
- svt \
- svx \
- svxcore \
+ comphelper \
+ cppu \
+ cppuhelper \
+ sal \
+ subsequenttest \
test \
- tk \
- tl \
- ucbhelper \
unotest \
- utl \
- vbahelper \
- vcl \
- xo \
))
$(eval $(call gb_CppunitTest_set_include,sc_modelobj,\
- -I$(SRCDIR)/sc/source/ui/inc \
- -I$(SRCDIR)/sc/inc \
- $$(INCLUDE) \
+ $$(INCLUDE) \
))
$(eval $(call gb_CppunitTest_use_sdk_api,sc_modelobj))
@@ -63,9 +36,9 @@ $(eval $(call gb_CppunitTest_use_sdk_api,sc_modelobj))
$(eval $(call gb_CppunitTest_use_ure,sc_modelobj))
$(eval $(call gb_CppunitTest_use_vcl,sc_modelobj))
-$(eval $(call gb_CppunitTest_use_components,sc_modelobj,\
- $(sc_unoapi_common_components) \
-))
+$(eval $(call gb_CppunitTest_use_rdb,sc_modelobj,services))
+
+$(eval $(call gb_CppunitTest_use_components,sc_modelobj))
$(eval $(call gb_CppunitTest_use_configuration,sc_modelobj))
diff --git a/sc/qa/extras/scmodelobj.cxx b/sc/qa/extras/scmodelobj.cxx
index 79f44080f7a7..78bc8f7b34d5 100644
--- a/sc/qa/extras/scmodelobj.cxx
+++ b/sc/qa/extras/scmodelobj.cxx
@@ -11,11 +11,13 @@
#include <test/sheet/spreadsheetdocumentsettings.hxx>
#include <test/sheet/xcalculatable.hxx>
#include <test/sheet/xconsolidatable.hxx>
+#include <test/sheet/xdocumentauditing.hxx>
#include <test/sheet/xgoalseek.hxx>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/sheet/XSpreadsheet.hpp>
#include <com/sun/star/sheet/XSpreadsheets.hpp>
@@ -32,6 +34,7 @@ class ScModelObj : public UnoApiTest,
public apitest::SpreadsheetDocumentSettings,
public apitest::XCalculatable,
public apitest::XConsolidatable,
+ public apitest::XDocumentAuditing,
public apitest::XGoalSeek
{
public:
@@ -39,6 +42,7 @@ public:
virtual void tearDown() override;
virtual uno::Reference< uno::XInterface > init() override;
+ virtual uno::Reference< uno::XInterface > getXMSF() override;
virtual uno::Sequence<uno::Reference<table::XCell>> getXCells() override;
ScModelObj();
@@ -57,6 +61,9 @@ public:
CPPUNIT_TEST(testCreateConsolidationDescriptor);
CPPUNIT_TEST(testConsolidate);
+ // XDocumentAuditing
+ CPPUNIT_TEST(testRefreshArrows);
+
// XGoalSeek
CPPUNIT_TEST(testSeekGoal);
@@ -93,6 +100,11 @@ uno::Reference< uno::XInterface > ScModelObj::init()
return xModel;
}
+uno::Reference<uno::XInterface> ScModelObj::getXMSF()
+{
+ return getMultiServiceFactory();
+}
+
uno::Sequence<uno::Reference<table::XCell>> ScModelObj::getXCells()
{
return m_xCells;
diff --git a/test/Library_subsequenttest.mk b/test/Library_subsequenttest.mk
index 83ba40a06850..c6a69d23623b 100644
--- a/test/Library_subsequenttest.mk
+++ b/test/Library_subsequenttest.mk
@@ -86,6 +86,7 @@ $(eval $(call gb_Library_add_exception_objects,subsequenttest,\
test/source/sheet/xcellseries \
test/source/sheet/xconsolidatable \
test/source/sheet/xconsolidationdescriptor \
+ test/source/sheet/xdocumentauditing \
test/source/sheet/xgoalseek \
test/source/sheet/xdatabaserange \
test/source/sheet/xdatabaseranges \
diff --git a/test/source/sheet/xdocumentauditing.cxx b/test/source/sheet/xdocumentauditing.cxx
new file mode 100644
index 000000000000..7b1565a62a43
--- /dev/null
+++ b/test/source/sheet/xdocumentauditing.cxx
@@ -0,0 +1,141 @@
+/* -*- 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/xdocumentauditing.hxx>
+
+#include <com/sun/star/awt/Point.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/frame/DispatchHelper.hpp>
+#include <com/sun/star/frame/XDispatchHelper.hpp>
+#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/sheet/XDocumentAuditing.hpp>
+#include <com/sun/star/sheet/XSheetAuditing.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheets.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+#include <cppunit/extensions/HelperMacros.h>
+
+using namespace com::sun::star;
+using namespace com::sun::star::uno;
+
+namespace apitest
+{
+void XDocumentAuditing::dispatch(const uno::Reference<frame::XFrame>& xFrame,
+ const uno::Sequence<beans::PropertyValue>& rArguments)
+{
+ uno::Reference<uno::XComponentContext> xContext = ::comphelper::getProcessComponentContext();
+ uno::Reference<frame::XDispatchHelper> xDispatchHelper(frame::DispatchHelper::create(xContext),
+ UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDispatchHelper.is());
+
+ uno::Reference<frame::XDispatchProvider> xDispatchProvider(xFrame, UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(xDispatchProvider.is());
+
+ xDispatchHelper->executeDispatch(xDispatchProvider, ".uno:AutoRefreshArrows", "", 0,
+ rArguments);
+}
+
+bool XDocumentAuditing::hasRightAmountOfShapes(const uno::Reference<drawing::XDrawPage>& xDrawPage,
+ const sal_Int32& nElementCount,
+ const sal_Int32& nShapes)
+{
+ const sal_Int32 nCount = xDrawPage->getCount();
+ if (nCount != nElementCount + nShapes)
+ return false;
+ else
+ {
+ if (nShapes >= 0)
+ {
+ for (sal_Int32 i = nElementCount; i < nCount; i++)
+ {
+ uno::Reference<drawing::XShape> xShape(xDrawPage->getByIndex(i), UNO_QUERY_THROW);
+ m_Position = xShape->getPosition();
+ }
+ }
+ }
+ return true;
+}
+
+void XDocumentAuditing::testRefreshArrows()
+{
+ uno::Reference<sheet::XDocumentAuditing> xDocumentAuditing(init(), UNO_QUERY_THROW);
+
+ uno::Reference<sheet::XSpreadsheetDocument> xDoc(xDocumentAuditing, UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheets> xSheets(xDoc->getSheets(), UNO_QUERY_THROW);
+ uno::Reference<container::XIndexAccess> xIA(xSheets, UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheet> xSheet1(xIA->getByIndex(0), UNO_QUERY_THROW);
+ uno::Reference<sheet::XSpreadsheet> xSheet2(xIA->getByIndex(1), UNO_QUERY_THROW);
+
+ uno::Reference<drawing::XDrawPagesSupplier> xDPS(xDocumentAuditing, UNO_QUERY_THROW);
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDPS->getDrawPages()->getByIndex(1),
+ UNO_QUERY_THROW);
+
+ sal_Int32 nDrawPageElementCount = 0;
+ if (xDrawPage->hasElements())
+ nDrawPageElementCount = xDrawPage->getCount();
+
+ uno::Sequence<beans::PropertyValue> aPropertyValue(1);
+ uno::Any aValue;
+ aValue <<= false;
+ aPropertyValue[0].Name = "AutoRefreshArrows";
+ aPropertyValue[0].Value = aValue;
+ uno::Reference<frame::XModel> xModel(xDocumentAuditing, UNO_QUERY_THROW);
+ dispatch(xModel->getCurrentController()->getFrame(), aPropertyValue);
+
+ xSheet1->getCellByPosition(6, 6)->setValue(9);
+ uno::Reference<container::XNamed> xNA1(xSheet1, UNO_QUERY_THROW);
+ OUString sSheet1Name = xNA1->getName();
+
+ xSheet2->getCellByPosition(6, 6)->setValue(16);
+ xSheet2->getCellByPosition(6, 7)->setFormula("= SQRT(G7)");
+
+ uno::Reference<sheet::XSheetAuditing> xSheetAuditing(xSheet2, UNO_QUERY_THROW);
+ xSheetAuditing->showPrecedents(table::CellAddress(1, 6, 7));
+ bool bResult = hasRightAmountOfShapes(xDrawPage, nDrawPageElementCount, 1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult);
+ awt::Point Position0 = m_Position;
+
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(4, xSheet2->getCellByPosition(6, 7)->getValue(), 0.1);
+ xSheet2->getCellByPosition(6, 7)->setFormula("= SQRT(" + sSheet1Name + ".G7)");
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(3, xSheet2->getCellByPosition(6, 7)->getValue(), 0.1);
+
+ bResult = hasRightAmountOfShapes(xDrawPage, nDrawPageElementCount, 1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult);
+ awt::Point Position1 = m_Position;
+
+ CPPUNIT_ASSERT_MESSAGE("Arrow has been refreshed",
+ Position0.X == Position1.X && Position0.Y == Position1.Y);
+
+ xDocumentAuditing->refreshArrows();
+
+ bResult = hasRightAmountOfShapes(xDrawPage, nDrawPageElementCount, 1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong amount of shapes on page", bResult);
+ awt::Point Position2 = m_Position;
+
+ CPPUNIT_ASSERT_MESSAGE("Arrow has not been refreshed",
+ Position1.X != Position2.X || Position1.Y != Position2.Y);
+}
+} // namespace apitest
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */