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 SC_SELECTIONSTATE_HXX 29 #define SC_SELECTIONSTATE_HXX 30 31 #include <editeng/editdata.hxx> 32 #include "rangelst.hxx" 33 34 // ============================================================================ 35 36 /** Enumerates all possible types of selections in a Calc document. */ 37 enum ScSelectionType 38 { 39 SC_SELECTTYPE_NONE, /// No selection, simple cell cursor. 40 SC_SELECTTYPE_SHEET, /// Single cell, cell range, or multi range selection. 41 SC_SELECTTYPE_EDITCELL, /// Cell in edit mode (with or without selection). 42 SC_SELECTTYPE_DRAWING, /// One or more drawing objects. 43 SC_SELECTTYPE_EDITDRAW /// Edit mode in drawing object (with or without selection). 44 }; 45 46 // ---------------------------------------------------------------------------- 47 48 class ScViewData; 49 50 /** Contains all available data about any possible selection in a Calc document. */ 51 class ScSelectionState 52 { 53 public: 54 explicit ScSelectionState( ScViewData& rViewData ); 55 56 /** Returns the type of the selection this object contains. */ 57 inline ScSelectionType GetSelectionType() const { return meType; } 58 59 /** Returns the position of the cell cursor. */ 60 inline const ScAddress& GetCellCursor() const { return maCursor; } 61 /** Returns a range list containing all selected cell ranges. */ 62 inline const ScRangeList& GetSheetSelection() const { return maSheetSel; } 63 /** Returns the edit engine selection. */ 64 inline const ESelection& GetEditSelection() const { return maEditSel; } 65 66 private: 67 ScSelectionType meType; /// Type of the selection. 68 ScAddress maCursor; /// Cell cursor position. 69 ScRangeList maSheetSel; /// Sheet selection. 70 ESelection maEditSel; /// Selection in edit mode. 71 }; 72 73 bool operator==( const ScSelectionState& rL, const ScSelectionState& rR ); 74 inline bool operator!=( const ScSelectionState& rL, const ScSelectionState& rR ) { return !(rL == rR); } 75 76 // ============================================================================ 77 78 #endif 79 80