xref: /aoo41x/main/formula/source/ui/dlg/structpg.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef SC_STRUCTPG_HXX
29 #define SC_STRUCTPG_HXX
30 
31 #include <svtools/stdctrl.hxx>
32 #include <vcl/lstbox.hxx>
33 #include <vcl/group.hxx>
34 #include <svtools/svmedit.hxx>
35 #include <vcl/tabpage.hxx>
36 #include <vcl/tabctrl.hxx>
37 #include <svtools/svtreebx.hxx>
38 #include "formula/IFunctionDescription.hxx"
39 #include "ModuleHelper.hxx"
40 
41 //============================================================================
42 
43 //============================================================================
44 namespace formula
45 {
46 
47 class IFormulaToken;
48 class	StructListBox : public SvTreeListBox
49 {
50 private:
51 
52 	sal_Bool			bActiveFlag;
53 
54 protected:
55 					virtual void MouseButtonDown( const MouseEvent& rMEvt );
56 
57 public:
58 
59 					StructListBox(Window* pParent, const ResId& rResId );
60 
61     /** Inserts an entry with static image (no difference between collapsed/expanded). */
62     SvLBoxEntry*    InsertStaticEntry(
63                         const XubString& rText,
64                         const Image& rEntryImg,
65                         const Image& rEntryImgHC,
66                         SvLBoxEntry* pParent = NULL,
67                         sal_uLong nPos = LIST_APPEND,
68                         IFormulaToken* pToken = NULL );
69 
70 	void			SetActiveFlag(sal_Bool bFlag=sal_True);
71 	sal_Bool			GetActiveFlag();
72 	void			GetFocus();
73 	void			LoseFocus();
74 };
75 
76 //============================================================================
77 
78 class StructPage : public TabPage
79                     , public IStructHelper
80 {
81 private:
82     OModuleClient   m_aModuleClient;
83 	Link			aSelLink;
84 
85 	FixedText		aFtStruct;
86 	StructListBox	aTlbStruct;
87     Image           maImgEnd;
88     Image           maImgError;
89     Image           maImgEndHC;
90     Image           maImgErrorHC;
91 
92 	IFormulaToken*	pSelectedToken;
93 
94 	DECL_LINK( SelectHdl, SvTreeListBox* );
95 
96     using Window::GetParent;
97 
98 protected:
99 
100 	IFormulaToken*		GetFunctionEntry(SvLBoxEntry* pEntry);
101 
102 public:
103 
104 					StructPage( Window* pParent);
105 
106 	void			ClearStruct();
107 	virtual SvLBoxEntry*	InsertEntry(const XubString& rText, SvLBoxEntry* pParent,
108 								sal_uInt16 nFlag,sal_uLong nPos=0,IFormulaToken* pScToken=NULL);
109 
110 	virtual String	        GetEntryText(SvLBoxEntry* pEntry) const;
111     virtual SvLBoxEntry*    GetParent(SvLBoxEntry* pEntry) const;
112 
113 	String			GetSelectedEntryText();
114 	IFormulaToken*	GetSelectedToken();
115 
116 	void            SetSelectionHdl( const Link& rLink ) { aSelLink = rLink; }
117 	const Link&     GetSelectionHdl() const { return aSelLink; }
118 };
119 
120 } // formula
121 
122 #endif
123 
124