Branch libreoffice-5-0-4
[LibreOffice.git] / include / formula / IFunctionDescription.hxx
blob85f42aaf903620f9aa72a65e5d4b5773a1612be1
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 <vector>
24 #include <memory>
25 #include <formula/formuladllapi.h>
26 #include <rtl/ustring.hxx>
27 #include <tools/solar.h>
28 #include <com/sun/star/sheet/XFormulaParser.hpp>
29 #include <com/sun/star/sheet/XFormulaOpCodeMapper.hpp>
31 class SvTreeListEntry;
33 namespace formula
35 class IFunctionCategory;
36 class IFunctionDescription;
37 class FormEditData;
38 class FormulaTokenArray;
40 class SAL_NO_VTABLE IFunctionManager
42 public:
43 IFunctionManager(){}
44 enum EToken
46 eOk,
47 eClose,
48 eSep,
49 eArrayOpen,
50 eArrayClose
52 virtual sal_uInt32 getCount() const = 0;
53 virtual const IFunctionCategory* getCategory(sal_uInt32 nPos) const = 0;
54 virtual void fillLastRecentlyUsedFunctions(::std::vector< const IFunctionDescription*>& _rLastRUFunctions) const = 0;
55 virtual const IFunctionDescription* getFunctionByName(const OUString& _sFunctionName) const = 0;
57 virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
59 protected:
60 ~IFunctionManager() {}
63 class SAL_NO_VTABLE IFunctionCategory
65 public:
66 IFunctionCategory(){}
67 virtual const IFunctionManager* getFunctionManager() const = 0;
68 virtual sal_uInt32 getCount() const = 0;
69 virtual const IFunctionDescription* getFunction(sal_uInt32 _nPos) const = 0;
70 virtual sal_uInt32 getNumber() const = 0;
71 virtual OUString getName() const = 0;
73 protected:
74 ~IFunctionCategory() {}
77 class SAL_NO_VTABLE IFunctionDescription
79 public:
80 IFunctionDescription(){}
81 virtual OUString getFunctionName() const = 0;
82 virtual const IFunctionCategory* getCategory() const = 0;
83 virtual OUString getDescription() const = 0;
84 // GetSuppressedArgCount
85 virtual sal_Int32 getSuppressedArgumentCount() const = 0;
86 // GetFormulaString
87 virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
88 // GetVisibleArgMapping
89 virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
90 virtual void initArgumentInfo() const = 0;
91 virtual OUString getSignature() const = 0;
92 virtual OString getHelpId() const = 0;
94 // parameter
95 virtual sal_uInt32 getParameterCount() const = 0;
96 virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
97 virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
98 virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
100 protected:
101 ~IFunctionDescription() {}
104 class SAL_NO_VTABLE IFormulaToken
106 public:
107 virtual bool isFunction() const = 0;
108 virtual sal_uInt32 getArgumentCount() const = 0;
110 protected:
111 ~IFormulaToken() {}
114 class SAL_NO_VTABLE IStructHelper
116 public:
117 IStructHelper(){}
118 virtual SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent,
119 sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL) = 0;
121 virtual OUString GetEntryText(SvTreeListEntry* pEntry) const = 0;
122 virtual SvTreeListEntry* GetParent(SvTreeListEntry* pEntry) const = 0;
124 protected:
125 ~IStructHelper() {}
128 class SAL_NO_VTABLE IFormulaEditorHelper
130 public:
131 IFormulaEditorHelper(){}
132 virtual void notifyChange() = 0;
133 virtual void fill() = 0;
135 virtual OUString getCurrentFormula() const = 0;
136 virtual void setCurrentFormula(const OUString& _sReplacement) = 0;
138 virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const = 0;
139 virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) = 0;
141 virtual FormEditData* getFormEditData() const = 0;
142 virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult) = 0;
144 virtual void switchBack() = 0;
146 virtual void clear() = 0;
147 virtual void deleteFormData() = 0;
148 virtual void setReferenceInput(const FormEditData* _pData) = 0;
150 virtual IFunctionManager* getFunctionManager() = 0;
151 virtual ::std::unique_ptr<FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList) = 0;
153 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
154 virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
155 virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
157 virtual void setDispatcherLock( bool bLock ) = 0;
158 virtual void dispatch(bool _bOK, bool _bMatrixChecked) = 0;
159 virtual void doClose(bool _bOk) = 0;
160 virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
161 virtual void showReference(const OUString& _sFormula) = 0;
163 protected:
164 ~IFormulaEditorHelper() {}
168 #endif // INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */