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>
32 const css::uno::Reference< ov::XHelperInterface >& xParent,
33 uno::Reference< uno::XComponentContext > xContext,
34 const uno::Reference< frame::XModel >& rModel,
35 const uno::Reference< sheet::XViewPane >& rViewPane ) :
37 m_xViewPane(rViewPane,
uno::UNO_SET_THROW),
46 return (
m_xViewPane->getFirstVisibleColumn() + 1 );
52 if( _scrollcolumn < 1 )
54 throw uno::RuntimeException(
"Column number should not be less than 1" );
56 m_xViewPane->setFirstVisibleColumn( _scrollcolumn - 1 );
70 throw uno::RuntimeException(
"Row number should not be less than 1" );
75uno::Reference< excel::XRange > SAL_CALL
79 table::CellRangeAddress aRangeAddr =
m_xViewPane->getVisibleRange();
80 uno::Reference< sheet::XSpreadsheetDocument > xDoc(
m_xModel, uno::UNO_QUERY_THROW );
81 uno::Reference< container::XIndexAccess > xSheetsIA( xDoc->getSheets(), uno::UNO_QUERY_THROW );
82 uno::Reference< sheet::XSpreadsheet > xSheet( xSheetsIA->getByIndex( aRangeAddr.Sheet ), uno::UNO_QUERY_THROW );
83 uno::Reference< table::XCellRange > xRange( xSheet->getCellRangeByPosition( aRangeAddr.StartColumn, aRangeAddr.StartRow, aRangeAddr.EndColumn, aRangeAddr.EndRow ), uno::UNO_SET_THROW );
92 OUString messageBuffer;
93 sal_Int32 downRows = 0;
94 sal_Int32 rightCols = 0;
95 table::CellRangeAddress visibleRange =
m_xViewPane->getVisibleRange();
103 messageBuffer +=
"Error getting parameter: Down\n";
111 messageBuffer +=
"Error getting parameter: Up\n";
116 if( ToRight >>=
right )
119 messageBuffer +=
"Error getting parameter: ToRight\n";
124 if( ToLeft >>=
left )
127 messageBuffer +=
"Error getting parameter: ToLeft\n";
129 if( !messageBuffer.isEmpty() )
130 throw uno::RuntimeException( messageBuffer );
132 sal_Int32 newStartRow = visibleRange.StartRow + downRows;
133 if( newStartRow < 0 )
135 sal_Int32 newStartCol = visibleRange.StartColumn + rightCols;
136 if( newStartCol < 0 )
145 OUString messageBuffer;
146 table::CellRangeAddress visibleRange =
m_xViewPane->getVisibleRange();
148 sal_Int32 vertPageSize = 1 + visibleRange.EndRow - visibleRange.StartRow;
149 sal_Int32 horizPageSize = 1 + visibleRange.EndColumn - visibleRange.StartColumn;
150 sal_Int32 downPages = 0;
151 sal_Int32 acrossPages = 0;
152 if(
Down.hasValue() )
158 messageBuffer +=
"Error getting parameter: Down\n";
166 messageBuffer +=
"Error getting parameter: Up\n";
171 if( ToRight >>=
right )
172 acrossPages +=
right;
174 messageBuffer +=
"Error getting parameter: ToRight\n";
179 if( ToLeft >>=
left )
182 messageBuffer +=
"Error getting parameter: ToLeft\n";
184 if( !messageBuffer.isEmpty() )
185 throw uno::RuntimeException( messageBuffer );
187 sal_Int32 newStartRow = visibleRange.StartRow + (downPages * vertPageSize );
188 if( newStartRow < 0 )
190 sal_Int32 newStartCol = visibleRange.StartColumn + (acrossPages * horizPageSize );
191 if( newStartCol < 0 )
Reference< XComponentContext > m_xContext
virtual sal_Int32 SAL_CALL getScrollRow() override
css::uno::Reference< css::frame::XModel > m_xModel
virtual void SAL_CALL setScrollColumn(sal_Int32 _scrollcolumn) override
virtual css::uno::Reference< ov::excel::XRange > SAL_CALL getVisibleRange() override
css::uno::WeakReference< ov::XHelperInterface > m_xParent
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 sal_Int32 SAL_CALL getScrollColumn() override
ScVbaPane(const css::uno::Reference< ov::XHelperInterface > &rParent, css::uno::Reference< css::uno::XComponentContext > xContext, const css::uno::Reference< css::frame::XModel > &rModel, const css::uno::Reference< css::sheet::XViewPane > &rViewPane)
css::uno::Reference< css::sheet::XViewPane > m_xViewPane
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
css::uno::Reference< css::uno::XComponentContext > m_xContext
Reference< frame::XModel > m_xModel
DECL_LISTENERMULTIPLEXER_END void SAL_CALL up(const css::awt::SpinEvent &rEvent) override
void SAL_CALL down(const css::awt::SpinEvent &rEvent) override