Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sc / inc / detdata.hxx
blobabe2d2a57d62c52fac8fb38a808a10eb723a98bb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_INC_DETDATA_HXX
21 #define INCLUDED_SC_INC_DETDATA_HXX
23 #include "global.hxx"
25 #include <memory>
26 #include <vector>
28 enum ScDetOpType
30 SCDETOP_ADDSUCC,
31 SCDETOP_DELSUCC,
32 SCDETOP_ADDPRED,
33 SCDETOP_DELPRED,
34 SCDETOP_ADDERROR
37 class ScDetOpData
39 ScAddress aPos;
40 ScDetOpType eOperation;
42 public:
43 ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) :
44 aPos(rP), eOperation(eOp) {}
46 ScDetOpData( const ScDetOpData& rData ) :
47 aPos(rData.aPos), eOperation(rData.eOperation) {}
49 const ScAddress& GetPos() const { return aPos; }
50 ScDetOpType GetOperation() const { return eOperation; }
52 // for UpdateRef:
53 void SetPos(const ScAddress& rNew) { aPos=rNew; }
56 // list of operators
58 typedef std::vector<std::unique_ptr<ScDetOpData>> ScDetOpDataVector;
60 class ScDetOpList
62 bool bHasAddError; // updated in append
63 ScDetOpDataVector aDetOpDataVector;
65 public:
66 ScDetOpList() : bHasAddError(false) {}
67 ScDetOpList(const ScDetOpList& rList);
69 void DeleteOnTab( SCTAB nTab );
70 void UpdateReference( const ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
71 const ScRange& rRange, SCCOL nDx, SCROW nDy, SCTAB nDz );
73 bool operator==( const ScDetOpList& r ) const; // for ref-undo
75 void Append( ScDetOpData* pData );
76 ScDetOpDataVector& GetDataVector() { return aDetOpDataVector; }
77 const ScDetOpData& GetObject( size_t nPos ) const;
79 bool HasAddError() const { return bHasAddError; }
80 size_t Count() const { return aDetOpDataVector.size(); }
83 #endif
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */