xref: /aoo41x/main/formula/source/ui/dlg/funcpage.hxx (revision 5116778e)
1*5116778eSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5116778eSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5116778eSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5116778eSAndrew Rist  * distributed with this work for additional information
6*5116778eSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5116778eSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5116778eSAndrew Rist  * "License"); you may not use this file except in compliance
9*5116778eSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5116778eSAndrew Rist  *
11*5116778eSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5116778eSAndrew Rist  *
13*5116778eSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5116778eSAndrew Rist  * software distributed under the License is distributed on an
15*5116778eSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5116778eSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5116778eSAndrew Rist  * specific language governing permissions and limitations
18*5116778eSAndrew Rist  * under the License.
19*5116778eSAndrew Rist  *
20*5116778eSAndrew Rist  *************************************************************/
21*5116778eSAndrew Rist 
22*5116778eSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef FORMULA_FUNCPAGE_HXX
25cdf0e10cSrcweir #define FORMULA_FUNCPAGE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svtools/stdctrl.hxx>
28cdf0e10cSrcweir #include <vcl/lstbox.hxx>
29cdf0e10cSrcweir #include <vcl/group.hxx>
30cdf0e10cSrcweir #include <svtools/svmedit.hxx>
31cdf0e10cSrcweir #include <vcl/tabpage.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vcl/tabctrl.hxx>
34cdf0e10cSrcweir #include <vcl/button.hxx>
35cdf0e10cSrcweir #include <svtools/svtreebx.hxx>
36cdf0e10cSrcweir 
37cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
38cdf0e10cSrcweir #include <vector>
39cdf0e10cSrcweir #include "ModuleHelper.hxx"
40cdf0e10cSrcweir //============================================================================
41cdf0e10cSrcweir namespace formula
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 
44cdf0e10cSrcweir class IFunctionDescription;
45cdf0e10cSrcweir class IFunctionManager;
46cdf0e10cSrcweir class IFunctionCategory;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir //============================================================================
49cdf0e10cSrcweir class FormulaListBox : public ListBox
50cdf0e10cSrcweir {
51cdf0e10cSrcweir protected:
52cdf0e10cSrcweir 
53cdf0e10cSrcweir 	virtual void	KeyInput( const KeyEvent& rKEvt );
54cdf0e10cSrcweir 	virtual long	PreNotify( NotifyEvent& rNEvt );
55cdf0e10cSrcweir 
56cdf0e10cSrcweir public:
57cdf0e10cSrcweir 					FormulaListBox( Window* pParent, WinBits nWinStyle = WB_BORDER );
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 					FormulaListBox( Window* pParent, const ResId& rResId );
60cdf0e10cSrcweir 
61cdf0e10cSrcweir };
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 
64cdf0e10cSrcweir 
65cdf0e10cSrcweir typedef const IFunctionDescription* TFunctionDesc;
66cdf0e10cSrcweir //============================================================================
67cdf0e10cSrcweir class FuncPage : public TabPage
68cdf0e10cSrcweir {
69cdf0e10cSrcweir private:
70cdf0e10cSrcweir     OModuleClient   m_aModuleClient;
71cdf0e10cSrcweir 	Link			aDoubleClickLink;
72cdf0e10cSrcweir 	Link			aSelectionLink;
73cdf0e10cSrcweir 	FixedText		aFtCategory;
74cdf0e10cSrcweir 	ListBox			aLbCategory;
75cdf0e10cSrcweir 	FixedText		aFtFunction;
76cdf0e10cSrcweir     FormulaListBox  aLbFunction;
77cdf0e10cSrcweir     const IFunctionManager*
78cdf0e10cSrcweir                     m_pFunctionManager;
79cdf0e10cSrcweir 
80cdf0e10cSrcweir     ::std::vector< TFunctionDesc >	aLRUList;
81cdf0e10cSrcweir     rtl::OString    m_aHelpId;
82cdf0e10cSrcweir 
83cdf0e10cSrcweir 
84cdf0e10cSrcweir     void impl_addFunctions(const IFunctionCategory* _pCategory);
85cdf0e10cSrcweir 					DECL_LINK( SelHdl, ListBox* );
86cdf0e10cSrcweir 					DECL_LINK( DblClkHdl, ListBox* );
87cdf0e10cSrcweir 
88cdf0e10cSrcweir protected:
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	void			UpdateFunctionList();
91cdf0e10cSrcweir 	void			InitLRUList();
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 
94cdf0e10cSrcweir public:
95cdf0e10cSrcweir 
96cdf0e10cSrcweir 					FuncPage( Window* pParent,const IFunctionManager* _pFunctionManager);
97cdf0e10cSrcweir 
98cdf0e10cSrcweir 	void			SetCategory(sal_uInt16 nCat);
99cdf0e10cSrcweir 	void			SetFunction(sal_uInt16 nFunc);
100cdf0e10cSrcweir 	void			SetFocus();
101cdf0e10cSrcweir 	sal_uInt16			GetCategory();
102cdf0e10cSrcweir 	sal_uInt16			GetFunction();
103cdf0e10cSrcweir 	sal_uInt16			GetFunctionEntryCount();
104cdf0e10cSrcweir 
105cdf0e10cSrcweir     sal_uInt16          GetFuncPos(const IFunctionDescription* _pDesc);
106cdf0e10cSrcweir 	const IFunctionDescription*	GetFuncDesc( sal_uInt16 nPos ) const;
107cdf0e10cSrcweir 	String			GetSelFunctionName() const;
108cdf0e10cSrcweir 
SetDoubleClickHdl(const Link & rLink)109cdf0e10cSrcweir 	void            SetDoubleClickHdl( const Link& rLink ) { aDoubleClickLink = rLink; }
GetDoubleClickHdl() const110cdf0e10cSrcweir 	const Link&     GetDoubleClickHdl() const { return aDoubleClickLink; }
111cdf0e10cSrcweir 
SetSelectHdl(const Link & rLink)112cdf0e10cSrcweir 	void            SetSelectHdl( const Link& rLink ) { aSelectionLink = rLink; }
GetSelectHdl() const113cdf0e10cSrcweir 	const Link&     GetSelectHdl() const { return aSelectionLink; }
114cdf0e10cSrcweir 
115cdf0e10cSrcweir };
116cdf0e10cSrcweir 
117cdf0e10cSrcweir } // formula
118cdf0e10cSrcweir #endif
119cdf0e10cSrcweir 
120