xref: /trunk/main/sc/source/ui/miscdlgs/lbseldlg.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 #undef SC_DLLIMPLEMENTATION
32 
33 
34 
35 //------------------------------------------------------------------
36 
37 #include <vcl/msgbox.hxx>
38 
39 #include "lbseldlg.hxx"
40 #include "scresid.hxx"
41 #include "miscdlgs.hrc"
42 
43 
44 //==================================================================
45 
46 ScSelEntryDlg::ScSelEntryDlg(      Window*  pParent,
47 								   sal_uInt16	nResId,
48 							 const String&  aTitle,
49 							 const String&  aLbTitle,
50 								   List&    aEntryList ) :
51 	ModalDialog     ( pParent, ScResId( nResId ) ),
52 	//
53     aFlLbTitle      ( this, ScResId( FL_ENTRYLIST ) ),
54 	aLb             ( this, ScResId( LB_ENTRYLIST ) ),
55 	aBtnOk          ( this, ScResId( BTN_OK ) ),
56 	aBtnCancel      ( this, ScResId( BTN_CANCEL ) ),
57     aBtnHelp        ( this, ScResId( BTN_HELP ) )
58 {
59 	SetText( aTitle );
60     aFlLbTitle.SetText( aLbTitle );
61 	aLb.Clear();
62 	aLb.SetDoubleClickHdl( LINK( this, ScSelEntryDlg, DblClkHdl ) );
63 
64 	void*   pListEntry = aEntryList.First();
65 	while ( pListEntry )
66 	{
67 		aLb.InsertEntry( *((String*)pListEntry ) );
68 		pListEntry = aEntryList.Next();
69 	}
70 
71 	if ( aLb.GetEntryCount() > 0 )
72 		aLb.SelectEntryPos( 0 );
73 
74 	//-------------
75 	FreeResource();
76 }
77 
78 //------------------------------------------------------------------------
79 
80 String ScSelEntryDlg::GetSelectEntry() const
81 {
82 	return aLb.GetSelectEntry();
83 }
84 
85 //------------------------------------------------------------------------
86 
87 //UNUSED2008-05  sal_uInt16 ScSelEntryDlg::GetSelectEntryPos() const
88 //UNUSED2008-05  {
89 //UNUSED2008-05      return aLb.GetSelectEntryPos();
90 //UNUSED2008-05  }
91 
92 //------------------------------------------------------------------------
93 
94 IMPL_LINK_INLINE_START( ScSelEntryDlg, DblClkHdl, void *, EMPTYARG )
95 {
96 	EndDialog( RET_OK );
97 	return 0;
98 }
99 IMPL_LINK_INLINE_END( ScSelEntryDlg, DblClkHdl, void *, EMPTYARG )
100 
101 //------------------------------------------------------------------------
102 
103 __EXPORT ScSelEntryDlg::~ScSelEntryDlg()
104 {
105 }
106 
107 
108 
109