Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / include / formula / IFunctionDescription.hxx
blob121456b600cc591a5fbb0a48384c06ee054ee888
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_IFUNCTIONDESCRIPTION_HXX
21 #define INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
23 #include <memory>
24 #include <vector>
26 #include <com/sun/star/table/CellAddress.hpp>
27 #include <com/sun/star/uno/Reference.hxx>
28 #include <rtl/string.hxx>
29 #include <rtl/ustring.hxx>
30 #include <sal/types.h>
32 namespace com::sun::star {
33 namespace sheet { struct FormulaToken; }
34 namespace sheet { class XFormulaOpCodeMapper; }
35 namespace sheet { class XFormulaParser; }
38 namespace com::sun::star::uno { template <class E> class Sequence; }
40 namespace formula
42 class IFunctionCategory;
43 class IFunctionDescription;
44 class FormEditData;
45 class FormulaTokenArray;
46 class FormulaCompiler;
48 class SAL_NO_VTABLE IFunctionManager
50 public:
51 enum EToken
53 eOk,
54 eClose,
55 eSep,
56 eArrayOpen,
57 eArrayClose
59 virtual sal_uInt32 getCount() const = 0;
60 virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0;
61 virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0;
63 virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
65 protected:
66 ~IFunctionManager() {}
69 class SAL_NO_VTABLE IFunctionCategory
71 public:
72 virtual sal_uInt32 getCount() const = 0;
73 virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0;
74 virtual sal_uInt32 getNumber() const = 0;
75 virtual OUString getName() const = 0;
77 protected:
78 ~IFunctionCategory() {}
81 class SAL_NO_VTABLE IFunctionDescription
83 public:
84 virtual OUString getFunctionName() const = 0;
85 virtual const IFunctionCategory* getCategory() const = 0;
86 virtual OUString getDescription() const = 0;
87 // GetSuppressedArgCount
88 virtual sal_Int32 getSuppressedArgumentCount() const = 0;
89 // GetFormulaString
90 virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
91 // GetVisibleArgMapping
92 virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
93 virtual void initArgumentInfo() const = 0;
94 virtual OUString getSignature() const = 0;
95 virtual OUString getHelpId() const = 0;
96 virtual bool isHidden() const = 0;
98 // parameter
99 virtual sal_uInt32 getParameterCount() const = 0;
100 virtual sal_uInt32 getVarArgsStart() const = 0;
101 virtual sal_uInt32 getVarArgsLimit() const = 0;
102 virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
103 virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
104 virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
106 protected:
107 ~IFunctionDescription() {}
110 class SAL_NO_VTABLE IFormulaEditorHelper
112 public:
113 virtual void notifyChange() = 0;
114 virtual void fill() = 0;
116 virtual OUString getCurrentFormula() const = 0;
117 virtual void setCurrentFormula(const OUString& _sReplacement) = 0;
119 virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const = 0;
120 virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) = 0;
122 virtual FormEditData* getFormEditData() const = 0;
123 virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) = 0;
125 /** Obtain a resident FormulaCompiler instance, created without
126 FormulaTokenArray and reused but being application specific derived.
128 virtual std::shared_ptr<FormulaCompiler> getCompiler() const = 0;
130 /** Create an application specific FormulaCompiler instance with
131 FormulaTokenArray. The FormulaTokenArray had to be created using
132 convertToTokenArray().
134 virtual std::unique_ptr<FormulaCompiler> createCompiler( FormulaTokenArray& rArray ) const = 0;
136 virtual void switchBack() = 0;
138 virtual void clear() = 0;
139 virtual void deleteFormData() = 0;
141 virtual IFunctionManager* getFunctionManager() = 0;
142 virtual ::std::unique_ptr<FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) = 0;
144 virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const = 0;
145 virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
146 virtual css::table::CellAddress getReferencePosition() const = 0;
148 virtual void setDispatcherLock( bool bLock ) = 0;
149 virtual void dispatch(bool _bOK, bool _bMatrixChecked) = 0;
150 virtual void doClose(bool _bOk) = 0;
151 virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
152 virtual void showReference(const OUString& _sFormula) = 0;
154 protected:
155 ~IFormulaEditorHelper() {}
159 #endif // INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */