21 #include <com/sun/star/frame/XModel.hpp>
22 #include <com/sun/star/sheet/XSpreadsheet.hpp>
23 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
24 #include <com/sun/star/table/CellRangeAddress.hpp>
31 const css::uno::Reference< ov::XHelperInterface >& xParent,
32 const uno::Reference< uno::XComponentContext >& xContext,
33 const uno::Reference< frame::XModel >& rModel,
34 const uno::Reference< sheet::XViewPane >& rViewPane ) :
36 m_xViewPane(rViewPane,
uno::UNO_SET_THROW),
45 return (
m_xViewPane->getFirstVisibleColumn() + 1 );
51 if( _scrollcolumn < 1 )
53 throw uno::RuntimeException(
"Column number should not be less than 1" );
55 m_xViewPane->setFirstVisibleColumn( _scrollcolumn - 1 );
69 throw uno::RuntimeException(
"Row number should not be less than 1" );
74 uno::Reference< excel::XRange > SAL_CALL
78 table::CellRangeAddress aRangeAddr =
m_xViewPane->getVisibleRange();
79 uno::Reference< sheet::XSpreadsheetDocument > xDoc(
m_xModel, uno::UNO_QUERY_THROW );
80 uno::Reference< container::XIndexAccess > xSheetsIA( xDoc->getSheets(), uno::UNO_QUERY_THROW );
81 uno::Reference< sheet::XSpreadsheet > xSheet( xSheetsIA->getByIndex( aRangeAddr.Sheet ), uno::UNO_QUERY_THROW );
82 uno::Reference< table::XCellRange > xRange( xSheet->getCellRangeByPosition( aRangeAddr.StartColumn, aRangeAddr.StartRow, aRangeAddr.EndColumn, aRangeAddr.EndRow ), uno::UNO_SET_THROW );
91 OUString messageBuffer;
92 sal_Int32 downRows = 0;
93 sal_Int32 rightCols = 0;
94 table::CellRangeAddress visibleRange =
m_xViewPane->getVisibleRange();
102 messageBuffer +=
"Error getting parameter: Down\n";
110 messageBuffer +=
"Error getting parameter: Up\n";
115 if( ToRight >>= right )
118 messageBuffer +=
"Error getting parameter: ToRight\n";
123 if( ToLeft >>= left )
126 messageBuffer +=
"Error getting parameter: ToLeft\n";
128 if( !messageBuffer.isEmpty() )
129 throw uno::RuntimeException( messageBuffer );
131 sal_Int32 newStartRow = visibleRange.StartRow + downRows;
132 if( newStartRow < 0 )
134 sal_Int32 newStartCol = visibleRange.StartColumn + rightCols;
135 if( newStartCol < 0 )
144 OUString messageBuffer;
145 table::CellRangeAddress visibleRange =
m_xViewPane->getVisibleRange();
147 sal_Int32 vertPageSize = 1 + visibleRange.EndRow - visibleRange.StartRow;
148 sal_Int32 horizPageSize = 1 + visibleRange.EndColumn - visibleRange.StartColumn;
149 sal_Int32 downPages = 0;
150 sal_Int32 acrossPages = 0;
157 messageBuffer +=
"Error getting parameter: Down\n";
165 messageBuffer +=
"Error getting parameter: Up\n";
170 if( ToRight >>= right )
171 acrossPages += right;
173 messageBuffer +=
"Error getting parameter: ToRight\n";
178 if( ToLeft >>= left )
181 messageBuffer +=
"Error getting parameter: ToLeft\n";
183 if( !messageBuffer.isEmpty() )
184 throw uno::RuntimeException( messageBuffer );
186 sal_Int32 newStartRow = visibleRange.StartRow + (downPages * vertPageSize );
187 if( newStartRow < 0 )
189 sal_Int32 newStartCol = visibleRange.StartColumn + (acrossPages * horizPageSize );
190 if( newStartCol < 0 )
virtual sal_Int32 SAL_CALL getScrollColumn() override
Reference< frame::XModel > m_xModel
void SAL_CALL down(const css::awt::SpinEvent &rEvent) override
css::uno::WeakReference< ov::XHelperInterface > m_xParent
css::uno::Reference< css::frame::XModel > m_xModel
css::uno::Reference< css::sheet::XViewPane > m_xViewPane
DECL_LISTENERMULTIPLEXER_END void SAL_CALL up(const css::awt::SpinEvent &rEvent) override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getVisibleRange() override
virtual sal_Int32 SAL_CALL getScrollRow() override
ScVbaPane(const css::uno::Reference< ov::XHelperInterface > &rParent, const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Reference< css::frame::XModel > &rModel, const css::uno::Reference< css::sheet::XViewPane > &rViewPane)
virtual void SAL_CALL SmallScroll(const css::uno::Any &Down, const css::uno::Any &Up, const css::uno::Any &ToRight, const css::uno::Any &ToLeft) override
virtual void SAL_CALL setScrollColumn(sal_Int32 _scrollcolumn) override
Reference< XComponentContext > m_xContext
virtual void SAL_CALL setScrollRow(sal_Int32 _scrollrow) override
virtual void SAL_CALL LargeScroll(const css::uno::Any &Down, const css::uno::Any &Up, const css::uno::Any &ToRight, const css::uno::Any &ToLeft) override