Version 4.0.2.1, tag libreoffice-4.0.2.1
[LibreOffice.git] / sc / inc / detdata.hxx
blob62fbf074f5660947b7c9eb7c0d0a8900e64a5ad8
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 SC_DETDATA_HXX
21 #define SC_DETDATA_HXX
23 #include <boost/ptr_container/ptr_vector.hpp>
24 #include "global.hxx"
27 //------------------------------------------------------------------------
28 enum ScDetOpType
30 SCDETOP_ADDSUCC,
31 SCDETOP_DELSUCC,
32 SCDETOP_ADDPRED,
33 SCDETOP_DELPRED,
34 SCDETOP_ADDERROR
37 //------------------------------------------------------------------------
39 class ScDetOpData
41 ScAddress aPos;
42 ScDetOpType eOperation;
44 public:
45 ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) :
46 aPos(rP), eOperation(eOp) {}
48 ScDetOpData( const ScDetOpData& rData ) :
49 aPos(rData.aPos), eOperation(rData.eOperation) {}
51 const ScAddress& GetPos() const { return aPos; }
52 ScDetOpType GetOperation() const { return eOperation; }
54 // for UpdateRef:
55 void SetPos(const ScAddress& rNew) { aPos=rNew; }
57 int operator== ( const ScDetOpData& r ) const
58 { return eOperation == r.eOperation && aPos == r.aPos; }
61 //------------------------------------------------------------------------
64 // list of operators
67 typedef boost::ptr_vector<ScDetOpData> ScDetOpDataVector;
69 class ScDetOpList
71 sal_Bool bHasAddError; // updated in append
72 ScDetOpDataVector aDetOpDataVector;
74 public:
75 ScDetOpList() : bHasAddError(false) {}
76 ScDetOpList(const ScDetOpList& rList);
77 ~ScDetOpList() {}
79 void DeleteOnTab( SCTAB nTab );
80 void UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode,
81 const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz );
83 sal_Bool operator==( const ScDetOpList& r ) const; // for ref-undo
85 void Append( ScDetOpData* pData );
86 ScDetOpDataVector& GetDataVector() { return aDetOpDataVector; }
87 const ScDetOpData* GetObject( size_t nPos ) const;
89 sal_Bool HasAddError() const { return bHasAddError; }
90 size_t Count() const { return aDetOpDataVector.size(); }
95 #endif
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */