Version 3.6.0.4, tag libreoffice-3.6.0.4
[LibreOffice.git] / svx / source / table / cellcursor.hxx
blob0b10468705babd836a83dcec4dbbebf86c4a6903
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _SVX_CELLCURSOR_HXX_
30 #define _SVX_CELLCURSOR_HXX_
32 #include <com/sun/star/table/XMergeableCellRange.hpp>
33 #include <com/sun/star/table/XCellCursor.hpp>
34 #include <cppuhelper/implbase2.hxx>
35 #include "cellrange.hxx"
37 // -----------------------------------------------------------------------------
39 namespace sdr { namespace table {
41 struct CellPos;
43 // -----------------------------------------------------------------------------
44 // CellCursor
45 // -----------------------------------------------------------------------------
47 typedef ::cppu::ImplInheritanceHelper2< CellRange, ::com::sun::star::table::XCellCursor, ::com::sun::star::table::XMergeableCellRange > CellCursorBase;
49 class CellCursor : public CellCursorBase
51 public:
52 CellCursor( const TableModelRef& xTableModel, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom );
53 virtual ~CellCursor();
55 // XCellRange
56 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);
57 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);
58 virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL getCellRangeByName( const ::rtl::OUString& aRange ) throw (::com::sun::star::uno::RuntimeException);
60 // XCellCursor
61 virtual void SAL_CALL gotoStart( ) throw (::com::sun::star::uno::RuntimeException);
62 virtual void SAL_CALL gotoEnd( ) throw (::com::sun::star::uno::RuntimeException);
63 virtual void SAL_CALL gotoNext( ) throw (::com::sun::star::uno::RuntimeException);
64 virtual void SAL_CALL gotoPrevious( ) throw (::com::sun::star::uno::RuntimeException);
65 virtual void SAL_CALL gotoOffset( ::sal_Int32 nColumnOffset, ::sal_Int32 nRowOffset ) throw (::com::sun::star::uno::RuntimeException);
67 // XMergeableCellRange
68 virtual void SAL_CALL merge( ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
69 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);
70 virtual ::sal_Bool SAL_CALL isMergeable( ) throw (::com::sun::star::uno::RuntimeException);
71 virtual ::sal_Bool SAL_CALL isUnmergeable( ) throw (::com::sun::star::uno::RuntimeException);
73 protected:
74 bool GetMergedSelection( CellPos& rStart, CellPos& rEnd );
76 void split_column( sal_Int32 nCol, sal_Int32 nColumns, std::vector< sal_Int32 >& rLeftOvers );
77 void split_horizontal( sal_Int32 nColumns );
78 void split_row( sal_Int32 nRow, sal_Int32 nRows, std::vector< sal_Int32 >& rLeftOvers );
79 void split_vertical( sal_Int32 nRows );
82 } }
84 #endif
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */