Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #ifndef SC_SELECTIONSTATE_HXX
21 : : #define SC_SELECTIONSTATE_HXX
22 : :
23 : : #include <editeng/editdata.hxx>
24 : : #include "rangelst.hxx"
25 : :
26 : : // ============================================================================
27 : :
28 : : /** Enumerates all possible types of selections in a Calc document. */
29 : : enum ScSelectionType
30 : : {
31 : : SC_SELECTTYPE_NONE, /// No selection, simple cell cursor.
32 : : SC_SELECTTYPE_SHEET, /// Single cell, cell range, or multi range selection.
33 : : SC_SELECTTYPE_EDITCELL, /// Cell in edit mode (with or without selection).
34 : : SC_SELECTTYPE_DRAWING, /// One or more drawing objects.
35 : : SC_SELECTTYPE_EDITDRAW /// Edit mode in drawing object (with or without selection).
36 : : };
37 : :
38 : : // ----------------------------------------------------------------------------
39 : :
40 : : class ScViewData;
41 : :
42 : : /** Contains all available data about any possible selection in a Calc document. */
43 : 0 : class ScSelectionState
44 : : {
45 : : public:
46 : : explicit ScSelectionState( ScViewData& rViewData );
47 : :
48 : : /** Returns the type of the selection this object contains. */
49 : 0 : inline ScSelectionType GetSelectionType() const { return meType; }
50 : :
51 : : /** Returns the position of the cell cursor. */
52 : 0 : inline const ScAddress& GetCellCursor() const { return maCursor; }
53 : : /** Returns a range list containing all selected cell ranges. */
54 : 0 : inline const ScRangeList& GetSheetSelection() const { return maSheetSel; }
55 : : /** Returns the edit engine selection. */
56 : 0 : inline const ESelection& GetEditSelection() const { return maEditSel; }
57 : :
58 : : private:
59 : : ScSelectionType meType; /// Type of the selection.
60 : : ScAddress maCursor; /// Cell cursor position.
61 : : ScRangeList maSheetSel; /// Sheet selection.
62 : : ESelection maEditSel; /// Selection in edit mode.
63 : : };
64 : :
65 : : bool operator==( const ScSelectionState& rL, const ScSelectionState& rR );
66 : : inline bool operator!=( const ScSelectionState& rL, const ScSelectionState& rR ) { return !(rL == rR); }
67 : :
68 : : // ============================================================================
69 : :
70 : : #endif
71 : :
72 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|