1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef FORMULA_FORMULA_HELPER_HXX 25 #define FORMULA_FORMULA_HELPER_HXX 26 27 #include "formula/IFunctionDescription.hxx" 28 #include <vector> 29 #include <tools/string.hxx> 30 #include <memory> 31 #include "formula/formuladllapi.h" 32 33 class SvtSysLocale; 34 class CharClass; 35 36 namespace formula 37 { 38 class FORMULA_DLLPUBLIC FormulaHelper 39 { 40 ::std::auto_ptr<SvtSysLocale> m_pSysLocale; 41 const CharClass* m_pCharClass; 42 const IFunctionManager* m_pFunctionManager; 43 const sal_Unicode open; 44 const sal_Unicode close; 45 const sal_Unicode sep; 46 const sal_Unicode arrayOpen; 47 const sal_Unicode arrayClose; 48 public: 49 FormulaHelper(const IFunctionManager* _pFunctionManager); 50 GetCharClass() const51 inline const CharClass* GetCharClass() const { return m_pCharClass; } 52 53 sal_Bool GetNextFunc( const String& rFormula, 54 sal_Bool bBack, 55 xub_StrLen& rFStart, // Ein- und Ausgabe 56 xub_StrLen* pFEnd = NULL, 57 const IFunctionDescription** ppFDesc = NULL, 58 ::std::vector< ::rtl::OUString>* pArgs = NULL ) const; 59 60 xub_StrLen GetFunctionStart( const String& rFormula, xub_StrLen nStart, 61 sal_Bool bBack, String* pFuncName = NULL ) const; 62 63 xub_StrLen GetFunctionEnd ( const String& rFormula, xub_StrLen nStart ) const; 64 65 xub_StrLen GetArgStart ( const String& rFormula, xub_StrLen nStart, 66 sal_uInt16 nArg ) const; 67 68 void GetArgStrings ( ::std::vector< ::rtl::OUString >& _rArgs, 69 const String& rFormula, 70 xub_StrLen nFuncPos, 71 sal_uInt16 nArgs ) const; 72 73 void FillArgStrings ( const String& rFormula, 74 xub_StrLen nFuncPos, 75 sal_uInt16 nArgs, 76 ::std::vector< ::rtl::OUString >& _rArgs ) const; 77 }; 78 // ============================================================================= 79 } // formula 80 // ============================================================================= 81 82 #endif //FORMULA_FORMULA_HELPER_HXX 83