1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_XEFORMULA_HXX 25cdf0e10cSrcweir #define SC_XEFORMULA_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "xlformula.hxx" 28cdf0e10cSrcweir #include "xeroot.hxx" 29cdf0e10cSrcweir 30cdf0e10cSrcweir // External reference log ===================================================== 31cdf0e10cSrcweir 32cdf0e10cSrcweir /** Log entry for external references in a formula, used i.e. in change tracking. */ 33cdf0e10cSrcweir struct XclExpRefLogEntry 34cdf0e10cSrcweir { 35cdf0e10cSrcweir const XclExpString* mpUrl; /// URL of the document containing the first sheet. 36cdf0e10cSrcweir const XclExpString* mpFirstTab; /// Name of the first sheet. 37cdf0e10cSrcweir const XclExpString* mpLastTab; /// Name of the last sheet. 38cdf0e10cSrcweir sal_uInt16 mnFirstXclTab; /// Calc index of the first sheet. 39cdf0e10cSrcweir sal_uInt16 mnLastXclTab; /// Calc index of the last sheet. 40cdf0e10cSrcweir 41cdf0e10cSrcweir explicit XclExpRefLogEntry(); 42cdf0e10cSrcweir }; 43cdf0e10cSrcweir 44cdf0e10cSrcweir /** Vector containing a log for all external references in a formula, used i.e. in change tracking. */ 45cdf0e10cSrcweir typedef ::std::vector< XclExpRefLogEntry > XclExpRefLog; 46cdf0e10cSrcweir 47cdf0e10cSrcweir // Formula compiler =========================================================== 48cdf0e10cSrcweir 49cdf0e10cSrcweir class ScRangeList; 50cdf0e10cSrcweir class XclExpFmlaCompImpl; 51cdf0e10cSrcweir 52cdf0e10cSrcweir /** The formula compiler to create Excel token arrays from Calc token arrays. */ 53cdf0e10cSrcweir class XclExpFormulaCompiler : protected XclExpRoot 54cdf0e10cSrcweir { 55cdf0e10cSrcweir public: 56cdf0e10cSrcweir explicit XclExpFormulaCompiler( const XclExpRoot& rRoot ); 57cdf0e10cSrcweir virtual ~XclExpFormulaCompiler(); 58cdf0e10cSrcweir 59cdf0e10cSrcweir /** Creates and returns the token array of a formula. */ 60cdf0e10cSrcweir XclTokenArrayRef CreateFormula( 61cdf0e10cSrcweir XclFormulaType eType, const ScTokenArray& rScTokArr, 62cdf0e10cSrcweir const ScAddress* pScBasePos = 0, XclExpRefLog* pRefLog = 0 ); 63cdf0e10cSrcweir 64cdf0e10cSrcweir /** Creates and returns a token array containing a single cell address. */ 65cdf0e10cSrcweir XclTokenArrayRef CreateFormula( XclFormulaType eType, const ScAddress& rScPos ); 66cdf0e10cSrcweir 67cdf0e10cSrcweir /** Creates and returns a token array containing a single cell range address. */ 68cdf0e10cSrcweir XclTokenArrayRef CreateFormula( XclFormulaType eType, const ScRange& rScRange ); 69cdf0e10cSrcweir 70cdf0e10cSrcweir /** Creates and returns the token array for a cell range list. */ 71cdf0e10cSrcweir XclTokenArrayRef CreateFormula( XclFormulaType eType, const ScRangeList& rScRanges ); 72cdf0e10cSrcweir 73cdf0e10cSrcweir /** Creates a single error token containing the passed error code. */ 74cdf0e10cSrcweir XclTokenArrayRef CreateErrorFormula( sal_uInt8 nErrCode ); 75cdf0e10cSrcweir 76cdf0e10cSrcweir /** Creates a single token for a special cell reference. 77cdf0e10cSrcweir @descr This is used for array formulas and shared formulas (token tExp), 78cdf0e10cSrcweir and multiple operation tables (token tTbl). */ 79cdf0e10cSrcweir XclTokenArrayRef CreateSpecialRefFormula( sal_uInt8 nTokenId, const XclAddress& rXclPos ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir /** Creates a single tNameXR token for a reference to an external name. 82cdf0e10cSrcweir @descr This is used i.e. for linked macros in push buttons. */ 83cdf0e10cSrcweir XclTokenArrayRef CreateNameXFormula( sal_uInt16 nExtSheet, sal_uInt16 nExtName ); 84cdf0e10cSrcweir 85cdf0e10cSrcweir private: 86cdf0e10cSrcweir typedef ScfRef< XclExpFmlaCompImpl > XclExpFmlaCompImplRef; 87cdf0e10cSrcweir XclExpFmlaCompImplRef mxImpl; 88cdf0e10cSrcweir }; 89cdf0e10cSrcweir 90cdf0e10cSrcweir // ============================================================================ 91cdf0e10cSrcweir 92cdf0e10cSrcweir #endif 93cdf0e10cSrcweir 94