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