LibreOffice Module sc (master) 1
selectionstate.cxx
Go to the documentation of this file.
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#include <selectionstate.hxx>
21
22#include <editeng/editview.hxx>
23#include <viewdata.hxx>
24#include <markdata.hxx>
25
28{
29 maCursor.SetTab( rViewData.GetTabNo() );
30 ScSplitPos eWhich = rViewData.GetActivePart();
31
32 if( rViewData.HasEditView( eWhich ) )
33 {
35 maCursor.SetCol( rViewData.GetEditViewCol() );
36 maCursor.SetRow( rViewData.GetEditViewRow() );
37 maEditSel = rViewData.GetEditView( eWhich )->GetSelection();
38 }
39 else
40 {
41 maCursor.SetCol( rViewData.GetCurX() );
42 maCursor.SetRow( rViewData.GetCurY() );
43
44 ScMarkData& rMarkData = rViewData.GetMarkData();
45 rMarkData.MarkToMulti();
46 if( rMarkData.IsMultiMarked() )
47 {
49 }
50 // else type is SC_SELECTTYPE_NONE - already initialized
51 }
52}
53
54/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetCol(SCCOL nColP)
Definition: address.hxx:291
void SetRow(SCROW nRowP)
Definition: address.hxx:287
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
bool IsMultiMarked() const
Definition: markdata.hxx:81
void MarkToMulti()
Definition: markdata.cxx:209
ScSelectionState(ScViewData &rViewData)
ScAddress maCursor
Type of the selection.
ScSelectionType meType
ESelection maEditSel
Cell cursor position.
SCCOL GetEditViewCol() const
Definition: viewdata.hxx:603
ScMarkData & GetMarkData()
Definition: viewdata.cxx:3146
SCTAB GetTabNo() const
Definition: viewdata.hxx:395
ScSplitPos GetActivePart() const
Definition: viewdata.hxx:398
void GetEditView(ScSplitPos eWhich, EditView *&rViewPtr, SCCOL &rCol, SCROW &rRow)
Definition: viewdata.cxx:2284
SCROW GetEditViewRow() const
Definition: viewdata.hxx:604
bool HasEditView(ScSplitPos eWhich) const
Definition: viewdata.hxx:582
SCROW GetCurY() const
Definition: viewdata.hxx:402
SCCOL GetCurX() const
Definition: viewdata.hxx:401
@ SC_SELECTTYPE_EDITCELL
Single cell, cell range, or multi range selection.
@ SC_SELECTTYPE_SHEET
No selection, simple cell cursor.
@ SC_SELECTTYPE_NONE
ScSplitPos
Definition: viewdata.hxx:44
RedlineType meType