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