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