merge the formfield patch from ooo-build
[ooovba.git] / sc / source / ui / inc / selectionstate.hxx
blob66a066142a2f889d2f01513e8645fdb35b3428d5
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: selectionstate.hxx,v $
10 * $Revision: 1.4 $
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 SC_SELECTIONSTATE_HXX
32 #define SC_SELECTIONSTATE_HXX
34 #include <svx/editdata.hxx>
35 #include "rangelst.hxx"
37 // ============================================================================
39 /** Enumerates all possible types of selections in a Calc document. */
40 enum ScSelectionType
42 SC_SELECTTYPE_NONE, /// No selection, simple cell cursor.
43 SC_SELECTTYPE_SHEET, /// Single cell, cell range, or multi range selection.
44 SC_SELECTTYPE_EDITCELL, /// Cell in edit mode (with or without selection).
45 SC_SELECTTYPE_DRAWING, /// One or more drawing objects.
46 SC_SELECTTYPE_EDITDRAW /// Edit mode in drawing object (with or without selection).
49 // ----------------------------------------------------------------------------
51 class ScViewData;
53 /** Contains all available data about any possible selection in a Calc document. */
54 class ScSelectionState
56 public:
57 explicit ScSelectionState( ScViewData& rViewData );
59 /** Returns the type of the selection this object contains. */
60 inline ScSelectionType GetSelectionType() const { return meType; }
62 /** Returns the position of the cell cursor. */
63 inline const ScAddress& GetCellCursor() const { return maCursor; }
64 /** Returns a range list containing all selected cell ranges. */
65 inline const ScRangeList& GetSheetSelection() const { return maSheetSel; }
66 /** Returns the edit engine selection. */
67 inline const ESelection& GetEditSelection() const { return maEditSel; }
69 private:
70 ScSelectionType meType; /// Type of the selection.
71 ScAddress maCursor; /// Cell cursor position.
72 ScRangeList maSheetSel; /// Sheet selection.
73 ESelection maEditSel; /// Selection in edit mode.
76 bool operator==( const ScSelectionState& rL, const ScSelectionState& rR );
77 inline bool operator!=( const ScSelectionState& rL, const ScSelectionState& rR ) { return !(rL == rR); }
79 // ============================================================================
81 #endif