1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: formula.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef RPTUI_FUNCTIONHELPER_HXX
32 #define RPTUI_FUNCTIONHELPER_HXX
34 #include <formula/IFunctionDescription.hxx>
35 #include <com/sun/star/report/meta/XFunctionManager.hpp>
36 #include <com/sun/star/report/meta/XFunctionCategory.hpp>
37 #include <com/sun/star/report/meta/XFunctionDescription.hpp>
39 #include <boost/shared_ptr.hpp>
40 #include <tools/string.hxx>
41 #include <comphelper/stl_types.hxx>
46 //============================================================================
47 class FunctionCategory
;
48 class FunctionDescription
;
49 //============================================================================
50 class FunctionManager
: public formula::IFunctionManager
52 DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr
< FunctionDescription
>, TFunctionsMap
);
53 DECLARE_STL_USTRINGACCESS_MAP( ::boost::shared_ptr
< FunctionCategory
> , TCategoriesMap
);
54 ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionManager
> m_xMgr
;
55 mutable TCategoriesMap m_aCategories
;
56 mutable ::std::vector
< TCategoriesMap::iterator
> m_aCategoryIndex
;
57 mutable TFunctionsMap m_aFunctions
;
59 FunctionManager(const ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionManager
>& _xMgr
);
60 virtual ~FunctionManager();
61 virtual sal_uInt32
getCount() const;
62 virtual const formula::IFunctionCategory
* getCategory(sal_uInt32 nPos
) const;
63 virtual void fillLastRecentlyUsedFunctions(::std::vector
< const formula::IFunctionDescription
*>& _rLastRUFunctions
) const;
64 virtual const formula::IFunctionDescription
* getFunctionByName(const ::rtl::OUString
& _sFunctionName
) const;
65 virtual const sal_Unicode
getSingleToken(const EToken _eToken
) const;
67 ::boost::shared_ptr
< FunctionDescription
> get(const ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionDescription
>& _xFunctionDescription
) const;
69 //============================================================================
70 class FunctionDescription
: public formula::IFunctionDescription
72 ::com::sun::star::uno::Sequence
< ::com::sun::star::sheet::FunctionArgument
> m_aParameter
;
73 ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionDescription
> m_xFunctionDescription
;
74 const formula::IFunctionCategory
* m_pFunctionCategory
;
76 FunctionDescription(const formula::IFunctionCategory
* _pFunctionCategory
,const ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionDescription
>& _xFunctionDescription
);
77 virtual ~FunctionDescription(){}
79 virtual ::rtl::OUString
getFunctionName() const ;
80 virtual const formula::IFunctionCategory
* getCategory() const ;
81 virtual ::rtl::OUString
getDescription() const ;
82 virtual xub_StrLen
getSuppressedArgumentCount() const ;
83 virtual ::rtl::OUString
getFormula(const ::std::vector
< ::rtl::OUString
>& _aArguments
) const ;
84 virtual void fillVisibleArgumentMapping(::std::vector
<USHORT
>& _rArguments
) const ;
85 virtual void initArgumentInfo() const;
86 virtual ::rtl::OUString
getSignature() const ;
87 virtual long getHelpId() const ;
88 virtual sal_uInt32
getParameterCount() const ;
89 virtual ::rtl::OUString
getParameterName(sal_uInt32 _nPos
) const ;
90 virtual ::rtl::OUString
getParameterDescription(sal_uInt32 _nPos
) const ;
91 virtual bool isParameterOptional(sal_uInt32 _nPos
) const ;
93 //============================================================================
94 class FunctionCategory
: public formula::IFunctionCategory
96 mutable ::std::vector
< ::boost::shared_ptr
< FunctionDescription
> > m_aFunctions
;
97 ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionCategory
> m_xCategory
;
98 sal_uInt32 m_nFunctionCount
;
100 const FunctionManager
* m_pFunctionManager
;
102 FunctionCategory(const FunctionManager
* _pFMgr
,sal_uInt32 _nPos
,const ::com::sun::star::uno::Reference
< ::com::sun::star::report::meta::XFunctionCategory
>& _xCategory
);
103 virtual ~FunctionCategory() {}
105 virtual sal_uInt32
getCount() const;
106 virtual const formula::IFunctionDescription
* getFunction(sal_uInt32 _nPos
) const;
107 virtual sal_uInt32
getNumber() const;
108 virtual const formula::IFunctionManager
* getFunctionManager() const;
109 virtual ::rtl::OUString
getName() const;
111 // =============================================================================
113 // =============================================================================
115 #endif //RPTUI_FUNCTIONHELPER_HXX