1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SVX_CELLCURSOR_HXX_ 29 #define _SVX_CELLCURSOR_HXX_ 30 31 #include <com/sun/star/table/XMergeableCellRange.hpp> 32 #include <com/sun/star/table/XCellCursor.hpp> 33 #include <cppuhelper/implbase2.hxx> 34 #include "cellrange.hxx" 35 36 // ----------------------------------------------------------------------------- 37 38 namespace sdr { namespace table { 39 40 struct CellPos; 41 42 // ----------------------------------------------------------------------------- 43 // CellCursor 44 // ----------------------------------------------------------------------------- 45 46 typedef ::cppu::ImplInheritanceHelper2< CellRange, ::com::sun::star::table::XCellCursor, ::com::sun::star::table::XMergeableCellRange > CellCursorBase; 47 48 class CellCursor : public CellCursorBase 49 { 50 public: 51 CellCursor( const TableModelRef& xTableModel, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ); 52 virtual ~CellCursor(); 53 54 // XCellRange 55 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 56 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); 57 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException); 58 59 // XCellCursor 60 virtual void SAL_CALL gotoStart( ) throw (::com::sun::star::uno::RuntimeException); 61 virtual void SAL_CALL gotoEnd( ) throw (::com::sun::star::uno::RuntimeException); 62 virtual void SAL_CALL gotoNext( ) throw (::com::sun::star::uno::RuntimeException); 63 virtual void SAL_CALL gotoPrevious( ) throw (::com::sun::star::uno::RuntimeException); 64 virtual void SAL_CALL gotoOffset( ::sal_Int32 nColumnOffset, ::sal_Int32 nRowOffset ) throw (::com::sun::star::uno::RuntimeException); 65 66 // XMergeableCellRange 67 virtual void SAL_CALL merge( ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException); 68 virtual void SAL_CALL split( ::sal_Int32 Columns, ::sal_Int32 Rows ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); 69 virtual ::sal_Bool SAL_CALL isMergeable( ) throw (::com::sun::star::uno::RuntimeException); 70 virtual ::sal_Bool SAL_CALL isUnmergeable( ) throw (::com::sun::star::uno::RuntimeException); 71 72 protected: 73 bool GetMergedSelection( CellPos& rStart, CellPos& rEnd ); 74 75 void split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< sal_Int32 >& rLeftOvers ); 76 void split_horizontal( sal_Int32 nColumns ); 77 void split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_Int32 >& rLeftOvers ); 78 void split_vertical( sal_Int32 nRows ); 79 }; 80 81 } } 82 83 #endif 84