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 INCLUDE_FUNCTION_DESCRIPTION
21 : #define INCLUDE_FUNCTION_DESCRIPTION
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 0 : 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 SAL_NO_VTABLE IFunctionCategory
64 : {
65 : public:
66 0 : 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 : protected:
74 0 : ~IFunctionCategory() {}
75 : };
76 :
77 : class SAL_NO_VTABLE IFunctionDescription
78 : {
79 : public:
80 0 : 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;
93 :
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;
99 :
100 : protected:
101 0 : ~IFunctionDescription() {}
102 : };
103 :
104 0 : class SAL_NO_VTABLE IFormulaToken
105 : {
106 : public:
107 : virtual bool isFunction() const = 0;
108 : virtual sal_uInt32 getArgumentCount() const = 0;
109 :
110 : protected:
111 0 : ~IFormulaToken() {}
112 : };
113 :
114 : class SAL_NO_VTABLE IStructHelper
115 : {
116 : public:
117 0 : IStructHelper(){}
118 : virtual SvTreeListEntry* InsertEntry(const OUString& rText, SvTreeListEntry* pParent,
119 : sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL) = 0;
120 :
121 : virtual OUString GetEntryText(SvTreeListEntry* pEntry) const = 0;
122 : virtual SvTreeListEntry* GetParent(SvTreeListEntry* pEntry) const = 0;
123 :
124 : protected:
125 0 : ~IStructHelper() {}
126 : };
127 :
128 : class SAL_NO_VTABLE IFormulaEditorHelper
129 : {
130 : public:
131 0 : IFormulaEditorHelper(){}
132 : virtual void notifyChange() = 0;
133 : virtual void fill() = 0;
134 :
135 : virtual OUString getCurrentFormula() const = 0;
136 : virtual void setCurrentFormula(const OUString& _sReplacement) = 0;
137 :
138 : virtual void getSelection(sal_Int32& _nStart, sal_Int32& _nEnd) const = 0;
139 : virtual void setSelection(sal_Int32 _nStart, sal_Int32 _nEnd) = 0;
140 :
141 : virtual FormEditData* getFormEditData() const = 0;
142 : virtual bool calculateValue(const OUString& _sExpression, OUString& _rResult) = 0;
143 :
144 : virtual void switchBack() = 0;
145 :
146 : virtual void clear() = 0;
147 : virtual void deleteFormData() = 0;
148 : virtual void setReferenceInput(const FormEditData* _pData) = 0;
149 :
150 : virtual IFunctionManager* getFunctionManager() = 0;
151 : virtual ::std::auto_ptr<FormulaTokenArray> convertToTokenArray(const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& _aTokenList) = 0;
152 :
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;
156 :
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;
162 :
163 : protected:
164 0 : ~IFormulaEditorHelper() {}
165 : };
166 :
167 : }
168 : #endif //INCLUDE_FUNCTION_DESCRIPTION
169 :
170 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|