12#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
13#include <com/sun/star/sheet/XDataPilotTables.hpp>
14#include <com/sun/star/sheet/XSpreadsheet.hpp>
15#include <com/sun/star/table/CellAddress.hpp>
16#include <com/sun/star/uno/RuntimeException.hpp>
17#include <com/sun/star/uno/Reference.hxx>
19#include <cppunit/TestAssert.h>
22using namespace css::uno;
28 uno::Reference<sheet::XDataPilotTables> xDPT(
init(), UNO_QUERY_THROW);
29 uno::Reference<sheet::XSpreadsheet> xSheet(
getXSpreadsheet(), UNO_QUERY_THROW);
31 uno::Reference<sheet::XDataPilotDescriptor> xDPD(xDPT->createDataPilotDescriptor(),
34 xDPT->insertNewByName(
"XDataPilotTables", table::CellAddress(0, 9, 8), xDPD);
35 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to insert new DataPilotTable", OUString(
"Filter"),
36 xSheet->getCellByPosition(9, 8)->getFormula());
38 CPPUNIT_ASSERT_THROW_MESSAGE(
39 "No exception thrown, when inserting element with existing name",
40 xDPT->insertNewByName(
"XDataPilotTables", table::CellAddress(0, 7, 7), xDPD),
41 css::uno::RuntimeException);
43 xDPT->removeByName(
"XDataPilotTables");
44 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to remove DataPilotTable", OUString(
""),
45 xSheet->getCellByPosition(9, 8)->getFormula());
47 CPPUNIT_ASSERT_THROW_MESSAGE(
"No exception, when removing no existing element",
48 xDPT->removeByName(
"XDataPilotTables"),
49 css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheet()=0
virtual css::uno::Reference< css::uno::XInterface > init()=0
void testXDataPilotTables()