12#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
13#include <com/sun/star/sheet/XSheetCellCursor.hpp>
14#include <com/sun/star/sheet/XSpreadsheet.hpp>
15#include <com/sun/star/sheet/XUsedAreaCursor.hpp>
17#include <com/sun/star/table/CellRangeAddress.hpp>
19#include <cppunit/TestAssert.h>
29 uno::Reference< sheet::XSpreadsheet > xSheet(
getXSpreadsheet(), UNO_QUERY_THROW);
30 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor(xSheet->createCursor(), UNO_SET_THROW);
31 uno::Reference< sheet::XCellRangeAddressable> xCellRangeAddressable(xSheetCellCursor, UNO_QUERY_THROW);
33 uno::Reference< sheet::XUsedAreaCursor > xUsedAreaCursor(xSheetCellCursor, UNO_QUERY_THROW);
35 xUsedAreaCursor->gotoStartOfUsedArea(
false);
36 xUsedAreaCursor->gotoEndOfUsedArea(
true);
37 table::CellRangeAddress cellRangeAddress = xCellRangeAddressable->getRangeAddress();
39 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start column",
40 sal_Int32(0), cellRangeAddress.StartColumn);
41 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
42 sal_Int32(2), cellRangeAddress.EndColumn);
43 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start row",
44 sal_Int32(0), cellRangeAddress.StartRow);
45 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
46 sal_Int32(0), cellRangeAddress.EndRow);
48 xUsedAreaCursor->gotoEndOfUsedArea(
false);
49 cellRangeAddress = xCellRangeAddressable->getRangeAddress();
51 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start column",
52 sal_Int32(2), cellRangeAddress.StartColumn);
53 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
54 sal_Int32(2), cellRangeAddress.EndColumn);
55 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start row",
56 sal_Int32(0), cellRangeAddress.StartRow);
57 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
58 sal_Int32(0), cellRangeAddress.EndRow);
63 uno::Reference< sheet::XSpreadsheet > xSheet(
getXSpreadsheet(), UNO_QUERY_THROW);
64 uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor(xSheet->createCursor(), UNO_SET_THROW);
65 uno::Reference< sheet::XCellRangeAddressable> xCellRangeAddressable(xSheetCellCursor, UNO_QUERY_THROW);
67 uno::Reference< sheet::XUsedAreaCursor > xUsedAreaCursor(xSheetCellCursor, UNO_QUERY_THROW);
69 xUsedAreaCursor->gotoEndOfUsedArea(
false);
70 xUsedAreaCursor->gotoStartOfUsedArea(
true);
71 table::CellRangeAddress cellRangeAddress = xCellRangeAddressable->getRangeAddress();
73 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start column",
74 sal_Int32(0), cellRangeAddress.StartColumn);
75 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
76 sal_Int32(2), cellRangeAddress.EndColumn);
77 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start row",
78 sal_Int32(0), cellRangeAddress.StartRow);
79 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
80 sal_Int32(0), cellRangeAddress.EndRow);
82 xUsedAreaCursor->gotoStartOfUsedArea(
false);
83 cellRangeAddress = xCellRangeAddressable->getRangeAddress();
85 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start column",
86 sal_Int32(0), cellRangeAddress.StartColumn);
87 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
88 sal_Int32(0), cellRangeAddress.EndColumn);
89 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong start row",
90 sal_Int32(0), cellRangeAddress.StartRow);
91 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Wrong end column",
92 sal_Int32(0), cellRangeAddress.EndRow);
void testGotoEndOfUsedArea()
void testGotoStartOfUsedArea()
virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheet()=0