xref: /aoo4110/main/formula/source/ui/dlg/structpg.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 SC_STRUCTPG_HXX
25 #define SC_STRUCTPG_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 #include <vcl/tabctrl.hxx>
33 #include <svtools/svtreebx.hxx>
34 #include "formula/IFunctionDescription.hxx"
35 #include "ModuleHelper.hxx"
36 
37 //============================================================================
38 
39 //============================================================================
40 namespace formula
41 {
42 
43 class IFormulaToken;
44 class	StructListBox : public SvTreeListBox
45 {
46 private:
47 
48 	sal_Bool			bActiveFlag;
49 
50 protected:
51 					virtual void MouseButtonDown( const MouseEvent& rMEvt );
52 
53 public:
54 
55 					StructListBox(Window* pParent, const ResId& rResId );
56 
57     /** Inserts an entry with static image (no difference between collapsed/expanded). */
58     SvLBoxEntry*    InsertStaticEntry(
59                         const XubString& rText,
60                         const Image& rEntryImg,
61                         const Image& rEntryImgHC,
62                         SvLBoxEntry* pParent = NULL,
63                         sal_uLong nPos = LIST_APPEND,
64                         IFormulaToken* pToken = NULL );
65 
66 	void			SetActiveFlag(sal_Bool bFlag=sal_True);
67 	sal_Bool			GetActiveFlag();
68 	void			GetFocus();
69 	void			LoseFocus();
70 };
71 
72 //============================================================================
73 
74 class StructPage : public TabPage
75                     , public IStructHelper
76 {
77 private:
78     OModuleClient   m_aModuleClient;
79 	Link			aSelLink;
80 
81 	FixedText		aFtStruct;
82 	StructListBox	aTlbStruct;
83     Image           maImgEnd;
84     Image           maImgError;
85     Image           maImgEndHC;
86     Image           maImgErrorHC;
87 
88 	IFormulaToken*	pSelectedToken;
89 
90 	DECL_LINK( SelectHdl, SvTreeListBox* );
91 
92     using Window::GetParent;
93 
94 protected:
95 
96 	IFormulaToken*		GetFunctionEntry(SvLBoxEntry* pEntry);
97 
98 public:
99 
100 					StructPage( Window* pParent);
101 
102 	void			ClearStruct();
103 	virtual SvLBoxEntry*	InsertEntry(const XubString& rText, SvLBoxEntry* pParent,
104 								sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL);
105 
106 	virtual String	        GetEntryText(SvLBoxEntry* pEntry) const;
107     virtual SvLBoxEntry*    GetParent(SvLBoxEntry* pEntry) const;
108 
109 	String			GetSelectedEntryText();
110 	IFormulaToken*	GetSelectedToken();
111 
SetSelectionHdl(const Link & rLink)112 	void            SetSelectionHdl( const Link& rLink ) { aSelLink = rLink; }
GetSelectionHdl() const113 	const Link&     GetSelectionHdl() const { return aSelLink; }
114 };
115 
116 } // formula
117 
118 #endif
119 
120