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