LibreOffice Module sc (master)  1
detdata.hxx
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 #ifndef INCLUDED_SC_INC_DETDATA_HXX
21 #define INCLUDED_SC_INC_DETDATA_HXX
22 
23 #include "global.hxx"
24 
25 #include <memory>
26 #include <vector>
27 
29 {
35 };
36 
38 {
41 
42 public:
43  ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) :
44  aPos(rP), eOperation(eOp) {}
45 
46  ScDetOpData( const ScDetOpData& rData ) :
47  aPos(rData.aPos), eOperation(rData.eOperation) {}
48 
49  const ScAddress& GetPos() const { return aPos; }
50  ScDetOpType GetOperation() const { return eOperation; }
51 
52  // for UpdateRef:
53  void SetPos(const ScAddress& rNew) { aPos=rNew; }
54 
55  bool operator== ( const ScDetOpData& r ) const
56  { return eOperation == r.eOperation && aPos == r.aPos; }
57 };
58 
59 // list of operators
60 
61 typedef std::vector<std::unique_ptr<ScDetOpData>> ScDetOpDataVector;
62 
64 {
65  bool bHasAddError; // updated in append
67 
68 public:
69  ScDetOpList() : bHasAddError(false) {}
70  ScDetOpList(const ScDetOpList& rList);
71 
72  void DeleteOnTab( SCTAB nTab );
73  void UpdateReference( const ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
74  const ScRange& rRange, SCCOL nDx, SCROW nDy, SCTAB nDz );
75 
76  bool operator==( const ScDetOpList& r ) const; // for ref-undo
77 
78  void Append( ScDetOpData* pData );
80  const ScDetOpData& GetObject( size_t nPos ) const;
81 
82  bool HasAddError() const { return bHasAddError; }
83  size_t Count() const { return aDetOpDataVector.size(); }
84 };
85 
86 #endif
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ScDetOpDataVector aDetOpDataVector
Definition: detdata.hxx:66
void SetPos(const ScAddress &rNew)
Definition: detdata.hxx:53
ScDetOpData(const ScDetOpData &rData)
Definition: detdata.hxx:46
bool HasAddError() const
Definition: detdata.hxx:82
ScDetOpData(const ScAddress &rP, ScDetOpType eOp)
Definition: detdata.hxx:43
size_t Count() const
Definition: detdata.hxx:83
ScDetOpType eOperation
Definition: detdata.hxx:40
const ScAddress & GetPos() const
Definition: detdata.hxx:49
sal_Int16 SCCOL
Definition: types.hxx:22
std::vector< std::unique_ptr< ScDetOpData > > ScDetOpDataVector
Definition: detdata.hxx:61
ScDetOpDataVector & GetDataVector()
Definition: detdata.hxx:79
ScAddress aPos
Definition: detdata.hxx:39
bool operator==(const ScDetOpList &r) const
Definition: detdata.cxx:75
void Append(ScDetOpData *pData)
Definition: detdata.cxx:67
UpdateRefMode
Definition: global.hxx:310
sal_Int32 SCROW
Definition: types.hxx:18
ScDetOpType GetOperation() const
Definition: detdata.hxx:50
ScDetOpType
Definition: detdata.hxx:28
void DeleteOnTab(SCTAB nTab)
Definition: detdata.cxx:35
void UpdateReference(const ScDocument *pDoc, UpdateRefMode eUpdateRefMode, const ScRange &rRange, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: detdata.cxx:44
const ScDetOpData & GetObject(size_t nPos) const
Definition: detdata.cxx:88
bool bHasAddError
Definition: detdata.hxx:65
sal_Int16 SCTAB
Definition: types.hxx:23