12#include <com/sun/star/sheet/XNamedRange.hpp>
13#include <com/sun/star/table/CellAddress.hpp>
14#include <com/sun/star/sheet/NamedRangeFlag.hpp>
16#include <cppunit/TestAssert.h>
17#include <rtl/ustring.hxx>
20using namespace css::uno;
26 uno::Reference< sheet::XNamedRange > xNamedRange =
getNamedRange(
"initial1");
28 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected content for initial1 on GetContent", OUString(
"$Sheet1.$B$1"), xNamedRange->getContent());
33 uno::Reference< sheet::XNamedRange > xNamedRange =
getNamedRange(
"initial1");
35 OUString aExpectedContent;
38 aExpectedContent =
"D1";
39 xNamedRange->setContent(aExpectedContent);
40 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected content for initial1 after SetContent a cell", aExpectedContent, xNamedRange->getContent());
43 aExpectedContent =
"D1:D10";
44 xNamedRange->setContent(aExpectedContent);
45 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected content for initial1 after SetContent a cellrange", aExpectedContent, xNamedRange->getContent());
48 aExpectedContent =
"=D10";
49 xNamedRange->setContent(aExpectedContent);
50 aExpectedContent =
"D10";
51 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected content for initial1 after SetContent a formula", aExpectedContent, xNamedRange->getContent());
56 uno::Reference< sheet::XNamedRange > xNamedRange =
getNamedRange(
"initial1");
57 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected Type", sal_Int32(0), xNamedRange->getType());
62 uno::Reference< sheet::XNamedRange > xNamedRange =
getNamedRange(
"initial1");
64 sal_Int32
nType = ::sheet::NamedRangeFlag::ROW_HEADER;
65 xNamedRange->setType(
nType);
66 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected Type ROW_HEADER after setting it",
nType, xNamedRange->getType());
68 nType = ::sheet::NamedRangeFlag::COLUMN_HEADER;
69 xNamedRange->setType(
nType);
70 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected Type COLUMN_HEADER after setting it",
nType, xNamedRange->getType());
72 nType = ::sheet::NamedRangeFlag::FILTER_CRITERIA;
73 xNamedRange->setType(
nType);
74 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected Type FILTER_CRITERIA after setting it",
nType, xNamedRange->getType());
76 nType = ::sheet::NamedRangeFlag::PRINT_AREA;
77 xNamedRange->setType(
nType);
78 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected Type PRINT_AREA after setting it",
nType, xNamedRange->getType());
81 xNamedRange->setType(
nType);
82 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong expected Type 0 after setting it",
nType, xNamedRange->getType());
87 uno::Reference< sheet::XNamedRange > xNamedRange =
getNamedRange(
"initial2");
89 table::CellAddress aCellAddress = xNamedRange->getReferencePosition();
91 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong SHEET reference position", sal_Int16(0), aCellAddress.Sheet);
92 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong COLUMN reference position", sal_Int32(1), aCellAddress.Column);
93 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong ROW reference position", sal_Int32(0), aCellAddress.Row);
98 uno::Reference< sheet::XNamedRange > xNamedRange =
getNamedRange(
"initial1");
100 table::CellAddress aBaseAddress(1,2,3);
102 xNamedRange->setReferencePosition(aBaseAddress);
104 table::CellAddress aCellAddress = xNamedRange->getReferencePosition();
105 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong SHEET reference position after setting it", sal_Int16(1), aCellAddress.Sheet);
106 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong COLUMN reference position after setting it", sal_Int32(2), aCellAddress.Column);
107 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong ROW reference position after setting it", sal_Int32(3), aCellAddress.Row);
virtual css::uno::Reference< css::sheet::XNamedRange > getNamedRange(const OUString &)=0
void testSetReferencePosition()
void testGetReferencePosition()