update credits
[LibreOffice.git] / sc / inc / tokenarray.hxx
blob32a266d91fc7aadd7adb335d61b4f10b2a132191
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_TOKENARRAY_HXX
21 #define SC_TOKENARRAY_HXX
23 #include "formula/token.hxx"
24 #include "scmatrix.hxx"
25 #include <tools/solar.h>
26 #include "scdllapi.h"
27 #include "types.hxx"
28 #include <formula/tokenarray.hxx>
30 struct ScRawToken;
31 struct ScSingleRefData;
32 struct ScComplexRefData;
34 class SC_DLLPUBLIC ScTokenArray : public formula::FormulaTokenArray
36 friend class ScCompiler;
38 bool ImplGetReference( ScRange& rRange, bool bValidOnly ) const;
40 size_t mnHashValue;
41 ScFormulaVectorState meVectorState;
43 public:
44 ScTokenArray();
45 /// Assignment with references to ScToken entries (not copied!)
46 ScTokenArray( const ScTokenArray& );
47 virtual ~ScTokenArray();
48 ScTokenArray* Clone() const; /// True copy!
50 void GenHash();
51 size_t GetHash() const;
53 ScFormulaVectorState GetVectorState() const;
55 /// Exactly and only one range (valid or deleted)
56 bool IsReference( ScRange& rRange ) const;
57 /// Exactly and only one valid range (no #REF!s)
58 bool IsValidReference( ScRange& rRange ) const;
61 /** Determines the extent of direct adjacent
62 references. Only use with real functions, e.g.
63 GetOuterFuncOpCode() == ocSum ! */
64 bool GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend,
65 const ScAddress& rPos, ScDirection );
67 formula::FormulaToken* AddRawToken( const ScRawToken& );
68 virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken,formula::ExternalReferenceHelper* _pRef);
69 virtual void CheckToken( const formula::FormulaToken& r );
70 virtual formula::FormulaToken* AddOpCode( OpCode eCode );
71 /** ScSingleRefToken with ocPush. */
72 formula::FormulaToken* AddSingleReference( const ScSingleRefData& rRef );
73 /** ScSingleRefOpToken with ocMatRef. */
74 formula::FormulaToken* AddMatrixSingleReference( const ScSingleRefData& rRef );
75 formula::FormulaToken* AddDoubleReference( const ScComplexRefData& rRef );
76 formula::FormulaToken* AddRangeName( sal_uInt16 n, bool bGlobal );
77 formula::FormulaToken* AddDBRange( sal_uInt16 n );
78 formula::FormulaToken* AddExternalName( sal_uInt16 nFileId, const String& rName );
79 formula::FormulaToken* AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef );
80 formula::FormulaToken* AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef );
81 formula::FormulaToken* AddMatrix( const ScMatrixRef& p );
82 /** ScSingleRefOpToken with ocColRowName. */
83 formula::FormulaToken* AddColRowName( const ScSingleRefData& rRef );
84 virtual formula::FormulaToken* MergeArray( );
86 /** Merge very last SingleRef+ocRange+SingleRef combination into DoubleRef
87 and adjust pCode array, or do nothing if conditions not met.
88 Unconditionally returns last token from the resulting pCode array, or
89 NULL if there is no pCode (which actually would be caller's fault). */
90 formula::FormulaToken* MergeRangeReference( const ScAddress & rPos );
92 /// Assignment with references to ScToken entries (not copied!)
93 ScTokenArray& operator=( const ScTokenArray& );
95 /// Make 3D references point to old referenced position even if relative
96 void ReadjustRelative3DReferences(
97 const ScAddress& rOldPos,
98 const ScAddress& rNewPos );
101 * Make all absolute references external references pointing to the old document
103 * @param pOldDoc old document
104 * @param pNewDoc new document
105 * @param rPos position of the cell to determine if the reference is in the copied area
106 * @param bRangeName set for range names, range names have special handling for absolute sheet ref + relative col/row ref
108 void ReadjustAbsolute3DReferences( const ScDocument* pOldDoc, const ScDocument* pNewDoc, const ScAddress& rPos, bool bRangeName = false );
111 * Make all absolute references pointing to the copied range if the range is copied too
112 * @param bCheckCopyArea should references pointing into the copy area be adjusted independently from being absolute, should be true only for copy&paste between documents
114 void AdjustAbsoluteRefs( const ScDocument* pOldDoc, const ScAddress& rOldPos, const ScAddress& rNewPos, bool bRangeName = false, bool bCheckCopyArea = false );
117 #endif // SC_TOKENARRAY_HXX
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */