make ValueTransfer easier to understand
[LibreOffice.git] / include / formula / IFunctionDescription.hxx
blobb27907fedca5a2a69a6aead79778b74679fc2ac4
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 IFunctionManager(){}
52 enum EToken
54 eOk,
55 eClose,
56 eSep,
57 eArrayOpen,
58 eArrayClose
60 virtual sal_uInt32 getCount() const = 0;
61 virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0;
62 virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0;
64 virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
66 protected:
67 ~IFunctionManager() {}
70 class SAL_NO_VTABLE IFunctionCategory
72 public:
73 IFunctionCategory(){}
74 virtual sal_uInt32 getCount() const = 0;
75 virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0;
76 virtual sal_uInt32 getNumber() const = 0;
77 virtual OUString getName() const = 0;
79 protected:
80 ~IFunctionCategory() {}
83 class SAL_NO_VTABLE IFunctionDescription
85 public:
86 IFunctionDescription(){}
87 virtual OUString getFunctionName() const = 0;
88 virtual const IFunctionCategory* getCategory() const = 0;
89 virtual OUString getDescription() const = 0;
90 // GetSuppressedArgCount
91 virtual sal_Int32 getSuppressedArgumentCount() const = 0;
92 // GetFormulaString
93 virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
94 // GetVisibleArgMapping
95 virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
96 virtual void initArgumentInfo() const = 0;
97 virtual OUString getSignature() const = 0;
98 virtual OString getHelpId() const = 0;
99 virtual bool isHidden() const = 0;
101 // parameter
102 virtual sal_uInt32 getParameterCount() const = 0;
103 virtual sal_uInt32 getVarArgsStart() const = 0;
104 virtual sal_uInt32 getVarArgsLimit() const = 0;
105 virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
106 virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
107 virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
109 protected:
110 ~IFunctionDescription() {}
113 class SAL_NO_VTABLE IFormulaEditorHelper
115 public:
116 IFormulaEditorHelper(){}
117 virtual void notifyChange() = 0;
118 virtual void fill() = 0;
120 virtual OUString getCurrentFormula() const = 0;
121 virtual void setCurrentFormula(const OUString& _sReplacement) = 0;
123 virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const = 0;
124 virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) = 0;
126 virtual FormEditData* getFormEditData() const = 0;
127 virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult, bool bMatrixFormula) = 0;
129 /** Obtain a resident FormulaCompiler instance, created without
130 FormulaTokenArray and reused but being application specific derived.
132 virtual std::shared_ptr<FormulaCompiler> getCompiler() const = 0;
134 /** Create an application specific FormulaCompiler instance with
135 FormulaTokenArray. The FormulaTokenArray had to be created using
136 convertToTokenArray().
138 virtual std::unique_ptr<FormulaCompiler> createCompiler( FormulaTokenArray& rArray ) const = 0;
140 virtual void switchBack() = 0;
142 virtual void clear() = 0;
143 virtual void deleteFormData() = 0;
145 virtual IFunctionManager* getFunctionManager() = 0;
146 virtual ::std::unique_ptr<FormulaTokenArray> convertToTokenArray(const css::uno::Sequence< css::sheet::FormulaToken >& _aTokenList) = 0;
148 virtual css::uno::Reference< css::sheet::XFormulaParser> getFormulaParser() const = 0;
149 virtual css::uno::Reference< css::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
150 virtual css::table::CellAddress getReferencePosition() const = 0;
152 virtual void setDispatcherLock( bool bLock ) = 0;
153 virtual void dispatch(bool _bOK, bool _bMatrixChecked) = 0;
154 virtual void doClose(bool _bOk) = 0;
155 virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
156 virtual void showReference(const OUString& _sFormula) = 0;
158 protected:
159 ~IFormulaEditorHelper() {}
163 #endif // INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */