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 INCLUDED_SC_INC_DETDATA_HXX
21 : #define INCLUDED_SC_INC_DETDATA_HXX
22 :
23 : #include <boost/ptr_container/ptr_vector.hpp>
24 : #include "global.hxx"
25 :
26 : enum ScDetOpType
27 : {
28 : SCDETOP_ADDSUCC,
29 : SCDETOP_DELSUCC,
30 : SCDETOP_ADDPRED,
31 : SCDETOP_DELPRED,
32 : SCDETOP_ADDERROR
33 : };
34 :
35 : class ScDetOpData
36 : {
37 : ScAddress aPos;
38 : ScDetOpType eOperation;
39 :
40 : public:
41 2 : ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) :
42 2 : aPos(rP), eOperation(eOp) {}
43 :
44 2 : ScDetOpData( const ScDetOpData& rData ) :
45 2 : aPos(rData.aPos), eOperation(rData.eOperation) {}
46 :
47 28 : const ScAddress& GetPos() const { return aPos; }
48 30 : ScDetOpType GetOperation() const { return eOperation; }
49 :
50 : // for UpdateRef:
51 0 : void SetPos(const ScAddress& rNew) { aPos=rNew; }
52 :
53 0 : bool operator== ( const ScDetOpData& r ) const
54 0 : { return eOperation == r.eOperation && aPos == r.aPos; }
55 : };
56 :
57 : // list of operators
58 :
59 : typedef boost::ptr_vector<ScDetOpData> ScDetOpDataVector;
60 :
61 : class ScDetOpList
62 : {
63 : bool bHasAddError; // updated in append
64 : ScDetOpDataVector aDetOpDataVector;
65 :
66 : public:
67 2 : ScDetOpList() : bHasAddError(false) {}
68 : ScDetOpList(const ScDetOpList& rList);
69 2 : ~ScDetOpList() {}
70 :
71 : void DeleteOnTab( SCTAB nTab );
72 : void UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
73 : const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
74 :
75 : bool operator==( const ScDetOpList& r ) const; // for ref-undo
76 :
77 : void Append( ScDetOpData* pData );
78 0 : ScDetOpDataVector& GetDataVector() { return aDetOpDataVector; }
79 : const ScDetOpData* GetObject( size_t nPos ) const;
80 :
81 28 : bool HasAddError() const { return bHasAddError; }
82 60 : size_t Count() const { return aDetOpDataVector.size(); }
83 : };
84 :
85 : #endif
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|