1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef SC_REFTOKENHELPER_HXX 29 #define SC_REFTOKENHELPER_HXX 30 31 #include "token.hxx" 32 33 #include <vector> 34 35 namespace rtl { 36 class OUString; 37 } 38 39 class ScDocument; 40 class ScRange; 41 class ScRangeList; 42 43 class ScRefTokenHelper 44 { 45 private: 46 ScRefTokenHelper(); 47 ScRefTokenHelper(const ScRefTokenHelper&); 48 ~ScRefTokenHelper(); 49 50 public: 51 /** 52 * Compile an array of reference tokens from a data source range string. 53 * The source range may consist of multiple ranges separated by ';'s. 54 */ 55 static void compileRangeRepresentation( 56 ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc, 57 ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH); 58 59 static bool getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal = false); 60 61 static void getRangeListFromTokens(ScRangeList& rRangeList, const ::std::vector<ScSharedTokenRef>& pTokens); 62 63 /** 64 * Create a double reference token from a range object. 65 */ 66 static void getTokenFromRange(ScSharedTokenRef& pToken, const ScRange& rRange); 67 68 static void getTokensFromRangeList(::std::vector<ScSharedTokenRef>& pTokens, const ScRangeList& rRanges); 69 70 static bool SC_DLLPUBLIC isRef(const ScSharedTokenRef& pToken); 71 static bool SC_DLLPUBLIC isExternalRef(const ScSharedTokenRef& pToken); 72 73 static bool SC_DLLPUBLIC intersects(const ::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken); 74 75 static void SC_DLLPUBLIC join(::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken); 76 77 static bool getDoubleRefDataFromToken(ScComplexRefData& rData, const ScSharedTokenRef& pToken); 78 }; 79 80 #endif 81