xref: /AOO41X/main/svtools/workben/browser.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_svtools.hxx"
30*cdf0e10cSrcweir #include <vcl/svapp.hxx>
31*cdf0e10cSrcweir #include <vcl/sound.hxx>
32*cdf0e10cSrcweir #include <vcl/msgbox.hxx>
33*cdf0e10cSrcweir #include <vcl/floatwin.hxx>
34*cdf0e10cSrcweir #include <vcl/menu.hxx>
35*cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
36*cdf0e10cSrcweir #include <vcl/edit.hxx>
37*cdf0e10cSrcweir #include <svtools/brwbox.hxx>
38*cdf0e10cSrcweir #include <vcl/group.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #ifndef _SV_BUTTON_HXX //autogen
41*cdf0e10cSrcweir #include <vcl/button.hxx>
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir #include <vcl/dialog.hxx>
44*cdf0e10cSrcweir 
45*cdf0e10cSrcweir #define MID_BROWSER 			10
46*cdf0e10cSrcweir #define MID_MODE				11
47*cdf0e10cSrcweir #define MID_EVENTVIEW			12
48*cdf0e10cSrcweir #define MID_INVALIDATE			13
49*cdf0e10cSrcweir #define MID_CLEAR				14
50*cdf0e10cSrcweir #define MID_ROW                 20
51*cdf0e10cSrcweir #define MID_INSERTROW_BEFORE	21
52*cdf0e10cSrcweir #define MID_INSERTROW_AT		22
53*cdf0e10cSrcweir #define MID_INSERTROW_BEHIND	23
54*cdf0e10cSrcweir #define MID_REMOVEROW_BEFORE	24
55*cdf0e10cSrcweir #define MID_REMOVEROW_AT		25
56*cdf0e10cSrcweir #define MID_REMOVEROW_BEHIND	26
57*cdf0e10cSrcweir #define MID_MODIFYROW_BEFORE	27
58*cdf0e10cSrcweir #define MID_MODIFYROW_AT		28
59*cdf0e10cSrcweir #define MID_MODIFYROW_BEHIND	29
60*cdf0e10cSrcweir #define MID_COL                 30
61*cdf0e10cSrcweir #define MID_INSERTCOL			31
62*cdf0e10cSrcweir #define MID_REMOVECOL			32
63*cdf0e10cSrcweir #define MID_MOVECOLLEFT 		33
64*cdf0e10cSrcweir #define MID_MOVECOLRIGHT		34
65*cdf0e10cSrcweir #define MID_SELECTIONS			60
66*cdf0e10cSrcweir #define MID_SELECTROW			61
67*cdf0e10cSrcweir #define MID_SELECTALL			62
68*cdf0e10cSrcweir #define MID_SELECTNONE			63
69*cdf0e10cSrcweir #define MID_INVERSE 			64
70*cdf0e10cSrcweir #define MID_EXTRAS  			70
71*cdf0e10cSrcweir #define MID_STARMONEY_1 		71
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir //==================================================================
74*cdf0e10cSrcweir 
75*cdf0e10cSrcweir class BrowseModeDialog: public ModalDialog
76*cdf0e10cSrcweir {
77*cdf0e10cSrcweir 	RadioButton     aSingleSel;
78*cdf0e10cSrcweir 	RadioButton     aMultiSel;
79*cdf0e10cSrcweir 	GroupBox        aSelGroup;
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir 	CheckBox        aKeepHighlight;
82*cdf0e10cSrcweir 	CheckBox        aColumnCursor;
83*cdf0e10cSrcweir 	CheckBox        aThumbDragging;
84*cdf0e10cSrcweir 	GroupBox        aOptGroup;
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir 	RadioButton     aNoHLines;
87*cdf0e10cSrcweir 	RadioButton     aDottedHLines;
88*cdf0e10cSrcweir 	RadioButton     aFullHLines;
89*cdf0e10cSrcweir 	GroupBox        aHLinGroup;
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	RadioButton     aNoVLines;
92*cdf0e10cSrcweir 	RadioButton     aDottedVLines;
93*cdf0e10cSrcweir 	RadioButton     aFullVLines;
94*cdf0e10cSrcweir 	GroupBox        aVLinGroup;
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir 	OKButton        aOKButton;
97*cdf0e10cSrcweir 	CancelButton    aCancelButton;
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir public:
100*cdf0e10cSrcweir 					BrowseModeDialog( Window *pParent );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir 	void            SetMode( BrowserMode eMode );
103*cdf0e10cSrcweir 	BrowserMode     GetMode() const;
104*cdf0e10cSrcweir };
105*cdf0e10cSrcweir 
106*cdf0e10cSrcweir //==================================================================
107*cdf0e10cSrcweir 
108*cdf0e10cSrcweir DECLARE_LIST(DataList,long);
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir class Browser: public BrowseBox
111*cdf0e10cSrcweir {
112*cdf0e10cSrcweir friend class AppWindow;
113*cdf0e10cSrcweir 
114*cdf0e10cSrcweir 	DataList        aRows;
115*cdf0e10cSrcweir 	sal_Bool            bInverse;
116*cdf0e10cSrcweir 	Edit*			pEdit;
117*cdf0e10cSrcweir 
118*cdf0e10cSrcweir protected:
119*cdf0e10cSrcweir 	virtual long    GetRowCount() const;
120*cdf0e10cSrcweir 	virtual sal_Bool    SeekRow( long nRow );
121*cdf0e10cSrcweir 	virtual void	PaintField( OutputDevice& rDev, const Rectangle& rRect,
122*cdf0e10cSrcweir 								sal_uInt16 nColumnId ) const;
123*cdf0e10cSrcweir 
124*cdf0e10cSrcweir 	virtual void    Select();
125*cdf0e10cSrcweir 	virtual void	DoubleClick();
126*cdf0e10cSrcweir 	virtual void    CursorMoved();
127*cdf0e10cSrcweir 	virtual void    StartScroll();
128*cdf0e10cSrcweir 	virtual void    EndScroll();
129*cdf0e10cSrcweir 	virtual void    Command( const CommandEvent &eEvt );
130*cdf0e10cSrcweir 
131*cdf0e10cSrcweir 	virtual sal_Bool    StartDragging( Pointer& rMovePtr,
132*cdf0e10cSrcweir 								   Pointer& rCopyPtr );
133*cdf0e10cSrcweir 	virtual void    EndDragging( const DropAction &rAction );
134*cdf0e10cSrcweir 	virtual	void	MouseButtonDown( const BrowserMouseEvent &rEvt );
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir public:
137*cdf0e10cSrcweir 					Browser( AppWindow* pParent, BrowserMode eMode );
138*cdf0e10cSrcweir 					~Browser();
139*cdf0e10cSrcweir 
140*cdf0e10cSrcweir 	void            SetInverseSelection( sal_Bool bInverseSel )
141*cdf0e10cSrcweir 					{ bInverse = bInverseSel; }
142*cdf0e10cSrcweir };
143*cdf0e10cSrcweir 
144*cdf0e10cSrcweir //------------------------------------------------------------------
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir class AppWindow: public WorkWindow
147*cdf0e10cSrcweir {
148*cdf0e10cSrcweir 	MenuBar         aMenu;
149*cdf0e10cSrcweir 	PopupMenu		aBrwMenu, aRowMenu, aColMenu, aSelMenu, aExtMenu;
150*cdf0e10cSrcweir 	Edit			aEdit;
151*cdf0e10cSrcweir 	Browser         aBrowser;
152*cdf0e10cSrcweir 	BrowserMode     eCurMode;
153*cdf0e10cSrcweir 	FloatingWindow *pEventView;
154*cdf0e10cSrcweir 	sal_uLong           nNewRowNo;
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir private:
157*cdf0e10cSrcweir 	DECL_LINK( Modify, void * );
158*cdf0e10cSrcweir 	DECL_LINK( MenuSelect, Menu * );
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir protected:
161*cdf0e10cSrcweir 	void            Resize();
162*cdf0e10cSrcweir 	void            Activate();
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir public:
165*cdf0e10cSrcweir 					AppWindow();
166*cdf0e10cSrcweir 					~AppWindow();
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	void            Event( const String &rEvent );
169*cdf0e10cSrcweir };
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir //------------------------------------------------------------------
172*cdf0e10cSrcweir 
173*cdf0e10cSrcweir class App: public Application
174*cdf0e10cSrcweir {
175*cdf0e10cSrcweir protected:
176*cdf0e10cSrcweir 	void            Main();
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir public:
179*cdf0e10cSrcweir 					App();
180*cdf0e10cSrcweir 					~App();
181*cdf0e10cSrcweir };
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir //==================================================================
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir App aApp;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir //==================================================================
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir BrowseModeDialog::BrowseModeDialog( Window *pParent ):
190*cdf0e10cSrcweir 	ModalDialog( pParent, WinBits( WB_MOVEABLE | WB_CLOSEABLE | WB_3DLOOK ) ),
191*cdf0e10cSrcweir 
192*cdf0e10cSrcweir 	aSingleSel( this ),
193*cdf0e10cSrcweir 	aMultiSel( this ),
194*cdf0e10cSrcweir 	aSelGroup( this ),
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 	aKeepHighlight( this ),
197*cdf0e10cSrcweir 	aColumnCursor( this ),
198*cdf0e10cSrcweir 	aThumbDragging( this ),
199*cdf0e10cSrcweir 	aOptGroup( this ),
200*cdf0e10cSrcweir 
201*cdf0e10cSrcweir 	aNoHLines( this ),
202*cdf0e10cSrcweir 	aDottedHLines( this ),
203*cdf0e10cSrcweir 	aFullHLines( this ),
204*cdf0e10cSrcweir 	aHLinGroup( this ),
205*cdf0e10cSrcweir 
206*cdf0e10cSrcweir 	aNoVLines( this, WinBits( WB_GROUP ) ),
207*cdf0e10cSrcweir 	aDottedVLines( this ),
208*cdf0e10cSrcweir 	aFullVLines( this ),
209*cdf0e10cSrcweir 	aVLinGroup( this ),
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir 	aOKButton( this ),
212*cdf0e10cSrcweir 	aCancelButton( this )
213*cdf0e10cSrcweir {
214*cdf0e10cSrcweir 	SetOutputSizePixel( Size( 290, 220 ) );
215*cdf0e10cSrcweir 	SetText( String( "Browse Mode", RTL_TEXTENCODING_IBM_850 ) );
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	aSingleSel.SetText( String( "single", RTL_TEXTENCODING_IBM_850 ) );
218*cdf0e10cSrcweir 	aMultiSel.SetText( String( "multi", RTL_TEXTENCODING_IBM_850 ) );
219*cdf0e10cSrcweir 	aSelGroup.SetText( String( " Selection ", RTL_TEXTENCODING_IBM_850 ) );
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir 	aKeepHighlight.SetText( String( "keep highlight", RTL_TEXTENCODING_IBM_850 ) );
222*cdf0e10cSrcweir 	aColumnCursor.SetText( String( "column cursor", RTL_TEXTENCODING_IBM_850 ) );
223*cdf0e10cSrcweir 	aThumbDragging.SetText( String( "thumb dragging", RTL_TEXTENCODING_IBM_850 ) );
224*cdf0e10cSrcweir 	aOptGroup.SetText( String( " Options ", RTL_TEXTENCODING_IBM_850 ) );
225*cdf0e10cSrcweir 
226*cdf0e10cSrcweir 	aNoHLines.SetText( String( "none", RTL_TEXTENCODING_IBM_850 ) );
227*cdf0e10cSrcweir 	aDottedHLines.SetText( String( "dotted", RTL_TEXTENCODING_IBM_850 ) );
228*cdf0e10cSrcweir 	aFullHLines.SetText( String( "full", RTL_TEXTENCODING_IBM_850 ) );
229*cdf0e10cSrcweir 	aHLinGroup.SetText( String( " Horizontal ", RTL_TEXTENCODING_IBM_850 ) );
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir 	aNoVLines.SetText( String( "none", RTL_TEXTENCODING_IBM_850 ) );
232*cdf0e10cSrcweir 	aDottedVLines.SetText( String( "dotted", RTL_TEXTENCODING_IBM_850 ) );
233*cdf0e10cSrcweir 	aFullVLines.SetText( String( "full", RTL_TEXTENCODING_IBM_850 ) );
234*cdf0e10cSrcweir 	aVLinGroup.SetText( String( " Vertical ", RTL_TEXTENCODING_IBM_850 ) );
235*cdf0e10cSrcweir 
236*cdf0e10cSrcweir 	aSingleSel.SetPosSizePixel( Point( 20, 30 ), Size( 80, 14 ) );
237*cdf0e10cSrcweir 	aMultiSel.SetPosSizePixel( Point( 20, 70 ), Size( 80, 14 ) );
238*cdf0e10cSrcweir 	aSelGroup.SetPosSizePixel( Point( 10, 10 ), Size( 100, 80 ) );
239*cdf0e10cSrcweir 	aSelGroup.SetText( String( " Selection ", RTL_TEXTENCODING_IBM_850 ) );
240*cdf0e10cSrcweir 
241*cdf0e10cSrcweir 	aKeepHighlight.SetPosSizePixel( Point( 130, 30 ), Size( 140, 14 ) );
242*cdf0e10cSrcweir 	aColumnCursor.SetPosSizePixel( Point( 130, 50 ), Size( 140, 14 ) );
243*cdf0e10cSrcweir 	aThumbDragging.SetPosSizePixel( Point( 130, 70 ), Size( 140, 14 ) );
244*cdf0e10cSrcweir 	aOptGroup.SetPosSizePixel( Point( 120, 10 ), Size( 160, 80 ) );
245*cdf0e10cSrcweir 	aOptGroup.SetText( String( " Options ", RTL_TEXTENCODING_IBM_850 ) );
246*cdf0e10cSrcweir 
247*cdf0e10cSrcweir 	aNoHLines.SetPosSizePixel( Point( 20, 120 ), Size( 80, 14 ) );
248*cdf0e10cSrcweir 	aDottedHLines.SetPosSizePixel( Point( 20, 140 ), Size( 80, 14 ) );
249*cdf0e10cSrcweir 	aFullHLines.SetPosSizePixel( Point( 20, 160 ), Size( 80, 14 ) );
250*cdf0e10cSrcweir 	aHLinGroup.SetPosSizePixel( Point( 10, 100 ), Size( 100, 80 ) );
251*cdf0e10cSrcweir 	aHLinGroup.SetText( String( " horizontal ", RTL_TEXTENCODING_IBM_850 ) );
252*cdf0e10cSrcweir 
253*cdf0e10cSrcweir 	aNoVLines.SetPosSizePixel( Point( 130, 120 ), Size( 80, 14 ) );
254*cdf0e10cSrcweir 	aDottedVLines.SetPosSizePixel( Point( 130, 140 ), Size( 80, 14 ) );
255*cdf0e10cSrcweir 	aFullVLines.SetPosSizePixel( Point( 130, 160 ), Size( 80, 14 ) );
256*cdf0e10cSrcweir 	aVLinGroup.SetPosSizePixel( Point( 120, 100 ), Size( 100, 80 ) );
257*cdf0e10cSrcweir 	aVLinGroup.SetText( String( " vertical ", RTL_TEXTENCODING_IBM_850 ) );
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 	aOKButton.SetPosSizePixel( Point( 10, 190 ), Size( 100, 22 ) );
260*cdf0e10cSrcweir 	aCancelButton.SetPosSizePixel( Point( 120, 190 ), Size( 100, 22 ) );
261*cdf0e10cSrcweir 
262*cdf0e10cSrcweir 	aSingleSel.Check();
263*cdf0e10cSrcweir 	aNoHLines.Check();
264*cdf0e10cSrcweir 	aNoVLines.Check();
265*cdf0e10cSrcweir 
266*cdf0e10cSrcweir 	aSingleSel.Show();
267*cdf0e10cSrcweir 	aMultiSel.Show();
268*cdf0e10cSrcweir 	aSelGroup.Show();
269*cdf0e10cSrcweir 
270*cdf0e10cSrcweir 	aKeepHighlight.Show();
271*cdf0e10cSrcweir 	aColumnCursor.Show();
272*cdf0e10cSrcweir 	aThumbDragging.Show();
273*cdf0e10cSrcweir 	aOptGroup.Show();
274*cdf0e10cSrcweir 
275*cdf0e10cSrcweir 	aNoHLines.Show();
276*cdf0e10cSrcweir 	aDottedHLines.Show();
277*cdf0e10cSrcweir 	aFullHLines.Show();
278*cdf0e10cSrcweir 	aHLinGroup.Show();
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 	aNoVLines.Show();
281*cdf0e10cSrcweir 	aDottedVLines.Show();
282*cdf0e10cSrcweir 	aFullVLines.Show();
283*cdf0e10cSrcweir 	aVLinGroup.Show();
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir 	aOKButton.Show();
286*cdf0e10cSrcweir 	aCancelButton.Show();
287*cdf0e10cSrcweir }
288*cdf0e10cSrcweir 
289*cdf0e10cSrcweir //------------------------------------------------------------------
290*cdf0e10cSrcweir 
291*cdf0e10cSrcweir void BrowseModeDialog::SetMode( BrowserMode eMode )
292*cdf0e10cSrcweir {
293*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_COLUMNSELECTION ) == BROWSER_COLUMNSELECTION )
294*cdf0e10cSrcweir 		aColumnCursor.Check();
295*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_MULTISELECTION ) == BROWSER_MULTISELECTION )
296*cdf0e10cSrcweir 		aMultiSel.Check();
297*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_THUMBDRAGGING ) == BROWSER_THUMBDRAGGING )
298*cdf0e10cSrcweir 		aThumbDragging.Check();
299*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_KEEPHIGHLIGHT ) == BROWSER_KEEPHIGHLIGHT )
300*cdf0e10cSrcweir 		aKeepHighlight.Check();
301*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_HLINESFULL ) == BROWSER_HLINESFULL )
302*cdf0e10cSrcweir 		aFullHLines.Check();
303*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_VLINESFULL ) == BROWSER_VLINESFULL )
304*cdf0e10cSrcweir 		aFullVLines.Check();
305*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_HLINESDOTS ) == BROWSER_HLINESDOTS )
306*cdf0e10cSrcweir 		aDottedHLines.Check();
307*cdf0e10cSrcweir 	if ( ( eMode & BROWSER_VLINESDOTS ) == BROWSER_VLINESDOTS )
308*cdf0e10cSrcweir 		aDottedVLines.Check();
309*cdf0e10cSrcweir }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir //------------------------------------------------------------------
312*cdf0e10cSrcweir 
313*cdf0e10cSrcweir BrowserMode BrowseModeDialog::GetMode() const
314*cdf0e10cSrcweir {
315*cdf0e10cSrcweir 	BrowserMode eMode = 0;
316*cdf0e10cSrcweir 
317*cdf0e10cSrcweir 	if ( aColumnCursor.IsChecked() )
318*cdf0e10cSrcweir 		eMode |= BROWSER_COLUMNSELECTION;
319*cdf0e10cSrcweir 	if ( aMultiSel.IsChecked() )
320*cdf0e10cSrcweir 		eMode |= BROWSER_MULTISELECTION;
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir 	if ( aKeepHighlight.IsChecked() )
323*cdf0e10cSrcweir 		eMode |= BROWSER_KEEPHIGHLIGHT;
324*cdf0e10cSrcweir 	if ( aThumbDragging.IsChecked() )
325*cdf0e10cSrcweir 		eMode |= BROWSER_THUMBDRAGGING;
326*cdf0e10cSrcweir 
327*cdf0e10cSrcweir 	if ( aDottedHLines.IsChecked() )
328*cdf0e10cSrcweir 		eMode |= BROWSER_HLINESDOTS;
329*cdf0e10cSrcweir 	if ( aFullHLines.IsChecked() )
330*cdf0e10cSrcweir 		eMode |= BROWSER_HLINESFULL;
331*cdf0e10cSrcweir 
332*cdf0e10cSrcweir 	if ( aDottedVLines.IsChecked() )
333*cdf0e10cSrcweir 		eMode |= BROWSER_VLINESDOTS;
334*cdf0e10cSrcweir 	if ( aFullVLines.IsChecked() )
335*cdf0e10cSrcweir 		eMode |= BROWSER_VLINESFULL;
336*cdf0e10cSrcweir 
337*cdf0e10cSrcweir 	return eMode;
338*cdf0e10cSrcweir }
339*cdf0e10cSrcweir 
340*cdf0e10cSrcweir //==================================================================
341*cdf0e10cSrcweir 
342*cdf0e10cSrcweir Browser::Browser( AppWindow* pParent, BrowserMode eMode ):
343*cdf0e10cSrcweir 	BrowseBox( pParent, WinBits(WB_DRAG), eMode ),
344*cdf0e10cSrcweir 	bInverse(sal_False),
345*cdf0e10cSrcweir 	pEdit( 0 )
346*cdf0e10cSrcweir {
347*cdf0e10cSrcweir 	for ( long n = 0; n < 100; ++n )
348*cdf0e10cSrcweir 		aRows.Insert( n, LIST_APPEND );
349*cdf0e10cSrcweir 
350*cdf0e10cSrcweir 	//InsertHandleColumn( 30 );
351*cdf0e10cSrcweir 	InsertDataColumn( 1, String( "eins", RTL_TEXTENCODING_IBM_850 ), 85 ); // FreezeColumn( 1 );
352*cdf0e10cSrcweir 	InsertDataColumn( 2, String( "zwei", RTL_TEXTENCODING_IBM_850 ), 85 ); // FreezeColumn( 2 );
353*cdf0e10cSrcweir 	InsertDataColumn( 3, String( "drei", RTL_TEXTENCODING_IBM_850 ), 85 );
354*cdf0e10cSrcweir 	InsertDataColumn( 4, String( "vier", RTL_TEXTENCODING_IBM_850 ), 85 );
355*cdf0e10cSrcweir 	InsertDataColumn( 5, String( "fuenf", RTL_TEXTENCODING_IBM_850 ), 85 );
356*cdf0e10cSrcweir 	InsertDataColumn( 6, String( "sechs", RTL_TEXTENCODING_IBM_850 ), 85 );
357*cdf0e10cSrcweir 	InsertDataColumn( 7, String( "sieben", RTL_TEXTENCODING_IBM_850 ), 85 );
358*cdf0e10cSrcweir 	InsertDataColumn( 8, String( "acht", RTL_TEXTENCODING_IBM_850 ), 85 );
359*cdf0e10cSrcweir 	InsertDataColumn( 9, String( "neun", RTL_TEXTENCODING_IBM_850 ), 85 );
360*cdf0e10cSrcweir 	InsertDataColumn(10, String( "zehn", RTL_TEXTENCODING_IBM_850 ), 85 );
361*cdf0e10cSrcweir }
362*cdf0e10cSrcweir 
363*cdf0e10cSrcweir //------------------------------------------------------------------
364*cdf0e10cSrcweir 
365*cdf0e10cSrcweir Browser::~Browser()
366*cdf0e10cSrcweir {
367*cdf0e10cSrcweir 	delete pEdit;
368*cdf0e10cSrcweir }
369*cdf0e10cSrcweir 
370*cdf0e10cSrcweir //------------------------------------------------------------------
371*cdf0e10cSrcweir 
372*cdf0e10cSrcweir sal_Bool Browser::StartDragging( Pointer& rMovePtr, Pointer& rCopyPtr )
373*cdf0e10cSrcweir {
374*cdf0e10cSrcweir 	rMovePtr = Pointer( POINTER_MOVEDATA );
375*cdf0e10cSrcweir 	rCopyPtr = Pointer( POINTER_COPYDATA );
376*cdf0e10cSrcweir 	return sal_True;
377*cdf0e10cSrcweir }
378*cdf0e10cSrcweir 
379*cdf0e10cSrcweir //------------------------------------------------------------------
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir void Browser::MouseButtonDown( const BrowserMouseEvent &rEvt )
382*cdf0e10cSrcweir {
383*cdf0e10cSrcweir 	if ( 3 == rEvt.GetClicks() )
384*cdf0e10cSrcweir 		InfoBox( 0, String( GetColumnAtXPosPixel(rEvt.GetPosPixel().X() ) ) ).Execute();
385*cdf0e10cSrcweir 	else
386*cdf0e10cSrcweir 		BrowseBox::MouseButtonDown( rEvt );
387*cdf0e10cSrcweir }
388*cdf0e10cSrcweir 
389*cdf0e10cSrcweir //------------------------------------------------------------------
390*cdf0e10cSrcweir 
391*cdf0e10cSrcweir void Browser::EndDragging( const DropAction &rAction )
392*cdf0e10cSrcweir {
393*cdf0e10cSrcweir }
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir //------------------------------------------------------------------
396*cdf0e10cSrcweir 
397*cdf0e10cSrcweir void Browser::StartScroll()
398*cdf0e10cSrcweir {
399*cdf0e10cSrcweir 	( (AppWindow*) GetParent() )->Event( String( "StartScroll", RTL_TEXTENCODING_IBM_850 ) );
400*cdf0e10cSrcweir 	if ( pEdit )
401*cdf0e10cSrcweir 		pEdit->Hide();
402*cdf0e10cSrcweir 	BrowseBox::StartScroll();
403*cdf0e10cSrcweir }
404*cdf0e10cSrcweir 
405*cdf0e10cSrcweir //------------------------------------------------------------------
406*cdf0e10cSrcweir 
407*cdf0e10cSrcweir void Browser::EndScroll()
408*cdf0e10cSrcweir {
409*cdf0e10cSrcweir 	BrowseBox::EndScroll();
410*cdf0e10cSrcweir 	( (AppWindow*) GetParent() )->Event( String( "EndScroll", RTL_TEXTENCODING_IBM_850 ) );
411*cdf0e10cSrcweir 	if ( pEdit )
412*cdf0e10cSrcweir 		pEdit->Show();
413*cdf0e10cSrcweir }
414*cdf0e10cSrcweir //------------------------------------------------------------------
415*cdf0e10cSrcweir 
416*cdf0e10cSrcweir void Browser::Command( const CommandEvent &rEvt )
417*cdf0e10cSrcweir {
418*cdf0e10cSrcweir 	String aEvent( String( "Command at ", RTL_TEXTENCODING_IBM_850 ) );
419*cdf0e10cSrcweir 	aEvent += rEvt.GetMousePosPixel().X();
420*cdf0e10cSrcweir 	aEvent += String( ":", RTL_TEXTENCODING_IBM_850 );
421*cdf0e10cSrcweir 	aEvent += rEvt.GetMousePosPixel().Y();
422*cdf0e10cSrcweir 	( (AppWindow*) GetParent() )->Event( aEvent );
423*cdf0e10cSrcweir 	BrowseBox::Command(rEvt);
424*cdf0e10cSrcweir }
425*cdf0e10cSrcweir 
426*cdf0e10cSrcweir //------------------------------------------------------------------
427*cdf0e10cSrcweir 
428*cdf0e10cSrcweir void Browser::Select()
429*cdf0e10cSrcweir {
430*cdf0e10cSrcweir 	String aEvent( String( "Select: ", RTL_TEXTENCODING_IBM_850 ) );
431*cdf0e10cSrcweir 	DELETEZ(pEdit);
432*cdf0e10cSrcweir 	for ( long nRow = FirstSelectedRow(bInverse); nRow >= 0; nRow = NextSelectedRow() )
433*cdf0e10cSrcweir 	{
434*cdf0e10cSrcweir 		if ( bInverse )
435*cdf0e10cSrcweir 			aEvent += String( String( "~", RTL_TEXTENCODING_IBM_850 ) );
436*cdf0e10cSrcweir 		aEvent += String( nRow );
437*cdf0e10cSrcweir 		aEvent += String( ", ", RTL_TEXTENCODING_IBM_850 );
438*cdf0e10cSrcweir 	}
439*cdf0e10cSrcweir 	aEvent.Erase( aEvent.Len() - 2 );
440*cdf0e10cSrcweir 
441*cdf0e10cSrcweir 	( (AppWindow*) GetParent() )->Event( aEvent );
442*cdf0e10cSrcweir }
443*cdf0e10cSrcweir 
444*cdf0e10cSrcweir //------------------------------------------------------------------
445*cdf0e10cSrcweir 
446*cdf0e10cSrcweir void Browser::DoubleClick()
447*cdf0e10cSrcweir {
448*cdf0e10cSrcweir 	String aEvent( String( "DoubleClick: ", RTL_TEXTENCODING_IBM_850 ) );
449*cdf0e10cSrcweir 	aEvent += String( GetCurRow() );
450*cdf0e10cSrcweir 	aEvent += String( String( ", ", RTL_TEXTENCODING_IBM_850 ) );
451*cdf0e10cSrcweir 	aEvent += String( FirstSelectedRow() );
452*cdf0e10cSrcweir 	( (AppWindow*) GetParent() )->Event( aEvent );
453*cdf0e10cSrcweir 
454*cdf0e10cSrcweir 	SetNoSelection();
455*cdf0e10cSrcweir 	if ( !pEdit )
456*cdf0e10cSrcweir 		pEdit = new Edit( &GetDataWindow() );
457*cdf0e10cSrcweir 	Rectangle aRect( GetFieldRect( GetCurColumnId() ) );
458*cdf0e10cSrcweir 	pEdit->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
459*cdf0e10cSrcweir 	pEdit->Show();
460*cdf0e10cSrcweir 	pEdit->GrabFocus();
461*cdf0e10cSrcweir }
462*cdf0e10cSrcweir 
463*cdf0e10cSrcweir //------------------------------------------------------------------
464*cdf0e10cSrcweir 
465*cdf0e10cSrcweir void Browser::CursorMoved()
466*cdf0e10cSrcweir {
467*cdf0e10cSrcweir 	String aEvent( String( "Cursor: ", RTL_TEXTENCODING_IBM_850 ) );
468*cdf0e10cSrcweir 	aEvent += String( GetCurRow() );
469*cdf0e10cSrcweir 	aEvent += String( ":", RTL_TEXTENCODING_IBM_850 );
470*cdf0e10cSrcweir 	aEvent += String( GetCurColumnId() );
471*cdf0e10cSrcweir 	( (AppWindow*) GetParent() )->Event( aEvent );
472*cdf0e10cSrcweir 	if ( IsFieldVisible( GetCurRow(), GetCurColumnId(), sal_True ) )
473*cdf0e10cSrcweir 		( (AppWindow*) GetParent() )->Event( String( "completely visible", RTL_TEXTENCODING_IBM_850 ) );
474*cdf0e10cSrcweir 	else if ( IsFieldVisible( 1, GetCurColumnId(), sal_False) )
475*cdf0e10cSrcweir 		( (AppWindow*) GetParent() )->Event( String( "partly visible", RTL_TEXTENCODING_IBM_850 ) );
476*cdf0e10cSrcweir 	else
477*cdf0e10cSrcweir 		( (AppWindow*) GetParent() )->Event( String( "not visible", RTL_TEXTENCODING_IBM_850 ) );
478*cdf0e10cSrcweir 
479*cdf0e10cSrcweir 	DELETEZ(pEdit);
480*cdf0e10cSrcweir }
481*cdf0e10cSrcweir 
482*cdf0e10cSrcweir //------------------------------------------------------------------
483*cdf0e10cSrcweir 
484*cdf0e10cSrcweir long Browser::GetRowCount() const
485*cdf0e10cSrcweir {
486*cdf0e10cSrcweir 	return aRows.Count();
487*cdf0e10cSrcweir }
488*cdf0e10cSrcweir 
489*cdf0e10cSrcweir //------------------------------------------------------------------
490*cdf0e10cSrcweir 
491*cdf0e10cSrcweir sal_Bool Browser::SeekRow( long nRow )
492*cdf0e10cSrcweir {
493*cdf0e10cSrcweir 	if ( nRow >= 0 && nRow < (long) aRows.Count() )
494*cdf0e10cSrcweir 	{
495*cdf0e10cSrcweir 		aRows.Seek(nRow);
496*cdf0e10cSrcweir 		return sal_True;
497*cdf0e10cSrcweir 	}
498*cdf0e10cSrcweir 	return sal_False;
499*cdf0e10cSrcweir }
500*cdf0e10cSrcweir 
501*cdf0e10cSrcweir //------------------------------------------------------------------
502*cdf0e10cSrcweir 
503*cdf0e10cSrcweir void Browser::PaintField( OutputDevice& rDev, const Rectangle& rRect,
504*cdf0e10cSrcweir 						  sal_uInt16 nColumnId ) const
505*cdf0e10cSrcweir {
506*cdf0e10cSrcweir 	rDev.SetClipRegion( rRect );
507*cdf0e10cSrcweir 	String aText( aRows.GetCurObject() );
508*cdf0e10cSrcweir 	aText += String( ".", RTL_TEXTENCODING_IBM_850 );
509*cdf0e10cSrcweir 	aText += String( nColumnId );
510*cdf0e10cSrcweir 	rDev.DrawText( rRect.TopLeft(), aText );
511*cdf0e10cSrcweir }
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir //==================================================================
514*cdf0e10cSrcweir 
515*cdf0e10cSrcweir AppWindow::AppWindow():
516*cdf0e10cSrcweir 	WorkWindow( 0, WinBits(WB_APP|WB_STDWORK) ),
517*cdf0e10cSrcweir 	aEdit( this, WinBits( WB_BORDER ) ),
518*cdf0e10cSrcweir 	aBrowser( this, 0 ),
519*cdf0e10cSrcweir 	eCurMode( 0 ),
520*cdf0e10cSrcweir 	pEventView( 0 ),
521*cdf0e10cSrcweir 	nNewRowNo( 2000L )
522*cdf0e10cSrcweir {
523*cdf0e10cSrcweir 	SetText( String( "BrowseBox Testframe", RTL_TEXTENCODING_IBM_850 ) );
524*cdf0e10cSrcweir 
525*cdf0e10cSrcweir 	aMenu.InsertItem( MID_BROWSER, String( "~Browser", RTL_TEXTENCODING_IBM_850 ) );
526*cdf0e10cSrcweir 	 aMenu.SetPopupMenu( MID_BROWSER, &aBrwMenu );
527*cdf0e10cSrcweir 	 aBrwMenu.InsertItem( MID_MODE, String( "~Mode...", RTL_TEXTENCODING_IBM_850 ) );
528*cdf0e10cSrcweir 	 aBrwMenu.InsertItem( MID_EVENTVIEW, String( "~Event-Viewer", RTL_TEXTENCODING_IBM_850 ) );
529*cdf0e10cSrcweir 	 aBrwMenu.InsertSeparator();
530*cdf0e10cSrcweir 	 aBrwMenu.InsertItem( MID_INVALIDATE, String( "~Invalidate", RTL_TEXTENCODING_IBM_850 ) );
531*cdf0e10cSrcweir 	 aBrwMenu.InsertItem( MID_CLEAR, String( "~Clear", RTL_TEXTENCODING_IBM_850 ) );
532*cdf0e10cSrcweir 	aMenu.InsertItem( MID_ROW, String( "~Row", RTL_TEXTENCODING_IBM_850 ) );
533*cdf0e10cSrcweir 	 aMenu.SetPopupMenu( MID_ROW, &aRowMenu );
534*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_INSERTROW_BEFORE, String( "Insert before current", RTL_TEXTENCODING_IBM_850 ) );
535*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_INSERTROW_AT, String( "~Insert at current", RTL_TEXTENCODING_IBM_850 ) );
536*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_INSERTROW_BEHIND, String( "~Insert behind current", RTL_TEXTENCODING_IBM_850 ) );
537*cdf0e10cSrcweir 	 aRowMenu.InsertSeparator();
538*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_REMOVEROW_BEFORE, String( "Remove before current", RTL_TEXTENCODING_IBM_850 ) );
539*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_REMOVEROW_AT, String( "~Remove at current", RTL_TEXTENCODING_IBM_850 ) );
540*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_REMOVEROW_BEHIND, String( "~Remove behind current", RTL_TEXTENCODING_IBM_850 ) );
541*cdf0e10cSrcweir 	 aRowMenu.InsertSeparator();
542*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_MODIFYROW_BEFORE, String( "Modify before current", RTL_TEXTENCODING_IBM_850 ) );
543*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_MODIFYROW_AT, String( "~Modify at current", RTL_TEXTENCODING_IBM_850 ) );
544*cdf0e10cSrcweir 	 aRowMenu.InsertItem( MID_MODIFYROW_BEHIND, String( "~Modify behind current", RTL_TEXTENCODING_IBM_850 ) );
545*cdf0e10cSrcweir 	aMenu.InsertItem( MID_COL, String( "~Column", RTL_TEXTENCODING_IBM_850 ) );
546*cdf0e10cSrcweir 	 aMenu.SetPopupMenu( MID_COL, &aColMenu );
547*cdf0e10cSrcweir 	 aColMenu.InsertItem( MID_INSERTCOL, String( "~Insert", RTL_TEXTENCODING_IBM_850 ) );
548*cdf0e10cSrcweir 	 aColMenu.InsertItem( MID_REMOVECOL, String( "Re~move", RTL_TEXTENCODING_IBM_850 ) );
549*cdf0e10cSrcweir 	 aColMenu.InsertItem( MID_MOVECOLLEFT, String( "Move ~Left", RTL_TEXTENCODING_IBM_850 ) );
550*cdf0e10cSrcweir 	 aColMenu.InsertItem( MID_MOVECOLRIGHT, String( "Move ~Right", RTL_TEXTENCODING_IBM_850 ) );
551*cdf0e10cSrcweir 	aMenu.InsertItem( MID_SELECTIONS, String( "Selections", RTL_TEXTENCODING_IBM_850 ) );
552*cdf0e10cSrcweir 	 aMenu.SetPopupMenu( MID_SELECTIONS, &aSelMenu );
553*cdf0e10cSrcweir 	 aSelMenu.InsertItem( MID_SELECTROW, String( "Row", RTL_TEXTENCODING_IBM_850 ) );
554*cdf0e10cSrcweir 	 aSelMenu.InsertItem( MID_SELECTALL, String( "All", RTL_TEXTENCODING_IBM_850 ) );
555*cdf0e10cSrcweir 	 aSelMenu.InsertItem( MID_SELECTNONE, String( "None", RTL_TEXTENCODING_IBM_850 ) );
556*cdf0e10cSrcweir 	 aSelMenu.InsertItem( MID_INVERSE, String( "Inverse", RTL_TEXTENCODING_IBM_850 ), MENU_APPEND, MIB_CHECKABLE );
557*cdf0e10cSrcweir 	aMenu.InsertItem( MID_EXTRAS, String( "Extras", RTL_TEXTENCODING_IBM_850 ) );
558*cdf0e10cSrcweir 	 aMenu.SetPopupMenu( MID_EXTRAS, &aExtMenu );
559*cdf0e10cSrcweir 	 aExtMenu.InsertItem( MID_STARMONEY_1, String( "StarMoney: SelectRow(+1)+DeleteRow", RTL_TEXTENCODING_IBM_850 ) );
560*cdf0e10cSrcweir 	aMenu.PushSelectHdl( LINK(this, AppWindow, MenuSelect) );
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 	aEdit.SetModifyHdl( LINK(this,AppWindow,Modify) );
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir 	aEdit.Show();
565*cdf0e10cSrcweir 	aBrowser.Show();
566*cdf0e10cSrcweir 	Show();
567*cdf0e10cSrcweir }
568*cdf0e10cSrcweir 
569*cdf0e10cSrcweir //------------------------------------------------------------------
570*cdf0e10cSrcweir 
571*cdf0e10cSrcweir AppWindow::~AppWindow()
572*cdf0e10cSrcweir {
573*cdf0e10cSrcweir 	GetpApp()->SetAppMenu( 0 );
574*cdf0e10cSrcweir 	if ( pEventView )
575*cdf0e10cSrcweir 		delete pEventView;
576*cdf0e10cSrcweir }
577*cdf0e10cSrcweir 
578*cdf0e10cSrcweir //------------------------------------------------------------------
579*cdf0e10cSrcweir 
580*cdf0e10cSrcweir IMPL_LINK_INLINE_START( AppWindow, Modify, void *, pCaller )
581*cdf0e10cSrcweir {
582*cdf0e10cSrcweir 	Edit *pEdit = (Edit*) pCaller;
583*cdf0e10cSrcweir 	aBrowser.GoToRow( pEdit->GetText().ToInt32() );
584*cdf0e10cSrcweir 	aBrowser.GrabFocus();
585*cdf0e10cSrcweir 
586*cdf0e10cSrcweir 	return sal_True;
587*cdf0e10cSrcweir }
588*cdf0e10cSrcweir IMPL_LINK_INLINE_END( AppWindow, Modify, void *, pCaller )
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir //------------------------------------------------------------------
591*cdf0e10cSrcweir 
592*cdf0e10cSrcweir IMPL_LINK( AppWindow, MenuSelect, Menu *, pMenu )
593*cdf0e10cSrcweir {
594*cdf0e10cSrcweir 	sal_uLong nPos;
595*cdf0e10cSrcweir 
596*cdf0e10cSrcweir 	switch ( pMenu->GetCurItemId() )
597*cdf0e10cSrcweir 	{
598*cdf0e10cSrcweir 		case MID_MODE:
599*cdf0e10cSrcweir 		{
600*cdf0e10cSrcweir 			BrowseModeDialog *pDlg = new BrowseModeDialog( this );
601*cdf0e10cSrcweir 			pDlg->SetMode( eCurMode );
602*cdf0e10cSrcweir 			if ( pDlg->Execute() == RET_OK )
603*cdf0e10cSrcweir 			{
604*cdf0e10cSrcweir 				eCurMode = pDlg->GetMode();
605*cdf0e10cSrcweir 				aBrowser.SetMode( eCurMode | BROWSER_AUTOSIZE_LASTCOL );
606*cdf0e10cSrcweir 			}
607*cdf0e10cSrcweir 			delete pDlg;
608*cdf0e10cSrcweir 			break;
609*cdf0e10cSrcweir 		}
610*cdf0e10cSrcweir 
611*cdf0e10cSrcweir 		case MID_INVALIDATE:
612*cdf0e10cSrcweir 			aBrowser.Invalidate();
613*cdf0e10cSrcweir 			break;
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir 		case MID_INSERTROW_BEFORE:
616*cdf0e10cSrcweir 			if ( aBrowser.GetCurRow() == 0 )
617*cdf0e10cSrcweir 			{
618*cdf0e10cSrcweir 				Sound::Beep();
619*cdf0e10cSrcweir 				break;
620*cdf0e10cSrcweir 			}
621*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow() - 1;
622*cdf0e10cSrcweir 			aBrowser.aRows.Insert( nNewRowNo++, nPos );
623*cdf0e10cSrcweir 			aBrowser.RowInserted( aBrowser.GetCurRow()-1 );
624*cdf0e10cSrcweir 			break;
625*cdf0e10cSrcweir 
626*cdf0e10cSrcweir 		case MID_INSERTROW_AT:
627*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow();
628*cdf0e10cSrcweir 			if ( nPos == BROWSER_ENDOFSELECTION )
629*cdf0e10cSrcweir 				nPos = 0;
630*cdf0e10cSrcweir 			aBrowser.aRows.Insert( nNewRowNo++, nPos );
631*cdf0e10cSrcweir 			aBrowser.RowInserted( nPos );
632*cdf0e10cSrcweir 			break;
633*cdf0e10cSrcweir 
634*cdf0e10cSrcweir 		case MID_INSERTROW_BEHIND:
635*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow() + 1;
636*cdf0e10cSrcweir 			aBrowser.aRows.Insert( nNewRowNo++, nPos );
637*cdf0e10cSrcweir 			aBrowser.RowInserted( nPos );
638*cdf0e10cSrcweir 			break;
639*cdf0e10cSrcweir 
640*cdf0e10cSrcweir 		case MID_REMOVEROW_BEFORE:
641*cdf0e10cSrcweir 			if ( aBrowser.GetCurRow() == 0 )
642*cdf0e10cSrcweir 			{
643*cdf0e10cSrcweir 				Sound::Beep();
644*cdf0e10cSrcweir 				break;
645*cdf0e10cSrcweir 			}
646*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow() - 1;
647*cdf0e10cSrcweir 			aBrowser.aRows.Remove( nPos );
648*cdf0e10cSrcweir 			aBrowser.RowRemoved( nPos );
649*cdf0e10cSrcweir 			break;
650*cdf0e10cSrcweir 
651*cdf0e10cSrcweir 		case MID_REMOVEROW_AT:
652*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow();
653*cdf0e10cSrcweir 			aBrowser.aRows.Remove( nPos );
654*cdf0e10cSrcweir 			aBrowser.RowRemoved( nPos );
655*cdf0e10cSrcweir 			break;
656*cdf0e10cSrcweir 
657*cdf0e10cSrcweir 		case MID_REMOVEROW_BEHIND:
658*cdf0e10cSrcweir 			if ( (aBrowser.GetCurRow()+1) >= aBrowser.GetRowCount() )
659*cdf0e10cSrcweir 			{
660*cdf0e10cSrcweir 				Sound::Beep();
661*cdf0e10cSrcweir 				break;
662*cdf0e10cSrcweir 			}
663*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow() + 1;
664*cdf0e10cSrcweir 			aBrowser.aRows.Remove( nPos );
665*cdf0e10cSrcweir 			aBrowser.RowRemoved( nPos );
666*cdf0e10cSrcweir 			break;
667*cdf0e10cSrcweir 
668*cdf0e10cSrcweir 		case MID_MODIFYROW_BEFORE:
669*cdf0e10cSrcweir 			if ( aBrowser.GetCurRow() == 0 )
670*cdf0e10cSrcweir 			{
671*cdf0e10cSrcweir 				Sound::Beep();
672*cdf0e10cSrcweir 				break;
673*cdf0e10cSrcweir 			}
674*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow() - 1;
675*cdf0e10cSrcweir 			aBrowser.aRows.Replace( nNewRowNo++, nPos );
676*cdf0e10cSrcweir 			aBrowser.RowModified( nPos );
677*cdf0e10cSrcweir 			break;
678*cdf0e10cSrcweir 
679*cdf0e10cSrcweir 		case MID_MODIFYROW_AT:
680*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow();
681*cdf0e10cSrcweir 			aBrowser.aRows.Replace( nNewRowNo++, nPos );
682*cdf0e10cSrcweir 			aBrowser.RowModified( nPos );
683*cdf0e10cSrcweir 			break;
684*cdf0e10cSrcweir 
685*cdf0e10cSrcweir 		case MID_MODIFYROW_BEHIND:
686*cdf0e10cSrcweir 			if ( (aBrowser.GetCurRow()+1) >= aBrowser.GetRowCount() )
687*cdf0e10cSrcweir 			{
688*cdf0e10cSrcweir 				Sound::Beep();
689*cdf0e10cSrcweir 				break;
690*cdf0e10cSrcweir 			}
691*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow() + 1;
692*cdf0e10cSrcweir 			aBrowser.aRows.Replace( nNewRowNo++, nPos );
693*cdf0e10cSrcweir 			aBrowser.RowModified( nPos );
694*cdf0e10cSrcweir 			break;
695*cdf0e10cSrcweir 
696*cdf0e10cSrcweir 		case MID_EVENTVIEW:
697*cdf0e10cSrcweir 			if ( pEventView )
698*cdf0e10cSrcweir 			{
699*cdf0e10cSrcweir 				delete pEventView;
700*cdf0e10cSrcweir 				pEventView = 0;
701*cdf0e10cSrcweir 			}
702*cdf0e10cSrcweir 			else
703*cdf0e10cSrcweir 			{
704*cdf0e10cSrcweir 				pEventView = new FloatingWindow( this );
705*cdf0e10cSrcweir 				pEventView->SetPosPixel( Point( 100, 100 ) );
706*cdf0e10cSrcweir 				pEventView->SetOutputSizePixel(
707*cdf0e10cSrcweir 					Size( 320, 8*GetTextHeight() ) );
708*cdf0e10cSrcweir 				pEventView->Show();
709*cdf0e10cSrcweir 				aBrowser.CursorMoved();
710*cdf0e10cSrcweir 				aBrowser.Select();
711*cdf0e10cSrcweir 			}
712*cdf0e10cSrcweir 			break;
713*cdf0e10cSrcweir 
714*cdf0e10cSrcweir 		case MID_SELECTROW:
715*cdf0e10cSrcweir 			aBrowser.SelectRow( aBrowser.GetCurRow(),
716*cdf0e10cSrcweir 				!aBrowser.IsRowSelected( aBrowser.GetCurRow() ) );
717*cdf0e10cSrcweir 			break;
718*cdf0e10cSrcweir 
719*cdf0e10cSrcweir 		case MID_SELECTALL:
720*cdf0e10cSrcweir 			aBrowser.SelectAll();
721*cdf0e10cSrcweir 			break;
722*cdf0e10cSrcweir 
723*cdf0e10cSrcweir 		case MID_SELECTNONE:
724*cdf0e10cSrcweir 			aBrowser.SetNoSelection();
725*cdf0e10cSrcweir 			break;
726*cdf0e10cSrcweir 
727*cdf0e10cSrcweir 		case MID_INVERSE:
728*cdf0e10cSrcweir 		{
729*cdf0e10cSrcweir 			sal_Bool bChecked = pMenu->IsItemChecked( MID_INVERSE );
730*cdf0e10cSrcweir 			pMenu->CheckItem( MID_INVERSE, !bChecked );
731*cdf0e10cSrcweir 			aBrowser.SetInverseSelection( !bChecked );
732*cdf0e10cSrcweir 			break;
733*cdf0e10cSrcweir 		}
734*cdf0e10cSrcweir 
735*cdf0e10cSrcweir 		case MID_CLEAR:
736*cdf0e10cSrcweir 			aBrowser.Clear();
737*cdf0e10cSrcweir 			break;
738*cdf0e10cSrcweir 
739*cdf0e10cSrcweir 		case MID_STARMONEY_1:
740*cdf0e10cSrcweir 		{
741*cdf0e10cSrcweir 			nPos = aBrowser.GetCurRow();
742*cdf0e10cSrcweir 			aBrowser.SelectRow( nPos + 1, sal_True );
743*cdf0e10cSrcweir 			aBrowser.aRows.Remove( nPos );
744*cdf0e10cSrcweir 			aBrowser.RowRemoved( nPos );
745*cdf0e10cSrcweir 			break;
746*cdf0e10cSrcweir 		}
747*cdf0e10cSrcweir 	}
748*cdf0e10cSrcweir 
749*cdf0e10cSrcweir 	return sal_True;
750*cdf0e10cSrcweir }
751*cdf0e10cSrcweir 
752*cdf0e10cSrcweir //------------------------------------------------------------------
753*cdf0e10cSrcweir 
754*cdf0e10cSrcweir void AppWindow::Resize()
755*cdf0e10cSrcweir {
756*cdf0e10cSrcweir 	Size aOutSz( GetOutputSizePixel() );
757*cdf0e10cSrcweir 
758*cdf0e10cSrcweir 	aEdit.SetPosSizePixel(
759*cdf0e10cSrcweir 		Point( 0, 0 ),
760*cdf0e10cSrcweir 		Size( aOutSz.Width(), 24 ) );
761*cdf0e10cSrcweir 
762*cdf0e10cSrcweir 	aBrowser.SetPosSizePixel(
763*cdf0e10cSrcweir 		Point( 0, aEdit.GetSizePixel().Height() ),
764*cdf0e10cSrcweir 		Size( aOutSz.Width(), aOutSz.Height() - 24 ) );
765*cdf0e10cSrcweir }
766*cdf0e10cSrcweir 
767*cdf0e10cSrcweir //------------------------------------------------------------------
768*cdf0e10cSrcweir 
769*cdf0e10cSrcweir void AppWindow::Activate()
770*cdf0e10cSrcweir {
771*cdf0e10cSrcweir 	GetpApp()->SetAppMenu( &aMenu );
772*cdf0e10cSrcweir 	aBrowser.GrabFocus();
773*cdf0e10cSrcweir }
774*cdf0e10cSrcweir 
775*cdf0e10cSrcweir //------------------------------------------------------------------
776*cdf0e10cSrcweir 
777*cdf0e10cSrcweir void AppWindow::Event( const String &rEvent )
778*cdf0e10cSrcweir {
779*cdf0e10cSrcweir 	if ( pEventView )
780*cdf0e10cSrcweir 	{
781*cdf0e10cSrcweir 		pEventView->Scroll( 0, -GetTextHeight() );
782*cdf0e10cSrcweir 		pEventView->Update();
783*cdf0e10cSrcweir 		pEventView->DrawText( Point(0, 7*GetTextHeight() ), rEvent );
784*cdf0e10cSrcweir 	}
785*cdf0e10cSrcweir }
786*cdf0e10cSrcweir 
787*cdf0e10cSrcweir //==================================================================
788*cdf0e10cSrcweir 
789*cdf0e10cSrcweir App::App()
790*cdf0e10cSrcweir {
791*cdf0e10cSrcweir }
792*cdf0e10cSrcweir 
793*cdf0e10cSrcweir //------------------------------------------------------------------
794*cdf0e10cSrcweir 
795*cdf0e10cSrcweir App::~App()
796*cdf0e10cSrcweir {
797*cdf0e10cSrcweir }
798*cdf0e10cSrcweir 
799*cdf0e10cSrcweir //------------------------------------------------------------------
800*cdf0e10cSrcweir 
801*cdf0e10cSrcweir void App::Main( )
802*cdf0e10cSrcweir {
803*cdf0e10cSrcweir 	EnableSVLook();
804*cdf0e10cSrcweir 
805*cdf0e10cSrcweir 	AppWindow aAppWin;
806*cdf0e10cSrcweir 
807*cdf0e10cSrcweir 
808*cdf0e10cSrcweir 	Execute();
809*cdf0e10cSrcweir }
810*cdf0e10cSrcweir 
811