Branch data 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 RPTUI_FUNCTIONHELPER_HXX
21 : : #define RPTUI_FUNCTIONHELPER_HXX
22 : :
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>
27 : : #include <vector>
28 : : #include <boost/shared_ptr.hpp>
29 : : #include <comphelper/stl_types.hxx>
30 : :
31 : :
32 : : namespace rptui
33 : : {
34 : : //============================================================================
35 : : class FunctionCategory;
36 : : class FunctionDescription;
37 : : //============================================================================
38 : : class FunctionManager : public formula::IFunctionManager
39 : : {
40 : : DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionDescription >, TFunctionsMap);
41 : : DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr< FunctionCategory > , TCategoriesMap);
42 : : ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager> m_xMgr;
43 : : mutable TCategoriesMap m_aCategories;
44 : : mutable ::std::vector< TCategoriesMap::iterator > m_aCategoryIndex;
45 : : mutable TFunctionsMap m_aFunctions;
46 : : public:
47 : : FunctionManager(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionManager>& _xMgr);
48 : : virtual ~FunctionManager();
49 : : virtual sal_uInt32 getCount() const;
50 : : virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const;
51 : : virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const;
52 : : virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const;
53 : : virtual sal_Unicode getSingleToken(const EToken _eToken) const;
54 : :
55 : : ::boost::shared_ptr< FunctionDescription > get(const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription) const;
56 : : };
57 : : //============================================================================
58 : : class FunctionDescription : public formula::IFunctionDescription
59 : : {
60 : : ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FunctionArgument > m_aParameter;
61 : : ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription> m_xFunctionDescription;
62 : : const formula::IFunctionCategory* m_pFunctionCategory;
63 : : public:
64 : : FunctionDescription(const formula::IFunctionCategory* _pFunctionCategory,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionDescription>& _xFunctionDescription);
65 : 0 : virtual ~FunctionDescription(){}
66 : :
67 : : virtual ::rtl::OUString getFunctionName() const ;
68 : : virtual const formula::IFunctionCategory* getCategory() const ;
69 : : virtual ::rtl::OUString getDescription() const ;
70 : : virtual xub_StrLen getSuppressedArgumentCount() const ;
71 : : virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ;
72 : : virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const ;
73 : : virtual void initArgumentInfo() const;
74 : : virtual ::rtl::OUString getSignature() const ;
75 : : virtual rtl::OString getHelpId() const ;
76 : : virtual sal_uInt32 getParameterCount() const ;
77 : : virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ;
78 : : virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ;
79 : : virtual bool isParameterOptional(sal_uInt32 _nPos) const ;
80 : : };
81 : : //============================================================================
82 : : class FunctionCategory : public formula::IFunctionCategory
83 : : {
84 : : mutable ::std::vector< ::boost::shared_ptr< FunctionDescription > > m_aFunctions;
85 : : ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory> m_xCategory;
86 : : sal_uInt32 m_nFunctionCount;
87 : : sal_uInt32 m_nNumber;
88 : : const FunctionManager* m_pFunctionManager;
89 : : public:
90 : : FunctionCategory(const FunctionManager* _pFMgr,sal_uInt32 _nPos,const ::com::sun::star::uno::Reference< ::com::sun::star::report::meta::XFunctionCategory>& _xCategory);
91 : 0 : virtual ~FunctionCategory() {}
92 : :
93 : : virtual sal_uInt32 getCount() const;
94 : : virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const;
95 : : virtual sal_uInt32 getNumber() const;
96 : : virtual const formula::IFunctionManager* getFunctionManager() const;
97 : : virtual ::rtl::OUString getName() const;
98 : : };
99 : : // =============================================================================
100 : : } // rptui
101 : : // =============================================================================
102 : :
103 : : #endif //RPTUI_FUNCTIONHELPER_HXX
104 : :
105 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|