1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_REPORTDESIGN_SOURCE_UI_INC_FUNCTIONHELPER_HXX
21 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FUNCTIONHELPER_HXX
23 #include <formula/IFunctionDescription.hxx>
24 #include <com/sun/star/report/meta/XFunctionManager.hpp>
25 #include <com/sun/star/report/meta/XFunctionCategory.hpp>
26 #include <com/sun/star/report/meta/XFunctionDescription.hpp>
34 class FunctionCategory
;
35 class FunctionDescription
;
37 class FunctionManager
: public formula::IFunctionManager
39 typedef std::map
< OUString
, std::shared_ptr
< FunctionDescription
> > TFunctionsMap
;
40 typedef std::map
< OUString
, std::shared_ptr
< FunctionCategory
> > TCategoriesMap
;
41 css::uno::Reference
< css::report::meta::XFunctionManager
> m_xMgr
;
42 mutable TCategoriesMap m_aCategories
;
43 mutable ::std::vector
< TCategoriesMap::iterator
> m_aCategoryIndex
;
44 mutable TFunctionsMap m_aFunctions
;
46 FunctionManager(css::uno::Reference
< css::report::meta::XFunctionManager
> _xMgr
);
47 virtual ~FunctionManager();
48 virtual sal_uInt32
getCount() const override
;
49 virtual const formula::IFunctionCategory
* getCategory(sal_uInt32 nPos
) const override
;
50 virtual void fillLastRecentlyUsedFunctions(::std::vector
< const formula::IFunctionDescription
*>& _rLastRUFunctions
) const override
;
51 virtual sal_Unicode
getSingleToken(const EToken _eToken
) const override
;
53 std::shared_ptr
< FunctionDescription
> get(const css::uno::Reference
< css::report::meta::XFunctionDescription
>& _xFunctionDescription
) const;
56 class FunctionDescription
: public formula::IFunctionDescription
58 css::uno::Sequence
< css::sheet::FunctionArgument
> m_aParameter
;
59 css::uno::Reference
< css::report::meta::XFunctionDescription
> m_xFunctionDescription
;
60 const formula::IFunctionCategory
* m_pFunctionCategory
;
62 FunctionDescription(const formula::IFunctionCategory
* _pFunctionCategory
,css::uno::Reference
< css::report::meta::XFunctionDescription
> _xFunctionDescription
);
63 virtual ~FunctionDescription(){}
65 virtual OUString
getFunctionName() const override
;
66 virtual const formula::IFunctionCategory
* getCategory() const override
;
67 virtual OUString
getDescription() const override
;
68 virtual sal_Int32
getSuppressedArgumentCount() const override
;
69 virtual OUString
getFormula(const ::std::vector
< OUString
>& _aArguments
) const override
;
70 virtual void fillVisibleArgumentMapping(::std::vector
<sal_uInt16
>& _rArguments
) const override
;
71 virtual void initArgumentInfo() const override
;
72 virtual OUString
getSignature() const override
;
73 virtual OUString
getHelpId() const override
;
74 virtual bool isHidden() const override
;
75 virtual sal_uInt32
getParameterCount() const override
;
76 virtual sal_uInt32
getVarArgsStart() const override
;
77 virtual sal_uInt32
getVarArgsLimit() const override
;
78 virtual OUString
getParameterName(sal_uInt32 _nPos
) const override
;
79 virtual OUString
getParameterDescription(sal_uInt32 _nPos
) const override
;
80 virtual bool isParameterOptional(sal_uInt32 _nPos
) const override
;
83 class FunctionCategory
: public formula::IFunctionCategory
85 mutable ::std::vector
< std::shared_ptr
< FunctionDescription
> > m_aFunctions
;
86 css::uno::Reference
< css::report::meta::XFunctionCategory
> m_xCategory
;
87 sal_uInt32 m_nFunctionCount
;
89 const FunctionManager
* m_pFunctionManager
;
91 FunctionCategory(const FunctionManager
* _pFMgr
,sal_uInt32 _nPos
,const css::uno::Reference
< css::report::meta::XFunctionCategory
>& _xCategory
);
92 virtual ~FunctionCategory() {}
94 virtual sal_uInt32
getCount() const override
;
95 virtual const formula::IFunctionDescription
* getFunction(sal_uInt32 _nPos
) const override
;
96 virtual sal_uInt32
getNumber() const override
;
97 virtual OUString
getName() const override
;
103 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_FUNCTIONHELPER_HXX
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */