update dev300-m58
[ooovba.git] / svx / source / table / cellcursor.hxx
blob87cef8c343ef5fb2414dddc83e1f6280549dcb67
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cellcursor.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SVX_CELLCURSOR_HXX_
32 #define _SVX_CELLCURSOR_HXX_
34 #include <com/sun/star/table/XMergeableCellRange.hpp>
35 #include <com/sun/star/table/XCellCursor.hpp>
36 #include <cppuhelper/implbase2.hxx>
37 #include "cellrange.hxx"
39 // -----------------------------------------------------------------------------
41 namespace sdr { namespace table {
43 struct CellPos;
45 // -----------------------------------------------------------------------------
46 // CellCursor
47 // -----------------------------------------------------------------------------
49 typedef ::cppu::ImplInheritanceHelper2< CellRange, ::com::sun::star::table::XCellCursor, ::com::sun::star::table::XMergeableCellRange > CellCursorBase;
51 class CellCursor : public CellCursorBase
53 public:
54 CellCursor( const TableModelRef& xTableModel, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom );
55 virtual ~CellCursor();
57 // XCellRange
58 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);
59 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);
60 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException);
62 // XCellCursor
63 virtual void SAL_CALL gotoStart( ) throw (::com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL gotoEnd( ) throw (::com::sun::star::uno::RuntimeException);
65 virtual void SAL_CALL gotoNext( ) throw (::com::sun::star::uno::RuntimeException);
66 virtual void SAL_CALL gotoPrevious( ) throw (::com::sun::star::uno::RuntimeException);
67 virtual void SAL_CALL gotoOffset( ::sal_Int32 nColumnOffset, ::sal_Int32 nRowOffset ) throw (::com::sun::star::uno::RuntimeException);
69 // XMergeableCellRange
70 virtual void SAL_CALL merge( ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
71 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);
72 virtual ::sal_Bool SAL_CALL isMergeable( ) throw (::com::sun::star::uno::RuntimeException);
73 virtual ::sal_Bool SAL_CALL isUnmergeable( ) throw (::com::sun::star::uno::RuntimeException);
75 protected:
76 bool GetMergedSelection( CellPos& rStart, CellPos& rEnd );
78 void split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< sal_Int32 >& rLeftOvers );
79 void split_horizontal( sal_Int32 nColumns );
80 void split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_Int32 >& rLeftOvers );
81 void split_vertical( sal_Int32 nRows );
84 } }
86 #endif