12#include <com/sun/star/sheet/XDataPilotDescriptor.hpp>
13#include <com/sun/star/table/CellRangeAddress.hpp>
14#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
15#include <com/sun/star/beans/XPropertySet.hpp>
17#include <cppunit/TestAssert.h>
19#include <rtl/ustring.hxx>
22using namespace css::uno;
30 OUString aTag(
"DataPilotDescriptor_Tag");
31 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(), UNO_QUERY_THROW);
33 OUString aNewTag = xDescr->getTag();
34 CPPUNIT_ASSERT_EQUAL( aTag, aNewTag );
39 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(), UNO_QUERY_THROW);
40 table::CellRangeAddress aOldAddress = xDescr->getSourceRange();
42 table::CellRangeAddress aAddress;
44 aAddress.StartColumn = 1;
45 aAddress.StartRow = 1;
46 aAddress.EndColumn = 5;
48 xDescr->setSourceRange(aAddress);
50 table::CellRangeAddress aReturn = xDescr->getSourceRange();
52 CPPUNIT_ASSERT_EQUAL(aAddress.Sheet, aReturn.Sheet);
53 CPPUNIT_ASSERT_EQUAL(aAddress.StartColumn, aReturn.StartColumn);
54 CPPUNIT_ASSERT_EQUAL(aAddress.StartRow, aReturn.StartRow);
55 CPPUNIT_ASSERT_EQUAL(aAddress.EndColumn, aReturn.EndColumn);
56 CPPUNIT_ASSERT_EQUAL(aAddress.EndRow, aReturn.EndRow);
59 xDescr->setSourceRange(aOldAddress);
64 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(), UNO_QUERY_THROW);
65 uno::Reference< sheet::XSheetFilterDescriptor > xSheetFilterDescr = xDescr->getFilterDescriptor();
66 CPPUNIT_ASSERT(xSheetFilterDescr.is());
71 uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataPilotFields(), UNO_SET_THROW);
73 sal_Int32
nCount = xIndex->getCount();
75 OUString aOrientation(
"Orientation");
76 for (sal_Int32
i = 0;
i <
nCount &&
i < 5; ++
i)
78 uno::Reference< container::XNamed > xNamed( xIndex->getByIndex(
i ), UNO_QUERY_THROW);
79 OUString
aName = xNamed->getName();
81 CPPUNIT_ASSERT(
aName !=
"Data" );
83 uno::Reference< beans::XPropertySet > xPropSet( xNamed, UNO_QUERY_THROW);
90 aAny<<= sheet::DataPilotFieldOrientation_COLUMN;
91 xPropSet->setPropertyValue(aOrientation, aAny);
97 aAny<<= sheet::DataPilotFieldOrientation_ROW;
98 xPropSet->setPropertyValue(aOrientation, aAny);
104 aAny<<= sheet::DataPilotFieldOrientation_DATA;
105 xPropSet->setPropertyValue(aOrientation, aAny);
111 aAny<<= sheet::DataPilotFieldOrientation_HIDDEN;
112 xPropSet->setPropertyValue(aOrientation, aAny);
118 aAny<<= sheet::DataPilotFieldOrientation_PAGE;
119 xPropSet->setPropertyValue(aOrientation, aAny);
128 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(), UNO_QUERY_THROW);
134 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(),UNO_QUERY_THROW);
136 uno::Reference< container::XIndexAccess > xIndex(xDescr->getColumnFields(), UNO_SET_THROW);
143 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(),UNO_QUERY_THROW);
145 uno::Reference< container::XIndexAccess > xIndex(xDescr->getRowFields(), UNO_SET_THROW);
152 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(), UNO_QUERY_THROW);
154 uno::Reference< container::XIndexAccess > xIndex(xDescr->getPageFields(), UNO_SET_THROW);
161 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(),UNO_QUERY_THROW);
163 uno::Reference< container::XIndexAccess > xIndex(xDescr->getDataFields(), UNO_SET_THROW);
170 uno::Reference< sheet::XDataPilotDescriptor > xDescr(
init(),UNO_QUERY_THROW);
172 uno::Reference< container::XIndexAccess > xIndex(xDescr->getHiddenFields(), UNO_SET_THROW);
179 CPPUNIT_ASSERT(xIndex.is());
182 for (sal_Int32
i = 0;
i < xIndex->getCount(); ++
i)
184 uno::Reference< container::XNamed > xNamed( xIndex->getByIndex(
i), UNO_QUERY_THROW);
static void checkName(css::uno::Reference< css::container::XIndexAccess > const &xIndex, std::size_t nIndex)
static std::vector< OUString > maFieldNames
void testGetColumnFields()
void testGetFilterDescriptor()
void testGetHiddenFields()
virtual css::uno::Reference< css::uno::XInterface > init()=0
static void testGetDataPilotFields_Impl(css::uno::Reference< css::sheet::XDataPilotDescriptor > const &xDescr)
void testGetDataPilotFields()