Avoid potential negative array index access to cached text.
[LibreOffice.git] / include / formula / formulahelper.hxx
blobb298dfa36b07d24da6a48b58feff24d7e35b3940
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 INCLUDED_FORMULA_FORMULAHELPER_HXX
21 #define INCLUDED_FORMULA_FORMULAHELPER_HXX
23 #include <vector>
25 #include <formula/formuladllapi.h>
26 #include <rtl/ustring.hxx>
27 #include <sal/types.h>
28 #include <unotools/syslocale.hxx>
30 class CharClass;
32 namespace formula
34 class IFunctionDescription;
35 class IFunctionManager;
37 class FORMULA_DLLPUBLIC FormulaHelper
39 SvtSysLocale m_aSysLocale;
40 const CharClass& m_rCharClass;
41 const IFunctionManager* m_pFunctionManager;
42 const sal_Unicode open;
43 const sal_Unicode close;
44 const sal_Unicode sep;
45 const sal_Unicode arrayOpen;
46 const sal_Unicode arrayClose;
47 public:
48 FormulaHelper(const IFunctionManager* _pFunctionManager);
50 const CharClass& GetCharClass() const { return m_rCharClass; }
52 sal_Int32 GetCategoryCount() const;
54 bool GetNextFunc( const OUString& rFormula,
55 bool bBack,
56 sal_Int32& rFStart, // input and output
57 sal_Int32* pFEnd = nullptr,
58 const IFunctionDescription** ppFDesc = nullptr,
59 ::std::vector< OUString>* pArgs = nullptr ) const;
61 sal_Int32 GetFunctionStart( const OUString& rFormula, sal_Int32 nStart,
62 bool bBack, OUString* pFuncName = nullptr ) const;
64 sal_Int32 GetFunctionEnd ( std::u16string_view rFormula, sal_Int32 nStart ) const;
66 sal_Int32 GetArgStart ( std::u16string_view rFormula, sal_Int32 nStart,
67 sal_uInt16 nArg ) const;
69 void GetArgStrings ( ::std::vector< OUString >& _rArgs,
70 std::u16string_view rFormula,
71 sal_Int32 nFuncPos,
72 sal_uInt16 nArgs ) const;
74 void FillArgStrings ( std::u16string_view rFormula,
75 sal_Int32 nFuncPos,
76 sal_uInt16 nArgs,
77 ::std::vector< OUString >& _rArgs ) const;
80 } // formula
83 #endif // INCLUDED_FORMULA_FORMULAHELPER_HXX
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */