Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
21 : #define INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
22 :
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>
30 :
31 : class SvTreeListEntry;
32 :
33 : namespace formula
34 : {
35 : class IFunctionCategory;
36 : class IFunctionDescription;
37 : class FormEditData;
38 : class FormulaTokenArray;
39 :
40 : class SAL_NO_VTABLE IFunctionManager
41 : {
42 : public:
43 2 : IFunctionManager(){}
44 : enum EToken
45 : {
46 : eOk,
47 : eClose,
48 : eSep,
49 : eArrayOpen,
50 : eArrayClose
51 : };
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;
56 :
57 : virtual sal_Unicode getSingleToken(const EToken _eToken) const = 0;
58 :
59 : protected:
60 0 : ~IFunctionManager() {}
61 : };
62 :
63 : class IFunctionCategory
64 : {
65 : public:
66 22 : 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;
72 :
73 0 : virtual ~IFunctionCategory() {}
74 : };
75 :
76 : class SAL_NO_VTABLE IFunctionDescription
77 : {
78 : public:
79 1902 : IFunctionDescription(){}
80 : virtual OUString getFunctionName() const = 0;
81 : virtual const IFunctionCategory* getCategory() const = 0;
82 : virtual OUString getDescription() const = 0;
83 : // GetSuppressedArgCount
84 : virtual sal_Int32 getSuppressedArgumentCount() const = 0;
85 : // GetFormulaString
86 : virtual OUString getFormula(const ::std::vector< OUString >& _aArguments) const = 0;
87 : // GetVisibleArgMapping
88 : virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const = 0;
89 : virtual void initArgumentInfo() const = 0;
90 : virtual OUString getSignature() const = 0;
91 : virtual OString getHelpId() const = 0;
92 :
93 : // parameter
94 : virtual sal_uInt32 getParameterCount() const = 0;
95 : virtual OUString getParameterName(sal_uInt32 _nPos) const = 0;
96 : virtual OUString getParameterDescription(sal_uInt32 _nPos) const = 0;
97 : virtual bool isParameterOptional(sal_uInt32 _nPos) const = 0;
98 :
99 : protected:
100 1152 : ~IFunctionDescription() {}
101 : };
102 :
103 242281 : class SAL_NO_VTABLE IFormulaToken
104 : {
105 : public:
106 : virtual bool isFunction() const = 0;
107 : virtual sal_uInt32 getArgumentCount() const = 0;
108 :
109 : protected:
110 242105 : ~IFormulaToken() {}
111 : };
112 :
113 : class SAL_NO_VTABLE IStructHelper
114 : {
115 : public:
116 0 : IStructHelper(){}
117 : virtual SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent,
118 : sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL) = 0;
119 :
120 : virtual OUString GetEntryText(SvTreeListEntry* pEntry) const = 0;
121 : virtual SvTreeListEntry* GetParent(SvTreeListEntry* pEntry) const = 0;
122 :
123 : protected:
124 0 : ~IStructHelper() {}
125 : };
126 :
127 : class SAL_NO_VTABLE IFormulaEditorHelper
128 : {
129 : public:
130 0 : IFormulaEditorHelper(){}
131 : virtual void notifyChange() = 0;
132 : virtual void fill() = 0;
133 :
134 : virtual OUString getCurrentFormula() const = 0;
135 : virtual void setCurrentFormula(const OUString& _sReplacement) = 0;
136 :
137 : virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const = 0;
138 : virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) = 0;
139 :
140 : virtual FormEditData* getFormEditData() const = 0;
141 : virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult) = 0;
142 :
143 : virtual void switchBack() = 0;
144 :
145 : virtual void clear() = 0;
146 : virtual void deleteFormData() = 0;
147 : virtual void setReferenceInput(const FormEditData* _pData) = 0;
148 :
149 : virtual IFunctionManager* getFunctionManager() = 0;
150 : virtual ::std::unique_ptr<FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList) = 0;
151 :
152 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser> getFormulaParser() const = 0;
153 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaOpCodeMapper> getFormulaOpCodeMapper() const = 0;
154 : virtual ::com::sun::star::table::CellAddress getReferencePosition() const = 0;
155 :
156 : virtual void setDispatcherLock( bool bLock ) = 0;
157 : virtual void dispatch(bool _bOK, bool _bMatrixChecked) = 0;
158 : virtual void doClose(bool _bOk) = 0;
159 : virtual void insertEntryToLRUList(const IFunctionDescription* pDesc) = 0;
160 : virtual void showReference(const OUString& _sFormula) = 0;
161 :
162 : protected:
163 0 : ~IFormulaEditorHelper() {}
164 : };
165 :
166 : }
167 : #endif // INCLUDED_FORMULA_IFUNCTIONDESCRIPTION_HXX
168 :
169 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|