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