12#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
13#include <com/sun/star/sheet/XSheetCellCursor.hpp>
14#include <com/sun/star/sheet/XSheetCellRange.hpp>
15#include <com/sun/star/sheet/XSpreadsheet.hpp>
16#include <com/sun/star/table/CellRangeAddress.hpp>
17#include <com/sun/star/table/XCellCursor.hpp>
18#include <com/sun/star/table/XCellRange.hpp>
20#include <com/sun/star/uno/Reference.hxx>
22#include <cppunit/TestAssert.h>
31 uno::Reference<table::XCellCursor> xCellCursor(
init(), UNO_QUERY_THROW);
33 uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
35 table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
36 const sal_Int32 startCol = aCellRangeAddr.StartColumn;
38 xCellCursor->gotoNext();
40 aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
41 const sal_Int32 startCol2 = aCellRangeAddr.StartColumn;
43 CPPUNIT_ASSERT_MESSAGE(
"Successfully able to go to Next", startCol != startCol2);
48 uno::Reference<table::XCellCursor> xCellCursor(
init(), UNO_QUERY_THROW);
50 uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
52 table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
53 const sal_Int32 startRow = aCellRangeAddr.StartRow;
54 const sal_Int32 startCol = aCellRangeAddr.StartColumn;
56 xCellCursor->gotoOffset(4, 4);
58 aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
59 const sal_Int32 startRow2 = aCellRangeAddr.StartRow;
60 const sal_Int32 startCol2 = aCellRangeAddr.StartColumn;
62 CPPUNIT_ASSERT_MESSAGE(
"Successfully able to go to Offset",
63 (startCol != startCol2) || (startRow == startRow2));
68 uno::Reference<table::XCellCursor> xCellCursor(
init(), UNO_QUERY_THROW);
70 uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
72 xCellCursor->gotoOffset(4, 4);
74 table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
75 const sal_Int32 startCol = aCellRangeAddr.StartColumn;
77 xCellCursor->gotoPrevious();
79 aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
80 const sal_Int32 startCol2 = aCellRangeAddr.StartColumn;
81 CPPUNIT_ASSERT_MESSAGE(
"Successfully able to go to Previous", startCol != startCol2);
86 uno::Reference<table::XCellCursor> xCellCursor(
init(), UNO_QUERY_THROW);
88 uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
90 xCellCursor->gotoStart();
92 table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
94 const sal_Int32 startRow = aCellRangeAddr.StartRow;
95 const sal_Int32 startCol = aCellRangeAddr.StartColumn;
96 const sal_Int32 endRow = aCellRangeAddr.EndRow;
97 const sal_Int32 endCol = aCellRangeAddr.EndColumn;
98 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Successfully able to go to Start", startCol, endCol);
99 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Successfully able to go to Start", endRow, startRow);
104 uno::Reference<table::XCellCursor> xCellCursor(
init(), UNO_QUERY_THROW);
105 uno::Reference<sheet::XSpreadsheet> xSpreadsheet(
getXSpreadsheet(), UNO_QUERY_THROW);
106 uno::Reference<table::XCellRange> xCellRange(xCellCursor, UNO_QUERY_THROW);
107 xCellRange = xSpreadsheet->getCellRangeByName(
"$A$1:$g$7");
108 uno::Reference<sheet::XSheetCellRange> xSheetCellRange(xCellCursor, UNO_QUERY_THROW);
109 uno::Reference<sheet::XSheetCellCursor> xSheetCellCursor(xCellCursor, UNO_QUERY_THROW);
110 xSheetCellCursor = xSpreadsheet->createCursorByRange(xSheetCellRange);
111 uno::Reference<sheet::XCellRangeAddressable> xCellRangeAddressable(xCellCursor,
114 xCellCursor->gotoEnd();
116 table::CellRangeAddress aCellRangeAddr = xCellRangeAddressable->getRangeAddress();
117 const sal_Int32 startRow = aCellRangeAddr.StartRow;
118 const sal_Int32 startCol = aCellRangeAddr.StartColumn;
119 const sal_Int32 endRow = aCellRangeAddr.EndRow;
120 const sal_Int32 endCol = aCellRangeAddr.EndColumn;
121 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Successfully able to go to End", startCol, endCol);
122 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Successfully able to go to End", endRow, startRow);
virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheet()=0
virtual css::uno::Reference< css::uno::XInterface > init()=0